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, 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 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

  • ungrouped_label - the label to assign persons who do not fit to a provided matching age group; default label "Unspecified"

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, 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 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

  • ungrouped_label - the label to assign persons who do not fit to a provided matching age group; default label "Unspecified"

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:

- `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

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:

- `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

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
OMOPCDMCohortCreator.GetDrugExposureEndDate โ€” Function

function GetDrugExposureEndDate(drugexposureids; tab = drug_exposure)

Given a list of drugexposure IDs, find their corresponding drugexposureenddate 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_end_date
source
OMOPCDMCohortCreator.GetDrugExposureStartDate โ€” Function

function 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)

source

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`
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