diff --git a/previews/PR71/api/index.html b/previews/PR71/api/index.html index 90da0c2..93969c7 100644 --- a/previews/PR71/api/index.html +++ b/previews/PR71/api/index.html @@ -1,5 +1,5 @@ -API ยท OMOPCDMCohortCreator.jl

API

This is a list of documentation associated with every single exported function from OMOPCDMCohortCreator. There are a few different sections with a brief explanation of what these sections are followed by relevant functions.

Getters

This family of functions are dedicated to only getting information concerning a patient or OMOP CDM database.

OMOPCDMCohortCreator.GetDatabasePersonIDs โ€” Function

GetDatabasePersonIDs(conn; tab = person)

Get all unique person_id's from a database.

Arguments:

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • ids::Vector{Int64} - the list of persons
source

GetDatabasePersonIDs(; tab = person)

Return SQL statement that gets all unique person_id's from a database.

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • sql::String - Prepared SQL statement as a String
source
OMOPCDMCohortCreator.GetPatientState โ€” Function

GetPatientState(ids, conn; tab = location, join_tab = person)

Given a list of person IDs, find their home state.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Location table; default location

  • join_tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :state
source

GetPatientState(ids; tab = location, join_tab = person)

Return SQL statement where if given a list of person IDs, find their home state.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Location table; default location

  • join_tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :state
source
OMOPCDMCohortCreator.GetPatientGender โ€” Function

GetPatientGender(ids, conn; tab = person)

Given a list of person IDs, find their gender.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :gender_concept_id
source

GetPatientGender(ids; tab = person)

Return SQL statement that gets the gender_concept_id for a given list of person_id's

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :gender_concept_id
source
OMOPCDMCohortCreator.GetPatientRace โ€” Function

GetPatientRace(ids, conn; tab = person)

Given a list of person IDs, find their race.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :race_concept_id
source

GetPatientRace(ids; tab = person)

Return SQL statement that gets the race_concept_id for a given list of person_id's

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :race_concept_id
source
OMOPCDMCohortCreator.GetPatientEthnicity โ€” Function

GetPatientEthnicity(ids, conn; tab = person)

Given a list of person IDs, find their ethnicity.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :ethnicity_concept_id
source

GetPatientEthnicity(ids, conn; tab = person)

Return SQL statement that gets the ethnicity_concept_id for a given list of person_id's

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :ethnicity_concept_id
source
OMOPCDMCohortCreator.GetPatientAgeGroup โ€” Function

GetPatientAgeGroup( ids, conn; minuend = :now, age_groupings = [ [0, 9], [10, 19], [20, 29], [30, 39], [40, 49], [50, 59], [60, 69], [70, 79], [80, 89], ], tab = person, )

Finds all individuals in age groups as specified by age_groupings.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • age_groupings - a vector of age groups of the form [[10, 19], [20, 29],] denoting an age group of 10 - 19 and 20 - 29 respectively; age values must subtype of Integer

  • minuend - the year that a patient's year_of_birth variable is subtracted from; default :now. There are two different options that can be set:

    • :now - the year as of the day the code is executed given in UTC time
    • any year provided by a user as long as it is an Integer (such as 2022, 1998, etc.)
  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :age_group

Note

Age can be difficult to be calculated consistently. In this case, there are some assumptions made to ensure consistency:

  1. According to the OMOP CDM v5.4, only the variable year_of_birth is guaranteed for a given patient. This is one of three options used as the minuend in age calculations.

  2. The subtrahend is based on what one chooses for the minuend key word argument.

The age is then calculated following what is selected based on 1 and 2. This flexibility is encoded to allow a user to choose how they want age groups calculated as well as clear up an ambiguity on how this is determined.

source

GetPatientAgeGroup( ids; minuend = :now, age_groupings = [ [0, 9], [10, 19], [20, 29], [30, 39], [40, 49], [50, 59], [60, 69], [70, 79], [80, 89], ], tab = person, )

Return SQL statement that assigns an age group to each patient in a given patient list. Customized age groupings can be provided as a list.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • age_groupings - a vector of age groups of the form [[10, 19], [20, 29],] denoting an age group of 10 - 19 and 20 - 29 respectively; age values must subtype of Integer

  • minuend - the year that a patient's year_of_birth variable is subtracted from; default :now. There are two different options that can be set:

    • :now - the year as of the day the code is executed given in UTC time
    • any year provided by a user as long as it is an Integer (such as 2022, 1998, etc.)
  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :age_group

Note

Age can be difficult to be calculated consistently. In this case, there are some assumptions made to ensure consistency:

  1. According to the OMOP CDM v5.4, only the variable year_of_birth is guaranteed for a given patient. This is one of three options used as the minuend in age calculations.

  2. The subtrahend is based on what one chooses for the minuend key word argument.

The age is then calculated following what is selected based on 1 and 2. This flexibility is encoded to allow a user to choose how they want age groups calculated as well as clear up an ambiguity on how this is determined.

source
OMOPCDMCohortCreator.GetPatientVisits โ€” Function

GetPatientVisits(ids, conn; tab = visit_occurrence)

Given a list of person IDs, find all their visits.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :visit_occurrence_id
source

GetPatientVisits(ids; tab = visit_occurrence)

Return SQL statement that returns all visit_occurrence_id for a given patient list

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :visit_occurrence_id
source
OMOPCDMCohortCreator.GetMostRecentConditions โ€” Function

GetMostRecentConditions(ids, conn; tab = condition_occurrence)

Given a list of person IDs, find their last recorded conditions.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :condition_concept_id
source

GetMostRecentConditions(ids; tab = condition_occurrence)

Produces SQL statement that, given a list of person IDs, finds their last recorded conditions.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :condition_concept_id
source
OMOPCDMCohortCreator.GetMostRecentVisit โ€” Function

GetMostRecentVisit(ids, conn; tab = visit_occurrence)

Given a list of person IDs, find their last recorded visit.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :visit_occurrence_id
source

GetMostRecentVisit(ids, conn; tab = visit_occurrence)

Produces SQL statement that, given a list of person IDs, finds their last recorded visit.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :visit_occurrence_id
source
OMOPCDMCohortCreator.GetVisitCondition โ€” Function

GetVisitCondition(visitids, conn; tab = visitoccurrence)

Given a list of visit IDs, find their corresponding conditions.

Arguments:

  • visit_ids - list of visit_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :visit_occurrence_id and :condition_concept_id
source

GetVisitCondition(visitids; tab = visitoccurrence)

Produces SQL statement that, given a list of visit_id's, finds the conditions diagnosed associated with that visit.

Arguments:

  • visit_ids - list of visit_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :visit_occurrence_id and :condition_concept_id
