Title: | Identify Relevant Clinical Codes and Evaluate Their Use |
---|---|
Description: | Generate a candidate code list for the Observational Medical Outcomes Partnership (OMOP) common data model based on string matching. For a given search strategy, a candidate code list will be returned. |
Authors: | Edward Burn [aut, cre] , Marti Catala [ctb] , Xihang Chen [aut] , Nuria Mercade-Besora [aut] , Mike Du [ctb] , Danielle Newby [ctb] |
Maintainer: | Edward Burn <[email protected]> |
License: | Apache License (>= 2) |
Version: | 3.3.0 |
Built: | 2024-11-11 09:19:46 UTC |
Source: | https://github.com/darwin-eu/codelistgenerator |
Get all ATC codes from the cdm
availableATC(cdm, level = c("ATC 1st"))
availableATC(cdm, level = c("ATC 1st"))
cdm |
cdm_reference via CDMConnector |
level |
ATC level. Can be one or more of "ATC 1st", "ATC 2nd", "ATC 3rd", "ATC 4th", and "ATC 5th" |
A vector list of all ATC codes for the chosen level(s) found in the concept table of cdm.
cdm <- mockVocabRef() availableATC(cdm)
cdm <- mockVocabRef() availableATC(cdm)
Get all ICD codes from the cdm
availableICD10(cdm, level = c("ICD10 Chapter", "ICD10 SubChapter"))
availableICD10(cdm, level = c("ICD10 Chapter", "ICD10 SubChapter"))
cdm |
cdm_reference via CDMConnector |
level |
Can be either "ICD10 Chapter" or "ICD10 SubChapter" |
A vector list of all ICD10 codes for the chosen level(s) found in the concept table of cdm.
cdm <- mockVocabRef() availableICD10(cdm)
cdm <- mockVocabRef() availableICD10(cdm)
Get all ingredients codes from the cdm
availableIngredients(cdm)
availableIngredients(cdm)
cdm |
cdm_reference via CDMConnector |
A vector list of all ingredient level codes found in the concept table of cdm.
cdm <- mockVocabRef() availableIngredients(cdm)
cdm <- mockVocabRef() availableIngredients(cdm)
Get concept ids from a provided path to cohort json files
codesFromCohort(path, cdm, type = c("codelist"))
codesFromCohort(path, cdm, type = c("codelist"))
path |
Path to a file or folder containing JSONs of cohort definitions |
cdm |
A cdm reference created with CDMConnector |
type |
Can be "codelist", "codelist_with_details", or "concept_set_expression" |
Named list with concept_ids for each concept set
Get concept ids from a provided path to json files
codesFromConceptSet(path, cdm, type = c("codelist"))
codesFromConceptSet(path, cdm, type = c("codelist"))
path |
Path to a file or folder containing JSONs of concept sets |
cdm |
A cdm reference created with CDMConnector |
type |
Can be "codelist", "codelist_with_details", or "concept_set_expression" |
Named list with concept_ids for each concept set
cdm <- mockVocabRef("database") x <- codesFromConceptSet(cdm = cdm, path = system.file(package = "CodelistGenerator", "concepts_for_mock")) x CDMConnector::cdmDisconnect(cdm)
cdm <- mockVocabRef("database") x <- codesFromConceptSet(cdm = cdm, path = system.file(package = "CodelistGenerator", "concepts_for_mock")) x CDMConnector::cdmDisconnect(cdm)
Use achilles counts to get codes used in the database
codesInUse( cdm, minimumCount = 0, table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", "procedure_occurrence", "visit_occurrence") )
codesInUse( cdm, minimumCount = 0, table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", "procedure_occurrence", "visit_occurrence") )
cdm |
cdm_reference via CDMConnector |
minimumCount |
Any codes with a frequency under this will be removed. |
table |
cdm table |
A list of integers indicating codes being used in the database.
cdm <- mockVocabRef("database") x <- codesInUse(cdm = cdm) x CDMConnector::cdmDisconnect(cdm)
cdm <- mockVocabRef("database") x <- codesInUse(cdm = cdm) x CDMConnector::cdmDisconnect(cdm)
Compare two codelists
compareCodelists(codelist1, codelist2)
compareCodelists(codelist1, codelist2)
codelist1 |
Output of getCandidateCodes |
codelist2 |
Output of getCandidateCodes |
tibble
cdm <- mockVocabRef() codes1 <- getCandidateCodes( cdm = cdm, keywords = "Arthritis", domains = "Condition", includeDescendants = TRUE ) codes2 <- getCandidateCodes( cdm = cdm, keywords = c("knee osteoarthritis", "arthrosis"), domains = "Condition", includeDescendants = TRUE ) compareCodelists( codelist1 = codes1, codelist2 = codes2 )
cdm <- mockVocabRef() codes1 <- getCandidateCodes( cdm = cdm, keywords = "Arthritis", domains = "Condition", includeDescendants = TRUE ) codes2 <- getCandidateCodes( cdm = cdm, keywords = c("knee osteoarthritis", "arthrosis"), domains = "Condition", includeDescendants = TRUE ) compareCodelists( codelist1 = codes1, codelist2 = codes2 )
Equivalence from dose from concept IDs to route categories.
doseFormToRoute
doseFormToRoute
A data frame with two variables: dose_form_concept_id
and
route_category
.
Get descendant codes for ATC levels
getATCCodes( cdm, level = c("ATC 1st"), name = NULL, doseForm = NULL, doseUnit = NULL, routeCategory = NULL, type = "codelist" )
getATCCodes( cdm, level = c("ATC 1st"), name = NULL, doseForm = NULL, doseUnit = NULL, routeCategory = NULL, type = "codelist" )
cdm |
cdm_reference via CDMConnector |
level |
ATC level. Can be one or more of "ATC 1st", "ATC 2nd", "ATC 3rd", "ATC 4th", and "ATC 5th" |
name |
ATC name of interest. For example, c("Dermatologicals", "Nervous System"), would result in a list of length two with the descendant concepts for these two particular ATC groups. |
doseForm |
Only descendants codes with the specified dose form will be returned. If NULL, descendant codes will be returned regardless of dose form. |
doseUnit |
Only descendants codes with the specified dose unit will be returned. If NULL, descendant codes will be returned regardless of dose unit |
routeCategory |
Only descendants codes with the specified route will be returned. If NULL, descendant codes will be returned regardless of dose form. |
type |
Can be "codelist", "codelist_with_details", or "concept_set_expression" |
Concepts with their format based on the type argument.
cdm <- mockVocabRef() getATCCodes(cdm = cdm, level = "ATC 1st")
cdm <- mockVocabRef() getATCCodes(cdm = cdm, level = "ATC 1st")
This function generates a set of codes that can be considered for creating a phenotype using the OMOP CDM.
getCandidateCodes( cdm, keywords, exclude = NULL, domains = "Condition", standardConcept = "Standard", searchInSynonyms = FALSE, searchNonStandard = FALSE, includeDescendants = TRUE, includeAncestor = FALSE )
getCandidateCodes( cdm, keywords, exclude = NULL, domains = "Condition", standardConcept = "Standard", searchInSynonyms = FALSE, searchNonStandard = FALSE, includeDescendants = TRUE, includeAncestor = FALSE )
cdm |
cdm_reference via CDMConnector |
keywords |
Character vector of words to search for. Where more than one word is given (e.g. "knee osteoarthritis"), all combinations of those words should be identified positions (e.g. "osteoarthritis of knee") should be identified. |
exclude |
Character vector of words to identify concepts to exclude. |
domains |
Character vector with one or more of the OMOP CDM domain. |
standardConcept |
Character vector with one or more of "Standard", "Classification", and "Non-standard". These correspond to the flags used for the standard_concept field in the concept table of the cdm. |
searchInSynonyms |
Either TRUE or FALSE. If TRUE the code will also search using both the primary name in the concept table and synonyms from the concept synonym table. |
searchNonStandard |
Either TRUE or FALSE. If TRUE the code will also search via non-standard concepts. |
includeDescendants |
Either TRUE or FALSE. If TRUE descendant concepts of identified concepts will be included in the candidate codelist. |
includeAncestor |
Either TRUE or FALSE. If TRUE the direct ancestor concepts of identified concepts will be included in the candidate codelist. |
tibble
cdm <- CodelistGenerator::mockVocabRef() CodelistGenerator::getCandidateCodes( cdm = cdm, keywords = "osteoarthritis" )
cdm <- CodelistGenerator::mockVocabRef() CodelistGenerator::getCandidateCodes( cdm = cdm, keywords = "osteoarthritis" )
getConceptClassId
getConceptClassId(cdm, standardConcept = "Standard", domain = NULL)
getConceptClassId(cdm, standardConcept = "Standard", domain = NULL)
cdm |
cdm_reference via CDMConnector |
standardConcept |
Character vector with one or more of "Standard", "Classification", and "Non-standard". These correspond to the flags used for the standard_concept field in the concept table of the cdm. |
domain |
Vocabulary domain |
The concept class used for a given set of domains
cdm <- mockVocabRef() getConceptClassId(cdm = cdm, domain = "drug")
cdm <- mockVocabRef() getConceptClassId(cdm = cdm, domain = "drug")
getDescendants
getDescendants( cdm, conceptId, withAncestor = FALSE, ingredientRange = c(0, Inf), doseForm = NULL )
getDescendants( cdm, conceptId, withAncestor = FALSE, ingredientRange = c(0, Inf), doseForm = NULL )
cdm |
cdm_reference via CDMConnector |
conceptId |
concpet_id to search |
withAncestor |
If TRUE, return column with ancestor. In case of multiple ancestors, concepts will be separated by ";" |
ingredientRange |
Used to restrict descendant codes to those associated with a specific number of drug ingredients. Must be a vector of length two with the first element the minimum number of ingredients allowed and the second the maximum. A value of c(2, 2) would restrict to only concepts associated with two ingredients. |
doseForm |
Only descendants codes with the specified drug dose form will be returned. If NULL, descendant codes will be returned regardless of dose form. |
The descendants of a given concept id
cdm <- mockVocabRef() getDescendants(cdm = cdm, conceptId = 1)
cdm <- mockVocabRef() getDescendants(cdm = cdm, conceptId = 1)
getDomains
getDomains(cdm, standardConcept = "Standard")
getDomains(cdm, standardConcept = "Standard")
cdm |
cdm_reference via CDMConnector |
standardConcept |
Character vector with one or more of "Standard", "Classification", and "Non-standard". These correspond to the flags used for the standard_concept field in the concept table of the cdm. |
The domains of the cdm
cdm <- mockVocabRef() getDomains(cdm = cdm)
cdm <- mockVocabRef() getDomains(cdm = cdm)
getDoseForm
getDoseForm(cdm)
getDoseForm(cdm)
cdm |
cdm_reference via CDMConnector |
The dose forms available for drug concepts
cdm <- mockVocabRef() getDoseForm(cdm = cdm)
cdm <- mockVocabRef() getDoseForm(cdm = cdm)
Get the dose form categories available in the database (see https://doi.org/10.1002/pds.5809) for more details on how routes were classified).
getDoseUnit(cdm)
getDoseUnit(cdm)
cdm |
A cdm reference. |
A character vector with available routes
Get descendant codes for drug ingredients
getDrugIngredientCodes( cdm, name = NULL, nameStyle = "{concept_code}_{concept_name}", doseForm = NULL, doseUnit = NULL, routeCategory = NULL, ingredientRange = c(1, Inf), type = "codelist" )
getDrugIngredientCodes( cdm, name = NULL, nameStyle = "{concept_code}_{concept_name}", doseForm = NULL, doseUnit = NULL, routeCategory = NULL, ingredientRange = c(1, Inf), type = "codelist" )
cdm |
cdm_reference via CDMConnector |
name |
Names of ingredients of interest. For example, c("acetaminophen", "codeine"), would result in a list of length two with the descendant concepts for these two particular drug ingredients. |
nameStyle |
Name style to apply to returned list. Can be one of
|
doseForm |
Only descendants codes with the specified dose form will be returned. If NULL, descendant codes will be returned regardless of dose form. |
doseUnit |
Only descendants codes with the specified dose unit will be returned. If NULL, descendant codes will be returned regardless of dose unit |
routeCategory |
Only descendants codes with the specified route will be returned. If NULL, descendant codes will be returned regardless of route category. |
ingredientRange |
Used to restrict descendant codes to those associated with a specific number of ingredients. Must be a vector of length two with the first element the minimum number of ingredients allowed and the second the maximum. A value of c(2, 2) would restrict to only concepts associated with two ingredients. |
type |
Can be "codelist", "codelist_with_details", or "concept_set_expression" |
Concepts with their format based on the type argument.
cdm <- mockVocabRef() getDrugIngredientCodes(cdm = cdm, name = "Adalimumab", nameStyle = "{concept_name}")
cdm <- mockVocabRef() getDrugIngredientCodes(cdm = cdm, name = "Adalimumab", nameStyle = "{concept_name}")
Get corresponding standard codes for ICD-10 chapters and sub-chapters
getICD10StandardCodes( cdm, level = c("ICD10 Chapter", "ICD10 SubChapter"), name = NULL, includeDescendants = TRUE, type = "codelist" )
getICD10StandardCodes( cdm, level = c("ICD10 Chapter", "ICD10 SubChapter"), name = NULL, includeDescendants = TRUE, type = "codelist" )
cdm |
cdm_reference via CDMConnector |
level |
Can be either "ICD10 Chapter" or "ICD10 SubChapter" |
name |
Name of chapter or sub-chapter of interest. If NULL, all will be considered. |
includeDescendants |
If FALSE only direct mappings from ICD-10 codes to standard codes will be returned. If TRUE descendants of standard concepts will also be included. |
type |
Can be "codelist", "codelist_with_details", or "concept_set_expression" |
A named list, with each element containing the corresponding standard codes (and descendants) of ICD chapters and sub-chapters
cdm <- mockVocabRef() getICD10StandardCodes(cdm = cdm, level = c( "ICD10 Chapter", "ICD10 SubChapter" ))
cdm <- mockVocabRef() getICD10StandardCodes(cdm = cdm, level = c( "ICD10 Chapter", "ICD10 SubChapter" ))
Show mappings from non-standard vocabularies to standard
getMappings( candidateCodelist, cdm = NULL, nonStandardVocabularies = c("ATC", "ICD10CM", "ICD10PCS", "ICD9CM", "ICD9Proc", "LOINC", "OPCS4", "Read", "RxNorm", "RxNorm Extension", "SNOMED") )
getMappings( candidateCodelist, cdm = NULL, nonStandardVocabularies = c("ATC", "ICD10CM", "ICD10PCS", "ICD9CM", "ICD9Proc", "LOINC", "OPCS4", "Read", "RxNorm", "RxNorm Extension", "SNOMED") )
candidateCodelist |
Dataframe |
cdm |
cdm_reference via CDMConnector::cdm_from_con() |
nonStandardVocabularies |
Character vector |
tibble
cdm <- CodelistGenerator::mockVocabRef() codes <- CodelistGenerator::getCandidateCodes( cdm = cdm, keywords = "osteoarthritis" ) CodelistGenerator::getMappings( cdm = cdm, candidateCodelist = codes, nonStandardVocabularies = "READ" )
cdm <- CodelistGenerator::mockVocabRef() codes <- CodelistGenerator::getCandidateCodes( cdm = cdm, keywords = "osteoarthritis" ) CodelistGenerator::getMappings( cdm = cdm, candidateCodelist = codes, nonStandardVocabularies = "READ" )
Get relationship ID values from the concept relationship table
getRelationshipId( cdm, standardConcept1 = "standard", standardConcept2 = "standard", domains1 = "condition", domains2 = "condition" )
getRelationshipId( cdm, standardConcept1 = "standard", standardConcept2 = "standard", domains1 = "condition", domains2 = "condition" )
cdm |
A cdm reference |
standardConcept1 |
Character vector with one or more of "Standard", "Classification", and "Non-standard". These correspond to the flags used for the standard_concept field in the concept table of the cdm. |
standardConcept2 |
Character vector with one or more of "Standard", "Classification", and "Non-standard". These correspond to the flags used for the standard_concept field in the concept table of the cdm. |
domains1 |
Character vector with one or more of the OMOP CDM domain. |
domains2 |
Character vector with one or more of the OMOP CDM domain. |
A character vector with unique values
cdm <- mockVocabRef() getRelationshipId(cdm = cdm)
cdm <- mockVocabRef() getRelationshipId(cdm = cdm)
Get the dose form categories available in the database (see https://doi.org/10.1002/pds.5809) for more details on how routes were classified).
getRouteCategories(cdm)
getRouteCategories(cdm)
cdm |
A cdm reference. |
A character vector with available routes
getVocabularies
getVocabularies(cdm)
getVocabularies(cdm)
cdm |
cdm_reference via CDMConnector |
Names of available vocabularies
cdm <- mockVocabRef() getVocabularies(cdm = cdm)
cdm <- mockVocabRef() getVocabularies(cdm = cdm)
getVocabVersion
getVocabVersion(cdm)
getVocabVersion(cdm)
cdm |
cdm_reference via CDMConnector |
the vocabulary version being used
cdm <- mockVocabRef() getVocabVersion(cdm = cdm)
cdm <- mockVocabRef() getVocabVersion(cdm = cdm)
Generate example vocabulary database
mockVocabRef(backend = "data_frame")
mockVocabRef(backend = "data_frame")
backend |
'database' (duckdb) or 'data_frame' |
cdm reference with mock vocabulary
cdm <- mockVocabRef() cdm
cdm <- mockVocabRef() cdm
Use achilles counts to get source codes used in the database
sourceCodesInUse( cdm, table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", "procedure_occurrence", "visit_occurrence") )
sourceCodesInUse( cdm, table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", "procedure_occurrence", "visit_occurrence") )
cdm |
cdm_reference via CDMConnector |
table |
cdm table |
A list of source codes used in the database.
cdm <- mockVocabRef("database") x <- sourceCodesInUse(cdm = cdm) x CDMConnector::cdmDisconnect(cdm)
cdm <- mockVocabRef("database") x <- sourceCodesInUse(cdm = cdm) x CDMConnector::cdmDisconnect(cdm)
Stratify a codelist by the concepts included within it
stratifyByConcept(x, cdm, keepOriginal = FALSE)
stratifyByConcept(x, cdm, keepOriginal = FALSE)
x |
A codelist |
cdm |
A cdm reference |
keepOriginal |
Whether to keep the original codelist and append the stratify (if TRUE) or just return the stratified codelist (if FALSE). |
A codelist
Stratify a codelist by dose unit
stratifyByDoseUnit(x, cdm, keepOriginal = FALSE)
stratifyByDoseUnit(x, cdm, keepOriginal = FALSE)
x |
A codelist |
cdm |
A cdm reference |
keepOriginal |
Whether to keep the original codelist and append the stratify (if TRUE) or just return the stratified codelist (if FALSE). |
A codelist
Stratify a codelist by route category
stratifyByRouteCategory(x, cdm, keepOriginal = FALSE)
stratifyByRouteCategory(x, cdm, keepOriginal = FALSE)
x |
A codelist |
cdm |
A cdm reference |
keepOriginal |
Whether to keep the original codelist and append the stratify (if TRUE) or just return the stratified codelist (if FALSE). |
A codelist
Subset a codelist to only those codes from a particular domain
subsetOnDomain(x, cdm, domain)
subsetOnDomain(x, cdm, domain)
x |
Codelist |
cdm |
A cdm reference |
domain |
Domains. Use getDomains() to find the available domains in a cdm |
The codelist with only those concepts associated with the domain
Subset a codelist to only those with a particular dose unit
subsetOnDoseUnit(x, cdm, doseUnit)
subsetOnDoseUnit(x, cdm, doseUnit)
x |
Codelist |
cdm |
A cdm reference |
doseUnit |
Dose unit. Use getDoseUnit() to find the available dose units in a cdm |
The codelist with only those concepts associated with the dose unit
Subset a codelist to only those with a particular route category
subsetOnRouteCategory(x, cdm, routeCategory)
subsetOnRouteCategory(x, cdm, routeCategory)
x |
Codelist |
cdm |
A cdm reference |
routeCategory |
Route category. Use getRoutes() to find the available route categories for a cdm |
The codelist with only those concepts associated with the specified route categories
Use achilles counts to filter a codelist to keep only the codes used in the database
subsetToCodesInUse( x, cdm, minimumCount = 0L, table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", "procedure_occurrence", "visit_occurrence") )
subsetToCodesInUse( x, cdm, minimumCount = 0L, table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", "procedure_occurrence", "visit_occurrence") )
x |
A codelist |
cdm |
cdm_reference via CDMConnector |
minimumCount |
Any codes with a frequency under this will be removed. |
table |
cdm table |
Use achilles counts to filter codelist to only the codes used in the database
cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "arthritis", domains = "Condition", includeDescendants = FALSE) x <- subsetToCodesInUse(list("cs1" = codes$concept_id, "cs2" = 999), cdm = cdm) x CDMConnector::cdmDisconnect(cdm)
cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "arthritis", domains = "Condition", includeDescendants = FALSE) x <- subsetToCodesInUse(list("cs1" = codes$concept_id, "cs2" = 999), cdm = cdm) x CDMConnector::cdmDisconnect(cdm)
Summarise code use from achilles counts
summariseAchillesCodeUse(x, cdm, countBy = c("record", "person"))
summariseAchillesCodeUse(x, cdm, countBy = c("record", "person"))
x |
Codelist |
cdm |
cdm_reference via CDMConnector::cdm_from_con() |
countBy |
Either "record" for record-level counts or "person" for person-level counts |
A tibble with results
cdm <- mockVocabRef("database") oa <- getCandidateCodes(cdm = cdm, keywords = "osteoarthritis") result_achilles <- summariseAchillesCodeUse(list(oa = oa$concept_id), cdm = cdm) result_achilles CDMConnector::cdmDisconnect(cdm)
cdm <- mockVocabRef("database") oa <- getCandidateCodes(cdm = cdm, keywords = "osteoarthritis") result_achilles <- summariseAchillesCodeUse(list(oa = oa$concept_id), cdm = cdm) result_achilles CDMConnector::cdmDisconnect(cdm)
Summarise code use in patient-level data
summariseCodeUse( x, cdm, countBy = c("record", "person"), byConcept = TRUE, byYear = FALSE, bySex = FALSE, ageGroup = NULL )
summariseCodeUse( x, cdm, countBy = c("record", "person"), byConcept = TRUE, byYear = FALSE, bySex = FALSE, ageGroup = NULL )
x |
List of concept IDs |
cdm |
cdm_reference via CDMConnector::cdm_from_con() |
countBy |
Either "record" for record-level counts or "person" for person-level counts |
byConcept |
TRUE or FALSE. If TRUE code use will be summarised by concept |
byYear |
TRUE or FALSE. If TRUE code use will be summarised by year. |
bySex |
TRUE or FALSE. If TRUE code use will be summarised by sex. |
ageGroup |
If not NULL, a list of ageGroup vectors of length two. |
A tibble with results overall and, if specified, by strata
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomia_dir()) cdm <- CDMConnector::cdm_from_con(con, cdm_schem = "main", write_schema = "main") acetiminophen <- c(1125315, 1127433, 40229134, 40231925, 40162522, 19133768, 1127078) poliovirus_vaccine <- c(40213160) cs <- list(acetiminophen = acetiminophen, poliovirus_vaccine = poliovirus_vaccine) results <- summariseCodeUse(cs,cdm = cdm) results CDMConnector::cdmDisconnect(cdm) ## End(Not run)
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomia_dir()) cdm <- CDMConnector::cdm_from_con(con, cdm_schem = "main", write_schema = "main") acetiminophen <- c(1125315, 1127433, 40229134, 40231925, 40162522, 19133768, 1127078) poliovirus_vaccine <- c(40213160) cs <- list(acetiminophen = acetiminophen, poliovirus_vaccine = poliovirus_vaccine) results <- summariseCodeUse(cs,cdm = cdm) results CDMConnector::cdmDisconnect(cdm) ## End(Not run)
Summarise code use among a cohort in the cdm reference
summariseCohortCodeUse( x, cdm, cohortTable, cohortId = NULL, timing = "any", countBy = c("record", "person"), byConcept = TRUE, byYear = FALSE, bySex = FALSE, ageGroup = NULL )
summariseCohortCodeUse( x, cdm, cohortTable, cohortId = NULL, timing = "any", countBy = c("record", "person"), byConcept = TRUE, byYear = FALSE, bySex = FALSE, ageGroup = NULL )
x |
Vector of concept IDs |
cdm |
cdm_reference via CDMConnector::cdm_from_con() |
cohortTable |
A cohort table from the cdm reference. |
cohortId |
A vector of cohort IDs to include |
timing |
When to assess the code use relative cohort dates. This can be "any"(code use any time by individuals in the cohort) or "entry" (code use on individuals' cohort start date). |
countBy |
Either "record" for record-level counts or "person" for person-level counts |
byConcept |
TRUE or FALSE. If TRUE code use will be summarised by |
byYear |
TRUE or FALSE. If TRUE code use will be summarised by year. |
bySex |
TRUE or FALSE. If TRUE code use will be summarised by sex. |
ageGroup |
If not NULL, a list of ageGroup vectors of length two. |
A tibble with results overall and, if specified, by strata
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomia_dir()) cdm <- CDMConnector::cdm_from_con(con, cdm_schem = "main", write_schema = "main") cdm <- CDMConnector::generateConceptCohortSet(cdm = cdm, conceptSet = list(a = 260139, b = 1127433), name = "cohorts", end = "observation_period_end_date", overwrite = TRUE) results_cohort_mult <- summariseCohortCodeUse(list(cs = c(260139,19133873)), cdm = cdm, cohortTable = "cohorts", timing = "entry") results_cohort_mult CDMConnector::cdmDisconnect(cdm) ## End(Not run)
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomia_dir()) cdm <- CDMConnector::cdm_from_con(con, cdm_schem = "main", write_schema = "main") cdm <- CDMConnector::generateConceptCohortSet(cdm = cdm, conceptSet = list(a = 260139, b = 1127433), name = "cohorts", end = "observation_period_end_date", overwrite = TRUE) results_cohort_mult <- summariseCohortCodeUse(list(cs = c(260139,19133873)), cdm = cdm, cohortTable = "cohorts", timing = "entry") results_cohort_mult CDMConnector::cdmDisconnect(cdm) ## End(Not run)
Find orphan codes related to a codelist using achilles counts and, if available, PHOEBE concept recommendations
summariseOrphanCodes( x, cdm, domain = c("condition", "device", "drug", "measurement", "observation", "procedure", "visit") )
summariseOrphanCodes( x, cdm, domain = c("condition", "device", "drug", "measurement", "observation", "procedure", "visit") )
x |
A codelist for which to find related codes used in the database |
cdm |
cdm_reference via CDMConnector |
domain |
The domains to restrict results too. Only concepts from these domains will be returned. |
A summarised result containg the frequency of codes related to (but not in) the codelist
cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE) orphan_codes <- summariseOrphanCodes(x = list("msk" = codes$concept_id), cdm = cdm) orphan_codes CDMConnector::cdmDisconnect(cdm)
cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE) orphan_codes <- summariseOrphanCodes(x = list("msk" = codes$concept_id), cdm = cdm) orphan_codes CDMConnector::cdmDisconnect(cdm)
Findunmapped concepts related to codelist
summariseUnmappedCodes( x, cdm, table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", "procedure_occurrence") )
summariseUnmappedCodes( x, cdm, table = c("condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", "procedure_occurrence") )
x |
A codelist |
cdm |
A cdm reference |
table |
Names of clinical tables in which to search for unmapped codes. Can be one or more of "condition_occurrence", "device_exposure", "drug_exposure", "measurement", "observation", and "procedure_occurrence". |
A summarised result
Format the result of summariseAchillesCodeUse into a table.
tableAchillesCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = character(), hide = character(), .options = list() )
tableAchillesCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = character(), hide = character(), .options = list() )
result |
A |
type |
Type of desired formatted table. To see supported formats use visOmopResults::tableType() |
header |
A vector specifying the elements to include in the header. The order of elements matters, with the first being the topmost header. The header vector can contain one of the following variables: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". Alternatively, it can include other names to use as overall header labels. |
groupColumns |
Variables to use as group labels. Allowed columns are: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". These cannot be used in header. |
hide |
Table columns to exclude, options are: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". These cannot be used in header or groupColumn. |
.options |
Named list with additional formatting options. visOmopResults::tableOptions() shows allowed arguments and their default values. |
A table with a formatted version of the summariseCohortCodeUse result.
cdm <- mockVocabRef("database") oa <- getCandidateCodes(cdm = cdm, keywords = "osteoarthritis") result_achilles <- summariseAchillesCodeUse(list(oa = oa$concept_id), cdm = cdm) tableAchillesCodeUse(result_achilles) CDMConnector::cdmDisconnect(cdm)
cdm <- mockVocabRef("database") oa <- getCandidateCodes(cdm = cdm, keywords = "osteoarthritis") result_achilles <- summariseAchillesCodeUse(list(oa = oa$concept_id), cdm = cdm) tableAchillesCodeUse(result_achilles) CDMConnector::cdmDisconnect(cdm)
Format the result of summariseCodeUse into a table.
tableCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = character(), hide = character(), .options = list() )
tableCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = character(), hide = character(), .options = list() )
result |
A summarised result with results of the type "code_use". |
type |
Type of desired formatted table. To see supported formats use visOmopResults::tableType() |
header |
A vector specifying the elements to include in the header. The order of elements matters, with the first being the topmost header. The header vector can contain one of the following variables: "cdm_name", "codelist_name", "standard_concept_name", "standard_concept_id", "estimate_name", "source_concept_name", "source_concept_id", "domain_id". If results are stratified, "year", "sex", "age_group" can also be used. Alternatively, it can include other names to use as overall header labels. |
groupColumns |
Variables to use as group labels. Allowed columns are: "cdm_name", "codelist_name", "standard_concept_name", "standard_concept_id", "estimate_name", "source_concept_name", "source_concept_id", "domain_id". If results are stratified, "year", "sex", "age_group" can also be used. These cannot be used in header. |
hide |
Table columns to exclude, options are: "cdm_name", "codelist_name", "year", "sex", "age_group", "standard_concept_name", "standard_concept_id", "estimate_name", "source_concept_name", "source_concept_id", "domain_id". If results are stratified, "year", "sex", "age_group" can also be used. These cannot be used in header or groupColumn. |
.options |
Named list with additional formatting options. visOmopResults::tableOptions() shows allowed arguments and their default values. |
A table with a formatted version of the summariseCodeUse result.
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomia_dir()) cdm <- CDMConnector::cdm_from_con(con, cdm_schem = "main", write_schema = "main") acetiminophen <- c(1125315, 1127433, 40229134, 40231925, 40162522, 19133768, 1127078) poliovirus_vaccine <- c(40213160) cs <- list(acetiminophen = acetiminophen, poliovirus_vaccine = poliovirus_vaccine) results <- summariseCodeUse(cs,cdm = cdm) tableCodeUse(results) CDMConnector::cdmDisconnect(cdm) ## End(Not run)
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomia_dir()) cdm <- CDMConnector::cdm_from_con(con, cdm_schem = "main", write_schema = "main") acetiminophen <- c(1125315, 1127433, 40229134, 40231925, 40162522, 19133768, 1127078) poliovirus_vaccine <- c(40213160) cs <- list(acetiminophen = acetiminophen, poliovirus_vaccine = poliovirus_vaccine) results <- summariseCodeUse(cs,cdm = cdm) tableCodeUse(results) CDMConnector::cdmDisconnect(cdm) ## End(Not run)
Format the result of summariseCohortCodeUse into a table.
tableCohortCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = NULL, timing = FALSE, hide = character(), .options = list() )
tableCohortCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = NULL, timing = FALSE, hide = character(), .options = list() )
result |
A summarised result with results of the type "cohort_code_use". |
type |
Type of desired formatted table. To see supported formats use visOmopResults::tableType() |
header |
A vector specifying the elements to include in the header. The order of elements matters, with the first being the topmost header. The header vector can contain one of the following variables: "cdm_name", "codelist_name", "standard_concept_name", "standard_concept_id", "estimate_name", "source_concept_name", "source_concept_id", "domain_id". If results are stratified, "year", "sex", "age_group" can also be used. Alternatively, it can include other names to use as overall header labels. |
groupColumns |
Variables to use as group labels. Allowed columns are: "cdm_name", "codelist_name", "standard_concept_name", "standard_concept_id", "estimate_name", "source_concept_name", "source_concept_id", "domain_id". If results are stratified, "year", "sex", "age_group" can also be used. These cannot be used in header. |
timing |
If TRUE the timing setting will be displayed. |
hide |
Table columns to exclude, options are: "cdm_name", "codelist_name", "year", "sex", "age_group", "standard_concept_name", "standard_concept_id", "estimate_name", "source_concept_name", "source_concept_id", "domain_id". If results are stratified, "year", "sex", "age_group" can also be used. These cannot be used in header or groupColumn. |
.options |
Named list with additional formatting options. visOmopResults::tableOptions() shows allowed arguments and their default values. |
A table with a formatted version of the summariseCohortCodeUse result.
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomia_dir()) cdm <- CDMConnector::cdm_from_con(con, cdm_schem = "main", write_schema = "main") cdm <- CDMConnector::generateConceptCohortSet(cdm = cdm, conceptSet = list(a = 260139, b = 1127433), name = "cohorts", end = "observation_period_end_date", overwrite = TRUE) results_cohort_mult <- summariseCohortCodeUse(list(cs = c(260139,19133873)), cdm = cdm, cohortTable = "cohorts", timing = "entry") tableCohortCodeUse(results_cohort_mult) CDMConnector::cdmDisconnect(cdm) ## End(Not run)
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomia_dir()) cdm <- CDMConnector::cdm_from_con(con, cdm_schem = "main", write_schema = "main") cdm <- CDMConnector::generateConceptCohortSet(cdm = cdm, conceptSet = list(a = 260139, b = 1127433), name = "cohorts", end = "observation_period_end_date", overwrite = TRUE) results_cohort_mult <- summariseCohortCodeUse(list(cs = c(260139,19133873)), cdm = cdm, cohortTable = "cohorts", timing = "entry") tableCohortCodeUse(results_cohort_mult) CDMConnector::cdmDisconnect(cdm) ## End(Not run)
Format the result of summariseOrphanCodes into a table.
tableOrphanCodes( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = character(), hide = character(), .options = list() )
tableOrphanCodes( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = character(), hide = character(), .options = list() )
result |
A summarised result with results of the type "orphan_codes". |
type |
Type of desired formatted table. To see supported formats use visOmopResults::tableType() |
header |
A vector specifying the elements to include in the header. The order of elements matters, with the first being the topmost header. The header vector can contain one of the following variables: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". Alternatively, it can include other names to use as overall header labels. |
groupColumns |
Variables to use as group labels. Allowed columns are: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". These cannot be used in header. |
hide |
Table columns to exclude, options are: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". These cannot be used in header or groupColumn. |
.options |
Named list with additional formatting options. visOmopResults::tableOptions() shows allowed arguments and their default values. |
A table with a formatted version of the summariseOrphanCodes result.
cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE) orphan_codes <- summariseOrphanCodes(x = list("msk" = codes$concept_id), cdm = cdm) tableOrphanCodes(orphan_codes) CDMConnector::cdmDisconnect(cdm)
cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE) orphan_codes <- summariseOrphanCodes(x = list("msk" = codes$concept_id), cdm = cdm) tableOrphanCodes(orphan_codes) CDMConnector::cdmDisconnect(cdm)
Format the result of summariseUnmappedCodeUse into a table.
tableUnmappedCodes( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = character(), hide = character(), .options = list() )
tableUnmappedCodes( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumns = character(), hide = character(), .options = list() )
result |
A |
type |
Type of desired formatted table. To see supported formats use visOmopResults::tableType() |
header |
A vector specifying the elements to include in the header. The order of elements matters, with the first being the topmost header. The header vector can contain one of the following variables: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". Alternatively, it can include other names to use as overall header labels. |
groupColumns |
Variables to use as group labels. Allowed columns are: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". These cannot be used in header. |
hide |
Table columns to exclude, options are: "cdm_name", "codelist_name", "domain_id", "standard_concept_name", "standard_concept_id", "estimate_name", "standard_concept", "vocabulary_id". These cannot be used in header or groupColumn. |
.options |
Named list with additional formatting options. visOmopResults::tableOptions() shows allowed arguments and their default values. |
A table with a formatted version of the summariseUnmappedCodes result.