Run benchmark of drug utilisation cohort generation
Source:R/benchmarkDrugUtilisation.R
benchmarkDrugUtilisation.Rd
Run benchmark of drug utilisation cohort generation
Usage
benchmarkDrugUtilisation(
cdm,
numberOfCohort = 1:4,
indicationCohortName = "cohort1",
ingredientId = 1125315,
drugExposureName = "drug_exposure"
)
Arguments
- cdm
A CDM reference object
- numberOfCohort
Number of cohort to generate for benchmarking. An integer or a vector of integers
- indicationCohortName
Name of indication cohort table
- ingredientId
Ingredient OMOP concept that we are interested for the study. It is a compulsory input, no default value is provided.
- drugExposureName
Name of drug_exposure table in cdm, the table must contain drug_concept_id, quantity, drug_exposure_start_date and drug_exposure_end_date as columns
Examples
# \donttest{
library(DrugUtilisation)
cdm <- mockDrugUtilisation()
#> Warning: ! 6 column in person do not match expected column type:
#> • `gender_concept_id` is numeric but expected integer
#> • `race_concept_id` is numeric but expected integer
#> • `ethnicity_concept_id` is numeric but expected integer
#> • `location_id` is numeric but expected integer
#> • `provider_id` is numeric but expected integer
#> • `care_site_id` is numeric but expected integer
#> Warning: ! 1 column in observation_period do not match expected column type:
#> • `period_type_concept_id` is numeric but expected integer
#> Warning: ! 2 column in visit_occurrence do not match expected column type:
#> • `visit_concept_id` is numeric but expected integer
#> • `visit_type_concept_id` is numeric but expected integer
#> Warning: ! 10 column in condition_occurrence do not match expected column type:
#> • `condition_concept_id` is numeric but expected integer
#> • `condition_type_concept_id` is numeric but expected integer
#> • `condition_status_concept_id` is numeric but expected integer
#> • `stop_reason` is logical but expected character
#> • `provider_id` is logical but expected integer
#> • `visit_occurrence_id` is logical but expected integer
#> • `visit_detail_id` is logical but expected integer
#> • `condition_source_value` is logical but expected character
#> • `condition_source_concept_id` is logical but expected integer
#> • `condition_status_source_value` is logical but expected character
#> Warning: ! 2 column in drug_exposure do not match expected column type:
#> • `drug_concept_id` is numeric but expected integer
#> • `drug_type_concept_id` is numeric but expected integer
#> Warning: ! 2 column in observation do not match expected column type:
#> • `observation_concept_id` is numeric but expected integer
#> • `observation_type_concept_id` is numeric but expected integer
#> Warning: ! 4 column in concept do not match expected column type:
#> • `concept_id` is numeric but expected integer
#> • `valid_start_date` is character but expected date
#> • `valid_end_date` is character but expected date
#> • `invalid_reason` is logical but expected character
#> Warning: ! 2 column in concept_relationship do not match expected column type:
#> • `concept_id_1` is numeric but expected integer
#> • `concept_id_2` is numeric but expected integer
#> Warning: ! 4 column in concept_ancestor do not match expected column type:
#> • `ancestor_concept_id` is numeric but expected integer
#> • `descendant_concept_id` is numeric but expected integer
#> • `min_levels_of_separation` is numeric but expected integer
#> • `max_levels_of_separation` is numeric but expected integer
#> Warning: ! 9 column in drug_strength do not match expected column type:
#> • `drug_concept_id` is numeric but expected integer
#> • `ingredient_concept_id` is numeric but expected integer
#> • `amount_unit_concept_id` is numeric but expected integer
#> • `numerator_unit_concept_id` is numeric but expected integer
#> • `denominator_unit_concept_id` is numeric but expected integer
#> • `box_size` is logical but expected integer
#> • `valid_start_date` is character but expected date
#> • `valid_end_date` is character but expected date
#> • `invalid_reason` is logical but expected character
#> Warning: ! 6 column in person do not match expected column type:
#> • `gender_concept_id` is numeric but expected integer
#> • `race_concept_id` is numeric but expected integer
#> • `ethnicity_concept_id` is numeric but expected integer
#> • `location_id` is numeric but expected integer
#> • `provider_id` is numeric but expected integer
#> • `care_site_id` is numeric but expected integer
#> Warning: ! 1 column in observation_period do not match expected column type:
#> • `period_type_concept_id` is numeric but expected integer
timings <- benchmarkDrugUtilisation(cdm)
#> Warning: ! `codelist` contains numeric values, they are casted to integers.
#> Getting specified indications
#> Creating indication summary variables
#> Getting unknown indications
#> Warning: ! `codelist` contains numeric values, they are casted to integers.
#> Error in dplyr::select(tidyr::pivot_wider(dplyr::select(dplyr::arrange(dplyr::ungroup(dplyr::mutate(dplyr::mutate(dplyr::filter(dplyr::mutate(dplyr::arrange(dplyr::group_by(dplyr::union_all(xstart, xend), dplyr::across(dplyr::all_of(group))), .data$date_event, .data$date_id), cum_id = cumsum(.data$date_id)), .data$cum_id == 0 || (.data$cum_id == -1 && .data$date_id == -1)), name = dplyr::if_else(.data$date_id == -1, .env$start, .env$end), era_id = dplyr::if_else(.data$date_id == -1, 1, 0)), era_id = cumsum(as.numeric(.data$era_id))))), dplyr::all_of(group), "era_id", "name", "date_event"), names_from = "name", values_from = "date_event") %>% dplyr::mutate(`:=`(!!end, as.Date(!!CDMConnector::dateadd(date = end, number = -gap, interval = "day")))), dplyr::all_of(c(group, start, end))): ℹ In argument: `dplyr::all_of(c(group, start, end))`.
#> Caused by error in `dplyr::all_of()`:
#> ! Can't subset elements that don't exist.
#> ✖ Element `drug_exposure_start_date` doesn't exist.
timings
#> Error: object 'timings' not found
# }