source
OMOPCDMCohortCreator.GetDatabaseYearRange โ€” Function

GetDatabaseYearRange(conn; tab = observation_period)

Get the years for which data is available from a database.

Arguments:

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Observation Period table; default observation_period

Returns

  • year_range::NamedTuple{(:first_year, :last_year), Tuple{Int64, Int64}} - a NamedTuple where first_year is the first year data from the database was available and last_year where the last year data from the database was available
source

GetDatabaseYearRange(; tab = observation_period)

Return SQL to find the years for which data is available from a database.

Keyword Arguments:

  • tab - the SQLTable representing the Observation Period table; default observation_period

Returns

  • year_range::NamedTuple{(:first_year, :last_year), Tuple{Int64, Int64}} - a NamedTuple where first_year is the first year data from the database was available and last_year where the last year data from the database was available
source
OMOPCDMCohortCreator.GetDrugExposureIDs โ€” Function

GetDrugExposureIDs(ids, conn; tab = drug_exposure)

Given a list of person IDs, find their drug exposure.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the the drugexposure table; default `drugexposure`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :drug_exposure_id
source
OMOPCDMCohortCreator.GetDrugConceptIDs โ€” Function

GetDrugConcepts(drugexposureids; tab = drug_exposure)

Given a list of drug Exposure IDs, find their drugconceptid.

Arguments:

  • drug_exposure_ids - list of drug_exposure_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the drugexposure table; default `drugexposure`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :drug_exposure_id and :drug_concept_id
source

GetDrugConcepts(drugexposureids; tab = drug_exposure)

Return SQL statement that gets the drug_concept_id for a given list of drug_exposure_id's

Arguments:

  • drug_exposure_ids - list of drug_exposure_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the drugexposure table; default `drugexposure`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :drug_exposure_id and :drug_concept_id
source
OMOPCDMCohortCreator.GetDrugAmounts โ€” Function

GetDrugAmounts(drugconceptids, conn; tab = drug_strength)

Given a list of drugs concept IDs, find their amount.

Arguments:

  • drug_concept_ids - list of drug_concept_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the drugstrength table; default `drugstrength`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :drug_concept_id and :amount_value
source

GetDrugAmounts(drugconceptids; tab = drug_strength)

Return SQL statement that gets the amount_value for a given list of drug_concept_id's

Arguments:

  • drug_concept_ids - list of drug_concept_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the drugstrength table; default `drugstrength`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :drug_concept_id and :amount_value
source
OMOPCDMCohortCreator.GetDatabaseCohorts โ€” Function

GetDatabaseCohorts(conn; tab=cohort)

Given a DataFrame returns all unique cohortdefinitionid associated with a database.

#Arguments:

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Cohort table; default cohort

Returns

  • df::DataFrame - a one column DataFrame comprised of columns: :cohort_definition_id
source
OMOPCDMCohortCreator.GetCohortSubjects โ€” Function

GetCohortSubjects(cohort_ids, conn; tab = cohort)

Given a list of cohort IDs, find their corresponding subjects.

Arguments:

  • cohort_ids - list of cohort_id's; each ID must be of subtype Float64

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the cohort table; default cohort

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :cohort_definition_id and :subject_id
source

GetCohortSubjects(cohort_ids; tab = cohort)

Produces SQL statement that, given a list of cohort_id's, finds the subjects associated with that cohort.

Arguments:

  • cohort_ids - list of cohort_id's; each ID must be of subtype Float64

Keyword Arguments:

  • tab - the SQLTable representing the cohort table; default cohort

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :cohort_definition_id and :subject_id
source
OMOPCDMCohortCreator.GetCohortSubjectStartDate โ€” Function

function GetCohortSubjectStartDate(cohortids, subjectids, conn; tab=cohort)

Given a single or list of cohort IDs and subject IDs, return their start dates.
+API ยท OMOPCDMCohortCreator.jl

API

This is a list of documentation associated with every single exported function from OMOPCDMCohortCreator. There are a few different sections with a brief explanation of what these sections are followed by relevant functions.

Getters

This family of functions are dedicated to only getting information concerning a patient or OMOP CDM database.

OMOPCDMCohortCreator.GetDatabasePersonIDs โ€” Function

GetDatabasePersonIDs(conn; tab = person)

Get all unique person_id's from a database.

Arguments:

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • ids::Vector{Int64} - the list of persons
source

GetDatabasePersonIDs(; tab = person)

Return SQL statement that gets all unique person_id's from a database.

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • sql::String - Prepared SQL statement as a String
source
OMOPCDMCohortCreator.GetPatientState โ€” Function

GetPatientState(ids, conn; tab = location, join_tab = person)

Given a list of person IDs, find their home state.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Location table; default location

  • join_tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :state
source

GetPatientState(ids; tab = location, join_tab = person)

Return SQL statement where if given a list of person IDs, find their home state.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Location table; default location

  • join_tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :state
source
OMOPCDMCohortCreator.GetPatientGender โ€” Function

GetPatientGender(ids, conn; tab = person)

Given a list of person IDs, find their gender.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :gender_concept_id
source

GetPatientGender(ids; tab = person)

Return SQL statement that gets the gender_concept_id for a given list of person_id's

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :gender_concept_id
source
OMOPCDMCohortCreator.GetPatientRace โ€” Function

GetPatientRace(ids, conn; tab = person)

Given a list of person IDs, find their race.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :race_concept_id
source

GetPatientRace(ids; tab = person)

Return SQL statement that gets the race_concept_id for a given list of person_id's

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :race_concept_id
source
OMOPCDMCohortCreator.GetPatientEthnicity โ€” Function

GetPatientEthnicity(ids, conn; tab = person)

Given a list of person IDs, find their ethnicity.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :ethnicity_concept_id
source

GetPatientEthnicity(ids, conn; tab = person)

Return SQL statement that gets the ethnicity_concept_id for a given list of person_id's

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :ethnicity_concept_id
source
OMOPCDMCohortCreator.GetPatientAgeGroup โ€” Function

GetPatientAgeGroup( ids, conn; minuend = :now, age_groupings = [ [0, 9], [10, 19], [20, 29], [30, 39], [40, 49], [50, 59], [60, 69], [70, 79], [80, 89], ], tab = person, )

Finds all individuals in age groups as specified by age_groupings.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • age_groupings - a vector of age groups of the form [[10, 19], [20, 29],] denoting an age group of 10 - 19 and 20 - 29 respectively; age values must subtype of Integer

  • minuend - the year that a patient's year_of_birth variable is subtracted from; default :now. There are two different options that can be set:

    • :now - the year as of the day the code is executed given in UTC time
    • any year provided by a user as long as it is an Integer (such as 2022, 1998, etc.)
  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :age_group

Note

