| Title: | Patient-Level Indices from the OMOP Common Data Model |
|---|---|
| Description: | Provides tools to derive standardised, reproducible patient-level indices and covariates from Observational Medical Outcomes Partnership (OMOP) Common Data Model (CDM) databases. Functions calculate comorbidity and frailty scores, including the Charlson Comorbidity Index, Electronic Frailty Index, and Hospital Frailty Risk Score, as well as body mass index, polypharmacy, ethnicity, location, and socioeconomic status measures. |
| Authors: | Martí Català [aut, cre] (ORCID: <https://orcid.org/0000-0003-3308-9905>), Marta Alcalde-Herraiz [aut] (ORCID: <https://orcid.org/0009-0002-4405-1814>), Maria T Sanchez-Santos [aut] (ORCID: <https://orcid.org/0000-0003-1908-8623>) |
| Maintainer: | Martí Català <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 0.1.0.900 |
| Built: | 2026-09-18 11:45:37 UTC |
| Source: | https://github.com/ohdsi/omopindices |
Add Body Mass Index measurement
addBMI( x, conceptSet = getIndexCodelist("body_mass_index"), indexDate = "cohort_start_date", window = c(-Inf, 0), order = "last", nameStyle = "bmi", categories = NULL, inObservation = TRUE, name = tableName(x) )addBMI( x, conceptSet = getIndexCodelist("body_mass_index"), indexDate = "cohort_start_date", window = c(-Inf, 0), order = "last", nameStyle = "bmi", categories = NULL, inObservation = TRUE, name = tableName(x) )
x |
A |
conceptSet |
A named concept set supplied as a |
indexDate |
A character string naming the |
window |
A numeric vector of length two, |
order |
A character string specifying how to select among multiple BMI
measurements within the window: |
nameStyle |
A character string specifying the name of the new column. |
categories |
A named list of numeric vectors, each containing the lower
and upper bounds of a BMI interval. An additional column named by appending
|
inObservation |
Logical; whether to restrict records to the person's observation period. |
name |
A character string specifying the name of the output table. If
|
The table x with a new column containing the selected BMI value.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addBMI(window = c(-365, 0), order = "last") |> select(subject_id, cohort_start_date, bmi) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addBMI(window = c(-365, 0), order = "last") |> select(subject_id, cohort_start_date, bmi) |> glimpse()
Add Charlson Comorbidity Index (CCI) value based on Charlson et al. (1987) (doi:10.1016/0021-9681(87)90171-8) and Charlson et al. (1994) (doi:10.1016/0895-4356(94)90129-5) (age-adjusted) version.
addCharlsonIndex( x, indexDate = "cohort_start_date", ageAdjusted = TRUE, conceptSet = getIndexCodelist("charlson"), nameStyle = "charlson", categories = NULL, name = tableName(x) )addCharlsonIndex( x, indexDate = "cohort_start_date", ageAdjusted = TRUE, conceptSet = getIndexCodelist("charlson"), nameStyle = "charlson", categories = NULL, name = tableName(x) )
x |
A |
indexDate |
A character string naming the |
ageAdjusted |
Logical; whether to include age adjustment in the Charlson Comorbidity Index. |
conceptSet |
A named concept set supplied as a |
nameStyle |
A character string specifying the name of the new column. |
categories |
A named list of numeric vectors, each containing the lower
and upper bounds of a score interval. An additional column with the suffix
|
name |
A character string specifying the name of the output table. If
|
The table x with a new column containing the Charlson Comorbidity
Index value.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) # Using the internal concept sets: cdm$cohort |> addCharlsonIndex(ageAdjusted = TRUE) |> select(subject_id, cohort_start_date, charlson) |> glimpse() # This example uses custom concept sets. customConceptSet <- list( myocardial_infarction = 329847L, congestive_heart_failure = 319835L, peripheral_vascular_disease = 321052L, cerebrovascular_disease = 381591L, dementia = 4182210L, chronic_pulmonary_disease = 255573L, connective_tissue_disease = 4134537L, peptic_ulcer_disease = 4027663L, mild_liver_disease = 194984L, moderate_or_severe_liver_disease = 4212540L, diabetes_without_complication = 201820L, diabetes_with_complication = 42538715L, hemiplegia = 374022L, severe_chronic_kidney_disease = 46271022L, any_malignancy = 4180914L, metastatic_solid_tumor = 432851L, aids = 4267414L ) cdm$cohort |> addCharlsonIndex( conceptSet = customConceptSet, nameStyle = "charlson_custom" ) |> select(subject_id, cohort_start_date, charlson_custom) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) # Using the internal concept sets: cdm$cohort |> addCharlsonIndex(ageAdjusted = TRUE) |> select(subject_id, cohort_start_date, charlson) |> glimpse() # This example uses custom concept sets. customConceptSet <- list( myocardial_infarction = 329847L, congestive_heart_failure = 319835L, peripheral_vascular_disease = 321052L, cerebrovascular_disease = 381591L, dementia = 4182210L, chronic_pulmonary_disease = 255573L, connective_tissue_disease = 4134537L, peptic_ulcer_disease = 4027663L, mild_liver_disease = 194984L, moderate_or_severe_liver_disease = 4212540L, diabetes_without_complication = 201820L, diabetes_with_complication = 42538715L, hemiplegia = 374022L, severe_chronic_kidney_disease = 46271022L, any_malignancy = 4180914L, metastatic_solid_tumor = 432851L, aids = 4267414L ) cdm$cohort |> addCharlsonIndex( conceptSet = customConceptSet, nameStyle = "charlson_custom" ) |> select(subject_id, cohort_start_date, charlson_custom) |> glimpse()
Add Electronic Frailty Index (eFI) value based on Clegg et al. (2016) (doi:10.1093/ageing/afw039)
addElectronicFrailtyIndex( x, indexDate = "cohort_start_date", conceptSet = getIndexCodelist("electronic_frailty_index"), categories = list(fit = c(0, 0.12), mild = c(0.12, 0.24), moderate = c(0.24, 0.36), severe = c(0.36, 1)), nameStyle = "efi", name = tableName(x) )addElectronicFrailtyIndex( x, indexDate = "cohort_start_date", conceptSet = getIndexCodelist("electronic_frailty_index"), categories = list(fit = c(0, 0.12), mild = c(0.12, 0.24), moderate = c(0.24, 0.36), severe = c(0.36, 1)), nameStyle = "efi", name = tableName(x) )
x |
A |
indexDate |
A character string naming the |
conceptSet |
A named concept set supplied as a |
categories |
A named list of numeric vectors, each containing the lower
and upper bounds of a score interval. An additional column with the suffix
|
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
The table x with a new column containing the Electronic Frailty
Index value.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) # Using the internal concept sets: cdm$cohort |> addElectronicFrailtyIndex() |> select(subject_id, cohort_start_date, efi, efi_categories) |> glimpse() # This example uses custom concept sets. customConceptSet <- list( activity_limitation = 763723L, anemia = 439777L, arthritis = 4291025L, atrial_fibrillation = 313217L, chronic_kidney_disease = 46271022L, cerebrovascular_disease = 381591L, dizziness = 4223938L, dyspnea = 312437L, falls = 4059015L, foot_problem = 4101512L, fragility_fracture = 3170964L, hearing_impairment = 4234647L, heart_failure = 316139L, heart_valve_disorder = 4281749L, housebound = 4052962L, hypertension = 319826L, hypotension_syncope = 316447L, ischemic_heart_disease = 4185932L, memory_cognitive_disorder = 4304008L, mobility_problems = 4053076L, osteoporosis = 80502L, parkinsonism_tremor = 4140090L, peptic_ulcer = 4027663L, peripheral_vascular_disease = 321052L, care_requirement = 3661927L, respiratory_disease = 317009L, skin_ulcer = 4262920L, sleep_disturbance = 435524L, social_vulnerability = 4026161L, diabetes = 201820L, thyroid_disease = 4017052L, urinary_incontinence = 197672L, urinary_system_disease = 75865L, visual_impairment = 4265433L, weight_loss_anorexia = 436675L ) cdm$cohort |> addElectronicFrailtyIndex( conceptSet = customConceptSet, nameStyle = "efi_custom" ) |> select(subject_id, cohort_start_date, efi_custom, efi_custom_categories) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) # Using the internal concept sets: cdm$cohort |> addElectronicFrailtyIndex() |> select(subject_id, cohort_start_date, efi, efi_categories) |> glimpse() # This example uses custom concept sets. customConceptSet <- list( activity_limitation = 763723L, anemia = 439777L, arthritis = 4291025L, atrial_fibrillation = 313217L, chronic_kidney_disease = 46271022L, cerebrovascular_disease = 381591L, dizziness = 4223938L, dyspnea = 312437L, falls = 4059015L, foot_problem = 4101512L, fragility_fracture = 3170964L, hearing_impairment = 4234647L, heart_failure = 316139L, heart_valve_disorder = 4281749L, housebound = 4052962L, hypertension = 319826L, hypotension_syncope = 316447L, ischemic_heart_disease = 4185932L, memory_cognitive_disorder = 4304008L, mobility_problems = 4053076L, osteoporosis = 80502L, parkinsonism_tremor = 4140090L, peptic_ulcer = 4027663L, peripheral_vascular_disease = 321052L, care_requirement = 3661927L, respiratory_disease = 317009L, skin_ulcer = 4262920L, sleep_disturbance = 435524L, social_vulnerability = 4026161L, diabetes = 201820L, thyroid_disease = 4017052L, urinary_incontinence = 197672L, urinary_system_disease = 75865L, visual_impairment = 4265433L, weight_loss_anorexia = 436675L ) cdm$cohort |> addElectronicFrailtyIndex( conceptSet = customConceptSet, nameStyle = "efi_custom" ) |> select(subject_id, cohort_start_date, efi_custom, efi_custom_categories) |> glimpse()
Add the ethnicity of a person to a table
addEthnicity( x, from = c("ethnicity_concept_id", "ethnicity_source_concept_id", "race_concept_id", "race_source_concept_id"), nameStyle = "ethnicity", name = tableName(x), missingEthnicityValue = "Missing" )addEthnicity( x, from = c("ethnicity_concept_id", "ethnicity_source_concept_id", "race_concept_id", "race_source_concept_id"), nameStyle = "ethnicity", name = tableName(x), missingEthnicityValue = "Missing" )
x |
A |
from |
A character vector specifying the ethnicity sources to try, in priority order. The first source that provides a value is used. Available options are:
|
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
missingEthnicityValue |
A character string used to replace missing ethnicity values. |
The table x with a new column containing the patient's ethnicity.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addEthnicity() |> select(subject_id, cohort_start_date, ethnicity) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addEthnicity() |> select(subject_id, cohort_start_date, ethnicity) |> glimpse()
Add the hospital frailty risk score as defined in Gilbert et al. (2018) (doi:10.1016/S0140-6736(18)30668-8)
addHospitalFrailtyRiskScore( x, indexDate = "cohort_start_date", conceptSet = getIndexCodelist("hospital_frailty_risk_score"), categories = list(low = c(0, 5), intermediate = c(5, 15), high = c(15, Inf)), nameStyle = "hfrs", name = tableName(x) )addHospitalFrailtyRiskScore( x, indexDate = "cohort_start_date", conceptSet = getIndexCodelist("hospital_frailty_risk_score"), categories = list(low = c(0, 5), intermediate = c(5, 15), high = c(15, Inf)), nameStyle = "hfrs", name = tableName(x) )
x |
A |
indexDate |
A character string naming the |
conceptSet |
A named concept set supplied as a |
categories |
A named list of numeric vectors, each containing the lower
and upper bounds of a score interval. An additional column with the suffix
|
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
The table x with a new column containing the Hospital Frailty Risk
Score value.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addHospitalFrailtyRiskScore() |> select(subject_id, cohort_start_date, hfrs, hfrs_categories) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addHospitalFrailtyRiskScore() |> select(subject_id, cohort_start_date, hfrs, hfrs_categories) |> glimpse()
Add socioeconomic status as a column to a table using the Index of Multiple Deprivation
addIndexOfMultipleDeprivation( x, indexDate = "cohort_start_date", window = c(-Inf, Inf), order = "last", nameStyle = "socio_economic_status", name = tableName(x), missingSocioEconomicStatusValue = "Missing" )addIndexOfMultipleDeprivation( x, indexDate = "cohort_start_date", window = c(-Inf, Inf), order = "last", nameStyle = "socio_economic_status", name = tableName(x), missingSocioEconomicStatusValue = "Missing" )
x |
A |
indexDate |
A character string naming the |
window |
A numeric vector of length two, |
order |
A character string specifying which record to select when
multiple records are found: |
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
missingSocioEconomicStatusValue |
A character string used to replace missing socioeconomic status values. |
The table x with a new column containing the Index of Multiple
Deprivation value.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addIndexOfMultipleDeprivation() |> select(subject_id, cohort_start_date, socio_economic_status) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addIndexOfMultipleDeprivation() |> select(subject_id, cohort_start_date, socio_economic_status) |> glimpse()
Add the location to a table
addLocation( x, from = c("location_id", "care_site_id"), nameStyle = "location", name = tableName(x), locationSource = "location_source_value", missingLocationValue = "Missing" )addLocation( x, from = c("location_id", "care_site_id"), nameStyle = "location", name = tableName(x), locationSource = "location_source_value", missingLocationValue = "Missing" )
x |
A |
from |
A character vector specifying the location sources to try, in
priority order. The first source that provides a location is used. Supported
values are |
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
locationSource |
A character string specifying the column to retrieve
from the |
missingLocationValue |
A character string used to replace missing location values. |
The table x with a new column containing the patient's location.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addLocation() |> select(subject_id, cohort_start_date, location) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addLocation() |> select(subject_id, cohort_start_date, location) |> glimpse()
Add the maximum number of ingredients to which an individual is simultaneously exposed within a specified window
addPolypharmacy( x, indexDate = "cohort_start_date", window = c(0, 0), overlap = TRUE, categories = NULL, nameStyle = "polypharmacy", name = tableName(x) )addPolypharmacy( x, indexDate = "cohort_start_date", window = c(0, 0), overlap = TRUE, categories = NULL, nameStyle = "polypharmacy", name = tableName(x) )
x |
A |
indexDate |
A character string naming the |
window |
A numeric vector of length two, |
overlap |
Logical; if |
categories |
A named list of numeric vectors, each containing the lower
and upper bounds of a score interval. An additional column with the suffix
|
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
The table x with a new column containing the maximum number of
simultaneous ingredients in the window of interest.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addPolypharmacy(window = c(-30, 0)) |> select(subject_id, cohort_start_date, polypharmacy) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addPolypharmacy(window = c(-30, 0)) |> select(subject_id, cohort_start_date, polypharmacy) |> glimpse()
addPolypharmacyCount( x, indexDate = "cohort_start_date", window = c(0, 0), overlap = TRUE, categories = NULL, nameStyle = "polypharmacy", name = tableName(x) )addPolypharmacyCount( x, indexDate = "cohort_start_date", window = c(0, 0), overlap = TRUE, categories = NULL, nameStyle = "polypharmacy", name = tableName(x) )
x |
A |
indexDate |
A character string naming the |
window |
A numeric vector of length two, |
overlap |
Logical; if |
categories |
A named list of numeric vectors, each containing the lower
and upper bounds of a score interval. An additional column with the suffix
|
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
The function was renamed to addPolypharmacy()
The table x with a new column containing the maximum number of
simultaneous ingredients in the window of interest.
Add socioeconomic status as a column to a table
addSocioEconomicStatus( x, indexDate = "cohort_start_date", window = c(-Inf, Inf), order = "last", from = c("imd", "townsend"), nameStyle = "socio_economic_status", name = tableName(x), missingSocioEconomicStatusValue = "Missing" )addSocioEconomicStatus( x, indexDate = "cohort_start_date", window = c(-Inf, Inf), order = "last", from = c("imd", "townsend"), nameStyle = "socio_economic_status", name = tableName(x), missingSocioEconomicStatusValue = "Missing" )
x |
A |
indexDate |
A character string naming the |
window |
A numeric vector of length two, |
order |
A character string specifying which record to select when
multiple records are found: |
from |
A character vector specifying the socioeconomic status sources
to try, in priority order. Supported values are |
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
missingSocioEconomicStatusValue |
A character string used to replace missing socioeconomic status values. |
The table x with a new column containing the patient's
socioeconomic status.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addSocioEconomicStatus() |> select(subject_id, cohort_start_date, socio_economic_status) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addSocioEconomicStatus() |> select(subject_id, cohort_start_date, socio_economic_status) |> glimpse()
Add socioeconomic status as a column to a table using the Townsend deprivation index
addTownsend( x, indexDate = "cohort_start_date", window = c(-Inf, Inf), order = "last", nameStyle = "socio_economic_status", name = tableName(x), missingSocioEconomicStatusValue = "Missing" )addTownsend( x, indexDate = "cohort_start_date", window = c(-Inf, Inf), order = "last", nameStyle = "socio_economic_status", name = tableName(x), missingSocioEconomicStatusValue = "Missing" )
x |
A |
indexDate |
A character string naming the |
window |
A numeric vector of length two, |
order |
A character string specifying which record to select when
multiple records are found: |
nameStyle |
A character string specifying the name of the new column. |
name |
A character string specifying the name of the output table. If
|
missingSocioEconomicStatusValue |
A character string used to replace missing socioeconomic status values. |
The table x with a new column containing the Townsend deprivation
index.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addTownsend() |> select(subject_id, cohort_start_date, socio_economic_status) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) cdm$cohort |> addTownsend() |> select(subject_id, cohort_start_date, socio_economic_status) |> glimpse()
Add Updated Charlson Comorbidity Index (CCI) value based on Quan et al. (2011) (doi:10.1093/aje/kwq433)
addUpdatedCharlsonIndex( x, indexDate = "cohort_start_date", ageAdjusted = TRUE, conceptSet = getIndexCodelist("updated_charlson"), nameStyle = "updated_charlson", categories = NULL, name = tableName(x) )addUpdatedCharlsonIndex( x, indexDate = "cohort_start_date", ageAdjusted = TRUE, conceptSet = getIndexCodelist("updated_charlson"), nameStyle = "updated_charlson", categories = NULL, name = tableName(x) )
x |
A |
indexDate |
A character string naming the |
ageAdjusted |
Logical; whether to include age adjustment in the updated Charlson Comorbidity Index. |
conceptSet |
A named concept set supplied as a |
nameStyle |
A character string specifying the name of the new column. |
categories |
A named list of numeric vectors, each containing the lower
and upper bounds of a score interval. An additional column with the suffix
|
name |
A character string specifying the name of the output table. If
|
The table x with a new column containing the updated Charlson
Comorbidity Index value.
library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) # Using the internal concept sets: cdm$cohort |> addUpdatedCharlsonIndex(ageAdjusted = TRUE) |> select(subject_id, cohort_start_date, updated_charlson) |> glimpse() # This example uses custom concept sets. customConceptSet <- list( congestive_heart_failure = 319835L, dementia = 4182210L, chronic_pulmonary_disease = 255573L, connective_tissue_disease = 4134537L, mild_liver_disease = 194984L, moderate_or_severe_liver_disease = 4212540L, diabetes_with_complication = 42538715L, hemiplegia = 374022L, severe_chronic_kidney_disease = 46271022L, any_malignancy = 4180914L, metastatic_solid_tumor = 432851L, aids = 4267414L ) cdm$cohort |> addUpdatedCharlsonIndex( conceptSet = customConceptSet, nameStyle = "updated_charlson_custom" ) |> select(subject_id, cohort_start_date, updated_charlson_custom) |> glimpse()library(omock) library(duckdb) library(OmopIndices) library(dplyr) library(CohortConstructor) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") cdm$cohort <- conceptCohort( cdm = cdm, conceptSet = list(sinusitis = c(257012L, 4283893L, 4294548L, 40481087L)), name = "cohort" ) # Using the internal concept sets: cdm$cohort |> addUpdatedCharlsonIndex(ageAdjusted = TRUE) |> select(subject_id, cohort_start_date, updated_charlson) |> glimpse() # This example uses custom concept sets. customConceptSet <- list( congestive_heart_failure = 319835L, dementia = 4182210L, chronic_pulmonary_disease = 255573L, connective_tissue_disease = 4134537L, mild_liver_disease = 194984L, moderate_or_severe_liver_disease = 4212540L, diabetes_with_complication = 42538715L, hemiplegia = 374022L, severe_chronic_kidney_disease = 46271022L, any_malignancy = 4180914L, metastatic_solid_tumor = 432851L, aids = 4267414L ) cdm$cohort |> addUpdatedCharlsonIndex( conceptSet = customConceptSet, nameStyle = "updated_charlson_custom" ) |> select(subject_id, cohort_start_date, updated_charlson_custom) |> glimpse()
Get the codelists used for a specified index calculation
getIndexCodelist(index)getIndexCodelist(index)
index |
A character string identifying the index for which to retrieve
internal codelists. Supported values are |
A codelist containing the concepts used for the selected index.
library(OmopIndices) getIndexCodelist("charlson")library(OmopIndices) getIndexCodelist("charlson")