The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
library(CodelistGenerator)
library(CohortConstructor)
library(CohortCharacteristics)
library(ggplot2)
library(omock)
library(dplyr)In this vignette we’ll show how requirements related to patient demographics can be applied to a cohort. Again we’ll use the Eunomia synthetic data.
cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb")
#> ℹ Reading GiBleed tables.
#> ℹ Adding drug_strength table.Let’s start by creating a cohort of people with a fracture. We’ll first look for codes that might represent a fracture and the build a cohort using these codes, setting cohort exit to 180 days after the fracture.
fracture_codes <- getCandidateCodes(cdm, "fracture")
#> Limiting to domains of interest
#> Getting concepts to include
#> Adding descendants
#> Search completed. Finishing up.
#> ✔ 9 candidate concepts identified
#>
#> Time taken: 0 minutes and 0 seconds
fracture_codes <- list("fracture" = fracture_codes$concept_id)
cdm$fracture <- conceptCohort(cdm = cdm,
conceptSet = fracture_codes,
name = "fracture")
#> ℹ Subsetting table condition_occurrence using 9 concepts with domain:
#> condition.
#> ℹ Combining tables.
#> ℹ Creating cohort attributes.
#> ℹ Applying cohort requirements.
#> ℹ Merging overlapping records.
#> ✔ Cohort fracture created.
summary_attrition <- summariseCohortAttrition(cdm$fracture)
plotCohortAttrition(summary_attrition)We can choose a specific age range for individuals in our cohort
using requireAge() from CohortConstructor.
cdm$fracture <- cdm$fracture |>
requireAge(indexDate = "cohort_start_date",
ageRange = list(c(18, 100)))
summary_attrition <- summariseCohortAttrition(cdm$fracture)
plotCohortAttrition(summary_attrition)Note that by default individuals are filtered based on the age they were when they entered the cohort.
We can also specify a sex criteria for individuals in our cohort
using requireSex() from CohortConstructor.
We can also specify a minimum number of days of prior observations
for each individual using requirePriorObservation() from
CohortConstructor.
cdm$fracture <- cdm$fracture |>
requirePriorObservation(indexDate = "cohort_start_date",
minPriorObservation = 365)
summary_attrition <- summariseCohortAttrition(cdm$fracture)
#> `min_prior_observation` casted to character.
plotCohortAttrition(summary_attrition)As well as specifying a minimum amount of prior observation, we can
require some mimimum amount of follow-up by using
requireFutureObservation() in a similar way.
We can implement multiple demographic requirements at the same time
by using the more general requireDemographics()
function.
cdm$fracture <- conceptCohort(cdm = cdm,
conceptSet = fracture_codes,
name = "fracture") |>
requireDemographics(indexDate = "cohort_start_date",
ageRange = c(18,100),
sex = "Female",
minPriorObservation = 365,
minFutureObservation = 30)
#> ℹ Subsetting table condition_occurrence using 9 concepts with domain:
#> condition.
#> ℹ Combining tables.
#> ℹ Creating cohort attributes.
#> ℹ Applying cohort requirements.
#> ℹ Merging overlapping records.
#> ✔ Cohort fracture created.
summary_attrition <- summariseCohortAttrition(cdm$fracture)
#> `min_prior_observation` and `min_future_observation` casted to character.
plotCohortAttrition(summary_attrition)These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.