Age can be difficult to be calculated consistently. In this case, there are some assumptions made to ensure consistency:

  1. According to the OMOP CDM v5.4, only the variable year_of_birth is guaranteed for a given patient. This is one of three options used as the minuend in age calculations.

  2. The subtrahend is based on what one chooses for the minuend key word argument.

The age is then calculated following what is selected based on 1 and 2. This flexibility is encoded to allow a user to choose how they want age groups calculated as well as clear up an ambiguity on how this is determined.

source

GetPatientAgeGroup( ids; minuend = :now, age_groupings = [ [0, 9], [10, 19], [20, 29], [30, 39], [40, 49], [50, 59], [60, 69], [70, 79], [80, 89], ], tab = person, )

Return SQL statement that assigns an age group to each patient in a given patient list. Customized age groupings can be provided as a list.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • age_groupings - a vector of age groups of the form [[10, 19], [20, 29],] denoting an age group of 10 - 19 and 20 - 29 respectively; age values must subtype of Integer

  • minuend - the year that a patient's year_of_birth variable is subtracted from; default :now. There are two different options that can be set:

    • :now - the year as of the day the code is executed given in UTC time
    • any year provided by a user as long as it is an Integer (such as 2022, 1998, etc.)
  • tab - the SQLTable representing the Person table; default person

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :age_group

Note

Age can be difficult to be calculated consistently. In this case, there are some assumptions made to ensure consistency:

  1. According to the OMOP CDM v5.4, only the variable year_of_birth is guaranteed for a given patient. This is one of three options used as the minuend in age calculations.

  2. The subtrahend is based on what one chooses for the minuend key word argument.

The age is then calculated following what is selected based on 1 and 2. This flexibility is encoded to allow a user to choose how they want age groups calculated as well as clear up an ambiguity on how this is determined.

source
OMOPCDMCohortCreator.GetPatientVisits โ€” Function

GetPatientVisits(ids, conn; tab = visit_occurrence)

Given a list of person IDs, find all their visits.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :visit_occurrence_id
source

GetPatientVisits(ids; tab = visit_occurrence)

Return SQL statement that returns all visit_occurrence_id for a given patient list

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :visit_occurrence_id
source
OMOPCDMCohortCreator.GetMostRecentConditions โ€” Function

GetMostRecentConditions(ids, conn; tab = condition_occurrence)

Given a list of person IDs, find their last recorded conditions.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :condition_concept_id
source

GetMostRecentConditions(ids; tab = condition_occurrence)

Produces SQL statement that, given a list of person IDs, finds their last recorded conditions.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :condition_concept_id
source
OMOPCDMCohortCreator.GetMostRecentVisit โ€” Function

GetMostRecentVisit(ids, conn; tab = visit_occurrence)

Given a list of person IDs, find their last recorded visit.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :visit_occurrence_id
source

GetMostRecentVisit(ids, conn; tab = visit_occurrence)

Produces SQL statement that, given a list of person IDs, finds their last recorded visit.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :visit_occurrence_id
source
OMOPCDMCohortCreator.GetVisitCondition โ€” Function

GetVisitCondition(visitids, conn; tab = visitoccurrence)

Given a list of visit IDs, find their corresponding conditions.

Arguments:

  • visit_ids - list of visit_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :visit_occurrence_id and :condition_concept_id
source

GetVisitCondition(visitids; tab = visitoccurrence)

Produces SQL statement that, given a list of visit_id's, finds the conditions diagnosed associated with that visit.

Arguments:

  • visit_ids - list of visit_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :visit_occurrence_id and :condition_concept_id
source
OMOPCDMCohortCreator.GetDatabaseYearRange โ€” Function

GetDatabaseYearRange(conn; tab = observation_period)

Get the years for which data is available from a database.

Arguments:

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Observation Period table; default observation_period

Returns

  • year_range::NamedTuple{(:first_year, :last_year), Tuple{Int64, Int64}} - a NamedTuple where first_year is the first year data from the database was available and last_year where the last year data from the database was available
source

GetDatabaseYearRange(; tab = observation_period)

Return SQL to find the years for which data is available from a database.

Keyword Arguments:

  • tab - the SQLTable representing the Observation Period table; default observation_period

Returns

  • year_range::NamedTuple{(:first_year, :last_year), Tuple{Int64, Int64}} - a NamedTuple where first_year is the first year data from the database was available and last_year where the last year data from the database was available
source
OMOPCDMCohortCreator.GetDrugExposureIDs โ€” Function

GetDrugExposureIDs(ids, conn; tab = drug_exposure)

Given a list of person IDs, find their drug exposure.

Arguments:

  • ids - list of person_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the the drugexposure table; default `drugexposure`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :person_id and :drug_exposure_id
source
OMOPCDMCohortCreator.GetDrugConceptIDs โ€” Function

GetDrugConcepts(drugexposureids; tab = drug_exposure)

Given a list of drug Exposure IDs, find their drugconceptid.

Arguments:

  • drug_exposure_ids - list of drug_exposure_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the drugexposure table; default `drugexposure`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :drug_exposure_id and :drug_concept_id
source

GetDrugConcepts(drugexposureids; tab = drug_exposure)

Return SQL statement that gets the drug_concept_id for a given list of drug_exposure_id's

Arguments:

  • drug_exposure_ids - list of drug_exposure_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the drugexposure table; default `drugexposure`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :drug_exposure_id and :drug_concept_id
source
OMOPCDMCohortCreator.GetDrugAmounts โ€” Function

GetDrugAmounts(drugconceptids, conn; tab = drug_strength)

Given a list of drugs concept IDs, find their amount.

Arguments:

  • drug_concept_ids - list of drug_concept_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the drugstrength table; default `drugstrength`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :drug_concept_id and :amount_value
source

GetDrugAmounts(drugconceptids; tab = drug_strength)

Return SQL statement that gets the amount_value for a given list of drug_concept_id's

Arguments:

  • drug_concept_ids - list of drug_concept_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the drugstrength table; default `drugstrength`

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :drug_concept_id and :amount_value
source
OMOPCDMCohortCreator.GetDatabaseCohorts โ€” Function

GetDatabaseCohorts(conn; tab=cohort)

Given a DataFrame returns all unique cohortdefinitionid associated with a database.

#Arguments:

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Cohort table; default cohort

Returns

  • df::DataFrame - a one column DataFrame comprised of columns: :cohort_definition_id
source
OMOPCDMCohortCreator.GetCohortSubjects โ€” Function

GetCohortSubjects(cohort_ids, conn; tab = cohort)

Given a list of cohort IDs, find their corresponding subjects.

Arguments:

  • cohort_ids - list of cohort_id's; each ID must be of subtype Float64

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the cohort table; default cohort

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :cohort_definition_id and :subject_id
source

