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 โ FunctionGetDatabasePersonIDs(conn; tab = person)
Get all unique person_id's from a database.
Arguments:
conn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
ids::Vector{Int64}- the list of persons
GetDatabasePersonIDs(; tab = person)
Return SQL statement that gets all unique person_id's from a database.
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
sql::String- Prepared SQL statement as aString
OMOPCDMCohortCreator.GetPatientState โ FunctionGetPatientState(ids, conn; tab = location, join_tab = person)
Given a list of person IDs, find their home state.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Location table; defaultlocationjoin_tab- theSQLTablerepresenting the Person table; defaultperson
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:state
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 ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Location table; defaultlocationjoin_tab- theSQLTablerepresenting the Person table; defaultperson
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:state
OMOPCDMCohortCreator.GetPatientGender โ FunctionGetPatientGender(ids, conn; tab = person)
Given a list of person IDs, find their gender.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:gender_concept_id
GetPatientGender(ids; tab = person)
Return SQL statement that gets the gender_concept_id for a given list of person_id's
Arguments:
ids- list ofperson_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:gender_concept_id
OMOPCDMCohortCreator.GetPatientRace โ FunctionGetPatientRace(ids, conn; tab = person)
Given a list of person IDs, find their race.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:race_concept_id
GetPatientRace(ids; tab = person)
Return SQL statement that gets the race_concept_id for a given list of person_id's
Arguments:
ids- list ofperson_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:race_concept_id
OMOPCDMCohortCreator.GetPatientEthnicity โ FunctionGetPatientEthnicity(ids, conn; tab = person)
Given a list of person IDs, find their ethnicity.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:ethnicity_concept_id
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 ofperson_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:ethnicity_concept_id
OMOPCDMCohortCreator.GetPatientAgeGroup โ FunctionGetPatientAgeGroup( ids, conn; minuend = :now, agegroupings = [ [0, 9], [10, 19], [20, 29], [30, 39], [40, 49], [50, 59], [60, 69], [70, 79], [80, 89], ], tab = person, ungroupedlabel = "Unspecified" )
Finds all individuals in age groups as specified by age_groupings.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- 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 ofIntegerminuend- the year that a patient'syear_of_birthvariable 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- theSQLTablerepresenting the Person table; defaultpersonungrouped_label- the label to assign persons who do not fit to a provided matching age group; default label "Unspecified"
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:age_group
Note
Age can be difficult to be calculated consistently. In this case, there are some assumptions made to ensure consistency:
According to the OMOP CDM v5.4, only the variable
year_of_birthis guaranteed for a given patient. This is one of three options used as the minuend in age calculations.The subtrahend is based on what one chooses for the
minuendkey 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.
GetPatientAgeGroup( ids; minuend = :now, agegroupings = [ [0, 9], [10, 19], [20, 29], [30, 39], [40, 49], [50, 59], [60, 69], [70, 79], [80, 89], ], tab = person, ungroupedlabel = "Unspecified" )
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 ofperson_id's; each ID must be of subtypeInteger
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 ofIntegerminuend- the year that a patient'syear_of_birthvariable 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- theSQLTablerepresenting the Person table; defaultpersonungrouped_label- the label to assign persons who do not fit to a provided matching age group; default label "Unspecified"
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:age_group
Note
Age can be difficult to be calculated consistently. In this case, there are some assumptions made to ensure consistency:
According to the OMOP CDM v5.4, only the variable
year_of_birthis guaranteed for a given patient. This is one of three options used as the minuend in age calculations.The subtrahend is based on what one chooses for the
minuendkey 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.
OMOPCDMCohortCreator.GetPatientVisits โ FunctionGetPatientVisits(ids, conn; tab = visit_occurrence)
Given a list of person IDs, find all their visits.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Visit Occurrence table; defaultvisit_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:visit_occurrence_id
GetPatientVisits(ids; tab = visit_occurrence)
Return SQL statement that returns all visit_occurrence_id for a given patient list
Arguments:
ids- list ofperson_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Visit Occurrence table; defaultvisit_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:visit_occurrence_id
OMOPCDMCohortCreator.GetMostRecentConditions โ FunctionGetMostRecentConditions(ids, conn; tab = condition_occurrence)
Given a list of person IDs, find their last recorded conditions.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Condition Occurrence table; defaultcondition_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:condition_concept_id
GetMostRecentConditions(ids; tab = condition_occurrence)
Produces SQL statement that, given a list of person IDs, finds their last recorded conditions.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Condition Occurrence table; defaultcondition_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:condition_concept_id
OMOPCDMCohortCreator.GetMostRecentVisit โ FunctionGetMostRecentVisit(ids, conn; tab = visit_occurrence)
Given a list of person IDs, find their last recorded visit.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Visit Occurrence table; defaultvisit_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:visit_occurrence_id
GetMostRecentVisit(ids, conn; tab = visit_occurrence)
Produces SQL statement that, given a list of person IDs, finds their last recorded visit.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Visit Occurrence table; defaultvisit_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:visit_occurrence_id
OMOPCDMCohortCreator.GetVisitCondition โ FunctionGetVisitCondition(visitids, conn; tab = visitoccurrence)
Given a list of visit IDs, find their corresponding conditions.
Arguments:
visit_ids- list ofvisit_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Condition Occurrence table; defaultcondition_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::visit_occurrence_idand:condition_concept_id
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 ofvisit_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Condition Occurrence table; defaultcondition_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::visit_occurrence_idand:condition_concept_id
OMOPCDMCohortCreator.GetDatabaseYearRange โ FunctionGetDatabaseYearRange(conn; tab = observation_period)
Get the years for which data is available from a database.
Arguments:
conn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Observation Period table; defaultobservation_period
Returns
year_range::NamedTuple{(:first_year, :last_year), Tuple{Int64, Int64}}- a NamedTuple wherefirst_yearis the first year data from the database was available andlast_yearwhere the last year data from the database was available
GetDatabaseYearRange(; tab = observation_period)
Return SQL to find the years for which data is available from a database.
Keyword Arguments:
tab- theSQLTablerepresenting the Observation Period table; defaultobservation_period
Returns
year_range::NamedTuple{(:first_year, :last_year), Tuple{Int64, Int64}}- a NamedTuple wherefirst_yearis the first year data from the database was available andlast_yearwhere the last year data from the database was available
OMOPCDMCohortCreator.GetDrugExposureIDs โ FunctionGetDrugExposureIDs(ids, conn; tab = drug_exposure)
Given a list of person IDs, find their drug exposure.
Arguments:
ids- list ofperson_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the the drugexposure table; default `drugexposure`
Returns
df::DataFrame- a two columnDataFramecomprised of columns::person_idand:drug_exposure_id
OMOPCDMCohortCreator.GetDrugConceptIDs โ FunctionGetDrugConcepts(drugexposureids; tab = drug_exposure)
Given a list of drug Exposure IDs, find their drugconceptid.
Arguments:
drug_exposure_ids- list ofdrug_exposure_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the drugexposure table; default `drugexposure`
Returns
df::DataFrame- a two columnDataFramecomprised of columns::drug_exposure_idand:drug_concept_id
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 ofdrug_exposure_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the drugexposure table; default `drugexposure`
Returns
df::DataFrame- a two columnDataFramecomprised of columns::drug_exposure_idand:drug_concept_id
OMOPCDMCohortCreator.GetDrugAmounts โ FunctionGetDrugAmounts(drugconceptids, conn; tab = drug_strength)
Given a list of drugs concept IDs, find their amount.
Arguments:
drug_concept_ids- list ofdrug_concept_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the drugstrength table; default `drugstrength`
Returns
df::DataFrame- a two columnDataFramecomprised of columns::drug_concept_idand:amount_value
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 ofdrug_concept_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the drugstrength table; default `drugstrength`
Returns
df::DataFrame- a two columnDataFramecomprised of columns::drug_concept_idand:amount_value
OMOPCDMCohortCreator.GetDatabaseCohorts โ FunctionGetDatabaseCohorts(conn; tab=cohort)
Given a DataFrame returns all unique cohortdefinitionid associated with a database.
#Arguments:
conn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Cohort table; defaultcohort
Returns
df::DataFrame- a one columnDataFramecomprised of columns::cohort_definition_id
OMOPCDMCohortCreator.GetCohortSubjects โ FunctionGetCohortSubjects(cohort_ids, conn; tab = cohort)
Given a list of cohort IDs, find their corresponding subjects.
Arguments:
cohort_ids- list ofcohort_id's; each ID must be of subtypeFloat64conn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting thecohorttable; defaultcohort
Returns
df::DataFrame- a two columnDataFramecomprised of columns::cohort_definition_idand:subject_id
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 ofcohort_id's; each ID must be of subtypeFloat64
Keyword Arguments:
tab- theSQLTablerepresenting thecohorttable; defaultcohort
Returns
df::DataFrame- a two columnDataFramecomprised of columns::cohort_definition_idand:subject_id
OMOPCDMCohortCreator.GetCohortSubjectStartDate โ Functionfunction GetCohortSubjectStartDate(cohortids, subjectids, conn; tab=cohort)
Given a single or 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 columnDataFramecomprised of columns::cohort_definition_id,:subject_idand:cohort_start_date
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)
function GetCohortSubjectStartDate(cohortids, subjectids; tab=cohort)
Given a list of cohort IDs and subject IDs return their start dates.
Arguments:
cohort_ids- list ofcohort_id's; each ID must be of subtypeFloat64subject_id- list ofsubject_id's; each ID must be of subtypeFloat64conn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting thecohorttable; defaultcohort
Returns
df::DataFrame- a three columnDataFramecomprised of columns::cohort_definition_id,:subject_idand:cohort_start_date
OMOPCDMCohortCreator.GetCohortSubjectEndDate โ Functionfunction GetCohortSubjectEndDate(cohortids, subjectids, conn; tab=cohort)
Given a list of cohort IDs and subject IDs return their end 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 columnDataFramecomprised of columns::cohort_definition_id,:subject_idand:cohort_end_date
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)
function GetCohortSubjectEndDate(cohortids; subjectids; tab=cohort)
Given a list of cohort IDs and subject IDs return their end date.
Arguments:
cohort_ids- list ofcohort_id's; each ID must be of subtypeFloat64subject_id- list ofsubject_id's; each ID must be of subtypeFloat64conn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting thecohorttable; defaultcohort
Returns
df::DataFrame- a three columnDataFramecomprised of columns::cohort_definition_id,:subject_idand:cohort_end_date
OMOPCDMCohortCreator.GetVisitProcedure โ FunctionGetVisitProcedure(visitids, conn; tab = procedureoccurrence)
Given a list of visit IDs, find their corresponding procedures.
Arguments:
visit_ids- list ofvisit_id's; each ID must be of subtypeIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Condition Occurrence table; defaultprocedure_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::visit_occurrence_idand:procedure_concept_id
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 ofvisit_id's; each ID must be of subtypeInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Procedure Occurrence table; defaultprocedure_occurrence
Returns
df::DataFrame- a two columnDataFramecomprised of columns::visit_occurrence_idand:procedure_concept_id
OMOPCDMCohortCreator.GetDrugExposureEndDate โ Functionfunction GetDrugExposureEndDate(drugexposureids; tab = drug_exposure)
Given a list of drugexposure IDs, find their corresponding drugexposureenddate ID.
Arguments:
drug_exposure_ids- list ofdrug_exposure_id's; each ID must be of subtypeFloat64
Keyword Arguments:
tab- theSQLTablerepresenting the Drug Exposure table; defaultdrug_exposure
Returns
- SQL statement comprised of:
:drug_exposure_idand:drug_exposure_end_date
OMOPCDMCohortCreator.GetDrugExposureStartDate โ Functionfunction GetDrugExposureStartDate(df:DataFrame, conn; tab = drug_exposure)
Given a DataFrame with a :drugexposureid column, return the DataFrame with an associated :drugexposurestartdate corresponding to a given drugexposure_id in the DataFrame.
Multiple dispatch that accepts all other arguments like in GetDrugExposureStartDate(ids, conn; tab = drug_exposure)
function GetDrugExposureStartDate(drugexposureids; tab = drug_exposure)
Given a list of drug_exposure IDs, find their corresponding drug_exposure_start_date ID.
# Arguments:
- `drug_exposure_ids` - list of `drug_exposure_id`'s; each ID must be of subtype `Float64`
# Keyword Arguments:
- `tab` - the `SQLTable` representing the Drug Exposure table; default `drug_exposure`
# Returns
- SQL statement comprised of: `:drug_exposure_id` and `:drug_exposure_start_date`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 โ FunctionVisitFilterPersonIDs(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 ofvisit_concept_id's; must be a subtype ofIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Visit Occurrence table; defaultvisit_occurrence
Returns
ids::Vector{Int64}- the list of persons resulting from the filter
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 ofvisit_concept_id's; must be a subtype ofInteger
conn - database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Visit Occurrence table; defaultvisit_occurrence
Returns
sql::String- the SQL representation that runs this filter
OMOPCDMCohortCreator.ConditionFilterPersonIDs โ FunctionConditionFilterPersonIDs(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 ofcondition_concept_id's; must be a subtype ofIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Condition Occurrence table; defaultcondition_occurrence
Returns
ids::Vector{Int64}- the list of persons resulting from the filter
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 ofcondition_concept_id's; must be a subtype ofInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Condition Occurrence table; defaultcondition_occurrence
Returns
sql::String- the SQL representation that runs this filter
OMOPCDMCohortCreator.RaceFilterPersonIDs โ FunctionRaceFilterPersonIDs(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 ofrace_concept_id's; must be a subtype ofIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
ids::Vector{Int64}- the list of persons resulting from the filter
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 ofrace_concept_id's; must be a subtype ofInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
sql::String- the SQL representation that runs this filter
OMOPCDMCohortCreator.GenderFilterPersonIDs โ FunctionGenderFilterPersonIDs(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 ofgender_concept_id's; must be a subtype ofIntegerconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
ids::Vector{Int64}- the list of persons resulting from the filter
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 ofgender_concept_id's; must be a subtype ofInteger
Keyword Arguments:
tab- theSQLTablerepresenting the Person table; defaultperson
Returns
sql::String- the SQL representation that runs this filter
OMOPCDMCohortCreator.StateFilterPersonIDs โ FunctionStateFilterPersonIDs(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 ofAbstractStringconn- database connection using DBInterface
Keyword Arguments:
tab- theSQLTablerepresenting the Location table; defaultlocationjoin_tab- theSQLTablerepresenting the Person table; defaultperson
Returns
ids::Vector{Int64}- the list of persons resulting from the filter
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 ofAbstractString
Keyword Arguments:
tab- theSQLTablerepresenting the Location table; defaultlocationjoin_tab- theSQLTablerepresenting the Person table; defaultperson
Returns
sql::String- the SQL representation that runs this filter
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 โ FunctionGenerateDatabaseDetails(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.
OMOPCDMCohortCreator.GenerateGroupCounts โ FunctionGenerateGroupCounts(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 aperson_idcolumn
Returns:
df::DataFrame- a DataFrame that contains the group counts based on each feature found indatawith theperson_idfield removed for privacy
OMOPCDMCohortCreator.GenerateTables โ FunctionGenerateTables(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.
Executors
These functions perform quality assurance checks on data extracts genereated from OMOPCDMCohortCreator queries.
OMOPCDMCohortCreator.ExecuteAudit โ FunctionExecuteAudit(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 aDataFrameand contain a column calledcount
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- aDataFramethat is appropriately audited per a given standard