This function will iterate through the provided input table to identify the proportion of rows in each fact type that have an implausible date. Implausibility is defined as a date that falls before the associated visit start date, after the associated visit end date, or before the patient's birth date.
Usage
check_dp(
dp_tbl,
omop_or_pcornet = "omop",
visit_tbl = cdm_tbl("visit_occurrence"),
dob_tbl = cdm_tbl("person"),
check_string = "dp"
)
Arguments
- dp_tbl
tabular input || required
The primary input table that contains descriptive information about the checks to be executed by the function. It should include definitions for the clinical fact types that should be evaluated for date plausibility. see
?dp_input_omop
or?dp_input_pcornet
for examples of the input structure- omop_or_pcornet
string || defaults to
omop
A string, either
omop
orpcornet
, indicating the CDM format of the data- visit_tbl
tabular input || defaults to
cdm_tbl(visit_occurrence)
A table with visit information, including identifiers that can link back to facts and start & end dates. This argument will most likely be the
visit_occurrence
table for OMOP or theencounter
table for PCORnet. Custom tables with specific visit subsets (i.e. a table with only nephrology specialist visits) can also be provided.- dob_tbl
tabular input || defaults to
cdm_tbl('person')
A table with patient identifiers that can link back to facts and birth dates. This argument will most likely be the
person
table for OMOP or thedemographic
table for PCORnet.- check_string
string || defaults to
dp
An abbreviated identifier that will be used to label all output from this module
Value
This function will return a table with the count & proportion of rows with an implausible date value, with one column for each of the 3 implausibility definitions. These will indicate the proportion of facts falling before the associated visit start date, after the associated visit end date, or before the patient birth date
Examples
# First create input file with desired checks to be executed
# You can access examples for both OMOP & PCORnet here:
ndq::dp_input_omop
#> # A tibble: 3 × 6
#> check_id check_description schema table date_field filter_logic
#> <chr> <chr> <chr> <chr> <chr> <lgl>
#> 1 pr procedures cdm procedure_occurrence procedure… NA
#> 2 co conditions cdm condition_occurrence condition… NA
#> 3 dr drugs cdm drug_exposure drug_expo… NA
ndq::dp_input_pcornet
#> # A tibble: 4 × 6
#> check_id check_description schema table date_field filter_logic
#> <chr> <chr> <chr> <chr> <chr> <lgl>
#> 1 pr procedures cdm procedures px_date NA
#> 2 co conditions cdm diagnosis admit_date NA
#> 3 rx prescribed drugs cdm prescribing rx_start_d… NA
#> 4 admin inpatient administrations cdm med_admin med_admin_… NA
# Use this as your input to the DP function
if (FALSE) { # \dontrun{
my_dp_rslt <- check_dp(dp_tbl = ndq::dp_input_omop,
omop_or_pcornet = 'omop',
visit_tbl = cdm_tbl('visit_occurrence'), ## table with visit/encounter dates
dob_tbl = cdm_tbl('person'), ## table with dates of birth
check_string = 'dp')
} # }