GetCohortSubjects(cohort_ids; tab = cohort)

Produces SQL statement that, given a list of cohort_id's, finds the subjects associated with that cohort.

Arguments:

  • cohort_ids - list of cohort_id's; each ID must be of subtype Float64

Keyword Arguments:

  • tab - the SQLTable representing the cohort table; default cohort

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :cohort_definition_id and :subject_id
source
OMOPCDMCohortCreator.GetCohortSubjectStartDate โ€” Function

function GetCohortSubjectStartDate(cohortids, subjectids, conn; tab=cohort)

Given a single or list of cohort IDs and subject IDs, return their start dates.
 
 # Arguments:
 
@@ -11,7 +11,7 @@
     
 # Keyword Arguments:
     
-- `tab` - the `SQLTable` representing the `cohort` table; default `cohort`

Returns

  • df::DataFrame - a three column DataFrame comprised of columns: :cohort_definition_id , :subject_id and :cohort_start_date
source

function GetCohortSubjectStartDate(df:DataFrame, conn; tab = cohort)

Given a DataFrame with a :cohort_definition_id column and :subject_id column, return the DataFrame with an associated :cohort_start_date corresponding to a cohort's subject ID in the DataFrame

Multiple dispatch that accepts all other arguments like in GetCohortSubjectStartDate(ids, conn; tab = cohort)

source

function GetCohortSubjectStartDate(cohortids, subjectids; tab=cohort)

Given a list of cohort IDs and subject IDs return their start dates.

Arguments:

  • cohort_ids - list of cohort_id's; each ID must be of subtype Float64
  • subject_id - list of subject_id's; each ID must be of subtype Float64
  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the cohort table; default cohort

Returns

  • df::DataFrame - a three column DataFrame comprised of columns: :cohort_definition_id , :subject_id and :cohort_start_date
source
OMOPCDMCohortCreator.GetCohortSubjectEndDate โ€” Function

function GetCohortSubjectEndDate(cohortids, subjectids, conn; tab=cohort)

Given a list of cohort IDs and subject IDs return their end dates.
+- `tab` - the `SQLTable` representing the `cohort` table; default `cohort`

Returns

  • df::DataFrame - a three column DataFrame comprised of columns: :cohort_definition_id , :subject_id and :cohort_start_date
source

function GetCohortSubjectStartDate(df:DataFrame, conn; tab = cohort)

Given a DataFrame with a :cohort_definition_id column and :subject_id column, return the DataFrame with an associated :cohort_start_date corresponding to a cohort's subject ID in the DataFrame

Multiple dispatch that accepts all other arguments like in GetCohortSubjectStartDate(ids, conn; tab = cohort)

source

function GetCohortSubjectStartDate(cohortids, subjectids; tab=cohort)

Given a list of cohort IDs and subject IDs return their start dates.

Arguments:

  • cohort_ids - list of cohort_id's; each ID must be of subtype Float64
  • subject_id - list of subject_id's; each ID must be of subtype Float64
  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the cohort table; default cohort

Returns

  • df::DataFrame - a three column DataFrame comprised of columns: :cohort_definition_id , :subject_id and :cohort_start_date
source
OMOPCDMCohortCreator.GetCohortSubjectEndDate โ€” Function

function GetCohortSubjectEndDate(cohortids, subjectids, conn; tab=cohort)

Given a list of cohort IDs and subject IDs return their end dates.
 
 # Arguments:
 
@@ -23,4 +23,4 @@
     
 # Keyword Arguments:
     
-- `tab` - the `SQLTable` representing the `cohort` table; default `cohort`

Returns

  • df::DataFrame - a three column DataFrame comprised of columns: :cohort_definition_id , :subject_id and :cohort_end_date
source

function GetCohortSubjectEndDate(df:DataFrame, conn; tab = cohort)

Given a DataFrame with a :cohort_definition_id column and :subject_id column, return the DataFrame with an associated :cohort_end_date corresponding to a given cohort_definition_id and subject_id in the DataFrame

Multiple dispatch that accepts all other arguments like in GetCohortSubjectEndDate(ids, conn; tab = cohort)

source

function GetCohortSubjectEndDate(cohortids; subjectids; tab=cohort)

Given a list of cohort IDs and subject IDs return their end date.

Arguments:

  • cohort_ids - list of cohort_id's; each ID must be of subtype Float64
  • subject_id - list of subject_id's; each ID must be of subtype Float64
  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the cohort table; default cohort

Returns

  • df::DataFrame - a three column DataFrame comprised of columns: :cohort_definition_id , :subject_id and :cohort_end_date
source
OMOPCDMCohortCreator.GetVisitProcedure โ€” Function

GetVisitProcedure(visitids, conn; tab = procedureoccurrence)

Given a list of visit IDs, find their corresponding procedures.

Arguments:

  • visit_ids - list of visit_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default procedure_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :visit_occurrence_id and :procedure_concept_id
source

GetVisitProcedure(visitids; tab = procedureoccurrence)

Produces SQL statement that, given a list of visit_id's, finds the procedures associated with that visit.

Arguments:

  • visit_ids - list of visit_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Procedure Occurrence table; default procedure_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :visit_occurrence_id and :procedure_concept_id
source

Filters

These functions accepts parameters to produce queries that look for specific subpopulations or information given specific patient identifier(s) (i.e. person_id).

OMOPCDMCohortCreator.VisitFilterPersonIDs โ€” Function

VisitFilterPersonIDs(visitcodes, conn; tab = visitoccurrence)

Given a list of visit concept IDs, visit_codes return from the database patients matching at least one of the provided visit codes from the Visit Occurrence table.

Arguments:

  • visit_codes - a vector of visit_concept_id's; must be a subtype of Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

VisitFilterPersonIDs(visitcodes; tab = visitoccurrence)

Generates a SQL statement that, given a list of visit concept IDs, visit_codes, return from the database patients matching at least one of the provided visit codes from the Visit Occurrence table.

Arguments:

  • visit_codes - a vector of visit_concept_id's; must be a subtype of Integer

conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • sql::String - the SQL representation that runs this filter
source
OMOPCDMCohortCreator.ConditionFilterPersonIDs โ€” Function

ConditionFilterPersonIDs(conditioncodes, conn; tab = conditionoccurrence)

Given a list of condition concept IDs, condition_codes, return from the database individuals having at least one entry in the Condition Occurrence table matching at least one of the provided condition types.

Arguments:

  • condition_codes - a vector of condition_concept_id's; must be a subtype of Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

ConditionFilterPersonIDs(conditioncodes; tab = conditionoccurrence)

Generates a SQL statement that, given a list of condition concept IDs, condition_codes, return from the database individuals having at least one entry in the Condition Occurrence table matching at least one of the provided condition types.

