| 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] (ORCID: <https://orcid.org/0000-0002-9286-1128>), Marta Alcalde-Herraiz [aut] (ORCID: <https://orcid.org/0009-0002-4405-1814>), Martí Català [aut] (ORCID: <https://orcid.org/0000-0003-3308-9905>), Xihang Chen [aut] (ORCID: <https://orcid.org/0009-0001-8112-8959>), Nuria Mercade-Besora [aut] (ORCID: <https://orcid.org/0009-0006-7948-3747>), Mike Du [aut] (ORCID: <https://orcid.org/0000-0002-9517-8834>), Danielle Newby [aut] (ORCID: <https://orcid.org/0000-0002-3001-1478>) |
| Maintainer: | Edward Burn <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 4.0.2 |
| Built: | 2026-05-28 10:06:22 UTC |
| Source: | https://github.com/darwin-eu/codelistgenerator |
Add concepts to a codelist
addConcepts(x, cdm, concepts, codelistName = NULL)addConcepts(x, cdm, concepts, codelistName = NULL)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
concepts |
Concepts_ID to add |
codelistName |
Name or names of codelist in x. If NULL, all codelist present in x will be considered. |
A codelist
library(omock) library(CDMConnector) # Creating CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Creating codelist codelist <- getDrugIngredientCodes(cdm, nameStyle = "{concept_name}") # Add a concept to all the codelists: codelist$acetaminophen codelist <- codelist |> addConcepts(cdm, concepts = c(1L)) codelist$acetaminophen # Add a concept to a specific codelist codelist$amiodarone codelist <- codelist |> addConcepts(cdm, concepts = c(2L), codelistName = "amiodarone") codelist$amiodarone # See function: `excludeConcepts()` for details on how to remove specific concepts # from a codelistlibrary(omock) library(CDMConnector) # Creating CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Creating codelist codelist <- getDrugIngredientCodes(cdm, nameStyle = "{concept_name}") # Add a concept to all the codelists: codelist$acetaminophen codelist <- codelist |> addConcepts(cdm, concepts = c(1L)) codelist$acetaminophen # Add a concept to a specific codelist codelist$amiodarone codelist <- codelist |> addConcepts(cdm, concepts = c(2L), codelistName = "amiodarone") codelist$amiodarone # See function: `excludeConcepts()` for details on how to remove specific concepts # from a codelist
Coerce to a codelist
asCodelist(x, ...) ## S3 method for class 'codelist' asCodelist(x, ...) ## S3 method for class 'codelist_with_details' asCodelist(x, ...) ## S3 method for class 'concept_set_expression' asCodelist(x, cdm, ...) ## S3 method for class 'candidate_codes' asCodelist(x, ...)asCodelist(x, ...) ## S3 method for class 'codelist' asCodelist(x, ...) ## S3 method for class 'codelist_with_details' asCodelist(x, ...) ## S3 method for class 'concept_set_expression' asCodelist(x, cdm, ...) ## S3 method for class 'candidate_codes' asCodelist(x, ...)
x |
Only codelist_with_details and candidate_codes are currently supported. |
... |
For extensibility |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
codelist
library(omock) library(CDMConnector) # Creating CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Create codelist from a codelist_with_details codelist <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist_with_details") asCodelist(codelist) # Create codelist from a candidate_codes codelist <- getCandidateCodes(cdm, keywords = "arthritis") asCodelist(codelist)library(omock) library(CDMConnector) # Creating CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Create codelist from a codelist_with_details codelist <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist_with_details") asCodelist(codelist) # Create codelist from a candidate_codes codelist <- getCandidateCodes(cdm, keywords = "arthritis") asCodelist(codelist)
Coerce to a codelist with details
asCodelistWithDetails(x, cdm, ...) ## S3 method for class 'codelist_with_details' asCodelistWithDetails(x, ...) ## S3 method for class 'codelist' asCodelistWithDetails(x, cdm, ...) ## S3 method for class 'candidate_codes' asCodelistWithDetails(x, cdm, ...)asCodelistWithDetails(x, cdm, ...) ## S3 method for class 'codelist_with_details' asCodelistWithDetails(x, ...) ## S3 method for class 'codelist' asCodelistWithDetails(x, cdm, ...) ## S3 method for class 'candidate_codes' asCodelistWithDetails(x, cdm, ...)
x |
Only codelist and candidate_codes are currently supported. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
... |
For extensibility |
codelist
library(omock) library(CDMConnector) # Creating CDM object path <- downloadMockDataset(datasetName = "GiBleed", path = NULL, overwrite = NULL) cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Create codelist_with_details from a codelist codelist <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist") asCodelistWithDetails(codelist, cdm) # Create codelist from a candidate_codes codelist <- getCandidateCodes(cdm, keywords = "arthritis") asCodelistWithDetails(codelist)library(omock) library(CDMConnector) # Creating CDM object path <- downloadMockDataset(datasetName = "GiBleed", path = NULL, overwrite = NULL) cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Create codelist_with_details from a codelist codelist <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist") asCodelistWithDetails(codelist, cdm) # Create codelist from a candidate_codes codelist <- getCandidateCodes(cdm, keywords = "arthritis") asCodelistWithDetails(codelist)
Coerce to a concept set expression
asConceptSetExpression(x, ...) ## S3 method for class 'codelist' asConceptSetExpression(x, ...) ## S3 method for class 'codelist_with_details' asConceptSetExpression(x, ...)asConceptSetExpression(x, ...) ## S3 method for class 'codelist' asConceptSetExpression(x, ...) ## S3 method for class 'codelist_with_details' asConceptSetExpression(x, ...)
x |
Codelist or codelist with details |
... |
For extensibility |
codelist
library(omock) library(CDMConnector) # Creating CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Create concept_set_expression from a codelist codelist <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist") asConceptSetExpression(codelist) # Create concept_set_expression from a codelist_with_details codelist <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist_with_details") asConceptSetExpression(codelist)library(omock) library(CDMConnector) # Creating CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Create concept_set_expression from a codelist codelist <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist") asConceptSetExpression(codelist) # Create concept_set_expression from a codelist_with_details codelist <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist_with_details") asConceptSetExpression(codelist)
Get the concept classes associated with a codelist
associatedConceptClassIds(x, cdm, standardConcept = "Standard", domain = NULL)associatedConceptClassIds(x, cdm, standardConcept = "Standard", domain = NULL)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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 |
Character vector with one or more of the OMOP CDM domains. The results will be restricted to the given domains. Check the available ones by running availableDomains(). If NULL, all supported domains are included: Condition, Drug, Procedure, Device, Observation, and Measurement. |
The concept classes
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Get concept_class_ids in a codelist x <- newCodelist(list("codes1" = c(1118088L, 40213201L, 35208414L), "codes2" = c(1557272L, 4336464L, 4295880L))) associatedConceptClassIds(x, cdm, standardConcept = "Standard") # Notice that this corresponds to the information provided by `concept_class_id` # column in the `concept` tablelibrary(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Get concept_class_ids in a codelist x <- newCodelist(list("codes1" = c(1118088L, 40213201L, 35208414L), "codes2" = c(1557272L, 4336464L, 4295880L))) associatedConceptClassIds(x, cdm, standardConcept = "Standard") # Notice that this corresponds to the information provided by `concept_class_id` # column in the `concept` table
Get the domains associated with a codelist
associatedDomains(x, cdm, standardConcept = "Standard")associatedDomains(x, cdm, standardConcept = "Standard")
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
A vector with the domains of the cdm.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all domains available in a codelist codelist <- newCodelist(list("codes1" = c(194152L, 1830279L, 40558872L), "codes2" = c(44022939L))) associatedDomains(x = codelist, cdm = cdm, standardConcept = c("Non-standard", "Standard"))library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all domains available in a codelist codelist <- newCodelist(list("codes1" = c(194152L, 1830279L, 40558872L), "codes2" = c(44022939L))) associatedDomains(x = codelist, cdm = cdm, standardConcept = c("Non-standard", "Standard"))
Get the dose forms associated with drug concepts in a codelist
associatedDoseForms(x, cdm)associatedDoseForms(x, cdm)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
The dose forms available for drug concepts.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all dose forms available in a codelist codelist <- newCodelist(list("codes1" = c(194152L, 1830279L, 40558872L), "codes2" = c(44022939L))) associatedDoseForms(x = codelist, cdm = cdm)library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all dose forms available in a codelist codelist <- newCodelist(list("codes1" = c(194152L, 1830279L, 40558872L), "codes2" = c(44022939L))) associatedDoseForms(x = codelist, cdm = cdm)
Get the dose units associated with a codelist
associatedDoseUnits(x, cdm, standardConcept = "Standard")associatedDoseUnits(x, cdm, standardConcept = "Standard")
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
A character vector with available routes.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() codelist <- newCodelist(list("codes1" = c(194152L, 1830279L, 40558872L), "codes2" = c(44022939L, 1830282L))) associatedDoseUnits(cdm = cdm, x = codelist)library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() codelist <- newCodelist(list("codes1" = c(194152L, 1830279L, 40558872L), "codes2" = c(44022939L, 1830282L))) associatedDoseUnits(cdm = cdm, x = codelist)
Get the names of drug ingredients associated with codelist
associatedDrugIngredients(x, cdm, standardConcept = "Standard")associatedDrugIngredients(x, cdm, standardConcept = "Standard")
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
A vector containing the concept names for all ingredient level codes found in the concept table of cdm.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all drug ingredients associated with a codelist codelist <- newCodelist(list("codes1" = c(37498042L), "codes2" = c( 42899580L, 35741956L))) associatedDrugIngredients(x = codelist, cdm = cdm, standardConcept = c("Standard", "Non-standard"))library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all drug ingredients associated with a codelist codelist <- newCodelist(list("codes1" = c(37498042L), "codes2" = c( 42899580L, 35741956L))) associatedDrugIngredients(x = codelist, cdm = cdm, standardConcept = c("Standard", "Non-standard"))
Get available relationships with concepts in a codelist
associatedRelationshipIds( x, cdm, standardConcept1 = "Standard", standardConcept2 = "Standard", domains1 = "Condition", domains2 = "Condition" )associatedRelationshipIds( x, cdm, standardConcept1 = "Standard", standardConcept2 = "Standard", domains1 = "Condition", domains2 = "Condition" )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. If NULL, all domains are considered. |
domains2 |
Character vector with one or more of the OMOP CDM domain. If NULL, all domains are considered. |
A character vector with unique concept relationship values.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() codelist <- newCodelist(list("codes1" = c(8479L, 4117795L), "codes2" = c(8480L, 8600L, 8481L, 4189167L))) associatedRelationshipIds(x = codelist, cdm = cdm, standardConcept1 = c("Standard", "Non-standard", "Classification"), standardConcept2 = c("Standard", "Non-standard", "Classification"), domains1 = NULL, domains2 = NULL)library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() codelist <- newCodelist(list("codes1" = c(8479L, 4117795L), "codes2" = c(8480L, 8600L, 8481L, 4189167L))) associatedRelationshipIds(x = codelist, cdm = cdm, standardConcept1 = c("Standard", "Non-standard", "Classification"), standardConcept2 = c("Standard", "Non-standard", "Classification"), domains1 = NULL, domains2 = NULL)
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).
associatedRouteCategories(x, cdm)associatedRouteCategories(x, cdm)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
A character vector with all available routes.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all dose forms available in a codelist codelist <- newCodelist(list("codes1" = c(194152L, 1830279L, 40558872L), "codes2" = c(44022939L)))library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all dose forms available in a codelist codelist <- newCodelist(list("codes1" = c(194152L, 1830279L, 40558872L), "codes2" = c(44022939L)))
Get the vocabularies associated with a codelist
associatedVocabularies(x, cdm, standardConcept = "Standard", domain = NULL)associatedVocabularies(x, cdm, standardConcept = "Standard", domain = NULL)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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 |
Character vector with one or more of the OMOP CDM domains. The results will be restricted to the given domains. Check the available ones by running availableDomains(). If NULL, all supported domains are included: Condition, Drug, Procedure, Device, Observation, and Measurement. |
Names of available vocabularies.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all vocabularies from a codelist codelist <- newCodelist(list("codes1" = c(35604877L, 35604394L), "codes2" = c(4214687L))) associatedVocabularies(cdm = cdm, x = codelist)library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all vocabularies from a codelist codelist <- newCodelist(list("codes1" = c(35604877L, 35604394L), "codes2" = c(4214687L))) associatedVocabularies(cdm = cdm, x = codelist)
Get the names of all available Anatomical Therapeutic Chemical (ATC) classification codes
availableATC(cdm, level = c("ATC 1st"))availableATC(cdm, level = c("ATC 1st"))
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
level |
ATC level. Can be one or more of "ATC 1st", "ATC 2nd", "ATC 3rd", "ATC 4th", and "ATC 5th". |
A vector containing the names of ATC codes for the chosen level(s) found in the concept table of cdm.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get ATC 1st level classification codes availableATC(cdm, level = "ATC 1st") # Get all ATC classification codes availableATC(cdm, level = c("ATC 1st", "ATC 2nd", "ATC 3rd", "ATC 4th", "ATC 5th"))library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get ATC 1st level classification codes availableATC(cdm, level = "ATC 1st") # Get all ATC classification codes availableATC(cdm, level = c("ATC 1st", "ATC 2nd", "ATC 3rd", "ATC 4th", "ATC 5th"))
Get the available concept classes used in a given set of domains
availableConceptClassIds(cdm, standardConcept = "Standard", domain = NULL)availableConceptClassIds(cdm, standardConcept = "Standard", domain = NULL)
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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 |
Character vector with one or more of the OMOP CDM domains. The results will be restricted to the given domains. Check the available ones by running availableDomains(). If NULL, all supported domains are included: Condition, Drug, Procedure, Device, Observation, and Measurement. |
The concept classes
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Get all available concept_class_ids in the CDM availableConceptClassIds(cdm, standardConcept = "Standard") # Get all available concept_class_ids in the CDM for a specific domain availableConceptClassIds(cdm, standardConcept = "Standard", domain = "Condition") # Notice that this corresponds to the information provided by `concept_class_id` # column in the `concept` tablelibrary(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Get all available concept_class_ids in the CDM availableConceptClassIds(cdm, standardConcept = "Standard") # Get all available concept_class_ids in the CDM for a specific domain availableConceptClassIds(cdm, standardConcept = "Standard", domain = "Condition") # Notice that this corresponds to the information provided by `concept_class_id` # column in the `concept` table
Get the domains available in the cdm
availableDomains(cdm, standardConcept = "Standard")availableDomains(cdm, standardConcept = "Standard")
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
A vector with the domains of the cdm.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all domains available in the CDM for standard concepts availableDomains(cdm = cdm, standardConcept = "Standard")library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all domains available in the CDM for standard concepts availableDomains(cdm = cdm, standardConcept = "Standard")
Get the dose forms for drug concepts
availableDoseForms(cdm)availableDoseForms(cdm)
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
The dose forms available for drug concepts.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all domains available in the CDM availableDoseForms(cdm = cdm)library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all domains available in the CDM availableDoseForms(cdm = cdm)
Get the available dose units
availableDoseUnits(cdm, standardConcept = "Standard")availableDoseUnits(cdm, standardConcept = "Standard")
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
A character vector with available routes.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all dose units available in the CDM availableDoseUnits(cdm = cdm)library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all dose units available in the CDM availableDoseUnits(cdm = cdm)
Get the names of all available drug ingredients
availableDrugIngredients(cdm, standardConcept = "Standard")availableDrugIngredients(cdm, standardConcept = "Standard")
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
A vector containing the concept names for all ingredient level codes found in the concept table of cdm.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all drug ingredients available in the CDM for standard concepts availableDrugIngredients(cdm = cdm)library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all drug ingredients available in the CDM for standard concepts availableDrugIngredients(cdm = cdm)
Get available relationships between concepts
availableRelationshipIds( cdm, standardConcept1 = "Standard", standardConcept2 = "Standard", domains1 = "Condition", domains2 = "Condition" )availableRelationshipIds( cdm, standardConcept1 = "Standard", standardConcept2 = "Standard", domains1 = "Condition", domains2 = "Condition" )
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. If NULL, all domains are considered. |
domains2 |
Character vector with one or more of the OMOP CDM domain. If NULL, all domains are considered. |
A character vector with unique concept relationship values.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all relationship ids in the CDM between `Condition` and `Standard` concepts. availableRelationshipIds(cdm = cdm, standardConcept1 = "Standard", standardConcept2 = "Standard", domains1 = "Condition", domains2 = "Condition")library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all relationship ids in the CDM between `Condition` and `Standard` concepts. availableRelationshipIds(cdm = cdm, standardConcept1 = "Standard", standardConcept2 = "Standard", domains1 = "Condition", domains2 = "Condition")
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).
availableRouteCategories(cdm)availableRouteCategories(cdm)
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
A character vector with all available routes.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all domains available in the CDM availableRouteCategories(cdm = cdm)library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all domains available in the CDM availableRouteCategories(cdm = cdm)
Get the available vocabularies available in the cdm
availableVocabularies(cdm, standardConcept = "Standard", domain = NULL)availableVocabularies(cdm, standardConcept = "Standard", domain = NULL)
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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 |
Character vector with one or more of the OMOP CDM domains. The results will be restricted to the given domains. Check the available ones by running availableDomains(). If NULL, all supported domains are included: Condition, Drug, Procedure, Device, Observation, and Measurement. |
Names of available vocabularies.
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all vocabularies available in the CDM availableVocabularies(cdm) # Get all vocabularies available in the CDM for `Standard` and `Condition` concepts availableVocabularies(cdm, standardConcept = "Standard", domain = "Condition")library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Get all vocabularies available in the CDM availableVocabularies(cdm) # Get all vocabularies available in the CDM for `Standard` and `Condition` concepts availableVocabularies(cdm, standardConcept = "Standard", domain = "Condition")
Run benchmark of codelistGenerator analyses
benchmarkCodelistGenerator(cdm)benchmarkCodelistGenerator(cdm)
cdm |
a CDM reference object |
a tibble with time taken for different analysis
library(CodelistGenerator) cdm <- mockVocabRef() timings <- benchmarkCodelistGenerator(cdm)library(CodelistGenerator) cdm <- mockVocabRef() timings <- benchmarkCodelistGenerator(cdm)
Get concept ids from JSON files containing cohort definitions
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 to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
type |
Can be "codelist", "codelist_with_details" or "concept_set_expression". |
Named list with concept_ids for each concept set.
library(CodelistGenerator) cdm <- mockVocabRef("database") x <- codesFromCohort(cdm = cdm, path = system.file(package = "CodelistGenerator", "cohorts_for_mock")) x CDMConnector::cdmDisconnect(cdm)library(CodelistGenerator) cdm <- mockVocabRef("database") x <- codesFromCohort(cdm = cdm, path = system.file(package = "CodelistGenerator", "cohorts_for_mock")) x CDMConnector::cdmDisconnect(cdm)
Get concept ids from JSON files containing concept sets
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 to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
type |
Can be "codelist", "codelist_with_details" or "concept_set_expression". |
Named list with concept_ids for each concept set.
library(CodelistGenerator) library(omock) # Create a CDM object cdm <- mockCdmReference() # Load JSON files x <- codesFromConceptSet(cdm = cdm, path = system.file(package = "CodelistGenerator", "concepts_for_mock")) x # Load JSON files as codelist_with_details x <- codesFromConceptSet(cdm = cdm, path = system.file(package = "CodelistGenerator", "concepts_for_mock"), type = "codelist_with_details") x # Load JSON files as concept_set_expression x <- codesFromConceptSet(cdm = cdm, path = system.file(package = "CodelistGenerator", "concepts_for_mock"), type = "concept_set_expression") xlibrary(CodelistGenerator) library(omock) # Create a CDM object cdm <- mockCdmReference() # Load JSON files x <- codesFromConceptSet(cdm = cdm, path = system.file(package = "CodelistGenerator", "concepts_for_mock")) x # Load JSON files as codelist_with_details x <- codesFromConceptSet(cdm = cdm, path = system.file(package = "CodelistGenerator", "concepts_for_mock"), type = "codelist_with_details") x # Load JSON files as concept_set_expression x <- codesFromConceptSet(cdm = cdm, path = system.file(package = "CodelistGenerator", "concepts_for_mock"), type = "concept_set_expression") x
Compare overlap between two sets of codes
compareCodelists(codelist1, codelist2)compareCodelists(codelist1, codelist2)
codelist1 |
Output of getCandidateCodes or a codelist |
codelist2 |
Output of getCandidateCodes. |
Tibble with information on the overlap of codes in both codelists.
library(CodelistGenerator) library(omock) # Create a CDM object downloadMockDataset(datasetName = "GiBleed", path = NULL, overwrite = NULL) cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Compare two candidate_codes object codes1 <- getCandidateCodes( cdm = cdm, keywords = "Arthritis", domains = "Condition", includeDescendants = TRUE) codes2 <- getCandidateCodes( cdm = cdm, keywords = c("osteo"), domains = "Condition", includeDescendants = TRUE) compareCodelists( codelist1 = codes1, codelist2 = codes2) # Compare two codelists acetaminophen <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist") hydrocodone <- getDrugIngredientCodes(cdm, name = "hydrocodone", nameStyle = "{concept_name}", type = "codelist") compareCodelists( codelist1 = acetaminophen, codelist2 = hydrocodone) # Notice that concept_name = NA as `codelist` class does not store this information # for each concept. # Compare two codelists_with_details acetaminophen <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist_with_details") hydrocodone <- getDrugIngredientCodes(cdm, name = "hydrocodone", nameStyle = "{concept_name}", type = "codelist_with_details") compareCodelists( codelist1 = acetaminophen, codelist2 = hydrocodone)library(CodelistGenerator) library(omock) # Create a CDM object downloadMockDataset(datasetName = "GiBleed", path = NULL, overwrite = NULL) cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Compare two candidate_codes object codes1 <- getCandidateCodes( cdm = cdm, keywords = "Arthritis", domains = "Condition", includeDescendants = TRUE) codes2 <- getCandidateCodes( cdm = cdm, keywords = c("osteo"), domains = "Condition", includeDescendants = TRUE) compareCodelists( codelist1 = codes1, codelist2 = codes2) # Compare two codelists acetaminophen <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist") hydrocodone <- getDrugIngredientCodes(cdm, name = "hydrocodone", nameStyle = "{concept_name}", type = "codelist") compareCodelists( codelist1 = acetaminophen, codelist2 = hydrocodone) # Notice that concept_name = NA as `codelist` class does not store this information # for each concept. # Compare two codelists_with_details acetaminophen <- getDrugIngredientCodes(cdm, name = "acetaminophen", nameStyle = "{concept_name}", type = "codelist_with_details") hydrocodone <- getDrugIngredientCodes(cdm, name = "hydrocodone", nameStyle = "{concept_name}", type = "codelist_with_details") compareCodelists( codelist1 = acetaminophen, codelist2 = hydrocodone)
Table showing the route category associated with each dose form.
doseFormToRoutedoseFormToRoute
A data frame
Concept ID of each dose form
Concept name of each dose form
Route category associated to the dose form
library(CodelistGenerator) doseFormToRoutelibrary(CodelistGenerator) doseFormToRoute
Exclude concepts from a codelist
excludeConcepts(x, cdm, concepts, codelistName = NULL)excludeConcepts(x, cdm, concepts, codelistName = NULL)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
concepts |
Concepts_id to exclude |
codelistName |
Name or names of codelist in x. If NULL, all codelist present in x will be considered. |
A codelist
library(omock) library(CDMConnector) # Creating CDM object # downloadMockDataset(datasetName = "GiBleed") cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Creating codelist codelist <- getDrugIngredientCodes(cdm, nameStyle = "{concept_name}") # Exclude concept to all the codelists: codelist$acetaminophen codelist <- codelist |> excludeConcepts(cdm, concepts = c(1125315L)) codelist$acetaminophen # Add a concept to a specific codelist codelist$amiodarone codelist <- codelist |> excludeConcepts(cdm, concepts = c(1310034L), codelistName = "amiodarone") codelist$amiodarone # See function: `addConcepts()` for details on how to add specific concepts # to a codelistlibrary(omock) library(CDMConnector) # Creating CDM object # downloadMockDataset(datasetName = "GiBleed") cdm <- mockCdmFromDataset(datasetName = "GiBleed") # Creating codelist codelist <- getDrugIngredientCodes(cdm, nameStyle = "{concept_name}") # Exclude concept to all the codelists: codelist$acetaminophen codelist <- codelist |> excludeConcepts(cdm, concepts = c(1125315L)) codelist$acetaminophen # Add a concept to a specific codelist codelist$amiodarone codelist <- codelist |> excludeConcepts(cdm, concepts = c(1310034L), codelistName = "amiodarone") codelist$amiodarone # See function: `addConcepts()` for details on how to add specific concepts # to a codelist
Get the descendant codes of Anatomical Therapeutic Chemical (ATC) classification codes
getATCCodes( cdm, level = c("ATC 1st"), name = NULL, nameStyle = "{concept_code}_{concept_name}", doseForm = NULL, doseUnit = NULL, routeCategory = NULL, type = "codelist" )getATCCodes( cdm, level = c("ATC 1st"), name = NULL, nameStyle = "{concept_code}_{concept_name}", doseForm = NULL, doseUnit = NULL, routeCategory = NULL, type = "codelist" )
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
nameStyle |
Name style to apply to returned list. Can be one of
|
doseForm |
Only codes with the specified dose form will be returned. If NULL, descendant codes will be returned regardless of dose form. Use 'doseForms()' to see the available dose forms. |
doseUnit |
Only codes with the specified dose unit will be returned. If NULL, descendant codes will be returned regardless of dose unit Use 'availableDoseUnits()' to see the available dose units. |
routeCategory |
Only codes with the specified route will be returned. If NULL, descendant codes will be returned regardless of route category. Use getRoutes() to find the available route categories. |
type |
Can be "codelist" or "codelist_with_details". |
Concepts with their format based on the type argument
library(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Create a codelist with 1st level ATC codes available in the CDM codelist <- getATCCodes(cdm = cdm, level = "ATC 1st") codelist # Tune the name of the generated codelists codelist <- getATCCodes(cdm = cdm, level = "ATC 1st", nameStyle = "{concept_name}_{concept_code}") codelist # Search for a specific ATC name of interest codelist <- getATCCodes(cdm = cdm, level = "ATC 2nd", name = "immunostimulants") codelist # Restrict concepts to specific dose forms, dose units, or route categories. # Remember that you can use `availableDoseForm()`, `availableDoseUnit()` and # `availableRouteCategory()` to explore your codelist. codelist <- getATCCodes(cdm = cdm, level = "ATC 2nd", doseForm = NULL, doseUnit = NULL, routeCategory = NULL,) codelist # You can also create directly a codelist_with_details using the argument `type` codelist <- getATCCodes(cdm = cdm, level = "ATC 1st", type = "codelist_with_details") codelistlibrary(CodelistGenerator) library(omock) # Create CDM object cdm <- mockCdmReference() # Create a codelist with 1st level ATC codes available in the CDM codelist <- getATCCodes(cdm = cdm, level = "ATC 1st") codelist # Tune the name of the generated codelists codelist <- getATCCodes(cdm = cdm, level = "ATC 1st", nameStyle = "{concept_name}_{concept_code}") codelist # Search for a specific ATC name of interest codelist <- getATCCodes(cdm = cdm, level = "ATC 2nd", name = "immunostimulants") codelist # Restrict concepts to specific dose forms, dose units, or route categories. # Remember that you can use `availableDoseForm()`, `availableDoseUnit()` and # `availableRouteCategory()` to explore your codelist. codelist <- getATCCodes(cdm = cdm, level = "ATC 2nd", doseForm = NULL, doseUnit = NULL, routeCategory = NULL,) codelist # You can also create directly a codelist_with_details using the argument `type` codelist <- getATCCodes(cdm = cdm, level = "ATC 1st", type = "codelist_with_details") codelist
Based on the given search strategy, this function identifies a set of codes that may represent a clinical event of interest in data mapped to the OMOP CDM. These codes can then be considered for creating a study phenotype.
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 |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
keywords |
Character vector of terms to search for.
|
exclude |
Character vector of words to identify concepts to exclude.
For example,
|
domains |
Character vector with one or more of the OMOP CDM domain for
which to search within. If NULL, all domains are included in the search. Use
|
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. If FALSE only direct mappings from ICD-10 codes to standard codes will be returned. |
includeAncestor |
Either TRUE or FALSE. If TRUE the direct ancestor concepts of identified concepts will be included in the candidate codelist. |
A "candidate_codes" object. This includes a tibble with the potential codes of interest, along with an attribute containing the search strategy.
library(CodelistGenerator) cdm <- mockVocabRef() getCandidateCodes( cdm = cdm, keywords = "osteoarthritis" )library(CodelistGenerator) cdm <- mockVocabRef() getCandidateCodes( cdm = cdm, keywords = "osteoarthritis" )
Get descendant codes for a given concept
getDescendants(cdm, conceptId, withAncestor = FALSE)getDescendants(cdm, conceptId, withAncestor = FALSE)
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
conceptId |
concept_id to search |
withAncestor |
If TRUE, return column with ancestor. In case of multiple ancestors, concepts will be separated by ";". |
The descendants of a given concept id.
library(CodelistGenerator) cdm <- mockVocabRef() getDescendants(cdm = cdm, conceptId = 1)library(CodelistGenerator) cdm <- mockVocabRef() getDescendants(cdm = cdm, conceptId = 1)
Get descendant codes of 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 |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. Users can also specify the concept ID instead of the name (e.g., c(1125315, 42948451)) using a numeric vector. |
nameStyle |
Name style to apply to returned list. Can be one of
|
doseForm |
Only codes with the specified dose form will be returned. If NULL, descendant codes will be returned regardless of dose form. Use 'doseForms()' to see the available dose forms. |
doseUnit |
Only codes with the specified dose unit will be returned. If NULL, descendant codes will be returned regardless of dose unit Use 'availableDoseUnits()' to see the available dose units. |
routeCategory |
Only codes with the specified route will be returned. If NULL, descendant codes will be returned regardless of route category. Use getRoutes() to find the available route categories. |
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. |
type |
Can be "codelist" or "codelist_with_details". |
Concepts with their format based on the type argument.
library(CodelistGenerator) cdm <- mockVocabRef() getDrugIngredientCodes(cdm = cdm, name = "Adalimumab", nameStyle = "{concept_name}")library(CodelistGenerator) cdm <- mockVocabRef() getDrugIngredientCodes(cdm = cdm, name = "Adalimumab", nameStyle = "{concept_name}")
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 |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
nonStandardVocabularies |
Character vector. |
Tibble with the information of potential standard to non-standard mappings for the codelist of interest.
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" )
Generate a codelist from the intersection of different codelists. The generated codelist will come out in alphabetical order.
intersectCodelists(x, keepOriginal = FALSE)intersectCodelists(x, keepOriginal = FALSE)
x |
A codelist. |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
A codelist
library(CodelistGenerator) library(omock) # Create a CDM object cdm <- mockCdmReference() # Intersect two codelists codelist <- newCodelist(list("mood" = c(37110496L, 4226696L, 4304866L), "manic" = c(37110496L, 4226696L))) intersectCodelists(codelist, keepOriginal = TRUE) # Intersect two codelists_with_details codelist <- asCodelistWithDetails(codelist, cdm) intersectCodelists(codelist, keepOriginal = FALSE)library(CodelistGenerator) library(omock) # Create a CDM object cdm <- mockCdmReference() # Intersect two codelists codelist <- newCodelist(list("mood" = c(37110496L, 4226696L, 4304866L), "manic" = c(37110496L, 4226696L))) intersectCodelists(codelist, keepOriginal = TRUE) # Intersect two codelists_with_details codelist <- asCodelistWithDetails(codelist, cdm) intersectCodelists(codelist, keepOriginal = FALSE)
Generate example vocabulary database
mockVocabRef(backend = "data_frame")mockVocabRef(backend = "data_frame")
backend |
'database' (duckdb) or 'data_frame'. |
cdm reference with mock vocabulary.
library(CodelistGenerator) cdm <- mockVocabRef() cdmlibrary(CodelistGenerator) cdm <- mockVocabRef() cdm
getCandidateCodes() functionReport the search strategy used to identify codes when using the
getCandidateCodes() function
searchStrategy(x)searchStrategy(x)
x |
A codelist. |
A tibble with the search strategy
library(omock) library(CodelistGenerator) library(dplyr, warn.conflicts = FALSE) # Create CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") codes <- getCandidateCodes(cdm = cdm, keywords = c("sprain", "fracture"), exclude = "knee", domains = "Condition", standardConcept = "Standard", searchNonStandard = FALSE, searchInSynonyms = TRUE, includeDescendants = TRUE, includeAncestor = FALSE) searchStrategy(codes) |> glimpse()library(omock) library(CodelistGenerator) library(dplyr, warn.conflicts = FALSE) # Create CDM object cdm <- mockCdmFromDataset(datasetName = "GiBleed") codes <- getCandidateCodes(cdm = cdm, keywords = c("sprain", "fracture"), exclude = "knee", domains = "Condition", standardConcept = "Standard", searchNonStandard = FALSE, searchInSynonyms = TRUE, includeDescendants = TRUE, includeAncestor = FALSE) searchStrategy(codes) |> glimpse()
Stratify a codelist by brand category.
stratifyByBrand( x, cdm, nameStyle = "{codelist_name}_{brand}", keepOriginal = FALSE )stratifyByBrand( x, cdm, nameStyle = "{codelist_name}_{brand}", keepOriginal = FALSE )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
nameStyle |
Naming of the new codelists, use |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
The codelist with the required stratifications, as different elements of the list.
library(CodelistGenerator) cdm <- mockVocabRef() codes <- newCodelist(list( concepts_1 = c(20L, 21L, 22L), concepts_2 = c(10L, 13L, 21L) )) new_codes <- stratifyByBrand(x = codes, cdm = cdm, keepOriginal = TRUE) new_codeslibrary(CodelistGenerator) cdm <- mockVocabRef() codes <- newCodelist(list( concepts_1 = c(20L, 21L, 22L), concepts_2 = c(10L, 13L, 21L) )) new_codes <- stratifyByBrand(x = codes, cdm = cdm, keepOriginal = TRUE) new_codes
Stratify a codelist by the concepts included within it.
stratifyByConcept( x, cdm, nameStyle = "{codelist_name}_{concept}", keepOriginal = FALSE )stratifyByConcept( x, cdm, nameStyle = "{codelist_name}_{concept}", keepOriginal = FALSE )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
nameStyle |
Naming of the new codelists, use |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
The codelist or a codelist with details with the required stratifications, as different elements of the list.
library(CodelistGenerator) cdm <- mockVocabRef() codes <- newCodelist(list("concepts" = c(20L, 21L))) new_codes <- stratifyByConcept(x = codes, cdm = cdm, keepOriginal = TRUE) new_codeslibrary(CodelistGenerator) cdm <- mockVocabRef() codes <- newCodelist(list("concepts" = c(20L, 21L))) new_codes <- stratifyByConcept(x = codes, cdm = cdm, keepOriginal = TRUE) new_codes
Stratify a codelist by domain category.
stratifyByDomain( x, cdm, nameStyle = "{codelist_name}_{domain}", keepOriginal = FALSE )stratifyByDomain( x, cdm, nameStyle = "{codelist_name}_{domain}", keepOriginal = FALSE )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
nameStyle |
Naming of the new codelists, use |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
The codelist with the required stratifications, as different elements of the list.
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- newCodelist(list("concepts_1" = c(20L,21L,22L), "concepts_2" = c(10L,13L,21L))) new_codes <- stratifyByDomain(x = codes, cdm = cdm, keepOriginal = TRUE) new_codeslibrary(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- newCodelist(list("concepts_1" = c(20L,21L,22L), "concepts_2" = c(10L,13L,21L))) new_codes <- stratifyByDomain(x = codes, cdm = cdm, keepOriginal = TRUE) new_codes
Stratify a codelist by dose form.
stratifyByDoseForm( x, cdm, nameStyle = "{codelist_name}_{dose_form}", keepOriginal = FALSE )stratifyByDoseForm( x, cdm, nameStyle = "{codelist_name}_{dose_form}", keepOriginal = FALSE )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
nameStyle |
Naming of the new codelists, use |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
The codelist with the required stratifications, as different elements of the list.
library(CodelistGenerator) cdm <- mockVocabRef() codes <- newCodelist(list("codes" = c(10L, 20L, 21L))) new_codes <- stratifyByDoseForm(x = codes, cdm = cdm, keepOriginal = TRUE) new_codeslibrary(CodelistGenerator) cdm <- mockVocabRef() codes <- newCodelist(list("codes" = c(10L, 20L, 21L))) new_codes <- stratifyByDoseForm(x = codes, cdm = cdm, keepOriginal = TRUE) new_codes
Stratify a codelist by dose unit.
stratifyByDoseUnit( x, cdm, nameStyle = "{codelist_name}_{dose_unit}", keepOriginal = FALSE )stratifyByDoseUnit( x, cdm, nameStyle = "{codelist_name}_{dose_unit}", keepOriginal = FALSE )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
nameStyle |
Naming of the new codelists, use |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
The codelist with the required stratifications, as different elements of the list.
library(CodelistGenerator) cdm <- mockVocabRef() codes <- newCodelist(list("concepts" = c(20L, 21L))) new_codes <- stratifyByDoseUnit(x = codes, cdm = cdm, keepOriginal = TRUE) new_codeslibrary(CodelistGenerator) cdm <- mockVocabRef() codes <- newCodelist(list("concepts" = c(20L, 21L))) new_codes <- stratifyByDoseUnit(x = codes, cdm = cdm, keepOriginal = TRUE) new_codes
Stratify a codelist by route category.
stratifyByRouteCategory( x, cdm, nameStyle = "{codelist_name}_{route_category}", keepOriginal = FALSE )stratifyByRouteCategory( x, cdm, nameStyle = "{codelist_name}_{route_category}", keepOriginal = FALSE )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
nameStyle |
Naming of the new codelists, use |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
The codelist with the required stratifications, as different elements of the list.
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- newCodelist(list("concepts" = c(20,21,22))) new_codes <- stratifyByRouteCategory(x = codes, cdm = cdm, keepOriginal = TRUE) new_codeslibrary(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- newCodelist(list("concepts" = c(20,21,22))) new_codes <- stratifyByRouteCategory(x = codes, cdm = cdm, keepOriginal = TRUE) new_codes
Subset a codelist to only those codes from a particular domain.
stratifyByVocabulary( x, cdm, nameStyle = "{codelist_name}_{vocabulary}", keepOriginal = FALSE )stratifyByVocabulary( x, cdm, nameStyle = "{codelist_name}_{vocabulary}", keepOriginal = FALSE )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
nameStyle |
Naming of the new codelists, use |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
The codelist with the required stratifications, as different elements of the list.
library(CodelistGenerator) cdm <- mockVocabRef() codes <- stratifyByVocabulary( x = newCodelist(list("codes" = c(10L, 13L, 15L))), cdm = cdm, keepOriginal = TRUE ) codeslibrary(CodelistGenerator) cdm <- mockVocabRef() codes <- stratifyByVocabulary( x = newCodelist(list("codes" = c(10L, 13L, 15L))), cdm = cdm, keepOriginal = TRUE ) codes
Subset a codelist to only those codes from a particular domain.
subsetOnDomain(x, cdm, domain, negate = FALSE)subsetOnDomain(x, cdm, domain, negate = FALSE)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
domain |
Character vector with one or more of the OMOP CDM domains. The results will be restricted to the given domains. Check the available ones by running availableDomains(). If NULL, all supported domains are included: Condition, Drug, Procedure, Device, Observation, and Measurement. |
negate |
If FALSE, only concepts with the domain specified will be returned. If TRUE, concepts with the domain specified will be excluded. |
The codelist with only those concepts associated with the domain (if negate = FALSE) or the codelist without those concepts associated with the domain (if negate = TRUE).
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnDomain( x = newCodelist(list("codes" = c(10,13,15))), cdm = cdm, domain = "Drug") codeslibrary(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnDomain( x = newCodelist(list("codes" = c(10,13,15))), cdm = cdm, domain = "Drug") codes
Subset a codelist to only those codes from a particular domain.
subsetOnDoseForm(x, cdm, doseForm, negate = FALSE)subsetOnDoseForm(x, cdm, doseForm, negate = FALSE)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
doseForm |
Dose form/s. See |
negate |
If FALSE, only concepts with the dose form specified will be returned. If TRUE, concepts with the dose form specified will be excluded. |
The codelist with only those concepts associated with the dose form (if negate = FALSE) or the codelist without those concepts associated with the dose form (if negate = TRUE).
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codelist <- newCodelist(list("codes" = c(10L,20L,21L))) # Dose forms present in our codelist: codelist |> associatedDoseForms(cdm) codes <- subsetOnDoseForm( x = codelist, cdm = cdm, doseForm = "Injection") codes codes |> associatedDoseForms(cdm)library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codelist <- newCodelist(list("codes" = c(10L,20L,21L))) # Dose forms present in our codelist: codelist |> associatedDoseForms(cdm) codes <- subsetOnDoseForm( x = codelist, cdm = cdm, doseForm = "Injection") codes codes |> associatedDoseForms(cdm)
Subset a codelist to only those with a particular dose unit.
subsetOnDoseUnit(x, cdm, doseUnit, negate = FALSE)subsetOnDoseUnit(x, cdm, doseUnit, negate = FALSE)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
doseUnit |
Only codes with the specified dose unit will be returned. If NULL, descendant codes will be returned regardless of dose unit Use 'availableDoseUnits()' to see the available dose units. |
negate |
If FALSE, only concepts with the dose unit specified will be returned. If TRUE, concepts with the dose unit specified will be excluded. |
The codelist with only those concepts associated with the dose unit (if negate = FALSE) or codelist without those concepts associated with the dose unit(if negate = TRUE).
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnDoseUnit(x = newCodelist(list("codes" = c(20,21))), cdm = cdm, doseUnit = c("milligram")) codeslibrary(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnDoseUnit(x = newCodelist(list("codes" = c(20,21))), cdm = cdm, doseUnit = c("milligram")) codes
Subset a codelist to only those codes with a range of number of ingredients
subsetOnIngredientRange(x, cdm, ingredientRange, negate = FALSE)subsetOnIngredientRange(x, cdm, ingredientRange, negate = FALSE)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
negate |
If FALSE, only concepts with the ingredient range specified will be returned (both limits included). If TRUE, concepts with number of ingredients outside the range will be returned. |
The codelist with only those concepts associated with the domain (if negate = FALSE) or the codelist without those concepts associated with the domain (if negate = TRUE).
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnIngredientRange( x = newCodelist(list("codes" = c(10L, 13L))), cdm = cdm, ingredientRange = c(2, 10)) codeslibrary(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnIngredientRange( x = newCodelist(list("codes" = c(10L, 13L))), cdm = cdm, ingredientRange = c(2, 10)) codes
Subset a codelist to only those with a particular route category
subsetOnRouteCategory(x, cdm, routeCategory, negate = FALSE)subsetOnRouteCategory(x, cdm, routeCategory, negate = FALSE)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
routeCategory |
Only codes with the specified route will be returned. If NULL, descendant codes will be returned regardless of route category. Use getRoutes() to find the available route categories. |
negate |
If FALSE, only concepts with the routeCategory specified will be returned. If TRUE, concepts with the routeCategory specified will be excluded. |
The codelist with only those concepts associated with the specified route categories (if negate is FALSE) or the codelist without those concepts associated with the specified route categories (if negate is TRUE).
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnRouteCategory( x = newCodelist(list("codes" = c(20,21))), cdm = cdm, routeCategory = "topical") codeslibrary(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnRouteCategory( x = newCodelist(list("codes" = c(20,21))), cdm = cdm, routeCategory = "topical") codes
Subset a codelist to only those codes from a particular vocabulary.
subsetOnVocabulary(x, cdm, vocabulary, negate = FALSE)subsetOnVocabulary(x, cdm, vocabulary, negate = FALSE)
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
vocabulary |
Vocabulary to subset with (i.e., SNOMED) |
negate |
If FALSE, only concepts with the vocabulary specified will be returned. If TRUE, concepts with the vocabulary specified will be excluded. |
The codelist with only those concepts associated with the vocabulary (if negate = FALSE) or the codelist without those concepts associated with the vocabulary (if negate = TRUE).
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnVocabulary( x = newCodelist(list("codes" = c(1L,13L,15L))), cdm = cdm, vocabulary = "SNOMED") codeslibrary(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef() codes <- subsetOnVocabulary( x = newCodelist(list("codes" = c(1L,13L,15L))), cdm = cdm, vocabulary = "SNOMED") codes
Filter a codelist to keep only the codes being used in patient records
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 |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
minimumCount |
Any codes with a frequency under this will be removed. |
table |
cdm table of interest. |
The filtered codelist with only the codes used in the database
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "arthritis", domains = "Condition", includeDescendants = FALSE) x <- subsetToCodesInUse(newCodelist(list("cs1" = codes$concept_id, "cs2" = 999)), cdm = cdm) x CDMConnector::cdmDisconnect(cdm)library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "arthritis", domains = "Condition", includeDescendants = FALSE) x <- subsetToCodesInUse(newCodelist(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 |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
countBy |
Either "record" for record-level counts or "person" for person-level counts. |
A tibble with summarised counts.
library(CodelistGenerator) cdm <- mockVocabRef("database") oa <- getCandidateCodes(cdm = cdm, keywords = "osteoarthritis") codelist <- omopgenerics::newCodelist(list(oa = oa$concept_id)) result_achilles <- summariseAchillesCodeUse(codelist, cdm = cdm) result_achilles CDMConnector::cdmDisconnect(cdm)library(CodelistGenerator) cdm <- mockVocabRef("database") oa <- getCandidateCodes(cdm = cdm, keywords = "osteoarthritis") codelist <- omopgenerics::newCodelist(list(oa = oa$concept_id)) result_achilles <- summariseAchillesCodeUse(codelist, 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, dateRange = as.Date(c(NA, NA)), useSourceCodes = FALSE )summariseCodeUse( x, cdm, countBy = c("record", "person"), byConcept = TRUE, byYear = FALSE, bySex = FALSE, ageGroup = NULL, dateRange = as.Date(c(NA, NA)), useSourceCodes = FALSE )
x |
A codelist. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
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. |
dateRange |
Two dates. The first indicating the earliest cohort start date and the second indicating the latest possible cohort end date. If NULL or the first date is set as missing, the earliest observation_start_date in the observation_period table will be used for the former. If NULL or the second date is set as missing, the latest observation_end_date in the observation_period table will be used for the latter. |
useSourceCodes |
Whether the codelist provided contains source codes (TRUE) or standard codes (FALSE). |
A tibble with count results overall and, if specified, by strata.
## Not run: library(omopgenerics) library(CodelistGenerator) con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomiaDir()) cdm <- CDMConnector::cdmFromCon(con, cdmSchema = "main", writeSchema = "main") acetiminophen <- c(1125315, 1127433, 40229134, 40231925, 40162522, 19133768, 1127078) poliovirus_vaccine <- c(40213160) cs <- newCodelist(list(acetiminophen = acetiminophen, poliovirus_vaccine = poliovirus_vaccine)) results <- summariseCodeUse(cs,cdm = cdm) results CDMConnector::cdmDisconnect(cdm) ## End(Not run)## Not run: library(omopgenerics) library(CodelistGenerator) con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomiaDir()) cdm <- CDMConnector::cdmFromCon(con, cdmSchema = "main", writeSchema = "main") acetiminophen <- c(1125315, 1127433, 40229134, 40231925, 40162522, 19133768, 1127078) poliovirus_vaccine <- c(40213160) cs <- newCodelist(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( cdm, cohortTable, x = NULL, cohortId = NULL, timing = "any", countBy = c("record", "person"), byConcept = TRUE, byYear = FALSE, bySex = FALSE, ageGroup = NULL, useSourceCodes = FALSE )summariseCohortCodeUse( cdm, cohortTable, x = NULL, cohortId = NULL, timing = "any", countBy = c("record", "person"), byConcept = TRUE, byYear = FALSE, bySex = FALSE, ageGroup = NULL, useSourceCodes = FALSE )
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
cohortTable |
A cohort table from the cdm reference. |
x |
A codelist or cohort table name. |
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 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. |
useSourceCodes |
Whether the codelist provided contains source codes (TRUE) or standard codes (FALSE). |
A tibble with results overall and, if specified, by strata
## Not run: library(CodelistGenerator) library(duckdb) library(DBI) library(CDMConnector) con <- dbConnect(duckdb(), dbdir = eunomiaDir()) cdm <- cdmFromCon(con, cdmSchema = "main", writeSchema = "main") cdm <- generateConceptCohortSet(cdm = cdm, conceptSet = list(a = 260139, b = 1127433), name = "cohorts", end = "observation_period_end_date", overwrite = TRUE) results_cohort_mult <- summariseCohortCodeUse(omopgenerics::newCodelist(list(cs = c(260139,19133873))), cdm = cdm, cohortTable = "cohorts", timing = "entry") results_cohort_mult CDMConnector::cdmDisconnect(cdm) ## End(Not run)## Not run: library(CodelistGenerator) library(duckdb) library(DBI) library(CDMConnector) con <- dbConnect(duckdb(), dbdir = eunomiaDir()) cdm <- cdmFromCon(con, cdmSchema = "main", writeSchema = "main") cdm <- generateConceptCohortSet(cdm = cdm, conceptSet = list(a = 260139, b = 1127433), name = "cohorts", end = "observation_period_end_date", overwrite = TRUE) results_cohort_mult <- summariseCohortCodeUse(omopgenerics::newCodelist(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. |
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
domain |
Character vector with one or more of the OMOP CDM domains. The results will be restricted to the given domains. Check the available ones by running availableDomains(). If NULL, all supported domains are included: Condition, Drug, Procedure, Device, Observation, and Measurement. |
A summarised result containg the frequency of codes related to (but not in) the codelist.
library(CodelistGenerator) cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE) codelist <- omopgenerics::newCodelist(list("msk" = codes$concept_id)) orphan_codes <- summariseOrphanCodes(x = codelist, cdm = cdm) orphan_codes CDMConnector::cdmDisconnect(cdm)library(CodelistGenerator) cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE) codelist <- omopgenerics::newCodelist(list("msk" = codes$concept_id)) orphan_codes <- summariseOrphanCodes(x = codelist, cdm = cdm) orphan_codes CDMConnector::cdmDisconnect(cdm)
Format the result of summariseAchillesCodeUse into a table
tableAchillesCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumn = character(), hide = character(), style = "default", .options = list() )tableAchillesCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumn = character(), hide = character(), style = "default", .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. |
groupColumn |
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. |
style |
A character string or custom R code to define the visual formatting of the table. This argument can be provided in two ways: (1) Pre-defined Styles (Character String): Use a name for a built-in style (e.g., "darwin"). See visOmopResults::tableStyle() for available options. (2) Custome Code (Advanced): Supply a block of custom R code. This code must be specific to the table type. See visOmopResults::tableStyleCode() for structural examples. |
.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.
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef("database") oa <- getCandidateCodes(cdm = cdm, keywords = "osteoarthritis") result_achilles <- summariseAchillesCodeUse(newCodelist(list(oa = oa$concept_id)), cdm = cdm) tableAchillesCodeUse(result_achilles) CDMConnector::cdmDisconnect(cdm)library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef("database") oa <- getCandidateCodes(cdm = cdm, keywords = "osteoarthritis") result_achilles <- summariseAchillesCodeUse(newCodelist(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"), groupColumn = character(), hide = c("date_range_start", "date_range_end"), style = NULL, .options = list() )tableCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumn = character(), hide = c("date_range_start", "date_range_end"), style = NULL, .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", "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. |
groupColumn |
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. |
style |
A character string or custom R code to define the visual formatting of the table. This argument can be provided in two ways: (1) Pre-defined Styles (Character String): Use a name for a built-in style (e.g., "darwin"). See visOmopResults::tableStyle() for available options. (2) Custome Code (Advanced): Supply a block of custom R code. This code must be specific to the table type. See visOmopResults::tableStyleCode() for structural examples. |
.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: library(omopgenerics) library(CodelistGenerator) con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomiaDir()) cdm <- CDMConnector::cdmFromCon(con, cdmSchema = "main", writeSchema = "main") acetiminophen <- c(1125315, 1127433, 40229134, 40231925, 40162522, 19133768, 1127078) poliovirus_vaccine <- c(40213160) cs <- list(acetiminophen = acetiminophen, poliovirus_vaccine = poliovirus_vaccine) results <- summariseCodeUse(newCodelist(cs),cdm = cdm) tableCodeUse(results) CDMConnector::cdmDisconnect(cdm) ## End(Not run)## Not run: library(omopgenerics) library(CodelistGenerator) con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomiaDir()) cdm <- CDMConnector::cdmFromCon(con, cdmSchema = "main", writeSchema = "main") acetiminophen <- c(1125315, 1127433, 40229134, 40231925, 40162522, 19133768, 1127078) poliovirus_vaccine <- c(40213160) cs <- list(acetiminophen = acetiminophen, poliovirus_vaccine = poliovirus_vaccine) results <- summariseCodeUse(newCodelist(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"), groupColumn = character(), hide = c("timing"), .options = list(), style = NULL )tableCohortCodeUse( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumn = character(), hide = c("timing"), .options = list(), style = NULL )
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", "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. |
groupColumn |
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. |
style |
A character string or custom R code to define the visual formatting of the table. This argument can be provided in two ways: (1) Pre-defined Styles (Character String): Use a name for a built-in style (e.g., "darwin"). See visOmopResults::tableStyle() for available options. (2) Custome Code (Advanced): Supply a block of custom R code. This code must be specific to the table type. See visOmopResults::tableStyleCode() for structural examples. |
A table with a formatted version of the summariseCohortCodeUse result.
## Not run: con <- DBI::dbConnect(duckdb::duckdb(), dbdir = CDMConnector::eunomiaDir()) cdm <- CDMConnector::cdmFromCon(con, cdmSchema = "main", writeSchema = "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::eunomiaDir()) cdm <- CDMConnector::cdmFromCon(con, cdmSchema = "main", writeSchema = "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"), groupColumn = character(), hide = character(), style = NULL, .options = list() )tableOrphanCodes( result, type = "gt", header = c("cdm_name", "estimate_name"), groupColumn = character(), hide = character(), style = NULL, .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. |
groupColumn |
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. |
style |
A character string or custom R code to define the visual formatting of the table. This argument can be provided in two ways: (1) Pre-defined Styles (Character String): Use a name for a built-in style (e.g., "darwin"). See visOmopResults::tableStyle() for available options. (2) Custome Code (Advanced): Supply a block of custom R code. This code must be specific to the table type. See visOmopResults::tableStyleCode() for structural examples. |
.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.
library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE) orphan_codes <- summariseOrphanCodes(x = newCodelist(list("msk" = codes$concept_id)), cdm = cdm) tableOrphanCodes(orphan_codes) CDMConnector::cdmDisconnect(cdm)library(CodelistGenerator) library(omopgenerics) cdm <- mockVocabRef("database") codes <- getCandidateCodes(cdm = cdm, keywords = "Musculoskeletal disorder", domains = "Condition", includeDescendants = FALSE) orphan_codes <- summariseOrphanCodes(x = newCodelist(list("msk" = codes$concept_id)), cdm = cdm) tableOrphanCodes(orphan_codes) CDMConnector::cdmDisconnect(cdm)
Generate a codelist from the union of different codelists. The generated codelist will come out in alphabetical order.
unionCodelists(x, keepOriginal = FALSE)unionCodelists(x, keepOriginal = FALSE)
x |
A codelist. |
keepOriginal |
Whether to keep the original codelist (TRUE) or just return the stratified ones (FALSE). |
A codelist
library(CodelistGenerator) cdm <- mockVocabRef() getDrugIngredientCodes(cdm, nameStyle = "{concept_name}") |> unionCodelists()library(CodelistGenerator) cdm <- mockVocabRef() getDrugIngredientCodes(cdm, nameStyle = "{concept_name}") |> unionCodelists()
Get the available version of the vocabulary used in the cdm
vocabularyVersion(cdm)vocabularyVersion(cdm)
cdm |
A cdm reference to an OMOP CDM dataset. If data is held within a database, the vocabulary tables should be in the same schema as the clinical tables (person, observation period, and so on). |
The vocabulary version being used in the cdm.
library(CodelistGenerator) cdm <- mockVocabRef() vocabularyVersion(cdm = cdm)library(CodelistGenerator) cdm <- mockVocabRef() vocabularyVersion(cdm = cdm)