JuliaHealth / OMOPCDMCohortCreator.jl

Create cohorts from databases utilizing the OMOP CDM
https://juliahealth.org/OMOPCDMCohortCreator.jl/stable
Other
8 stars 7 forks source link

[FEATURE] Function gets treatement response for a drug #52

Open Farreeda opened 1 year ago

Farreeda commented 1 year ago

using funSQL, a function that takes the drug name as argument and returns a table of person_id and value_as_number (from measurement table)

TheCedarPrince commented 12 months ago

I think this may need three functions that look something like this:

  1. Function to get all drug_exposure_id's related to a single person
    1. Look at the Drug Exposure table
  2. Function to get drug_concept_ids associated with each drug_exposure_id
    1. Look at the Drug Exposure table
  3. Function to get amount_value for a given drug_concept_id
    1. Look at the Drug Strength table

Then, the interface I imagine would look something like this:

using OMOPCDMCohortCreator 

# Other code goes here

# Returns a DataFrame with two columns: person_id, drug_exposure_id
drug_exposures = GetDrugExposures([1, 2, 3], conn)

# Returns a DataFrame with two columns: person_id, drug_concept_id
drug_concepts = GetDrugConceptIDs(drug_exposures.drug_exposure_id, conn)

# Returns a DataFrame with two columns: drug_concept_id, amount_value
drug_amounts = GetDrugConceptIDs(drug_concepts.drug_concept_id, conn)

You could use the GetPatientGender function as a starting point in making these functions:

https://github.com/JuliaHealth/OMOPCDMCohortCreator.jl/blob/77126d02e304479991fe9fde9f47f71cb3d6ebaa/src/getters.jl#LL167-L185