Arguments:

  • condition_codes - a vector of condition_concept_id's; must be a subtype of Integer

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • sql::String - the SQL representation that runs this filter
source
OMOPCDMCohortCreator.RaceFilterPersonIDs โ€” Function

RaceFilterPersonIDs(race_codes, conn; tab = person)

Given a list of condition concept IDs, race_codes, return from the database individuals having at least one entry in the Person table matching at least one of the provided race types.

Arguments:

  • race_codes - a vector of race_concept_id's; must be a subtype of Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

RaceFilterPersonIDs(race_codes; tab = person)

Generates a SQL statement that, given a list of race_concept_id's, return from the database individuals having at least one entry in the Person table matching at least one of the provided race types.

Arguments:

  • race_codes - a vector of race_concept_id's; must be a subtype of Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • sql::String - the SQL representation that runs this filter
source
OMOPCDMCohortCreator.GenderFilterPersonIDs โ€” Function

GenderFilterPersonIDs(gendercodes, conn; tab = visitoccurrence)

Given a list of visit concept IDs, gender_codes return from the database individuals having at least one entry in the Person table matching at least one of the provided gender types.

Arguments:

  • visit_codes - a vector of gender_concept_id's; must be a subtype of Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

GenderFilterPersonIDs(gendercodes; tab = visitoccurrence)

Generates a SQL statement that, given a list of visit concept IDs, gender_codes return from the database individuals having at least one entry in the Person table matching at least one of the provided gender types.

Arguments:

  • visit_codes - a vector of gender_concept_id's; must be a subtype of Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • sql::String - the SQL representation that runs this filter
source
OMOPCDMCohortCreator.StateFilterPersonIDs โ€” Function

StateFilterPersonIDs(states, conn; tab = location, join_tab = person)

Given a list of states, states, return from the database individuals found in the provided state list.

Arguments:

  • states - a vector of state abbreviations; must be a subtype of AbstractString

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Location table; default location

  • join_tab - the SQLTable representing the Person table; default person

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

StateFilterPersonIDs(states; tab = location, join_tab = person)

Generates a SQL statement that, given a list of states, states, return from the database individuals found in the provided state list.

Arguments:

  • states - a vector of state abbreviations; must be a subtype of AbstractString

Keyword Arguments:

  • tab - the SQLTable representing the Location table; default location

  • join_tab - the SQLTable representing the Person table; default person

Returns

  • sql::String - the SQL representation that runs this filter
source
Missing docstring.

Missing docstring for AgeGroupFilterPersonIDs. Check Documenter's build log for details.

Generators

The generator functions are to set generate initial connections to an OMOP CDM database or to finalize resulting data from queries into various outputs.

OMOPCDMCohortCreator.GenerateDatabaseDetails โ€” Function

GenerateDatabaseDetails(dialect::Symbol, schema::String)

Generates the dialect and schema details for accessing a given OMOP CDM database.

