# \donttest{
library(DrugUtilisation)
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
cdm <- mockDrugUtilisation()
#> Warning: ! 7 column in condition_occurrence do not match expected column type:
#> • `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: ! 3 column in concept do not match expected column type:
#> • `valid_start_date` is character but expected date
#> • `valid_end_date` is character but expected date
#> • `invalid_reason` is logical but expected character
#> Warning: ! 4 column in drug_strength do not match expected column type:
#> • `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
cdm[["drug_exposure"]] |>
filter(drug_concept_id == 2905077) |>
addDailyDose(ingredientConceptId = 1125315)
#> Warning: `addDailyDose()` was deprecated in DrugUtilisation 0.7.0.
#> # Source: table<og_018_1733098819> [2 x 9]
#> # Database: DuckDB v1.1.3-dev165 [unknown@Linux 6.5.0-1025-azure:R 4.4.2/:memory:]
#> drug_exposure_id person_id drug_concept_id drug_exposure_start_date
#> <int> <int> <dbl> <date>
#> 1 5 2 2905077 2021-03-02
#> 2 6 2 2905077 2020-03-05
#> # ℹ 5 more variables: drug_exposure_end_date <date>,
#> # drug_type_concept_id <dbl>, quantity <dbl>, daily_dose <dbl>, unit <chr>
# }