Skip to contents

[Experimental]

Usage

summariseDrugRestart(
  cohort,
  switchCohortTable,
  switchCohortId = NULL,
  strata = list(),
  followUpDays = Inf,
  censorDate = NULL,
  restrictToFirstDiscontinuation = TRUE
)

Arguments

cohort

A cohort table.

switchCohortTable

A cohort table in the cdm that contains possible alternative treatments.

switchCohortId

The cohort ids to be used from switchCohortTable. If NULL all cohort definition ids are used.

strata

List with column names or vectors of column names groups to stratify results by.

followUpDays

A vector of number of days to follow up. It can be multiple values.

censorDate

Date of censoring. Individuals are always censored at the end of observation.

restrictToFirstDiscontinuation

Whether to consider only the first discontinuation episode or all of them.

Value

A summarised_result object with the percentages of restart, switch and not exposed per window.

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

conceptlist <- list("a" = 1125360, "b" = c(1503297, 1503327))
cdm <- generateDrugUtilisationCohortSet(
  cdm = cdm,
  name = "switch_cohort",
  conceptSet = conceptlist
)
#> Warning: ! 1 casted column in switch_cohort (cohort_codelist) as do not match expected
#>   column type:
#>  `concept_id` from numeric to integer

result <- cdm$cohort1 |>
  summariseDrugRestart(switchCohortTable = "switch_cohort")
#> Warning: `package_name` and `package_version` are not provided will be populated as ""
#> in settings

tableDrugRestart(result)
#> Warning: The `split` argument of `visOmopTable()` is deprecated as of visOmopResults
#> 0.4.0.
#>  The deprecated feature was likely used in the DrugUtilisation package.
#>   Please report the issue at
#>   <https://github.com/darwin-eu/DrugUtilisation/issues>.
#> ! Results have not been suppressed.
Follow-up Event Estimate name Estimate value
DUS MOCK; cohort_1
End of observation restart N (%) 0 (0.00 %)
switch N (%) 0 (0.00 %)
restart and switch N (%) 0 (0.00 %)
not treated N (%) 1 (100.00 %)
DUS MOCK; cohort_2
End of observation restart N (%) 0 (0.00 %)
switch N (%) 0 (0.00 %)
restart and switch N (%) 0 (0.00 %)
not treated N (%) 3 (100.00 %)
DUS MOCK; cohort_3
End of observation restart N (%) 0 (0.00 %)
switch N (%) 0 (0.00 %)
restart and switch N (%) 0 (0.00 %)
not treated N (%) 6 (100.00 %)
CDMConnector::cdmDisconnect(cdm = cdm) # }