Arguments:

  • dialect::Symbol - the dialect used for SQL queries (to see what is dialects are available, see here: https://mechanicalrabbit.github.io/FunSQL.jl/stable/reference/#FunSQL.SQLDialect)
  • schema::String - the name of the database schema being used.
source
OMOPCDMCohortCreator.GenerateGroupCounts โ€” Function

GenerateGroupCounts(data::DataFrame)

Given data in a DataFrame, get group counts based on each feature found in the DataFrame and removes person_id for privacy aggregation purposes.

Arguments:

  • data::DataFrame - a DataFrame that must have at least a person_id column

Returns:

  • df::DataFrame - a DataFrame that contains the group counts based on each feature found in data with the person_id field removed for privacy
source
OMOPCDMCohortCreator.GenerateTables โ€” Function

GenerateTables(conn; inplace = true, exported = false)

Generates Julia representations of all tables found in a given OMOP CDM database.

Arguments:

  • dialect::Symbol - the dialect used for SQL queries (to see what is dialects are available, see here: https://mechanicalrabbit.github.io/FunSQL.jl/stable/reference/#FunSQL.SQLDialect)
  • schema::String - the name of the database schema being used.
source

Executors

These functions perform quality assurance checks on data extracts genereated from OMOPCDMCohortCreator queries.

OMOPCDMCohortCreator.ExecuteAudit โ€” Function

ExecuteAudit(data::DataFrame; hitech = true)

Function that executes an audit on a dataframe that must contain a count column to ensure compliance with auditing and privacy preserving best practices

Arguments:

  • data::DataFrame - the data to audit that must be in a DataFrame and contain a column called count

Keyword Arguments:

  • hitech::Bool - a boolean that enforces HITECH standards for privacy preserving methods.

  • target_column::Symbol - the name of the column to target for auditing (default set to :count).

Returns

  • df - a DataFrame that is appropriately audited per a given standard
source
+- `tab` - the `SQLTable` representing the `cohort` table; default `cohort`

Returns

  • df::DataFrame - a three column DataFrame comprised of columns: :cohort_definition_id , :subject_id and :cohort_end_date
source

function GetCohortSubjectEndDate(df:DataFrame, conn; tab = cohort)

Given a DataFrame with a :cohort_definition_id column and :subject_id column, return the DataFrame with an associated :cohort_end_date corresponding to a given cohort_definition_id and subject_id in the DataFrame

Multiple dispatch that accepts all other arguments like in GetCohortSubjectEndDate(ids, conn; tab = cohort)

source

function GetCohortSubjectEndDate(cohortids; subjectids; tab=cohort)

Given a list of cohort IDs and subject IDs return their end date.

Arguments:

  • cohort_ids - list of cohort_id's; each ID must be of subtype Float64
  • subject_id - list of subject_id's; each ID must be of subtype Float64
  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the cohort table; default cohort

Returns

  • df::DataFrame - a three column DataFrame comprised of columns: :cohort_definition_id , :subject_id and :cohort_end_date
source
OMOPCDMCohortCreator.GetVisitProcedure โ€” Function

GetVisitProcedure(visitids, conn; tab = procedureoccurrence)

Given a list of visit IDs, find their corresponding procedures.

Arguments:

  • visit_ids - list of visit_id's; each ID must be of subtype Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default procedure_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :visit_occurrence_id and :procedure_concept_id
source

GetVisitProcedure(visitids; tab = procedureoccurrence)

Produces SQL statement that, given a list of visit_id's, finds the procedures associated with that visit.

Arguments:

  • visit_ids - list of visit_id's; each ID must be of subtype Integer

Keyword Arguments:

  • tab - the SQLTable representing the Procedure Occurrence table; default procedure_occurrence

Returns

  • df::DataFrame - a two column DataFrame comprised of columns: :visit_occurrence_id and :procedure_concept_id
source

Filters

These functions accepts parameters to produce queries that look for specific subpopulations or information given specific patient identifier(s) (i.e. person_id).

OMOPCDMCohortCreator.VisitFilterPersonIDs โ€” Function

VisitFilterPersonIDs(visitcodes, conn; tab = visitoccurrence)

Given a list of visit concept IDs, visit_codes return from the database patients matching at least one of the provided visit codes from the Visit Occurrence table.

Arguments:

  • visit_codes - a vector of visit_concept_id's; must be a subtype of Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

VisitFilterPersonIDs(visitcodes; tab = visitoccurrence)

Generates a SQL statement that, given a list of visit concept IDs, visit_codes, return from the database patients matching at least one of the provided visit codes from the Visit Occurrence table.

Arguments:

  • visit_codes - a vector of visit_concept_id's; must be a subtype of Integer

conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Visit Occurrence table; default visit_occurrence

Returns

  • sql::String - the SQL representation that runs this filter
source
OMOPCDMCohortCreator.ConditionFilterPersonIDs โ€” Function

ConditionFilterPersonIDs(conditioncodes, conn; tab = conditionoccurrence)

Given a list of condition concept IDs, condition_codes, return from the database individuals having at least one entry in the Condition Occurrence table matching at least one of the provided condition types.

Arguments:

  • condition_codes - a vector of condition_concept_id's; must be a subtype of Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

ConditionFilterPersonIDs(conditioncodes; tab = conditionoccurrence)

Generates a SQL statement that, given a list of condition concept IDs, condition_codes, return from the database individuals having at least one entry in the Condition Occurrence table matching at least one of the provided condition types.

Arguments:

  • condition_codes - a vector of condition_concept_id's; must be a subtype of Integer

Keyword Arguments:

  • tab - the SQLTable representing the Condition Occurrence table; default condition_occurrence

Returns

  • sql::String - the SQL representation that runs this filter
source
OMOPCDMCohortCreator.RaceFilterPersonIDs โ€” Function

RaceFilterPersonIDs(race_codes, conn; tab = person)

Given a list of condition concept IDs, race_codes, return from the database individuals having at least one entry in the Person table matching at least one of the provided race types.

Arguments:

  • race_codes - a vector of race_concept_id's; must be a subtype of Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

RaceFilterPersonIDs(race_codes; tab = person)

Generates a SQL statement that, given a list of race_concept_id's, return from the database individuals having at least one entry in the Person table matching at least one of the provided race types.

Arguments:

  • race_codes - a vector of race_concept_id's; must be a subtype of Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • sql::String - the SQL representation that runs this filter
source
OMOPCDMCohortCreator.GenderFilterPersonIDs โ€” Function

GenderFilterPersonIDs(gendercodes, conn; tab = visitoccurrence)

Given a list of visit concept IDs, gender_codes return from the database individuals having at least one entry in the Person table matching at least one of the provided gender types.

Arguments:

  • visit_codes - a vector of gender_concept_id's; must be a subtype of Integer

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

GenderFilterPersonIDs(gendercodes; tab = visitoccurrence)

Generates a SQL statement that, given a list of visit concept IDs, gender_codes return from the database individuals having at least one entry in the Person table matching at least one of the provided gender types.

Arguments:

  • visit_codes - a vector of gender_concept_id's; must be a subtype of Integer

Keyword Arguments:

  • tab - the SQLTable representing the Person table; default person

Returns

  • sql::String - the SQL representation that runs this filter
source
OMOPCDMCohortCreator.StateFilterPersonIDs โ€” Function

StateFilterPersonIDs(states, conn; tab = location, join_tab = person)

Given a list of states, states, return from the database individuals found in the provided state list.

Arguments:

  • states - a vector of state abbreviations; must be a subtype of AbstractString

  • conn - database connection using DBInterface

Keyword Arguments:

  • tab - the SQLTable representing the Location table; default location

  • join_tab - the SQLTable representing the Person table; default person

Returns

  • ids::Vector{Int64} - the list of persons resulting from the filter
source

StateFilterPersonIDs(states; tab = location, join_tab = person)

Generates a SQL statement that, given a list of states, states, return from the database individuals found in the provided state list.

Arguments:

  • states - a vector of state abbreviations; must be a subtype of AbstractString

Keyword Arguments:

  • tab - the SQLTable representing the Location table; default location

  • join_tab - the SQLTable representing the Person table; default person

Returns

  • sql::String - the SQL representation that runs this filter
source
Missing docstring.

Missing docstring for AgeGroupFilterPersonIDs. Check Documenter's build log for details.

Generators

The generator functions are to set generate initial connections to an OMOP CDM database or to finalize resulting data from queries into various outputs.

OMOPCDMCohortCreator.GenerateDatabaseDetails โ€” Function

GenerateDatabaseDetails(dialect::Symbol, schema::String)

Generates the dialect and schema details for accessing a given OMOP CDM database.

Arguments:

  • dialect::Symbol - the dialect used for SQL queries (to see what is dialects are available, see here: https://mechanicalrabbit.github.io/FunSQL.jl/stable/reference/#FunSQL.SQLDialect)
  • schema::String - the name of the database schema being used.
source
OMOPCDMCohortCreator.GenerateGroupCounts โ€” Function

GenerateGroupCounts(data::DataFrame)

Given data in a DataFrame, get group counts based on each feature found in the DataFrame and removes person_id for privacy aggregation purposes.

Arguments:

  • data::DataFrame - a DataFrame that must have at least a person_id column

Returns:

  • df::DataFrame - a DataFrame that contains the group counts based on each feature found in data with the person_id field removed for privacy
source
OMOPCDMCohortCreator.GenerateTables โ€” Function

GenerateTables(conn; inplace = true, exported = false)

Generates Julia representations of all tables found in a given OMOP CDM database.

Arguments:

  • dialect::Symbol - the dialect used for SQL queries (to see what is dialects are available, see here: https://mechanicalrabbit.github.io/FunSQL.jl/stable/reference/#FunSQL.SQLDialect)
  • schema::String - the name of the database schema being used.
source

Executors

These functions perform quality assurance checks on data extracts genereated from OMOPCDMCohortCreator queries.

OMOPCDMCohortCreator.ExecuteAudit โ€” Function

ExecuteAudit(data::DataFrame; hitech = true)

Function that executes an audit on a dataframe that must contain a count column to ensure compliance with auditing and privacy preserving best practices

Arguments:

  • data::DataFrame - the data to audit that must be in a DataFrame and contain a column called count

Keyword Arguments:

  • hitech::Bool - a boolean that enforces HITECH standards for privacy preserving methods.

  • target_column::Symbol - the name of the column to target for auditing (default set to :count).

Returns

  • df - a DataFrame that is appropriately audited per a given standard
source
diff --git a/previews/PR71/contributing/index.html b/previews/PR71/contributing/index.html index 87872b5..8ae08a7 100644 --- a/previews/PR71/contributing/index.html +++ b/previews/PR71/contributing/index.html @@ -7,4 +7,4 @@ (@v###) pkg> activate . (OMOPCDMCohortCreator) pkg> add [NAME OF DEPENDENCY]

Adding Test Dependencies ๐Ÿ“‹

If you are introducing a new test dependency, make sure to add that dependency to the Project.toml located in the OMOPCDMCohortCreator test directory. To do this, follow these steps:

  1. Enter the test directory inside of the OMOPCDMCohortCreator directory
cd /path/to/OMOPCDMCohortCreator.jl/test/
  1. Activate the OMOPCDMCohortCreator test environment and add the dependency:
julia> ]
 (@v###) pkg> activate .
-(test) pkg> add [NAME OF DEPENDENCY]
+(test) pkg> add [NAME OF DEPENDENCY] diff --git a/previews/PR71/index.html b/previews/PR71/index.html index 420277c..9769c33 100644 --- a/previews/PR71/index.html +++ b/previews/PR71/index.html @@ -1,2 +1,2 @@ -Home ยท OMOPCDMCohortCreator.jl

Welcome to the OMOPCDMCohortCreator.jl Docs! ๐Ÿ‘‹

Create cohorts from databases utilizing the OMOP CDM.

This package uses a functional approach to query databases in the OMOP Common Data Model format whereby you could build rapidly lines of inquiry into the database. Furthermore, this package is a companion to those tools found in the HADES ecosystem. To get started, visit the Tutorials section as well as visit the API section to see all the functions available. If you want to contribute, please check out our Contributing guide!

Main Features ๐Ÿ”ง

The biggest features of this package are:

  • Incremental building blocks for creating an analysis pipeline in the form of (more information in API):
    • "Getter" functions to "get" information from a database
    • "Filter" functions to "filter" information from a database
    • "Generator" functions to "generate" database information and connections
    • "Executor" functions to "execute" on retrieved information
  • Automatic targeting and support for the SQL flavors (via FunSQL.jl):
    • postgresql
    • sqlite
    • redshift
  • Prepare SQL queries if unable to connect to database via OMOPCDMCohortCreator that could then be run on a given SQL database directly
  • Does not mutate database or require temp tables
  • Interoperable with the R language via JuliaConnectoR to work directly within R syntax (see Tutorials)
  • Readily parallelizable via Distributed.jl
  • Complementary to OHDSI HADES ecosystem tools
  • Extensive test suite to ensure correctness and compliance with privacy preserving methods (HITECH, etc.)

Why? ๐Ÿค”

This package was created as the result of work in the MentalHealthEquity network study. Phenotype definitions work alongside this package and OMOPCDMCohortCreator allows an investigator to quickly iterate and build on top of phenotype definitions and/or concept sets. Where I personally see this being of use is when an investigator needs to quickly pull information out of a database, iterate and test ideas for a formal phenotype definition rapidly, and reason simply about queries.

Why Julia? ๐Ÿค“

Julia itself is built for High Performance Computing and readability. We wanted to work in a language that could handle the high amounts of data that could manifest in working with OMOP CDM databases. Julia not only made sense for "big data" operations and readability but also was attractive due to it's ability to work with other programming languages such as R or Python. Therefore, the benefit is:

  • High performance more easily reached on all ranges of hardware
  • Lower barrier to entry for new contributors
  • Interoperation with other programming languages

In our eyes, we do not see anything lost by choosing Julia as we can easily bridge to other languages. The idea is that this approach can keep users in the language they are comfortable with while working with a flexible package to quickly perform analyses.

+Home ยท OMOPCDMCohortCreator.jl

Welcome to the OMOPCDMCohortCreator.jl Docs! ๐Ÿ‘‹

Create cohorts from databases utilizing the OMOP CDM.

This package uses a functional approach to query databases in the OMOP Common Data Model format whereby you could build rapidly lines of inquiry into the database. Furthermore, this package is a companion to those tools found in the HADES ecosystem. To get started, visit the Tutorials section as well as visit the API section to see all the functions available. If you want to contribute, please check out our Contributing guide!

Main Features ๐Ÿ”ง

The biggest features of this package are:

  • Incremental building blocks for creating an analysis pipeline in the form of (more information in API):
    • "Getter" functions to "get" information from a database
    • "Filter" functions to "filter" information from a database
    • "Generator" functions to "generate" database information and connections
    • "Executor" functions to "execute" on retrieved information
  • Automatic targeting and support for the SQL flavors (via FunSQL.jl):
    • postgresql
    • sqlite
    • redshift
  • Prepare SQL queries if unable to connect to database via OMOPCDMCohortCreator that could then be run on a given SQL database directly
  • Does not mutate database or require temp tables
  • Interoperable with the R language via JuliaConnectoR to work directly within R syntax (see Tutorials)
  • Readily parallelizable via Distributed.jl
  • Complementary to OHDSI HADES ecosystem tools
  • Extensive test suite to ensure correctness and compliance with privacy preserving methods (HITECH, etc.)

Why? ๐Ÿค”

This package was created as the result of work in the MentalHealthEquity network study. Phenotype definitions work alongside this package and OMOPCDMCohortCreator allows an investigator to quickly iterate and build on top of phenotype definitions and/or concept sets. Where I personally see this being of use is when an investigator needs to quickly pull information out of a database, iterate and test ideas for a formal phenotype definition rapidly, and reason simply about queries.

Why Julia? ๐Ÿค“

Julia itself is built for High Performance Computing and readability. We wanted to work in a language that could handle the high amounts of data that could manifest in working with OMOP CDM databases. Julia not only made sense for "big data" operations and readability but also was attractive due to it's ability to work with other programming languages such as R or Python. Therefore, the benefit is:

  • High performance more easily reached on all ranges of hardware
  • Lower barrier to entry for new contributors
  • Interoperation with other programming languages

In our eyes, we do not see anything lost by choosing Julia as we can easily bridge to other languages. The idea is that this approach can keep users in the language they are comfortable with while working with a flexible package to quickly perform analyses.

diff --git a/previews/PR71/search/index.html b/previews/PR71/search/index.html index e6aeffd..dee8e97 100644 --- a/previews/PR71/search/index.html +++ b/previews/PR71/search/index.html @@ -1,2 +1,2 @@ -Search ยท OMOPCDMCohortCreator.jl

Loading search...

    +Search ยท OMOPCDMCohortCreator.jl

    Loading search...

      diff --git a/previews/PR71/tutorials/beginner_tutorial/index.html b/previews/PR71/tutorials/beginner_tutorial/index.html index 26841e3..f90c6b9 100644 --- a/previews/PR71/tutorials/beginner_tutorial/index.html +++ b/previews/PR71/tutorials/beginner_tutorial/index.html @@ -38,4 +38,4 @@ strep_patients_characterized = DF.outerjoin(strep_patients_race, strep_patients_gender, strep_patients_age_group; on = :person_id, matchmissing = :equal)

      Task: Create Patient Groupings

      Often with characterization style studies, it is extremely important to aggregate patient populations. Why? To protect the anonymity of patients with perhaps severely sensitive conditions (e.g. mental illnesses, sexually transmitted diseases, etc.) from possible repercussions from accidental disclosure of this patient information.

      For this task, add to the table you created in the previous task a new column called counts and remove the person_id column. The counts column should represent the total number of patients belonging to a group's gender, race, and age group. Here is an example on how to calculate counts: if there are $5$ rows in your table that have patients who are between the ages of $20 - 24$, are African American, and are female, the value for that age, race, and gender group is $5$. The $5$ rows would then collapse into $1$ row as unique patient identifiers (the person_id column) would be removed. Hint: removing the person_id column first may make things easier; also, look at the DataFrames.jl documentation on the Split-Apply-Combine approach to generate the counts column.

      Suggested solution:

      strep_patients_characterized = strep_patients_characterized[:, DF.Not(:person_id)]
       strep_patient_groups = DF.groupby(strep_patients_characterized, [:race_concept_id, :gender_concept_id, :age_group])
      -strep_patient_groups = DF.combine(strep_patient_groups, DF.nrow => :counts)

      Task: Execute Safety Audit

      To ensure the safety of the patients in this table, we can execute an audit. One such auditing standard are those put forth by "HITECH" which, amongst other things, requires researchers to filter out from a table patient counts $< 11$ in subpopulation groups โ€“ the kind of groups we created! We can apply that as follows:

      audited_strep_patient_groups = occ.ExecuteAudit(strep_patient_groups; hitech = true)

      Conclusion ๐ŸŽ‰

      This mini characterization study that we just conducted on this dataset opens up a whole new avenue for a researcher to pursue. For example, we could now calculate prevalence rates across different patient characteristics or compare and contrast multiple conditions at once. It should also be apparent that the API is set up in a very particular way: it is functional meaning that each function does one thing only. This gives a lot of flexibility to a user to build together study incrementally using OMOPCDMCohortCreator. Congratulations on finishing this tutorial and if there are any issues you encountered, feel free to open an issue here!

      Appendix ๐Ÿ•ต๏ธ

      Packages Used in Analysis

      Package descriptions:

      +strep_patient_groups = DF.combine(strep_patient_groups, DF.nrow => :counts)

      Task: Execute Safety Audit

      To ensure the safety of the patients in this table, we can execute an audit. One such auditing standard are those put forth by "HITECH" which, amongst other things, requires researchers to filter out from a table patient counts $< 11$ in subpopulation groups โ€“ the kind of groups we created! We can apply that as follows:

      audited_strep_patient_groups = occ.ExecuteAudit(strep_patient_groups; hitech = true)

      Conclusion ๐ŸŽ‰

      This mini characterization study that we just conducted on this dataset opens up a whole new avenue for a researcher to pursue. For example, we could now calculate prevalence rates across different patient characteristics or compare and contrast multiple conditions at once. It should also be apparent that the API is set up in a very particular way: it is functional meaning that each function does one thing only. This gives a lot of flexibility to a user to build together study incrementally using OMOPCDMCohortCreator. Congratulations on finishing this tutorial and if there are any issues you encountered, feel free to open an issue here!

      Appendix ๐Ÿ•ต๏ธ

      Packages Used in Analysis

      Package descriptions:

      diff --git a/previews/PR71/tutorials/index.html b/previews/PR71/tutorials/index.html index 5d16dfd..430a076 100644 --- a/previews/PR71/tutorials/index.html +++ b/previews/PR71/tutorials/index.html @@ -1,2 +1,2 @@ -Tutorials ยท OMOPCDMCohortCreator.jl

      Tutorials

      These tutorials are designed to equip new users with how to get started with OMOPCDMCohortCreator:

      • Beginner Tutorial - a step by step guide on using OMOPCDMCohortCreator to run a mini characterization study with minimal Julia knowledge required! Difficulty: Easy
      • Using OMOPCDMCohortCreator with R - a guide on how to use OMOPCDMCohortCreator within R to run a mini characterization study. Difficulty: Medium
      +Tutorials ยท OMOPCDMCohortCreator.jl

      Tutorials

      These tutorials are designed to equip new users with how to get started with OMOPCDMCohortCreator:

      • Beginner Tutorial - a step by step guide on using OMOPCDMCohortCreator to run a mini characterization study with minimal Julia knowledge required! Difficulty: Easy
      • Using OMOPCDMCohortCreator with R - a guide on how to use OMOPCDMCohortCreator within R to run a mini characterization study. Difficulty: Medium
      diff --git a/previews/PR71/tutorials/r_tutorial/index.html b/previews/PR71/tutorials/r_tutorial/index.html index 69d295b..ac08fc3 100644 --- a/previews/PR71/tutorials/r_tutorial/index.html +++ b/previews/PR71/tutorials/r_tutorial/index.html @@ -54,4 +54,4 @@ select(-person_id) %>% count(race_concept_id, age_group, gender_concept_id) %>% rename(count = "n") %>% -filter(count > 10)

      Conclusion ๐ŸŽ‰

      This mini characterization study that we just conducted on this dataset opens up a whole new avenue for a researcher to pursue. For example, we could now calculate prevalence rates across different patient characteristics or compare and contrast multiple conditions at once. It should also be apparent that the API is set up in a very particular way: it is functional meaning that each function does one thing only. This gives a lot of flexibility to a user to build together a study incrementally using OMOPCDMCohortCreator.

      Appendix ๐Ÿ•ต๏ธ

      Packages Used in Analysis

      R Packages Used:

      Julia Packages Used:

      +filter(count > 10)

      Conclusion ๐ŸŽ‰

      This mini characterization study that we just conducted on this dataset opens up a whole new avenue for a researcher to pursue. For example, we could now calculate prevalence rates across different patient characteristics or compare and contrast multiple conditions at once. It should also be apparent that the API is set up in a very particular way: it is functional meaning that each function does one thing only. This gives a lot of flexibility to a user to build together a study incrementally using OMOPCDMCohortCreator.

      Appendix ๐Ÿ•ต๏ธ

      Packages Used in Analysis

      R Packages Used:

      Julia Packages Used: