diff --git a/.Rbuildignore b/.Rbuildignore index 05b120c1..6fa6fcd9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,18 +1,20 @@ -^Capr\.Rproj$ -^\.Rproj\.user$ -.github -deploy.sh -compare_versions -^doc$ -^Meta$ -^_pkgdown\.yml$ -^docs$ -^extras$ -^man-roxygen$ -^scratch$ -^work$ -^README\.Rmd$ -^pkgdown$ -^cran-comments\.md$ -^CRAN-SUBMISSION$ -^LICENSE\.md$ +^renv$ +^renv\.lock$ +^Capr\.Rproj$ +^\.Rproj\.user$ +.github +deploy.sh +compare_versions +^doc$ +^Meta$ +^_pkgdown\.yml$ +^docs$ +^extras$ +^man-roxygen$ +^scratch$ +^work$ +^README\.Rmd$ +^pkgdown$ +^cran-comments\.md$ +^CRAN-SUBMISSION$ +^LICENSE\.md$ diff --git a/.Rprofile b/.Rprofile new file mode 100644 index 00000000..6e0d4744 --- /dev/null +++ b/.Rprofile @@ -0,0 +1,14 @@ +# Force compile packages from source before installing +options( + repos = c(CRAN = "https://cran.rstudio.com"), + install.packages.compile.from.source = TRUE, + pkgType = "source" +) + +if (any(list.files() == "renv")) { + source("renv/activate.R") +} else { + message("No renv initialized, calling renv::init()") + message("Please select to use only the DESCRIPTION file for dependency discovery if prompted, and next select 'Restore the project from the lockfile'") + renv::init() +} diff --git a/.gitignore b/.gitignore index 95aa7b8f..ccfd0c62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,33 @@ -.Rhistory -.Rproj.user -.DS_Store -errorReportSql.txt -*.log -/Meta/ -work/* -scratch/ -inst/doc +!.gitignore + +# Capr +.Rhistory +.Rproj.user +.DS_Store +errorReportSql.txt +*.log +/Meta/ +work/* +scratch/ +inst/doc + +# project-specific +inst/config/* +!inst/config/*-sample.yml + +inst/extdata/**/* + +!inst/extdata/phems_variable_list + +!inst/extdata/json +inst/extdata/json/* + +!inst/extdata/standard_concepts +inst/extdata/standard_concepts/* + +!inst/extdata/vocabularies +inst/extdata/vocabularies/* + +!*.gitkeep + +renv \ No newline at end of file diff --git a/Capr.Rproj b/Capr-PHEMS.Rproj similarity index 65% rename from Capr.Rproj rename to Capr-PHEMS.Rproj index cba1b6b7..8d82f1f3 100644 --- a/Capr.Rproj +++ b/Capr-PHEMS.Rproj @@ -1,21 +1,17 @@ -Version: 1.0 - -RestoreWorkspace: No -SaveWorkspace: No -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -AutoAppendNewline: Yes -StripTrailingWhitespace: Yes - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source -PackageRoxygenize: rd,collate,namespace +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source diff --git a/DESCRIPTION b/DESCRIPTION index 54296c7a..2e4c1a1c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,9 +1,10 @@ -Package: Capr -Title: Cohort Definition Application Programming +Package: Capr-PHEMS +Title: Cohort Definition Application Programming - project specific for PHEMS Version: 2.0.8 Authors@R: c( person("Martin", "Lavallee", , "martin.lavallee@boehringer-ingelheim.com", role = c("aut", "cre")), - person("Adam", "Black", , "black@ohdsi.org", role = c("aut")) + person("Adam", "Black", , "black@ohdsi.org", role = c("aut")), + person("Guus", "Wilmink", , "guus@thehyve.nl", role = c("aut")) ) Description: Provides a programming language for defining cohort definitions in R to use in studies for Observational Health Data Sciences and Informatics (OHDSI). The functions in 'Capr' allow for the programmatic creation of @@ -11,12 +12,13 @@ Description: Provides a programming language for defining cohort definitions in 'Capr' functions can be used to create, save, and load component parts to a cohort definition allowing R programmers to easily reuse cohort logic. 'Capr' provides tools to create a large number of OHDSI cohorts while also helping bridge the gap between human readable descriptions of clinical phenotypes - and their computational implementation. + and their computational implementation. + For PHEMS this package has been extended with additional functions to support PHEMS cohort creation. License: Apache License (>= 2) URL: https://ohdsi.github.io/Capr/, https://github.com/OHDSI/Capr/ BugReports: https://github.com/OHDSI/Capr/issues/ Encoding: UTF-8 -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Depends: R (>= 3.5.0) Imports: @@ -40,7 +42,11 @@ Imports: DatabaseConnector, SqlRender, generics, - CirceR + CirceR, + codetools, + readr, + dplyr, + DBI Suggests: testthat (>= 3.0.0), knitr, @@ -61,4 +67,9 @@ Collate: 'exit.R' 'cohort.R' 'collectCodesetId.R' + 'conceptSets.R' + 'countOccurrences.R' + 'isStandard.R' + 'isStandardCS.R' + 'table_linked_to_concept_field.R' 'utils.R' diff --git a/NAMESPACE b/NAMESPACE index 6b7afead..32678998 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,86 +1,100 @@ -# Generated by roxygen2: do not edit by hand - -S3method(compile,Cohort) -export("%>%") -export(age) -export(as.json) -export(atLeast) -export(atMost) -export(attrition) -export(bt) -export(censoringEvents) -export(cohort) -export(compile) -export(conditionEra) -export(conditionOccurrence) -export(conditionType) -export(continuousObservation) -export(cs) -export(dateAdjustment) -export(daysOfSupply) -export(death) -export(descendants) -export(deviceExposure) -export(drugEra) -export(drugExit) -export(drugExposure) -export(drugQuantity) -export(drugRefills) -export(drugType) -export(duringInterval) -export(endDate) -export(entry) -export(eq) -export(era) -export(eventEnds) -export(eventStarts) -export(exactly) -export(exclude) -export(exit) -export(female) -export(firstOccurrence) -export(fixedExit) -export(getConceptSetDetails) -export(gt) -export(gte) -export(lt) -export(lte) -export(makeCohortSet) -export(male) -export(mapped) -export(measurement) -export(measurementType) -export(nbt) -export(nestedWithAll) -export(nestedWithAny) -export(nestedWithAtLeast) -export(nestedWithAtMost) -export(observation) -export(observationExit) -export(observationType) -export(procedure) -export(procedureType) -export(rangeHigh) -export(rangeLow) -export(readConceptSet) -export(startDate) -export(toCirce) -export(unit) -export(valueAsNumber) -export(visit) -export(visitType) -export(withAll) -export(withAny) -export(withAtLeast) -export(withAtMost) -export(writeCohort) -export(writeConceptSet) -exportMethods("==") -exportMethods(compile) -import(dplyr) -importFrom(generics,compile) -importFrom(magrittr,"%>%") -importFrom(methods,"slot<-") -importFrom(rlang,"%||%") -importFrom(rlang,":=") -importFrom(rlang,.data) +# Generated by roxygen2: do not edit by hand + +S3method(compile,Cohort) +export("%>%") +export(age) +export(as.json) +export(atLeast) +export(atMost) +export(attrition) +export(bt) +export(censoringEvents) +export(cohort) +export(compile) +export(conceptSets) +export(conditionEra) +export(conditionOccurrence) +export(conditionType) +export(continuousObservation) +export(countOccurrences) +export(cs) +export(dateAdjustment) +export(daysOfSupply) +export(death) +export(descendants) +export(deviceExposure) +export(drugEra) +export(drugExit) +export(drugExposure) +export(drugQuantity) +export(drugRefills) +export(drugType) +export(duringInterval) +export(endDate) +export(entry) +export(eq) +export(era) +export(eventEnds) +export(eventStarts) +export(exactly) +export(exclude) +export(exit) +export(female) +export(firstOccurrence) +export(fixedExit) +export(getConceptSetDetails) +export(gt) +export(gte) +export(isStandard) +export(isStandardCS) +export(links) +export(lt) +export(lte) +export(makeCohortSet) +export(male) +export(mapped) +export(measurement) +export(measurementType) +export(nbt) +export(nestedWithAll) +export(nestedWithAny) +export(nestedWithAtLeast) +export(nestedWithAtMost) +export(observation) +export(observationExit) +export(observationType) +export(procedure) +export(procedureType) +export(rangeHigh) +export(rangeLow) +export(readConceptSet) +export(startDate) +export(toCirce) +export(unit) +export(valueAsNumber) +export(visit) +export(visitType) +export(withAll) +export(withAny) +export(withAtLeast) +export(withAtMost) +export(writeCohort) +export(writeConceptSet) +exportMethods("==") +exportMethods(collectGuid) +exportMethods(compile) +import(dplyr) +importFrom(DBI,dbGetQuery) +importFrom(dplyr,across) +importFrom(dplyr,filter) +importFrom(dplyr,inner_join) +importFrom(dplyr,mutate) +importFrom(dplyr,select) +importFrom(generics,compile) +importFrom(magrittr,"%>%") +importFrom(methods,"slot<-") +importFrom(readr,read_csv) +importFrom(readr,write_csv) +importFrom(rlang,"%||%") +importFrom(rlang,":=") +importFrom(rlang,.data) diff --git a/R/collectCodesetId.R b/R/collectCodesetId.R index 13ceadf6..f1f9ec49 100644 --- a/R/collectCodesetId.R +++ b/R/collectCodesetId.R @@ -1,315 +1,316 @@ -# Utilities --------------- -getGuid <- function(x) { - tibble::tibble( - guid = x@conceptSet@id - ) -} - -replaceGuid <- function(x, y) { - x@conceptSet@id <- y - return(x) -} - - -# Collect Guid -------------------------- - -setGeneric("collectGuid", function(x) standardGeneric("collectGuid")) - - -# setMethod("collectGuid", "Query", function(x) { -# getGuid(x) -# }) -# -# setMethod("collectGuid", "nestedAttribute", function(x) { -# collectGuid(x@group) -# }) - -#' @include query.R -setMethod("collectGuid", "Query", function(x) { - ids <- getGuid(x) - - #collect guids for nested attributes - checkNest <- purrr::map_chr(x@attributes, ~as.character(.x@name)) - if (any(checkNest %in% c("CorrelatedCriteria"))) { - ii <- which(checkNest == "CorrelatedCriteria") - id2 <- collectGuid(x@attributes[[ii]]@group) %>% - purrr::flatten() - - ids <- dplyr::bind_rows(ids, id2) - } - return(ids) - -}) - -#' @include criteria.R -setMethod("collectGuid", "Criteria", function(x) { - collectGuid(x@query) -}) - -#' @include criteria.R -setMethod("collectGuid", "Group", function(x) { - purrr::map(x@criteria, ~collectGuid(.x)) %>% - append(purrr::map(x@group, ~collectGuid(.x))) -}) - - - -setMethod("collectGuid", "CohortEntry", function(x) { - purrr::map(x@entryEvents, ~collectGuid(.x)) %>% - append(collectGuid(x@additionalCriteria)) - #TODO may need a flatten here with additional criteria -}) - -setMethod("collectGuid", "CohortAttrition", function(x) { - purrr::map(unname(x@rules), ~collectGuid(.x)) %>% - purrr::flatten() -}) - -setMethod("collectGuid", "CohortExit", function(x) { - #check if endstrategy is drug exit - es_nm_check <- "conceptSet" %in% methods::slotNames(methods::is(x@endStrategy)) - if (es_nm_check) { - #get concept sets from drug exit - ll <- list(getGuid(x@endStrategy)) - } else { - ll <- list() - } - append(ll, purrr::map(x@censoringCriteria@criteria, ~collectGuid(.x))) - -}) - -setMethod("collectGuid", "Cohort", function(x) { - - collectGuid(x@entry) %>% - append(collectGuid(x@attrition)) %>% - append(collectGuid(x@exit)) %>% - unlist() %>% - unname() %>% - unique() %>% - tibble::tibble(guid = .) %>% - dplyr::mutate( - codesetId = dplyr::row_number() - 1, - codesetId = as.integer(.data$codesetId) - ) - -}) - -# Replace CodesetId ----------------------- -## TODO HASH table implementation of find/replace -setGeneric("replaceCodesetId", function(x, guidTable) standardGeneric("replaceCodesetId")) - - -setMethod("replaceCodesetId", "Query", function(x, guidTable) { - - y <- getGuid(x) %>% - dplyr::inner_join(guidTable, by = c("guid")) %>% - dplyr::pull(.data$codesetId) - #first replace the query id - x <- replaceGuid(x, y) - - #next check for any nested criteria and replace - #replace guids for nested attributes - checkNest <- purrr::map_chr(x@attributes, ~as.character(.x@name)) - if (any(checkNest %in% c("CorrelatedCriteria"))) { - ii <- which(checkNest == "CorrelatedCriteria") - nest <- replaceCodesetId(x@attributes[[ii]]@group, guidTable) - - x@attributes[[ii]]@group <- nest - } - - return(x) -}) - -setMethod("replaceCodesetId", "DrugExposureExit", function(x, guidTable) { - - y <- getGuid(x) %>% - dplyr::inner_join(guidTable, by = c("guid")) %>% - dplyr::pull(.data$codesetId) - - x <- replaceGuid(x, y) - - return(x) -}) - - - -setMethod("replaceCodesetId", "Criteria", function(x, guidTable) { - - x@query <- replaceCodesetId(x@query, guidTable = guidTable) - - return(x) -}) - - -setMethod("replaceCodesetId", "Group", function(x, guidTable) { - crit <- purrr::map(x@criteria, ~replaceCodesetId(.x, guidTable)) - grp <- purrr::map(x@group, ~replaceCodesetId(.x, guidTable)) - - x@criteria <- crit - x@group <- grp - - return(x) -}) - - -setMethod("replaceCodesetId", "CohortEntry", function(x, guidTable) { - pc <- purrr::map(x@entryEvents, ~replaceCodesetId(.x, guidTable)) - ac <- replaceCodesetId(x@additionalCriteria, guidTable) - - x@entryEvents <- pc - x@additionalCriteria <- ac - return(x) - -}) - -setMethod("replaceCodesetId", "CohortAttrition", function(x, guidTable = guidTable) { - irs <- purrr::map(x@rules, ~replaceCodesetId(.x, guidTable)) - x@rules <- irs - return(x) -}) - - -setMethod("replaceCodesetId", "CohortExit", function(x, guidTable = guidTable) { - #check if endstrategy is drug exit - es_nm_check <- "conceptSet" %in% methods::slotNames(methods::is(x@endStrategy)) - if (es_nm_check) { - #get concept sets from drug exit - es <- replaceCodesetId(x@endStrategy, guidTable = guidTable) - x@endStrategy <- es - } - # Censoring Events replace - cen <- purrr::map(x@censoringCriteria@criteria, ~replaceCodesetId(.x, guidTable)) - x@censoringCriteria@criteria <- cen - return(x) - -}) - - -setMethod("replaceCodesetId", "Cohort", function(x, guidTable = guidTable) { - - x@entry <- replaceCodesetId(x@entry, guidTable = guidTable) - x@attrition <- replaceCodesetId(x@attrition, guidTable = guidTable) - x@exit <- replaceCodesetId(x@exit, guidTable = guidTable) - - return(x) -}) - -# list Concept Set ------------------ - -setGeneric("listConceptSets", function(x) standardGeneric("listConceptSets")) - -#' @include query.R -setMethod("listConceptSets", "Query", function(x) { - qs <- as.list(x@conceptSet) - - # handle listing concepts if have nestedAttribute - #next check for any nested criteria and replace - #replace guids for nested attributes - checkNest <- purrr::map_chr(x@attributes, ~as.character(.x@name)) - if (any(checkNest %in% c("CorrelatedCriteria"))) { - ii <- which(checkNest == "CorrelatedCriteria") - nest <- listConceptSets(x@attributes[[ii]]@group) - out <- c(list(qs), nest) - } else { - out <- list(qs) - } - - return(out) -}) - -#' @include criteria.R -setMethod("listConceptSets", "Criteria", function(x) { - listConceptSets(x@query) -}) - -check_names <- function(x) { - check <- names(x) %in% c("id", "name", "expression") - if (length(check) == 0) { - FALSE - } else{ - all(check) - } -} - -#' @include criteria.R -setMethod("listConceptSets", "Group", function(x) { - - #Start with criteria - a <- purrr::map(x@criteria, ~listConceptSets(.x)) - if (length(a) == 0) { - ll1 <- list() - } else { - la1 <- purrr::keep(a, ~check_names(.x)) - la2 <- purrr::discard(a, ~check_names(.x)) - if (length(la2) > 0) { - la2 <- purrr::list_flatten(la2) - } - - ll1 <- c(la1, la2) - } - - # Next Group - b <- purrr::map(x@group, ~listConceptSets(.x)) - if (length(b) == 0) { - ll2 <- list() - } else { - lb1 <- purrr::keep(b, ~check_names(.x)) - lb2 <- purrr::discard(b, ~check_names(.x)) - if (length(lb2) > 0) { - lb2 <- purrr::list_flatten(lb2) - } - - ll2 <- c(lb1, lb2) - } - - c(ll1, ll2) -}) - -setMethod("listConceptSets", "CohortEntry", function(x) { - - ce <- purrr::map(x@entryEvents, ~listConceptSets(.x)) - check <- purrr::map_int(ce, ~length(.x)) - if (!all(check == 3)) { - ce <- ce %>% - purrr::flatten() - } - - ce %>% - append(listConceptSets(x@additionalCriteria)) - # TODO may need a flatten here with additional criteria -}) - -setMethod("listConceptSets", "CohortAttrition", function(x) { - purrr::map(unname(x@rules), ~listConceptSets(.x)) %>% - purrr::list_flatten() -}) - -setMethod("listConceptSets", "CohortExit", function(x) { - # check if endstrategy is drug exit - es_nm_check <- "conceptSet" %in% methods::slotNames(methods::is(x@endStrategy)) - if (es_nm_check) { - # get concept sets from drug exit - ll <- list(as.list(x@endStrategy@conceptSet)) - } else { - ll <- list() - } - # get concept sets from censoring criteria - ll2 <- purrr::map(x@censoringCriteria@criteria, - ~listConceptSets(.x) %>% - purrr::flatten()) - - res <- append(ll, ll2) - return(res) -}) - -setMethod("listConceptSets", "Cohort", function(x) { - l1 <- listConceptSets(x@entry) - l2 <- listConceptSets(x@attrition) - l3 <- listConceptSets(x@exit) - ll <- c(l1, l2, l3) - - ids <- purrr::map_chr(ll, ~as.character(.x$id)) - - rr <- ll[!duplicated(ids)] - return(rr) -}) +# Utilities --------------- +getGuid <- function(x) { + tibble::tibble( + guid = x@conceptSet@id + ) +} + +replaceGuid <- function(x, y) { + x@conceptSet@id <- y + return(x) +} + + +# Collect Guid -------------------------- + +setGeneric("collectGuid", function(x) standardGeneric("collectGuid")) + + +# setMethod("collectGuid", "Query", function(x) { +# getGuid(x) +# }) +# +# setMethod("collectGuid", "nestedAttribute", function(x) { +# collectGuid(x@group) +# }) + +#' @include query.R +#' @export +setMethod("collectGuid", "Query", function(x) { + ids <- getGuid(x) + + #collect guids for nested attributes + checkNest <- purrr::map_chr(x@attributes, ~as.character(.x@name)) + if (any(checkNest %in% c("CorrelatedCriteria"))) { + ii <- which(checkNest == "CorrelatedCriteria") + id2 <- collectGuid(x@attributes[[ii]]@group) %>% + purrr::flatten() + + ids <- dplyr::bind_rows(ids, id2) + } + return(ids) + +}) + +#' @include criteria.R +setMethod("collectGuid", "Criteria", function(x) { + collectGuid(x@query) +}) + +#' @include criteria.R +setMethod("collectGuid", "Group", function(x) { + purrr::map(x@criteria, ~collectGuid(.x)) %>% + append(purrr::map(x@group, ~collectGuid(.x))) +}) + + + +setMethod("collectGuid", "CohortEntry", function(x) { + purrr::map(x@entryEvents, ~collectGuid(.x)) %>% + append(collectGuid(x@additionalCriteria)) + #TODO may need a flatten here with additional criteria +}) + +setMethod("collectGuid", "CohortAttrition", function(x) { + purrr::map(unname(x@rules), ~collectGuid(.x)) %>% + purrr::flatten() +}) + +setMethod("collectGuid", "CohortExit", function(x) { + #check if endstrategy is drug exit + es_nm_check <- "conceptSet" %in% methods::slotNames(methods::is(x@endStrategy)) + if (es_nm_check) { + #get concept sets from drug exit + ll <- list(getGuid(x@endStrategy)) + } else { + ll <- list() + } + append(ll, purrr::map(x@censoringCriteria@criteria, ~collectGuid(.x))) + +}) + +setMethod("collectGuid", "Cohort", function(x) { + + collectGuid(x@entry) %>% + append(collectGuid(x@attrition)) %>% + append(collectGuid(x@exit)) %>% + unlist() %>% + unname() %>% + unique() %>% + tibble::tibble(guid = .) %>% + dplyr::mutate( + codesetId = dplyr::row_number() - 1, + codesetId = as.integer(.data$codesetId) + ) + +}) + +# Replace CodesetId ----------------------- +## TODO HASH table implementation of find/replace +setGeneric("replaceCodesetId", function(x, guidTable) standardGeneric("replaceCodesetId")) + + +setMethod("replaceCodesetId", "Query", function(x, guidTable) { + + y <- getGuid(x) %>% + dplyr::inner_join(guidTable, by = c("guid")) %>% + dplyr::pull(.data$codesetId) + #first replace the query id + x <- replaceGuid(x, y) + + #next check for any nested criteria and replace + #replace guids for nested attributes + checkNest <- purrr::map_chr(x@attributes, ~as.character(.x@name)) + if (any(checkNest %in% c("CorrelatedCriteria"))) { + ii <- which(checkNest == "CorrelatedCriteria") + nest <- replaceCodesetId(x@attributes[[ii]]@group, guidTable) + + x@attributes[[ii]]@group <- nest + } + + return(x) +}) + +setMethod("replaceCodesetId", "DrugExposureExit", function(x, guidTable) { + + y <- getGuid(x) %>% + dplyr::inner_join(guidTable, by = c("guid")) %>% + dplyr::pull(.data$codesetId) + + x <- replaceGuid(x, y) + + return(x) +}) + + + +setMethod("replaceCodesetId", "Criteria", function(x, guidTable) { + + x@query <- replaceCodesetId(x@query, guidTable = guidTable) + + return(x) +}) + + +setMethod("replaceCodesetId", "Group", function(x, guidTable) { + crit <- purrr::map(x@criteria, ~replaceCodesetId(.x, guidTable)) + grp <- purrr::map(x@group, ~replaceCodesetId(.x, guidTable)) + + x@criteria <- crit + x@group <- grp + + return(x) +}) + + +setMethod("replaceCodesetId", "CohortEntry", function(x, guidTable) { + pc <- purrr::map(x@entryEvents, ~replaceCodesetId(.x, guidTable)) + ac <- replaceCodesetId(x@additionalCriteria, guidTable) + + x@entryEvents <- pc + x@additionalCriteria <- ac + return(x) + +}) + +setMethod("replaceCodesetId", "CohortAttrition", function(x, guidTable = guidTable) { + irs <- purrr::map(x@rules, ~replaceCodesetId(.x, guidTable)) + x@rules <- irs + return(x) +}) + + +setMethod("replaceCodesetId", "CohortExit", function(x, guidTable = guidTable) { + #check if endstrategy is drug exit + es_nm_check <- "conceptSet" %in% methods::slotNames(methods::is(x@endStrategy)) + if (es_nm_check) { + #get concept sets from drug exit + es <- replaceCodesetId(x@endStrategy, guidTable = guidTable) + x@endStrategy <- es + } + # Censoring Events replace + cen <- purrr::map(x@censoringCriteria@criteria, ~replaceCodesetId(.x, guidTable)) + x@censoringCriteria@criteria <- cen + return(x) + +}) + + +setMethod("replaceCodesetId", "Cohort", function(x, guidTable = guidTable) { + + x@entry <- replaceCodesetId(x@entry, guidTable = guidTable) + x@attrition <- replaceCodesetId(x@attrition, guidTable = guidTable) + x@exit <- replaceCodesetId(x@exit, guidTable = guidTable) + + return(x) +}) + +# list Concept Set ------------------ + +setGeneric("listConceptSets", function(x) standardGeneric("listConceptSets")) + +#' @include query.R +setMethod("listConceptSets", "Query", function(x) { + qs <- as.list(x@conceptSet) + + # handle listing concepts if have nestedAttribute + #next check for any nested criteria and replace + #replace guids for nested attributes + checkNest <- purrr::map_chr(x@attributes, ~as.character(.x@name)) + if (any(checkNest %in% c("CorrelatedCriteria"))) { + ii <- which(checkNest == "CorrelatedCriteria") + nest <- listConceptSets(x@attributes[[ii]]@group) + out <- c(list(qs), nest) + } else { + out <- list(qs) + } + + return(out) +}) + +#' @include criteria.R +setMethod("listConceptSets", "Criteria", function(x) { + listConceptSets(x@query) +}) + +check_names <- function(x) { + check <- names(x) %in% c("id", "name", "expression") + if (length(check) == 0) { + FALSE + } else{ + all(check) + } +} + +#' @include criteria.R +setMethod("listConceptSets", "Group", function(x) { + + #Start with criteria + a <- purrr::map(x@criteria, ~listConceptSets(.x)) + if (length(a) == 0) { + ll1 <- list() + } else { + la1 <- purrr::keep(a, ~check_names(.x)) + la2 <- purrr::discard(a, ~check_names(.x)) + if (length(la2) > 0) { + la2 <- purrr::list_flatten(la2) + } + + ll1 <- c(la1, la2) + } + + # Next Group + b <- purrr::map(x@group, ~listConceptSets(.x)) + if (length(b) == 0) { + ll2 <- list() + } else { + lb1 <- purrr::keep(b, ~check_names(.x)) + lb2 <- purrr::discard(b, ~check_names(.x)) + if (length(lb2) > 0) { + lb2 <- purrr::list_flatten(lb2) + } + + ll2 <- c(lb1, lb2) + } + + c(ll1, ll2) +}) + +setMethod("listConceptSets", "CohortEntry", function(x) { + + ce <- purrr::map(x@entryEvents, ~listConceptSets(.x)) + check <- purrr::map_int(ce, ~length(.x)) + if (!all(check == 3)) { + ce <- ce %>% + purrr::flatten() + } + + ce %>% + append(listConceptSets(x@additionalCriteria)) + # TODO may need a flatten here with additional criteria +}) + +setMethod("listConceptSets", "CohortAttrition", function(x) { + purrr::map(unname(x@rules), ~listConceptSets(.x)) %>% + purrr::list_flatten() +}) + +setMethod("listConceptSets", "CohortExit", function(x) { + # check if endstrategy is drug exit + es_nm_check <- "conceptSet" %in% methods::slotNames(methods::is(x@endStrategy)) + if (es_nm_check) { + # get concept sets from drug exit + ll <- list(as.list(x@endStrategy@conceptSet)) + } else { + ll <- list() + } + # get concept sets from censoring criteria + ll2 <- purrr::map(x@censoringCriteria@criteria, + ~listConceptSets(.x) %>% + purrr::flatten()) + + res <- append(ll, ll2) + return(res) +}) + +setMethod("listConceptSets", "Cohort", function(x) { + l1 <- listConceptSets(x@entry) + l2 <- listConceptSets(x@attrition) + l3 <- listConceptSets(x@exit) + ll <- c(l1, l2, l3) + + ids <- purrr::map_chr(ll, ~as.character(.x$id)) + + rr <- ll[!duplicated(ids)] + return(rr) +}) diff --git a/project/R/conceptSets.R b/R/conceptSets.R similarity index 97% rename from project/R/conceptSets.R rename to R/conceptSets.R index 76ac97cd..e6ed904f 100644 --- a/project/R/conceptSets.R +++ b/R/conceptSets.R @@ -1,7 +1,20 @@ +#' @name conceptSets +#' @title Medical Concept Sets Definition and Expansion +#' +#' @description +#' This script defines and expands various concept sets related to medical data. It utilizes the Capr library to fetch all descendant concepts +#' for each defined concept set, ensuring comprehensive coverage of related medical concepts. +#' +#' @details The script initializes by defining multiple concept sets within a list structure. Each concept set contains unique identifiers for medical concepts, +#' which are expanded to include all descendant concepts using the Capr library's functionality. The expanded concept sets are then stored in a new list within +#' the `conceptSets` object. Finally, the script outputs a confirmation message indicating successful sourcing and expansion of concept sets. +#' +#' @note This script requires the Capr library to be installed and loaded for proper execution. +#' @export + library(Capr) ## Define list of concepts to use for concept sets -# include all descendant concepts conceptSets <- list( concepts = list( # 5.3 VIS score medications @@ -545,9 +558,11 @@ conceptSets <- list( ) ) ) + +## Extend with descendants conceptSets$conceptSets <- list() for (cs in names(conceptSets$concepts)) { conceptSets$conceptSets[[cs]] <- cs(descendants(conceptSets$concepts[[cs]]), name = cs) } -cat("Sourced concept sets") +cat("\nSourced concept sets\n") diff --git a/R/countOccurrences.R b/R/countOccurrences.R new file mode 100644 index 00000000..dbc4a3da --- /dev/null +++ b/R/countOccurrences.R @@ -0,0 +1,84 @@ +#' Count Occurrences of Values in Database Tables +#' +#' This function counts the occurrences of specified concept ids within specified tables in a OMOP database, +#' including direct occurrences and occurrences through descendants, based on a provided cdm_schema and links. +#' It returns a tibble summarizing the counts across persons and across records. +#' +#' @param v A vector of concept_ids to count occurrences for. +#' @param tables A character vector of CDM table names to search within. +#' @param links A list linking each table to its respective concept_id field. +#' @param db_connection A database connection object through which queries will be executed. +#' @param cdm_schema The database cdm_schema in which the tables are located. +#' @param vocab_schema The database vocab_schema in which the concept tables are located. +#' +#' @return A tibble with columns for the number of times any concept from 'v' occurs: direct count of persons, +#' direct count of records, descendant count of persons, and descendant count of records. +#' The tibble also includes the concept names derived from `v` and is arranged by the total +#' record count (direct + descendant). +#' +#' @examples +#' # Assuming `db_connection` is a valid database connection, `cdm_schema` is set to "public", +#' # `tables` contains the names of the tables to search, `links` defines the relevant fields, +#' # and `v` contains the values to search for: +#' results <- countOccurrences(v = c(1, 2), tables = c("observation", "condition_occurrence"), +#' links = list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id", ...), +#' db_connection = db_connection, cdm_schema = "public") +#' +#' @export +countOccurrences <- function(v, tables, links, db_connection, cdm_schema, vocab_schema) { + library(DBI) + library(dplyr) + library(tibble) + + stopifnot(is.vector(v)) + stopifnot(is.character(tables) & is.vector(tables)) + stopifnot(is.list(links)) + stopifnot(is.character(cdm_schema)) + + results <- list() + + for (table in tables) { + concept_id_field <- links[[table]] + + # Combined SQL query for direct and descendant counts + combined_sql <- sprintf( + "WITH direct_counts AS ( + SELECT %s AS concept_id, COUNT(DISTINCT person_id) AS count_persons, COUNT(*) AS count_records + FROM %s.%s + WHERE %s IN (%s) + GROUP BY %s + ), descendant_counts AS ( + SELECT b.ancestor_concept_id AS concept_id, COUNT(DISTINCT a.person_id) AS descendant_count_person, COUNT(*) AS descendant_count_record + FROM %s.%s a + JOIN %s.concept_ancestor b ON a.%s = b.descendant_concept_id + WHERE b.ancestor_concept_id IN (%s) + GROUP BY b.ancestor_concept_id + ) + SELECT coalesce(d.concept_id, dc.concept_id) AS concept_id, coalesce(count_persons, 0) AS count_persons, coalesce(count_records, 0) AS count_records, coalesce(descendant_count_person, 0) AS descendant_count_person, coalesce(descendant_count_record, 0) AS descendant_count_record + FROM direct_counts d + FULL OUTER JOIN descendant_counts dc ON d.concept_id = dc.concept_id", + concept_id_field, cdm_schema, table, concept_id_field, paste(v, collapse = ","), concept_id_field, + cdm_schema, table, vocab_schema, concept_id_field, paste(v, collapse = ",") + ) + + combined_res <- dbGetQuery(db_connection, combined_sql) + + # Append results + results[[table]] <- combined_res + } + + # Combine all results into a single data frame and transform + final_res <- bind_rows(results) %>% + group_by(concept_id) %>% + summarise( + count_persons = sum(count_persons), + count_records = sum(count_records), + descendant_count_person = sum(descendant_count_person), + descendant_count_record = sum(descendant_count_record) + ) %>% + ungroup() %>% + mutate(concept_name = names(v)[match(concept_id, v)]) %>% + arrange(desc(count_records + descendant_count_record)) + + return(final_res) +} \ No newline at end of file diff --git a/R/isStandard.R b/R/isStandard.R new file mode 100644 index 00000000..1afa16fc --- /dev/null +++ b/R/isStandard.R @@ -0,0 +1,107 @@ +#' Check for Non-Standard Concepts in Database Tables +#' +#' This function examines a set of tables for non-standard concepts by comparing them against a standard concepts table in a SQL database. It identifies non-standard concepts and optionally saves the joined tables that contain these non-standard concepts. +#' +#' @param db_connection A DBI database connection object to the SQL database containing the standard concepts table. +#' @param data_concepts_path The file path to the directory containing CSV files of tables to be checked against the standard concepts table. Each CSV file should contain at least the columns `sourceCode` and `concept_id`. +#' @param save_path (Optional) The file path where the joined tables containing non-standard concepts should be saved. If not provided, the tables will not be saved but will still be checked for non-standard concepts. +#' @param vocab_schema The schema name of the vocabulary database containing the standard concepts table. +#' +#' @return A tibble containing the columns `concept_id`, `concept_name`, `source_code`, and `source_table`, which represent the concept ID, concept name, source code, and source table name for each non-standard concept found. +#' +#' @details The function first queries the `cdm.concept` table from the provided SQL database to retrieve the standard concepts. It then reads each CSV file in the specified directory, preparing and joining it with the standard concepts table based on the concept ID. Non-standard concepts are identified based on the `standard_concept` column not being 'S' or 'C'. Information about these non-standard concepts is collected and returned as a tibble. +#' +#' If a `save_path` is provided, each joined table that contains at least one non-standard concept is saved to the specified directory with the same name as the original table file. +#' +#' @examples +#' # Assuming you have a valid DBI connection `db_conn` and your tables are located in "path/to/data_concepts": +#' non_standard_concepts <- isStandard(db_conn, "path/to/data_concepts", "path/to/save_non_standard/") +#' +#' @importFrom readr read_csv write_csv +#' @importFrom dplyr mutate across filter select inner_join +#' @importFrom DBI dbGetQuery +#' @export +isStandard <- function(db_connection, data_concepts_path, vocab_schema, save_path = NULL) { + library(readr) + library(dplyr) + library(DBI) + + # Read concept table from SQL database + concept_table_query <- paste0( + "SELECT concept_id, concept_name, standard_concept FROM ", vocab_schema, ".concept" + ) + concept_table <- dbGetQuery(db_connection, concept_table_query) %>% + mutate(concept_id = as.character(concept_id)) %>% + mutate(concept_id = tolower(trimws(concept_id))) + + # Initialize vectors for non-standard concepts + nonStandard <- c() + conceptNameNonStandard <- c() + sourceCodeNonStandard <- c() + sourceTableNonStandard <- c() + standardness <- c() + + # Get tables from data_concepts_path + tables <- list.files(path = data_concepts_path, pattern = "\\.csv$", full.names = TRUE) + + # Stop if path does not point towards dir of CSVs + if (length(tables) == 0) { + stop("No CSV files found in the specified directory.") + } + + for (table_path in tables) { + table_name <- basename(table_path) + + # Read and prepare table + tb <- + readr::read_csv(table_path, col_types = cols(sourceCode = col_character(), concept_id = col_character())) %>% + mutate(across(c(sourceCode, concept_id), ~gsub("\u00A0", " ", .))) %>% + mutate(across(c(sourceCode, concept_id), ~trimws(.))) %>% + filter(!is.na(sourceCode), !is.na(concept_id)) %>% + mutate(concept_id = tolower(concept_id), + concept_id = as.character(concept_id)) %>% + select(sourceCode, concept_id) + + # Join tables + joined <- inner_join(concept_table, tb, by = "concept_id") + + # Add non-standard concept info to vectors + ind <- which(!(joined$standard_concept %in% c('S'))) + nonStandard <- append(nonStandard, joined$concept_id[ind]) + conceptNameNonStandard <- append(conceptNameNonStandard, joined$concept_name[ind]) + sourceCodeNonStandard <- append(sourceCodeNonStandard, joined$sourceCode[ind]) + sourceTableNonStandard <- append(sourceTableNonStandard, + replicate(length(ind), table_name, simplify="vector")) + standardness <- append(standardness, joined$standard_concept[ind]) + + if (length(ind) == 0) { + message("No non-standard concepts found in list of concepts: ", table_name) + } else { + message(paste("Found ", length(ind), " non-standard concepts in list of concepts: ", table_name)) + } + + # Save if not empty and save_path is provided + if (!is.null(save_path) && nrow(joined) > 0) { + message(paste0("saving file: ", table_name)) + readr::write_csv(joined, paste0(save_path, "/", table_name)) + } else if (is.null(save_path)) { + next + } else { + message(paste("No matches found for concept set.\n")) + } + } + + # NA == non-standard + standardness[is.na(standardness)] <- "Non-standard" + # Create table of non-standard concepts + res <- tibble::tibble( + concept_id = nonStandard, + concept_name = conceptNameNonStandard, + source_code = sourceCodeNonStandard, + source_table = unlist(sourceTableNonStandard), + standardness = standardness + ) + message(paste0("Finished checking for non-standard concepts.\n", nrow(res), " non-standard concepts found across tables.")) + + return(res) +} diff --git a/R/isStandardCS.R b/R/isStandardCS.R new file mode 100644 index 00000000..322109f9 --- /dev/null +++ b/R/isStandardCS.R @@ -0,0 +1,77 @@ +#' Check for Non-Standard Concepts in Concept Sets +#' +#' This function examines a concept set for non-standard concepts by comparing them against a standard concepts table in a SQL database. It identifies non-standard concepts and optionally saves the details of these non-standard concepts to a specified path. +#' +#' @param db_connection A DBI database connection object to the SQL database containing the standard concepts table. This parameter is currently not used in the function but intended for future use where database queries might be necessary. +#' @param conceptSet An object representing a set of concepts, containing details such as concept ID, concept name, and whether it is a standard concept. The structure of this object should support `@Expression` to access the individual concepts and their properties. +#' @param save_path (Optional) The file path where the details of non-standard concepts should be saved as a CSV file. If not provided, the information will not be saved but will still be checked for non-standard concepts. +#' +#' @return A tibble containing the columns `concept_name`, `concept_id`, `concept_set`, and `standard`, which represent the concept name, concept ID, the name of the concept set, and the standard status for each concept found to be non-standard or not classified as standard. +#' +#' @details The function processes a given concept set to identify non-standard concepts. Non-standard concepts are those not marked as 'S' (Standard) or 'C' (Classification) in their `standard_concept` attribute. The function creates a data frame with concept details, filters out standard and classification concepts, and if a `save_path` is provided, saves this information to a CSV file. If no non-standard concepts are found, appropriate messages are displayed. +#' +#' @examples +#' # Assuming you have a concept set `conceptSet`: +#' non_standard_concepts <- isStandardCS(db_conn, conceptSet, "path/to/save_standard_AND_non_standard/") +#' +#' @export +isStandardCS <- function(db_connection, conceptSet, save_path = NULL) { + library(readr) + library(dplyr) + library(DBI) + + # Initialize vectors for non-standard concepts + nonStandard <- c() + conceptNameNonStandard <- c() + sourceCodeNonStandard <- c() + sourceTableNonStandard <- c() + standardness <- c() + + # Get concept set details + cs <- conceptSet@Expression + + # initialize vectors + concept_name = c() + concept_id = c() + concept_set = c() + standardness = c() + + for (concept in cs) { + concept_name <- append(concept_name, concept@Concept@concept_name) + concept_id <- append(concept_id, concept@Concept@concept_id) + standardness <- append(standardness, concept@Concept@standard_concept) + } + cs_name <- conceptSet@Name + concept_set <- rep.int(cs_name, length(concept_id)) + + # Replace NAs with non-standard + standardness[is.na(standardness)] <- "Non-standard" + + # Filter out standard and classification concepts; keep non-standard and NA + df <- data.frame( + concept_name, + concept_id, + concept_set, + standardness + ) + + # Save if not empty and save_path is provided + if (!is.null(save_path) && nrow(df) > 0) { + message(paste0("saving file: CONCEPTSET_", cs_name)) + write_csv(df, paste0(save_path, "/CONCEPTSET_", cs_name, ".csv")) + } else if (is.null(save_path)) { + message("No save path specified; returning non-standard concepts\n") + } else { + message(paste0("No matches found for concept set: ", table_name, "\n")) + } + + + # NonStandard concepts + res <- df %>% filter(standardness != "S" | is.na(standardness)) %>% tibble::tibble() + if (nrow(res) == 0) { + message("No non-standard concepts found in concept set: ", cs_name) + } else { + message(paste0("Found ", nrow(res), " non-standard concepts in concept set: ", cs_name)) + } + return(res) +} diff --git a/R/table_linked_to_concept_field.R b/R/table_linked_to_concept_field.R new file mode 100644 index 00000000..21e8ab84 --- /dev/null +++ b/R/table_linked_to_concept_field.R @@ -0,0 +1,45 @@ +#' @name table_linked_to_concept_field +#' @title Link Table Names to Respective Concept ID Fields +#' +#' @description +#' This script creates a list mapping various table names to their respective +#' concept ID fields. This mapping is useful for dynamically referencing +#' concept IDs across different tables in a database schema, particularly +#' within the context of healthcare data where tables represent different +#' aspects of patient information (e.g., conditions, drug exposures). +#' +#' @details The `links` list object contains key-value pairs where each key is +#' a table name and the corresponding value is the name of the field that +#' contains the concept ID within that table. This object can be used to +#' programmatically access concept ID fields by table name. +#' +#' The following tables and their concept ID fields are included: +#' - `condition_occurrence`: `condition_concept_id` +#' - `death`: `cause_concept_id` +#' - `device_exposure`: `device_concept_id` +#' - `drug_exposure`: `drug_concept_id` +#' - `measurement`: `measurement_concept_id` +#' - `observation`: `observation_concept_id` +#' - `procedure_occurrence`: `procedure_concept_id` +#' - `specimen`: `specimen_concept_id` +#' - `visit_occurrence`: `visit_concept_id` +#' +#' @examples +#' # Access the concept ID field for the condition_occurrence table +#' concept_field <- links$condition_occurrence +#' print(concept_field) +#' +#' @export +links <- list( + condition_occurrence = "condition_concept_id", + death = "cause_concept_id", + device_exposure = "device_concept_id", + drug_exposure = "drug_concept_id", + measurement = "measurement_concept_id", + observation = "observation_concept_id", + procedure_occurrence = "procedure_concept_id", + specimen = "specimen_concept_id", + visit_occurrence = "visit_concept_id" +) + +cat("Sourced links object") \ No newline at end of file diff --git a/README.md b/README.md index cfabdb1c..dda67a55 100644 --- a/README.md +++ b/README.md @@ -1,63 +1,98 @@ -# Capr - - - -[![codecov.io](https://codecov.io/github/OHDSI/Capr/coverage.svg?branch=main)](https://app.codecov.io/gh/OHDSI/Capr?branch=main) [![Build Status](https://github.com/OHDSI/Capr/workflows/R-CMD-check/badge.svg)](https://github.com/OHDSI/Capr/actions?query=workflow%3AR-CMD-check) - - - -Capr is part of [HADES](https://ohdsi.github.io/Hades/) - -# Introduction - -The goal of Capr, pronounced 'kay-pr' like the edible flower, is to provide a language for expressing OHDSI Cohort definitions in R code. OHDSI defines a cohort as "a set of persons who satisfy one or more inclusion criteria for a duration of time" and provides a standardized approach for defining them (Circe-be). Capr exposes the standardized approach to cohort building through a programmatic interface in R which is particularly helpful when creating a large number of similar cohorts. Capr version 2 introduces a new user interface designed for readability with the goal that Capr code being a human readable description of a cohort while also being executable on an OMOP Common Data Model. - -Learn more about the OHDSI approach to cohort building in the [cohorts chapter of the Book of OHDSI.](https://ohdsi.github.io/TheBookOfOhdsi/Cohorts.html) - -# Installation - - -Users can install the current development version of Capr from [GitHub](https://github.com/) with: - -``` r -# install.packages("devtools") -devtools::install_github("ohdsi/Capr") -``` - - -# User Documentation - -Documentation can be found on the [package website](https://ohdsi.github.io/Capr/). - - -PDF versions of the documentation are also available: - -- Vignette: [Using Capr](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/Using-Capr.pdf) -- Vignette: [Capr Examples](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/Examples.pdf) -- Vignette: [Working with Concept Sets in Capr](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/Capr-conceptSets.pdf) -- Vignette: [Capr for Templating Cohort Definitions](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/capr_templates.pdf) -- Vignette: [Capr components](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/capr_objects.pdf) -- [Design Document](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/capr_design.pdf) -- [Package manual](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/Capr.pdf) - -# Support - -- Developer questions/comments/feedback: OHDSI Forum -- We use the GitHub issue tracker for all bugs/issues/enhancements - -# Contributing - -Read [here](https://ohdsi.github.io/Hades/contribute.html) how you can contribute to this package. - -# License - -Capr is licensed under Apache License 2.0 - -# Development - -Capr is being developed in R Studio. - -# Acknowledgements - -- This package is maintained by Martin Lavallee and Adam Black -- Guidance and support for the original development of Capr came from Lee Evans and LTS Computing LLC +# Capr + + + +[![codecov.io](https://codecov.io/github/OHDSI/Capr/coverage.svg?branch=main)](https://app.codecov.io/gh/OHDSI/Capr?branch=main) [![Build Status](https://github.com/OHDSI/Capr/workflows/R-CMD-check/badge.svg)](https://github.com/OHDSI/Capr/actions?query=workflow%3AR-CMD-check) + + + +Capr is part of [HADES](https://ohdsi.github.io/Hades/) + +# Introduction + +The goal of Capr, pronounced 'kay-pr' like the edible flower, is to provide a language for expressing OHDSI Cohort definitions in R code. OHDSI defines a cohort as "a set of persons who satisfy one or more inclusion criteria for a duration of time" and provides a standardized approach for defining them (Circe-be). Capr exposes the standardized approach to cohort building through a programmatic interface in R which is particularly helpful when creating a large number of similar cohorts. Capr version 2 introduces a new user interface designed for readability with the goal that Capr code being a human readable description of a cohort while also being executable on an OMOP Common Data Model. + +This package has been extended under the name Capr-PHEMS for the PHEMS consortium to facilitate the cohort building process via a template script and specific configurations, as well as providing extra functionality to enable querying the frequency of concept sets on a person and record level and to enable checking the standardness of concepts in a set or list of concepts, thereby making identification of non-standard concepts much more straightforward. + +Learn more about the OHDSI approach to cohort building in the [cohorts chapter of the Book of OHDSI.](https://ohdsi.github.io/TheBookOfOhdsi/Cohorts.html) + +# Installation + + +Users can install the current development version of Capr from [GitHub](https://github.com/) with: + +``` r +# install.packages("devtools") +devtools::install_github("ohdsi/Capr") +``` + +For Capr-PHEMS, it is recommended to clone the repo and work from the template script cohortCapr.R, whilst using the Capr-PHEMS.Rproj as the project. + +# Getting started with Capr-PHEMS +**Prerequisites** +Please make sure you have the following: +- R version >= 4.4.0 +- RStudio >= 2024.04.2 +- (CRAN library) renv >= 1.0.7 + +1. Clone the repo: +``` +git clone https://github.com/thehyve/Capr-PHEMS.git +``` + +2. Navigate to ./inst/config/. Here you will find two sample configuration files; config-sample.yml and connection_config-sample.yml + +3. Copy these files using: +``` +cp config-sample.yml config.yml +``` +and +``` +cp connection_config-sample.yml connection_config.yml +``` +and fill in your configuration details. + +4a. Open RStudio and verify renv >= 1.0.7 is installed by calling packageVersion("renv"). If not installed, call install.packages("renv) +4b. In the top-right "Project" dropdown menu, select "Open Project" and open ./Capr-PHEMS.Rproj +4c. .Rprofile will be sourced when opening the project; this will trigger renv::init() to initialize the environment. When prompted whether to use a DESCRIPTION file for dependency discovery, select option 1 to use the DESCRIPTION file. Next, you may be prompted the project already has a lockfile with another set of options. Here also select option 1 to restore the project from the lockfile. This will install all required packages to the environment. Your renv is now activated. + +5. A template script is provided under ./inst/templates/ as both an R script and .Rmd file. The code between these files is identical. It is recommended to use the .Rmd file, so chunks of code can easily be run at will. These chunks of code are self-explanatory. + +# User Documentation + +Documentation can be found on the [package website](https://ohdsi.github.io/Capr/). + + +PDF versions of the documentation are also available: + +- Vignette: [Using Capr](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/Using-Capr.pdf) +- Vignette: [Capr Examples](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/Examples.pdf) +- Vignette: [Working with Concept Sets in Capr](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/Capr-conceptSets.pdf) +- Vignette: [Capr for Templating Cohort Definitions](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/capr_templates.pdf) +- Vignette: [Capr components](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/capr_objects.pdf) +- [Design Document](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/pdf_vignette/capr_design.pdf) +- [Package manual](https://raw.githubusercontent.com/OHDSI/Capr/main/extras/Capr.pdf) + +# Support + +- Developer questions/comments/feedback: OHDSI Forum +- We use the GitHub issue tracker for all bugs/issues/enhancements + +# Contributing + +Read [here](https://ohdsi.github.io/Hades/contribute.html) how you can contribute to this package. + +# License + +Capr is licensed under Apache License 2.0 + +# Development + +Capr is being developed in R Studio. +Capr-PHEMS is beind developed in R Studio. + +# Acknowledgements + +- The original Capr package is maintained by Martin Lavallee and Adam Black +- Guidance and support for the original development of Capr came from Lee Evans and LTS Computing LLC +- Additional scripts and templates specific to Capr-PHEMS are maintained by Guus Wilmink diff --git a/inst/config/config-sample.yml b/inst/config/config-sample.yml new file mode 100644 index 00000000..93cffcbf --- /dev/null +++ b/inst/config/config-sample.yml @@ -0,0 +1,15 @@ +--- +## Default configuration values +# Default values are necessary for the `config` CRAN library, not used in package otherwise +# No need to change these values +default: + concepts_path: 'inst/extdata/phems_variable_list' # required for isStandard() function; specifies path to concept list directory with sourceCode and concept_id + save_path_isStandard: 'inst/extdata/phems_variable_list/is_standard' # (optional) if saving standard concept check results. Point to existing directory. + save_path_json: 'inst/extdata/json' # (optional) if saving cohort and/or concept set as json). Point to existing directory + +## Paths for CSVs of concepts and saves +# Replace with your paths +config: + concepts_path: '' + save_path_isStandard: '' + save_path_json: '' \ No newline at end of file diff --git a/inst/config/connection_config-sample.yml b/inst/config/connection_config-sample.yml new file mode 100644 index 00000000..1e2bc71e --- /dev/null +++ b/inst/config/connection_config-sample.yml @@ -0,0 +1,37 @@ +--- +## Default configuration values +# Default values are necessary for the `config` CRAN library, not used in package otherwise +# No need to change these values; they are unused +default: + dbms: 'postgres' # Database management system + user: 'postgres' + password: null + server: localhost/omop_db + port: 5432 + oracleDriver: null + pathToDriver: '~/jdbc/' + cdm_schema: 'cdm' + vocabulary_schema: 'vocab' + cohort_schema: 'cohort' + +## Connection details +# Replace with your connection details +# Used primarily as input to DatabaseConnector::createConnectionDetails() +# see the function documentation for more information +# Please check carefully which details are required for your dbms +# as not all of these details may be required. +# cdm_schema should point to the OMOP CDM schema +# vocabulary_schema should point to the schema where the vocabulary tables are stored +# cohort_schema should point to the schema where the cohort tables are stored +# All schemas should be EXISTING in the database +config: + dbms: '' + user: '' + password: '' + server: '' + port: 5432 + oracleDriver: null + pathToDriver: '' + cdm_schema: '' + vocabulary_schema: '' + cohort_schema: '' \ No newline at end of file diff --git a/inst/extdata/json/.gitkeep b/inst/extdata/json/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/project/data/phems_variable_list/5.10_cardiac_radiology.csv b/inst/extdata/phems_variable_list/5.10_cardiac_radiology.csv similarity index 100% rename from project/data/phems_variable_list/5.10_cardiac_radiology.csv rename to inst/extdata/phems_variable_list/5.10_cardiac_radiology.csv diff --git a/project/data/phems_variable_list/5.11_cardiac_los.csv b/inst/extdata/phems_variable_list/5.11_cardiac_los.csv similarity index 100% rename from project/data/phems_variable_list/5.11_cardiac_los.csv rename to inst/extdata/phems_variable_list/5.11_cardiac_los.csv diff --git a/project/data/phems_variable_list/5.12_additional.csv b/inst/extdata/phems_variable_list/5.12_additional.csv similarity index 100% rename from project/data/phems_variable_list/5.12_additional.csv rename to inst/extdata/phems_variable_list/5.12_additional.csv diff --git a/project/data/phems_variable_list/5.13_laboratory_tests.csv b/inst/extdata/phems_variable_list/5.13_laboratory_tests.csv similarity index 100% rename from project/data/phems_variable_list/5.13_laboratory_tests.csv rename to inst/extdata/phems_variable_list/5.13_laboratory_tests.csv diff --git a/project/data/phems_variable_list/5.14_cardiac_complications.csv b/inst/extdata/phems_variable_list/5.14_cardiac_complications.csv similarity index 100% rename from project/data/phems_variable_list/5.14_cardiac_complications.csv rename to inst/extdata/phems_variable_list/5.14_cardiac_complications.csv diff --git a/inst/extdata/phems_variable_list/5.15_vital_signs.csv b/inst/extdata/phems_variable_list/5.15_vital_signs.csv new file mode 100644 index 00000000..2e27e1de --- /dev/null +++ b/inst/extdata/phems_variable_list/5.15_vital_signs.csv @@ -0,0 +1,11 @@ +sourceCode,concept_id +Age-dependent HR ,3027018 +Age-dependent HR ,8483  +Age-dependent RR ,3024171 +Age-dependent RR ,8483  +SBP (Systolic Blood Pressure) ,3004249 +SBP (Systolic Blood Pressure) ,8876  +DBP (Dyastolic Blood Pressure) ,3012888 +DBP (Dyastolic Blood Pressure) ,8876  +SpO2 ,4096101  +SpO2 ,8554  diff --git a/project/data/phems_variable_list/5.16_hsjd_clinical.csv b/inst/extdata/phems_variable_list/5.16_hsjd_clinical.csv similarity index 100% rename from project/data/phems_variable_list/5.16_hsjd_clinical.csv rename to inst/extdata/phems_variable_list/5.16_hsjd_clinical.csv diff --git a/project/data/phems_variable_list/5.17_hsjd_surgery.csv b/inst/extdata/phems_variable_list/5.17_hsjd_surgery.csv similarity index 100% rename from project/data/phems_variable_list/5.17_hsjd_surgery.csv rename to inst/extdata/phems_variable_list/5.17_hsjd_surgery.csv diff --git a/project/data/phems_variable_list/5.18_hsjd_hospitalisation.csv b/inst/extdata/phems_variable_list/5.18_hsjd_hospitalisation.csv similarity index 100% rename from project/data/phems_variable_list/5.18_hsjd_hospitalisation.csv rename to inst/extdata/phems_variable_list/5.18_hsjd_hospitalisation.csv diff --git a/project/data/phems_variable_list/5.19_hsjd_complication.csv b/inst/extdata/phems_variable_list/5.19_hsjd_complication.csv similarity index 100% rename from project/data/phems_variable_list/5.19_hsjd_complication.csv rename to inst/extdata/phems_variable_list/5.19_hsjd_complication.csv diff --git a/inst/extdata/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv b/inst/extdata/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv new file mode 100644 index 00000000..056df727 --- /dev/null +++ b/inst/extdata/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv @@ -0,0 +1,88 @@ +sourceCode,concept_id +Previous diagnosis of sepsis measure ,1340204  +Previous diagnosis of sepsis measure ,132797  +Origin (external) ,44790567  +Origin (internal) ,4294886  +Reason for admission ,44803020  +Surgical admission (non-urgent) ,4084670  +Surgical admission (urgent) ,4123946   +Non-surgical admission ,0  +Central venous catheter ,4179206  +Diagnosis of chronic condition ,443783  +Diagnosis of chronic condition ,312723  +Diagnosis of chronic condition ,201820  +Diagnosis of chronic condition ,255573  +Diagnosis of acute infection having the potential for progression to sepsis1+2 ,37174269  +Diagnosis of acute infection having the potential for progression to sepsis1+2 ,4271450  +Meningo-encephalitis ,4322814  +hepatitis ,4243475  +pneumonia ,255848  +meningitis ,435785  +bacteremia ,132736  +viremia ,133327  +UTI ,4331815  +tuberculosis ,4103588  +candidiasis ,433968  +Diagnosis of SIRS ,434821  +Diagnosis of condition producing immunodeficiency ,4140977  +Abcess ,444202  +appendicitis ,440448  +, +peritonitis ,196152  +cellulitis ,435613  +surgical site inflammation ,4300243  +injury with open wound ,444187  +renal insufficiency ,36716945  +endocarditis ,441589  +miocarditis ,314383  +necrotizing enterocolitis ,44807226  +Cancer ,443392  +cardiac arrest ,321042  +organ transplant ,4208341  +acute kidney injury ,197320  +immunodeficiency ,433740  +asplenia ,45768671  +cerebral palsy ,4134120  +rheumatoid arthritis ,80809  +sickle cell disease ,22281  +ulcerative colitis ,81893  +Crohn's disease ,201606  +Cushing's disease ,195212  +Down's syndrome ,439125  +mitochondrial disease ,81539  +nephrotic syndrome ,195314  +neutropenia ,604243  +Diagnosis of organ system dysfunction ,4080011  +Antibiotics ,4085730  +Antivirals ,4140762  +Immunosuppressors ,4314777  +Corticoids ,21602722  +Antineoplastics ,4181511  +Surgery previous to prediction time point ,4301351  +"Chest opening, chest drainage ",4074689  +Arterial blood pressure catheter ,45758028  +Peripheral IV cannulas ,4177205  +Urinary catheter ,4070667  +Nasogastric/orogastric tube ,42538045  +Endotracheal tube ,4097216  +Tracheostomy ,44783799  +Invasive ventilation ,44790095  +Non-invasive ventilation ,4177224  +FiO2 ,42869590  +FiO2 ,8554  +FiO2 ,8510  +FiO2 ,720868  +Mean Airway Pressure (MAP) ,42527086  +Mean Airway Pressure (MAP) ,44777590  +Mean Airway Pressure (MAP) ,8876  +Mean Airway Pressure (MAP) ,44777602  +Oxygenation index ,4193843  +Oxygenation index ,8529  +Oxygenation index ,0  +ECMO ,4052536  +ECMO type ,37206603  +ECMO type ,37206601  +Ventricular assist device (VAD) ,4235043  +Dialysis ,4032243  +Dialysis ,4051330  +Peritoneal dialysis ,4324124  diff --git a/inst/extdata/phems_variable_list/5.22_vital_signs.csv b/inst/extdata/phems_variable_list/5.22_vital_signs.csv new file mode 100644 index 00000000..e2bd991b --- /dev/null +++ b/inst/extdata/phems_variable_list/5.22_vital_signs.csv @@ -0,0 +1,88 @@ +sourceCode,concept_id +HR ,3027018  +HR ,8483  +RR ,3024171  +RR ,8483  +Body temperature ,3020891  +Body temperature ,586323  +SBP (Systolic Blood Pressure) ,3004249  +SBP (Systolic Blood Pressure) ,8876  +DBP (Diastolic blood pressure) ,3012888  +DBP (Diastolic blood pressure) ,8876  +SpO2 ,4096101  +SpO2 ,8554  +Urine output ,3014315  +Urine output ,8587  +Urine output ,44777613  +Urine output ,33014  +Urine output ,0  +Weight ,3025315  +Weight ,9529  +Weight ,8504  +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, diff --git a/inst/extdata/phems_variable_list/5.23_physical_examination_signs.csv b/inst/extdata/phems_variable_list/5.23_physical_examination_signs.csv new file mode 100644 index 00000000..b304ff0d --- /dev/null +++ b/inst/extdata/phems_variable_list/5.23_physical_examination_signs.csv @@ -0,0 +1,88 @@ +sourceCode,concept_id +GCS ,3032652  +Pupillary reactivity (right) ,21490963  +Pupillary reactivity (right) ,4069590  +Pupillary reactivity (right) ,45879546  +Pupillary reactivity (right) ,45880051  +Pupillary reactivity (right) ,4188539  +Pupillary reactivity (right) ,4188540  +Pupillary reactivity (left) ,21491763  +Pupillary reactivity (left) ,4069590  +Pupillary reactivity (left) ,45879546  +Pupillary reactivity (left) ,45880051  +Pupillary reactivity (left) ,4188539  +Pupillary reactivity (left) ,4188540  +Pupillary size (right) ,3027214  +Pupillary size (right) ,8588  +Pupillary size (right) ,36310446  +Pupillary size (right) ,21499034  +Pupillary size (right) ,4116857  +Pupillary size (left) ,3021415  +Pupillary size (left) ,8588  +Pupillary size (left) ,36310446  +Pupillary size (left) ,21499034  +Pupillary size (left) ,4116857  +Capillary refill time ,3045676  +Capillary refill time ,8555  +Peripheral pulse (pressure) ,4314539  +Peripheral pulse (pressure) ,4181412  +Peripheral pulse (pressure) ,4132135  +Peripheral pulse (pressure) ,4124461  +Peripheral pulse (pressure) ,8483  +Central pulse ,4224504  +Central pulse ,4181412  +Central pulse ,4132135  +Central pulse ,4124461  +Central pulse ,8483  +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, diff --git a/inst/extdata/phems_variable_list/5.24_laboratory_test_results_uc2.csv b/inst/extdata/phems_variable_list/5.24_laboratory_test_results_uc2.csv new file mode 100644 index 00000000..70c91b9d --- /dev/null +++ b/inst/extdata/phems_variable_list/5.24_laboratory_test_results_uc2.csv @@ -0,0 +1,87 @@ +sourceCode,concept_id +Bacterial pathogen detection ,4036356  +Name of bacterial pathogen detected ,432545  +Quantification of colonies in culture ,4299649  +Quantification of colonies in culture ,9278  +PCR panel ,4196268  +Antibiotic resistance ,44806682  +Viral pathogen detection ,440029  +PCR panel ,4196268  +Leukocytes ,4212899  +Leukocytes ,9278  +Leukocytes ,0  +Thromboplastin time ,4175016  +Thromboplastin time ,8555  +Thromboplastin time ,8523  +D-dimer ,37393605  +D-dimer ,8751  +D-dimer ,8753  +Fibrinogen ,4094436  +Fibrinogen ,8636  +Fibrinogen ,8753  +Blood urea nitrogen ,4017361  +Blood urea nitrogen ,8753  +Blood urea nitrogen ,8840  +Glucose ,3013826  +Glucose ,8753  +Glucose ,8840  +Direct bilirubin ,4118986  +Direct bilirubin ,8749  +Direct bilirubin ,8753  +Direct bilirubin ,8840  +Ionized calcium ,44789220  +Ionized calcium ,8753  +PCT ,3046279  +PCT ,8842  +PCT ,8725  +PCT ,8748  +MR-proADM ,42536081  +MR-proADM ,8736  +Interleukin-6 ,3033291  +Interleukin-6 ,8845  +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, diff --git a/inst/extdata/phems_variable_list/5.25_arterial_blood_gas.csv b/inst/extdata/phems_variable_list/5.25_arterial_blood_gas.csv new file mode 100644 index 00000000..9db01561 --- /dev/null +++ b/inst/extdata/phems_variable_list/5.25_arterial_blood_gas.csv @@ -0,0 +1,87 @@ +sourceCode,concept_id +pH ,3019977  +pCO2 ,3027946  +pCO2 ,44777602  +pCO2 ,8876  +PaO2 ,3027801  +PaO2 ,44777602  +PaO2 ,8876  +HCO3 ,3008152  +HCO3 ,8753  +Base excess ,3003396  +Base excess ,8753  +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, diff --git a/inst/extdata/phems_variable_list/5.26_venous_blood_gas.csv b/inst/extdata/phems_variable_list/5.26_venous_blood_gas.csv new file mode 100644 index 00000000..610e92e9 --- /dev/null +++ b/inst/extdata/phems_variable_list/5.26_venous_blood_gas.csv @@ -0,0 +1,87 @@ +sourceCode,concept_id, +pH ,3012544 , +pH ,3009343 , +pCO2 ,3021447 , +pCO2 ,3023024 , +pCO2 ,44777602 , +pCO2 ,8876 , +PaO2 ,3024354 , +PaO2 ,3028626 , +PaO2 ,44777602 , +PaO2 ,8876 , +HCO3 ,3027273 , +HCO3 ,3015235 , +HCO3 ,8753 , +Base excess,3002032 , +Base excess,3003129 , +Base excess,8753 , +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, diff --git a/inst/extdata/phems_variable_list/5.28_patient_characteristics.csv b/inst/extdata/phems_variable_list/5.28_patient_characteristics.csv new file mode 100644 index 00000000..ee0ddb64 --- /dev/null +++ b/inst/extdata/phems_variable_list/5.28_patient_characteristics.csv @@ -0,0 +1,87 @@ +sourceCode,concept_id, +body weight ,3025315 , +body weight ,9529 , +body weight ,8504 , +height ,3036277 , +height ,8582 , +height ,9546 , +hemophilia A diagnosis ,434007 , +hemophilia A subtype/ severity ,4094223 , +hemophilia A subtype/ severity ,4140661 , +hemophilia A subtype/ severity ,4056830 , +blood group ,3003694 , +factor VIII inhibitor status ,37393608 , +factor VIII inhibitor status ,4126681 , +factor VIII inhibitor status ,9190 , +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, diff --git a/project/data/phems_variable_list/5.28_uc3_patient_characteristics.csv b/inst/extdata/phems_variable_list/5.28_uc3_patient_characteristics.csv similarity index 100% rename from project/data/phems_variable_list/5.28_uc3_patient_characteristics.csv rename to inst/extdata/phems_variable_list/5.28_uc3_patient_characteristics.csv diff --git a/inst/extdata/phems_variable_list/5.29_lab_measurements_uc3.csv b/inst/extdata/phems_variable_list/5.29_lab_measurements_uc3.csv new file mode 100644 index 00000000..8da65eab --- /dev/null +++ b/inst/extdata/phems_variable_list/5.29_lab_measurements_uc3.csv @@ -0,0 +1,37 @@ +sourceCode,concept_id +factor VIII inhibitor titer ,3024942  +factor VIII inhibitor titer ,44777562  +factor VIII activity measurement ,3022520  +factor VIII activity measurement ,3011832  +factor VIII activity measurement ,8985  +factor VIII activity measurement ,9332  +factor VIII activity measurement ,8554  +Von Willebrand factor activity measurement ,43534000  +Von Willebrand factor activity measurement ,8985  +Von Willebrand factor activity measurement ,9332  +Von Willebrand factor activity measurement ,8554  +Von Willebrand factor antigen measurement ,3002124  +Von Willebrand factor antigen measurement ,8985  +Von Willebrand factor antigen measurement ,9332  +Von Willebrand factor antigen measurement ,8554  +Von Willebrand factor propeptide measurement ,3023693  +Von Willebrand factor propeptide measurement ,3042349  +Von Willebrand factor propeptide measurement ,8763  +activated partial thromboplastin time (APTT) ,4175016   +activated partial thromboplastin time (APTT) ,8555  +activated partial thromboplastin time (APTT) ,8523  +Prothrombin time (PT) ,3034426  +Prothrombin time (PT) ,8555  +Prothrombin time (PT) ,8523  +Prothrombin time (PT) ,8554  +platelet count ,4267147 +platelet count ,44777588  +hematocrit ,3009542  +hematocrit ,44777604  +hematocrit ,8554 +fibrinogen ,3016407  +fibrinogen ,8636  +ALT ,3006923  +ALT ,8645  +AST ,3013721  +AST ,8645  diff --git a/project/data/phems_variable_list/5.29_uc3_lab_measurements.csv b/inst/extdata/phems_variable_list/5.29_uc3_lab_measurements.csv similarity index 100% rename from project/data/phems_variable_list/5.29_uc3_lab_measurements.csv rename to inst/extdata/phems_variable_list/5.29_uc3_lab_measurements.csv diff --git a/inst/extdata/phems_variable_list/5.30_treatments.csv b/inst/extdata/phems_variable_list/5.30_treatments.csv new file mode 100644 index 00000000..0dafecd2 --- /dev/null +++ b/inst/extdata/phems_variable_list/5.30_treatments.csv @@ -0,0 +1,85 @@ +sourceCode,concept_id, +factor VIII  ,35766745 , +factor VIII  ,21154209 , +factor VIII  ,35831239 , +factor VIII  ,40745282 , +factor VIII  ,8985 , +factor VIII dose is continuous infusion or bolus dose ,40492862 , +factor VIII dose is continuous infusion or bolus dose ,4129275 , +factor VIII dose is continuous infusion or bolus dose ,4265597 , +desmopressin ,1517070 , +desmopressin ,9655 , +desmopressin ,8576 , +desmopressin ,9662 , +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, diff --git a/project/data/phems_variable_list/5.30_uc3_treatments.csv b/inst/extdata/phems_variable_list/5.30_uc3_treatments.csv similarity index 100% rename from project/data/phems_variable_list/5.30_uc3_treatments.csv rename to inst/extdata/phems_variable_list/5.30_uc3_treatments.csv diff --git a/inst/extdata/phems_variable_list/5.31_surgery_specific_parameters.csv b/inst/extdata/phems_variable_list/5.31_surgery_specific_parameters.csv new file mode 100644 index 00000000..50ae5fb3 --- /dev/null +++ b/inst/extdata/phems_variable_list/5.31_surgery_specific_parameters.csv @@ -0,0 +1,85 @@ +sourceCode,concept_id, +Medical/ surgical procedure ,45888085 , +NaCl administration during surgery ,967823 , +,8587 , +plasma administration during surgery ,4028665 , +datetime start anesthesia ,45888867 , +blood loss during surgery ,4308716 , +blood transfusion during surgery ,37017589 , +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, +,, diff --git a/project/data/phems_variable_list/5.31_uc3_surgery.csv b/inst/extdata/phems_variable_list/5.31_uc3_surgery.csv similarity index 100% rename from project/data/phems_variable_list/5.31_uc3_surgery.csv rename to inst/extdata/phems_variable_list/5.31_uc3_surgery.csv diff --git a/project/data/phems_variable_list/5.3_vis_score_medications.csv b/inst/extdata/phems_variable_list/5.3_vis_score_medications.csv similarity index 100% rename from project/data/phems_variable_list/5.3_vis_score_medications.csv rename to inst/extdata/phems_variable_list/5.3_vis_score_medications.csv diff --git a/project/data/phems_variable_list/5.4_vasopressors_inotropes.csv b/inst/extdata/phems_variable_list/5.4_vasopressors_inotropes.csv similarity index 100% rename from project/data/phems_variable_list/5.4_vasopressors_inotropes.csv rename to inst/extdata/phems_variable_list/5.4_vasopressors_inotropes.csv diff --git a/project/data/phems_variable_list/5.5_immunosuppressants.csv b/inst/extdata/phems_variable_list/5.5_immunosuppressants.csv similarity index 100% rename from project/data/phems_variable_list/5.5_immunosuppressants.csv rename to inst/extdata/phems_variable_list/5.5_immunosuppressants.csv diff --git a/project/data/phems_variable_list/5.6_antibiotic_medication.csv b/inst/extdata/phems_variable_list/5.6_antibiotic_medication.csv similarity index 100% rename from project/data/phems_variable_list/5.6_antibiotic_medication.csv rename to inst/extdata/phems_variable_list/5.6_antibiotic_medication.csv diff --git a/project/data/phems_variable_list/5.7_antifungals.csv b/inst/extdata/phems_variable_list/5.7_antifungals.csv similarity index 100% rename from project/data/phems_variable_list/5.7_antifungals.csv rename to inst/extdata/phems_variable_list/5.7_antifungals.csv diff --git a/project/data/phems_variable_list/5.8_antibiotic_resistance.csv b/inst/extdata/phems_variable_list/5.8_antibiotic_resistance.csv similarity index 100% rename from project/data/phems_variable_list/5.8_antibiotic_resistance.csv rename to inst/extdata/phems_variable_list/5.8_antibiotic_resistance.csv diff --git a/project/data/phems_variable_list/5.9_cardiac_surgery.csv b/inst/extdata/phems_variable_list/5.9_cardiac_surgery.csv similarity index 100% rename from project/data/phems_variable_list/5.9_cardiac_surgery.csv rename to inst/extdata/phems_variable_list/5.9_cardiac_surgery.csv diff --git a/inst/extdata/phems_variable_list/is_standard/5.10_cardiac_radiology.csv b/inst/extdata/phems_variable_list/is_standard/5.10_cardiac_radiology.csv new file mode 100644 index 00000000..133cfabd --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.10_cardiac_radiology.csv @@ -0,0 +1,43 @@ +concept_id,concept_name,standard_concept,sourceCode +4019824,Transesophageal echocardiography,S,US transoesophageal echocardiogram (toe) +4032404,Bronchoscopy,S,IR bronchoscopy +4065416,Exercise tolerance test,S,Exercise test (non-CPET) +4345925,Videofluoroscopy swallow,S,FL video swallow +4083106,US scan of head,S,US cranial contents +4083108,US scan of neck,S,US neck +4082979,MRI of head,S,MRI head +4093436,Ultrasonography of thorax,S,US thorax and pleural cavity +4125350,CT of head,S,CT head +4125530,US urinary tract,S,US urinary tract +44802640,MRI study for cardiac congenital anomaly,S,MRI cardiac complex congenital +4163872,Plain chest X-ray,S,XR chest +4167029,Ultrasonography of inguinal region,S,US doppler groin both +4167052,Doppler ultrasonography of kidney,S,US doppler renal both +4305221,US scan of abdomen and pelvis,S,US abdomen and pelvis/ US abdomen +4303522,US scan of diaphragm,S,US diaphragmatic region +4306317,CT angiography of coronary artery with contrast,S,CT heart with contrast/ CT cardiac angiogram coronary/ CT cardiac gated with contrast +4169275,X-ray of chest and abdomen,S,XR chest and abdomen +4322380,Insertion of peripherally inserted central catheter,S,IR PICC line insertion +4140473,Holter extended electrocardiographic recording,S,24h holter monitor +4329508,Ultrasonography of pleural cavity,S,US thorax and pleural cavity +4335392,Doppler ultrasonography of vein of lower limb,S,US doppler lower limb veins both +4203365,Epicardial echocardiography,S,Epicardial echocardiogram +4335825,Transthoracic echocardiography,S,US transthoracic echocardiogram/ us transthoracic echocardiogram (pre- admission)/ US transthoracic echocardiogram (sedated) +40482732,Insertion of tunneled venous catheter,S,IR tunnelled central venous line insertion +40489841,Doppler ultrasonography of jugular vein,S,US doppler jugular vein both +40492338,Cardiopulmonary exercise test,S,Cardiopulmonary exercise test (CPET) +40488431,Interrogation of cardiac pacemaker,S,Pacemaker/ICD interrogation (in clinic)/ pacemaker/ICD interrogation (other) +42873079,Removal of tunneled central venous catheter,S,IR tunnelled central venous line removal +4261497,Ultrasonography of abdomen,S,US abdomen and pelvis/ US abdomen +4205144,Portable electroencephalogram,S,EEG routine portable +4181917,Electroencephalogram,S,EEG routine +4264477,Diagnostic radiography of abdomen,S,XR abdomen +45764527,Electrocardiographic Holter analyzer,S,24h holter monitor +45765560,Cardiovascular monitor,S,Event monitor +4327032,CT of thorax with contrast,S,CT thorax with contrast +35622931,Doppler ultrasound,S,US doppler groin both +35622931,Doppler ultrasound,S,US doppler +44813863,Ultrasonography of vocal cord,S,US vocal cord +4312208,Contrast bronchogram,S,IR bronchogram +4235141,Check artificial pacemaker,S,Pacemaker/ICD device check - remote patient initiated +4235141,Check artificial pacemaker,S,Pacemaker/ICD device check - remote device initiated diff --git a/inst/extdata/phems_variable_list/is_standard/5.11_cardiac_los.csv b/inst/extdata/phems_variable_list/is_standard/5.11_cardiac_los.csv new file mode 100644 index 00000000..1c4e01ec --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.11_cardiac_los.csv @@ -0,0 +1,5 @@ +concept_id,concept_name,standard_concept,sourceCode +4123933,Admission to pediatric intensive care unit,S,ICU admission (start datetime and end datetime) +8715,Hospital admission,S,Total hospital admission (start datetime and end datetime) +4161811,Admission to high dependency unit,S,HDU admission (start datetime and end datetime) +36675203,Admission to pediatric cardiology department,S,Cardiology ward admission (start datetime and end datetime) diff --git a/inst/extdata/phems_variable_list/is_standard/5.12_additional.csv b/inst/extdata/phems_variable_list/is_standard/5.12_additional.csv new file mode 100644 index 00000000..0948628d --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.12_additional.csv @@ -0,0 +1,36 @@ +concept_id,concept_name,standard_concept,sourceCode +4124462,None,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" +4095105,Base deficit measurement,S,Base Excess +4123933,Admission to pediatric intensive care unit,S,Elective ICU admission +4234469,Diagnosis,S,Diagnoses +40493026,Mechanical ventilator,S,Mechanical ventilation +44803020,Primary reason for admission,S,"Reason for ICU admission: (Main reason for ICU admission is not recovery from surgery or a procedure, Recovery from a bypass cardiac procedure, recovery from a non-bypass cardiac procedure, recovery from non-cardiac procedure)" +4209008,Pupillary function,S,Pupillary reaction +260134,Croup,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" +432571,Malignant lymphoma,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" +4029498,Seizure disorder,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" +317009,Asthma,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" +201957,Necrotizing enterocolitis in fetus OR newborn,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" +43530727,Spontaneous cerebral hemorrhage,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" +29783,Severe combined immunodeficiency disease,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" +321042,Cardiac arrest,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" +4165112,Bronchiolitis,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" +443727,Diabetic ketoacidosis,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" +314383,Myocarditis,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" +4245975,Hepatic failure,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" +440207,Hypoplastic left heart syndrome,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" +42537745,Bone marrow transplant present,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" +442588,Obstructive sleep apnea syndrome,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" +4213310,Degenerative disease of the central nervous system,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" +321319,Cardiomyopathy,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" +317510,Leukemia,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" +44777602,kilopascal,S,PaCO2 +9202,Outpatient Visit,S,"Outpatient appointments start datetime, end datetime" +8554,percent,S,FiO2 +8876,millimeter mercury column,S,Systolic blood pressure +8876,millimeter mercury column,S,PaCO2 +8753,millimole per liter,S,Base Excess +5083,Telehealth,S,Outpatient appointment type (telephone/ clinic visit etc.) +42869590,Oxygen/Gas total [Pure volume fraction] Inhaled gas,S,FiO2 +3027946,Carbon dioxide [Partial pressure] in Arterial blood,S,PaCO2 +3004249,Systolic blood pressure,S,Systolic blood pressure diff --git a/inst/extdata/phems_variable_list/is_standard/5.13_laboratory_tests.csv b/inst/extdata/phems_variable_list/is_standard/5.13_laboratory_tests.csv new file mode 100644 index 00000000..b3cf6426 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.13_laboratory_tests.csv @@ -0,0 +1,61 @@ +concept_id,concept_name,standard_concept,sourceCode +37399161,Blood arterial pH,S,pH (arterial) +37392672,Blood venous pH,S,pH (venous) +4267147,Platelet count,S,Platelet count +4298431,White blood cell count,S,Immature WBC count +8713,gram per deciliter,S,Hemoglobin +8713,gram per deciliter,S,Albumin +8636,gram per liter,S,Hemoglobin +8636,gram per liter,S,Albumin +44777602,kilopascal,S,pCO2 (venous) +8751,milligram per liter,S,CRP +8554,percent,S,Hematocrit +8840,milligram per deciliter,S,Creatinine +8876,millimeter mercury column,S,pCO2 (venous) +8876,millimeter mercury column,S,pCO2 (arterial) +8876,millimeter mercury column,S,pO2 (venous) +8876,millimeter mercury column,S,pO2 (arterial) +8753,millimole per liter,S,Lactate +8753,millimole per liter,S,Blood urea nitrogen +8753,millimole per liter,S,Glucose +8753,millimole per liter,S,Sodium +8753,millimole per liter,S,Potassium +8753,millimole per liter,S,Magnesium +8753,millimole per liter,S,Chloride +8753,millimole per liter,S,Calcium +8753,millimole per liter,S,Phosphate +8753,millimole per liter,S,Bicarbonate (venous) +8753,millimole per liter,S,Bicarbonate (arterial) +8555,second,S,INR prothrombin time +8647,per microliter,S,Immature WBC count +8647,per microliter,S,Neutrophil count +8647,per microliter,S,Platelet count +8645,unit per liter,S,ALT +8645,unit per liter,S,AST +8749,micromole per liter,S,Creatinine +8749,micromole per liter,S,Bilirubin +3005456,Potassium [Moles/volume] in Blood,S,Potassium +3018572,Chloride [Moles/volume] in Blood,S,Chloride +3051825,Creatinine [Mass/volume] in Blood,S,Creatinine +3027273,Bicarbonate [Moles/volume] in Venous blood,S,Bicarbonate (venous) +3006140,Bilirubin.total [Moles/volume] in Serum or Plasma,S,Bilirubin +3013826,Glucose [Moles/volume] in Serum or Plasma,S,Glucose +3003458,Phosphate [Moles/volume] in Serum or Plasma,S,Phosphate +3024641,Urea nitrogen [Moles/volume] in Serum or Plasma,S,Blood urea nitrogen +3006923,Alanine aminotransferase [Enzymatic activity/volume] in Serum or Plasma,S,ALT +3024561,Albumin [Mass/volume] in Serum or Plasma,S,Albumin +3013721,Aspartate aminotransferase [Enzymatic activity/volume] in Serum or Plasma,S,AST +3008152,Bicarbonate [Moles/volume] in Arterial blood,S,Bicarbonate (arterial) +3020460,C reactive protein [Mass/volume] in Serum or Plasma,S,CRP +3015377,Calcium [Moles/volume] in Serum or Plasma,S,Calcium +3027946,Carbon dioxide [Partial pressure] in Arterial blood,S,pCO2 (arterial) +3021447,Carbon dioxide [Partial pressure] in Venous blood,S,pCO2 (venous) +3009542,Hematocrit [Volume Fraction] of Blood,S,Hematocrit +3033836,Magnesium [Moles/volume] in Blood,S,Magnesium +3027801,Oxygen [Partial pressure] in Arterial blood,S,pO2 (arterial) +3024354,Oxygen [Partial pressure] in Venous blood,S,pO2 (venous) +3019550,Sodium [Moles/volume] in Serum or Plasma,S,Sodium +3047181,Lactate [Moles/volume] in Blood,S,Lactate +3007670,Neutrophil Ab [Units/volume] in Serum,S,Neutrophil count +3034426,Prothrombin time (PT),S,INR prothrombin time +40762351,Hemoglobin [Moles/volume] in Blood,S,Hemoglobin diff --git a/inst/extdata/phems_variable_list/is_standard/5.14_cardiac_complications.csv b/inst/extdata/phems_variable_list/is_standard/5.14_cardiac_complications.csv new file mode 100644 index 00000000..da4a9fc2 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.14_cardiac_complications.csv @@ -0,0 +1,13 @@ +concept_id,concept_name,standard_concept,sourceCode +4051330,Continuous venovenous hemofiltration,S,LCOS - renal support (CVVH/ PD) +4123933,Admission to pediatric intensive care unit,S,ICU ward stay +4295705,Exploratory incision,S,Surgical injury - Reexplore for bleeding +377091,Seizure,S,Neurological injury - seizure +439847,Intracranial hemorrhage,S,Neurological injury - intracranial haemmhorage/ intracranial bleeding +4308537,Injury to blood vessel during surgery,S,Surgical injury - Blood Loss +321042,Cardiac arrest,S,LCOS - Cardiac arrest +443454,Cerebral infarction,S,Neurological injury - infarction +4185565,Low cardiac output syndrome,S,Low cardiac output state (LCOS) - ECMO +4185565,Low cardiac output syndrome,S,LCOS - NEC requiring treatment +42537043,CLABSI - central line associated bloodstream infection,S,CVL infections +4306136,Chylothorax,S,Surgical injury - Chylothorax diff --git a/inst/extdata/phems_variable_list/is_standard/5.15_vital_signs.csv b/inst/extdata/phems_variable_list/is_standard/5.15_vital_signs.csv new file mode 100644 index 00000000..e44116e2 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.15_vital_signs.csv @@ -0,0 +1,11 @@ +concept_id,concept_name,standard_concept,sourceCode +4096101,Measurement of oxygen saturation at periphery,S,SpO2 +8483,counts per minute,S,Age-dependent HR +8483,counts per minute,S,Age-dependent RR +8554,percent,S,SpO2 +8876,millimeter mercury column,S,SBP (Systolic Blood Pressure) +8876,millimeter mercury column,S,DBP (Dyastolic Blood Pressure) +3027018,Heart rate,S,Age-dependent HR +3012888,Diastolic blood pressure,S,DBP (Dyastolic Blood Pressure) +3004249,Systolic blood pressure,S,SBP (Systolic Blood Pressure) +3024171,Respiratory rate,S,Age-dependent RR diff --git a/inst/extdata/phems_variable_list/is_standard/5.16_hsjd_clinical.csv b/inst/extdata/phems_variable_list/is_standard/5.16_hsjd_clinical.csv new file mode 100644 index 00000000..86440027 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.16_hsjd_clinical.csv @@ -0,0 +1,9 @@ +concept_id,concept_name,standard_concept,sourceCode +4201235,Body surface area,S,Body Surface Area (BSA) - Combination of weight and height +4275564,Operation on heart,S,Cardiac surgeries (Interventions) +8582,centimeter,S,Height +9529,kilogram,S,Weight +8617,square meter,S,Body Surface Area (BSA) - Combination of weight and height +3025315,Body weight,S,Weight +3036277,Body height,S,Height +0,No matching concept,NA,Extracardiac anomalies - diagnoses diff --git a/inst/extdata/phems_variable_list/is_standard/5.17_hsjd_surgery.csv b/inst/extdata/phems_variable_list/is_standard/5.17_hsjd_surgery.csv new file mode 100644 index 00000000..2b0734ad --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.17_hsjd_surgery.csv @@ -0,0 +1,9 @@ +concept_id,concept_name,standard_concept,sourceCode +44790138,Induced circulatory arrest,S,"Deep hypothermic circulatory arrest start datetime, end datetime" +4336464,Coronary artery bypass graft,S,"Cardiac bypass start datetime, end datetime" +4150627,Removal of endotracheal tube,S,Extubation event +4201547,Placement of arterial cross clamp,S,"Cross-clamping start datetime, end datetime" +4301351,Surgical procedure,S,"Surgery start datetime, end datetime" +40490494,Society of Thoracic Surgeons risk calculator,S,STAT/EACTS score of surgery +4272324,Cardiopulmonary bypass operation,S,"Antegrade Cerebral Perfusion start datetime, end datetime" +0,No matching concept,NA,Aristotle's score of surgery diff --git a/inst/extdata/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv b/inst/extdata/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv new file mode 100644 index 00000000..db64d22f --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv @@ -0,0 +1,11 @@ +concept_id,concept_name,standard_concept,sourceCode +37158404,Invasive mechanical ventilation,S,Invasive Mechanical Ventilation LOS +4177224,Non-invasive ventilation,S,Non-Invasive Mechanical Ventilation LOS +44803020,Primary reason for admission,S,Admission reason +4179206,Central venous catheter,S,"Postop central venous catheter in/start datetime, out/ end datetime" +42539650,Administration of intravenous vasoactive drug,S,"Vasoactive infusion start datetime, end datetime" +0,No matching concept,NA,ventilation +0,No matching concept,NA,Type of vasoactive infusion +0,No matching concept,NA,VIS score of vasoactive infusion +0,No matching concept,NA,"Total ventilation start datetime, end datetime" +794078,vasoactive intestinal peptide,S,Dose of vasoactive infusion (rate - mcg/kg/hr) diff --git a/inst/extdata/phems_variable_list/is_standard/5.19_hsjd_complication.csv b/inst/extdata/phems_variable_list/is_standard/5.19_hsjd_complication.csv new file mode 100644 index 00000000..99ee99f5 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.19_hsjd_complication.csv @@ -0,0 +1,21 @@ +concept_id,concept_name,standard_concept,sourceCode +4044892,Procedure on sternum,S,Sternum reopening (procedure undertaken) +4046868,Vocal cord dysfunction,S,Vocal Cord Dysfunction +4049398,Temporary cardiac pacemaker procedure,S,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" +4051940,Permanent cardiac pacemaker procedure,S,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" +4353741,Cardioversion,S,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" +4117045,Atrial overdrive pacing,S,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" +253796,Pneumothorax,S,Pneumothorax +609312,Awaiting transplantation of heart,S,Listed for heart transplantation +4202832,Intubation,S,intubation +315643,Tachyarrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" +4275564,Operation on heart,S,Cardiac surgeries (interventions) +44783799,Exteriorization of trachea,S,Tracheostomy +44784217,Cardiac arrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" +4068155,Atrial arrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" +4228448,Bradyarrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" +4185572,Ventricular arrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" +4275136,Paralysis of diaphragm,S,Diaphragmatic Paralysis +46234437,ivabradine,S,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" +1354860,flecainide,S,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" +1309944,amiodarone,S,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" diff --git a/inst/extdata/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv b/inst/extdata/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv new file mode 100644 index 00000000..0bb6e4c3 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv @@ -0,0 +1,87 @@ +concept_id,concept_name,standard_concept,sourceCode +37174269,At increased risk of sepsis,S,Diagnosis of acute infection having the potential for progression to sepsis1+2 +4032243,Dialysis procedure,S,Dialysis +197320,Acute kidney injury,S,acute kidney injury +4074689,Open drainage of pleural cavity,S,"Chest opening, chest drainage" +4084670,Non-urgent surgical admission,S,Surgical admission (non-urgent) +4070667,Urinary catheter,S,Urinary catheter +44790095,Invasive ventilation,S,Invasive ventilation +4052536,Extracorporeal membrane oxygenation,S,ECMO +4051330,Continuous venovenous hemofiltration,S,Dialysis +44790567,Patient transfer from hospital to hospital,S,Origin (external) +133327,Viremia,S,viremia +4097216,Endotracheal tube,S,Endotracheal tube +4085730,Antibiotic therapy,S,Antibiotics +4123946,Admission to surgical department,S,Surgical admission (urgent) +4208341,Solid organ transplant,S,organ transplant +4193843,Oxygenation index measurement,S,Oxygenation index +4235043,Ventricular assist device,S,Ventricular assist device (VAD) +443392,Malignant neoplastic disease,S,Cancer +4181511,Administration of antineoplastic agent,S,Antineoplastics +4294886,"Patient transfer, in-hospital",S,Origin (internal) +4301351,Surgical procedure,S,Surgery previous to prediction time point +4140762,Antiviral therapy,S,Antivirals +4177205,Cannulation,S,Peripheral IV cannulas +4177224,Non-invasive ventilation,S,Non-invasive ventilation +45758028,Arterial blood pressure catheter,S,Arterial blood pressure catheter +44803020,Primary reason for admission,S,Reason for admission +4179206,Central venous catheter,S,Central venous catheter +132736,Bacteremia,S,bacteremia +44783799,Exteriorization of trachea,S,Tracheostomy +45768671,Asplenia,S,asplenia +4324124,Peritoneal dialysis,S,Peritoneal dialysis +435785,Meningitis,S,meningitis +201820,Diabetes mellitus,S,Diagnosis of chronic condition +42538045,Nasogastric/orogastric tube stylet,S,Nasogastric/orogastric tube +37206601,Venoarterial extracorporeal membrane oxygenation,S,ECMO type +37206603,Venovenous extracorporeal membrane oxygenation,S,ECMO type +4314777,Immunosuppressive therapy,S,Immunosuppressors +604243,Acquired neutropenia,S,neutropenia +444187,Open wound,S,injury with open wound +22281,Sickle cell-hemoglobin SS disease,S,sickle cell disease +435613,Cellulitis,S,cellulitis +4134120,Cerebral palsy,S,cerebral palsy +444202,Abscess,S,Abcess +312723,Congenital heart disease,S,Diagnosis of chronic condition +255573,Chronic obstructive lung disease,S,Diagnosis of chronic condition +255848,Pneumonia,S,pneumonia +433740,Immunodeficiency disorder,S,immunodeficiency +4080011,Organ dysfunction syndrome,S,Diagnosis of organ system dysfunction +434821,Systemic inflammatory response syndrome,S,Diagnosis of SIRS +81539,Mitochondrial cytopathy,S,mitochondrial disease +4103588,Acute tuberculosis,S,tuberculosis +443783,Chronic disease,S,Diagnosis of chronic condition +4140977,Secondary immune deficiency disorder,S,Diagnosis of condition producing immunodeficiency +201606,Crohn's disease,S,Crohn's disease +4243475,Acute hepatitis,S,hepatitis +4300243,Postoperative complication,S,surgical site inflammation +439125,Complete trisomy 21 syndrome,S,Down's syndrome +321042,Cardiac arrest,S,cardiac arrest +4331815,Acute urinary tract infection,S,UTI +195212,Hypercortisolism,S,Cushing's disease +196152,Peritonitis,S,peritonitis +314383,Myocarditis,S,miocarditis +195314,Nephrotic syndrome,S,nephrotic syndrome +441589,Endocarditis,S,endocarditis +4271450,Acute infectious disease,S,Diagnosis of acute infection having the potential for progression to sepsis1+2 +81893,Ulcerative colitis,S,ulcerative colitis +80809,Rheumatoid arthritis,S,rheumatoid arthritis +4322814,Meningoencephalitis,S,Meningo-encephalitis +36716945,Renal insufficiency,S,renal insufficiency +440448,Appendicitis,S,appendicitis +433968,Candidiasis,S,candidiasis +44807226,Necrotising enterocolitis,S,necrotizing enterocolitis +132797,Sepsis,S,Previous diagnosis of sepsis measure +44777590,centimeter watercolumn,S,Mean Airway Pressure (MAP) +44777602,kilopascal,S,Mean Airway Pressure (MAP) +8510,unit,S,FiO2 +8554,percent,S,FiO2 +720868,fraction,S,FiO2 +8529,index,S,Oxygenation index +8876,millimeter mercury column,S,Mean Airway Pressure (MAP) +21602722,CORTICOSTEROIDS FOR SYSTEMIC USE,C,Corticoids +42869590,Oxygen/Gas total [Pure volume fraction] Inhaled gas,S,FiO2 +42527086,Mean airway pressure,S,Mean Airway Pressure (MAP) +0,No matching concept,NA,Non-surgical admission +0,No matching concept,NA,Oxygenation index +1340204,History of event,S,Previous diagnosis of sepsis measure diff --git a/inst/extdata/phems_variable_list/is_standard/5.22_vital_signs.csv b/inst/extdata/phems_variable_list/is_standard/5.22_vital_signs.csv new file mode 100644 index 00000000..a7b3fb88 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.22_vital_signs.csv @@ -0,0 +1,21 @@ +concept_id,concept_name,standard_concept,sourceCode +4096101,Measurement of oxygen saturation at periphery,S,SpO2 +8483,counts per minute,S,HR +8483,counts per minute,S,RR +9529,kilogram,S,Weight +8554,percent,S,SpO2 +586323,degree Celsius,S,Body temperature +8504,gram,S,Weight +8587,milliliter,S,Urine output +44777613,milliliter per hour,S,Urine output +33014,milliliter per kilogram per 24 hours,S,Urine output +8876,millimeter mercury column,S,SBP (Systolic Blood Pressure) +8876,millimeter mercury column,S,DBP (Diastolic blood pressure) +3025315,Body weight,S,Weight +3020891,Body temperature,S,Body temperature +3012888,Diastolic blood pressure,S,DBP (Diastolic blood pressure) +3004249,Systolic blood pressure,S,SBP (Systolic Blood Pressure) +3014315,Urine output,S,Urine output +3024171,Respiratory rate,S,RR +1004025,Heart rate,C,HR +0,No matching concept,NA,Urine output diff --git a/inst/extdata/phems_variable_list/is_standard/5.23_physical_examination_signs.csv b/inst/extdata/phems_variable_list/is_standard/5.23_physical_examination_signs.csv new file mode 100644 index 00000000..a66fcfeb --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.23_physical_examination_signs.csv @@ -0,0 +1,36 @@ +concept_id,concept_name,standard_concept,sourceCode +4069590,Normal,S,Pupillary reactivity (right) +4069590,Normal,S,Pupillary reactivity (left) +4116857,Medium,S,Pupillary size (right) +4116857,Medium,S,Pupillary size (left) +4124461,Weak,S,Peripheral pulse (pressure) +4124461,Weak,S,Central pulse +4132135,Absent,S,Peripheral pulse (pressure) +4132135,Absent,S,Central pulse +4188539,Yes,S,Pupillary reactivity (right) +4188539,Yes,S,Pupillary reactivity (left) +4188540,No,S,Pupillary reactivity (right) +4188540,No,S,Pupillary reactivity (left) +4181412,Present,S,Peripheral pulse (pressure) +4181412,Present,S,Central pulse +4224504,Pulse,S,Central pulse +4314539,Arterial pulse pressure,S,Peripheral pulse (pressure) +8483,counts per minute,S,Peripheral pulse (pressure) +8483,counts per minute,S,Central pulse +8588,millimeter,S,Pupillary size (right) +8588,millimeter,S,Pupillary size (left) +8555,second,S,Capillary refill time +21490963,Right pupil Pupillary response,S,Pupillary reactivity (right) +45879546,Sluggish,S,Pupillary reactivity (right) +45879546,Sluggish,S,Pupillary reactivity (left) +21499034,Dilated,S,Pupillary size (right) +21499034,Dilated,S,Pupillary size (left) +36310446,Constricted,S,Pupillary size (right) +36310446,Constricted,S,Pupillary size (left) +45880051,Unresponsive,S,Pupillary reactivity (right) +45880051,Unresponsive,S,Pupillary reactivity (left) +3032652,Glasgow coma scale,S,GCS +3045676,Capillary refill [Time],S,Capillary refill time +21491763,Left pupil Pupillary response,S,Pupillary reactivity (left) +3021415,Left pupil Diameter Auto,S,Pupillary size (left) +3027214,Right pupil Diameter Auto,S,Pupillary size (right) diff --git a/inst/extdata/phems_variable_list/is_standard/5.24_laboratory_test_results_uc2.csv b/inst/extdata/phems_variable_list/is_standard/5.24_laboratory_test_results_uc2.csv new file mode 100644 index 00000000..a323de0e --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.24_laboratory_test_results_uc2.csv @@ -0,0 +1,41 @@ +concept_id,concept_name,standard_concept,sourceCode +37393605,D-dimer level,S,D-dimer +4017361,Blood urea nitrogen measurement,S,Blood urea nitrogen +4036356,Detection of bacteria,S,Bacterial pathogen detection +44789220,Ionised calcium measurement,S,Ionized calcium +4094436,Fibrinogen measurement,S,Fibrinogen +4118986,Bilirubin measurement,S,Direct bilirubin +4196268,Polymerase chain reaction observation,S,PCR panel +4196268,Polymerase chain reaction observation,S,PCR panel +440029,Viral disease,S,Viral pathogen detection +4212899,Total white blood count,S,Leukocytes +4175016,"Partial thromboplastin time, activated",S,Thromboplastin time +42536081,Adrenal medulla hormone,S,MR-proADM +4299649,Quantitative microbial culture and measurement,S,Quantification of colonies in culture +44806682,Infection resistant to multiple antibiotics,S,Antibiotic resistance +432545,Bacterial infectious disease,S,Name of bacterial pathogen detected +8636,gram per liter,S,Fibrinogen +8751,milligram per liter,S,D-dimer +8845,picogram per milliliter,S,Interleukin-6 +9278,colony forming unit,S,Quantification of colonies in culture +9278,colony forming unit,S,Leukocytes +8840,milligram per deciliter,S,Blood urea nitrogen +8840,milligram per deciliter,S,Glucose +8840,milligram per deciliter,S,Direct bilirubin +8753,millimole per liter,S,D-dimer +8753,millimole per liter,S,Fibrinogen +8753,millimole per liter,S,Blood urea nitrogen +8753,millimole per liter,S,Glucose +8753,millimole per liter,S,Direct bilirubin +8753,millimole per liter,S,Ionized calcium +8725,nanogram per liter,S,PCT +8842,nanogram per milliliter,S,PCT +8736,nanomole per liter,S,MR-proADM +8523,ratio,S,Thromboplastin time +8555,second,S,Thromboplastin time +8748,microgram per liter,S,PCT +8749,micromole per liter,S,Direct bilirubin +3013826,Glucose [Moles/volume] in Serum or Plasma,S,Glucose +3046279,Procalcitonin [Mass/volume] in Serum or Plasma,S,PCT +3033291,Interleukin 6 [Mass/volume] in Body fluid,S,Interleukin-6 +0,No matching concept,NA,Leukocytes diff --git a/inst/extdata/phems_variable_list/is_standard/5.25_arterial_blood_gas.csv b/inst/extdata/phems_variable_list/is_standard/5.25_arterial_blood_gas.csv new file mode 100644 index 00000000..f2107887 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.25_arterial_blood_gas.csv @@ -0,0 +1,12 @@ +concept_id,concept_name,standard_concept,sourceCode +44777602,kilopascal,S,pCO2 +44777602,kilopascal,S,PaO2 +8876,millimeter mercury column,S,pCO2 +8876,millimeter mercury column,S,PaO2 +8753,millimole per liter,S,HCO3 +8753,millimole per liter,S,Base excess +3003396,Base excess in Arterial blood by calculation,S,Base excess +3019977,pH of Arterial blood,S,pH +3008152,Bicarbonate [Moles/volume] in Arterial blood,S,HCO3 +3027946,Carbon dioxide [Partial pressure] in Arterial blood,S,pCO2 +3027801,Oxygen [Partial pressure] in Arterial blood,S,PaO2 diff --git a/inst/extdata/phems_variable_list/is_standard/5.26_venous_blood_gas.csv b/inst/extdata/phems_variable_list/is_standard/5.26_venous_blood_gas.csv new file mode 100644 index 00000000..24d44bb9 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.26_venous_blood_gas.csv @@ -0,0 +1,17 @@ +concept_id,concept_name,standard_concept,sourceCode +44777602,kilopascal,S,pCO2 +44777602,kilopascal,S,PaO2 +8876,millimeter mercury column,S,pCO2 +8876,millimeter mercury column,S,PaO2 +8753,millimole per liter,S,HCO3 +8753,millimole per liter,S,Base excess +3009343,pH of Capillary blood,S,pH +3027273,Bicarbonate [Moles/volume] in Venous blood,S,HCO3 +3003129,Base excess in Capillary blood by calculation,S,Base excess +3002032,Base excess in Venous blood by calculation,S,Base excess +3015235,Bicarbonate [Moles/volume] in Capillary blood,S,HCO3 +3023024,Carbon dioxide [Partial pressure] in Capillary blood,S,pCO2 +3021447,Carbon dioxide [Partial pressure] in Venous blood,S,pCO2 +3028626,Oxygen [Partial pressure] in Capillary blood,S,PaO2 +3024354,Oxygen [Partial pressure] in Venous blood,S,PaO2 +3012544,pH of Venous blood,S,pH diff --git a/inst/extdata/phems_variable_list/is_standard/5.28_patient_characteristics.csv b/inst/extdata/phems_variable_list/is_standard/5.28_patient_characteristics.csv new file mode 100644 index 00000000..0a307ec2 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.28_patient_characteristics.csv @@ -0,0 +1,15 @@ +concept_id,concept_name,standard_concept,sourceCode +37393608,Factor VIII inhibitor activity,S,factor VIII inhibitor status +4126681,Detected,S,factor VIII inhibitor status +9190,Not detected,S,factor VIII inhibitor status +4056830,Severe hereditary factor VIII deficiency disease,S,hemophilia A subtype/ severity +4094223,Mild hereditary factor VIII deficiency disease,S,hemophilia A subtype/ severity +434007,Hereditary factor VIII deficiency disease,S,hemophilia A diagnosis +4140661,Moderate hereditary factor VIII deficiency disease,S,hemophilia A subtype/ severity +8582,centimeter,S,height +9529,kilogram,S,body weight +8504,gram,S,body weight +9546,meter,S,height +3025315,Body weight,S,body weight +3036277,Body height,S,height +3003694,ABO and Rh group [Type] in Blood,S,blood group diff --git a/inst/extdata/phems_variable_list/is_standard/5.29_lab_measurements_uc3.csv b/inst/extdata/phems_variable_list/is_standard/5.29_lab_measurements_uc3.csv new file mode 100644 index 00000000..f5b3ed55 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.29_lab_measurements_uc3.csv @@ -0,0 +1,37 @@ +concept_id,concept_name,standard_concept,sourceCode +4175016,"Partial thromboplastin time, activated",S,activated partial thromboplastin time (APTT) +4267147,Platelet count,S,platelet count +8636,gram per liter,S,fibrinogen +44777604,liter per liter,S,hematocrit +8554,percent,S,factor VIII activity measurement +8554,percent,S,Von Willebrand factor activity measurement +8554,percent,S,Von Willebrand factor antigen measurement +8554,percent,S,Prothrombin time (PT) +8554,percent,S,hematocrit +44777588,billion cells per liter,S,platelet count +44777562,Bethesda unit per milliliter,S,factor VIII inhibitor titer +9332,international unit per deciliter,S,factor VIII activity measurement +9332,international unit per deciliter,S,Von Willebrand factor activity measurement +9332,international unit per deciliter,S,Von Willebrand factor antigen measurement +8985,international unit per milliliter,S,factor VIII activity measurement +8985,international unit per milliliter,S,Von Willebrand factor activity measurement +8985,international unit per milliliter,S,Von Willebrand factor antigen measurement +8523,ratio,S,activated partial thromboplastin time (APTT) +8523,ratio,S,Prothrombin time (PT) +8555,second,S,activated partial thromboplastin time (APTT) +8555,second,S,Prothrombin time (PT) +8645,unit per liter,S,ALT +8645,unit per liter,S,AST +8763,unit per milliliter,S,Von Willebrand factor propeptide measurement +3024942,Coagulation factor VIII inhibitor [Units/volume] in Platelet poor plasma by Coagulation assay,S,factor VIII inhibitor titer +3011832,Coagulation factor VIII activity [Units/volume] in Platelet poor plasma by Chromogenic method,S,factor VIII activity measurement +3006923,Alanine aminotransferase [Enzymatic activity/volume] in Serum or Plasma,S,ALT +3013721,Aspartate aminotransferase [Enzymatic activity/volume] in Serum or Plasma,S,AST +3009542,Hematocrit [Volume Fraction] of Blood,S,hematocrit +3022520,Coagulation factor VIII activated [Units/volume] in Platelet poor plasma by Coagulation assay,S,factor VIII activity measurement +3016407,Fibrinogen [Mass/volume] in Platelet poor plasma by Coagulation assay,S,fibrinogen +3042349,von Willebrand factor (vWf) cleaving protease inhibitor [Units/volume] in Platelet poor plasma,S,Von Willebrand factor propeptide measurement +3034426,Prothrombin time (PT),S,Prothrombin time (PT) +3002124,von Willebrand factor (vWf) Ag [Units/volume] in Platelet poor plasma by Immunoassay,S,Von Willebrand factor antigen measurement +3023693,von Willebrand factor (vWf) multimers in Platelet poor plasma by Immunoblot,S,Von Willebrand factor propeptide measurement +43534000,von Willebrand factor (vWf).activity [Units/volume] in Platelet poor plasma by Immunoassay,S,Von Willebrand factor activity measurement diff --git a/inst/extdata/phems_variable_list/is_standard/5.30_treatments.csv b/inst/extdata/phems_variable_list/is_standard/5.30_treatments.csv new file mode 100644 index 00000000..4bbe00a5 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.30_treatments.csv @@ -0,0 +1,13 @@ +concept_id,concept_name,standard_concept,sourceCode +4129275,Continuous infusion,S,factor VIII dose is continuous infusion or bolus dose +4265597,Single bolus,S,factor VIII dose is continuous infusion or bolus dose +40492862,Method of drug administration,S,factor VIII dose is continuous infusion or bolus dose +9655,microgram,S,desmopressin +8985,international unit per milliliter,S,factor VIII +8576,milligram,S,desmopressin +9662,microgram per kilogram,S,desmopressin +1517070,desmopressin,S,desmopressin +21154209,Factor VIII 2000 UNT Injection [Kogenate Bayer],S,factor VIII +35766745,Factor VIII 250 UNT Injection [Advate],S,factor VIII +40745282,emicizumab 150 MG/ML Injectable Solution [Hemlibra],S,factor VIII +35831239,factor VII 250 UNT Injection [Eloctate],S,factor VIII diff --git a/inst/extdata/phems_variable_list/is_standard/5.31_surgery_specific_parameters.csv b/inst/extdata/phems_variable_list/is_standard/5.31_surgery_specific_parameters.csv new file mode 100644 index 00000000..60a64e1a --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.31_surgery_specific_parameters.csv @@ -0,0 +1,5 @@ +concept_id,concept_name,standard_concept,sourceCode +4028665,Transfusion of plasma,S,plasma administration during surgery +4308716,Intraoperative hemorrhage,S,blood loss during surgery +37017589,Bleeding during surgery requiring transfusion,S,blood transfusion during surgery +967823,sodium chloride,S,NaCl administration during surgery diff --git a/inst/extdata/phems_variable_list/is_standard/5.3_vis_score_medications.csv b/inst/extdata/phems_variable_list/is_standard/5.3_vis_score_medications.csv new file mode 100644 index 00000000..6671e328 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.3_vis_score_medications.csv @@ -0,0 +1,7 @@ +concept_id,concept_name,standard_concept,sourceCode +1507835,vasopressin (USP),S,vasopressin +1337720,dobutamine,S,dobutamine +1337860,dopamine,S,dopamine +1343916,epinephrine,S,epinephrine +1368671,milrinone,S,milrinone +1321341,norepinephrine,S,norepinephrin diff --git a/inst/extdata/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv b/inst/extdata/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv new file mode 100644 index 00000000..2cf1ddc7 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv @@ -0,0 +1,12 @@ +concept_id,concept_name,standard_concept,sourceCode +1507835,vasopressin (USP),S,Vasopressin +1337720,dobutamine,S,Dobutamine +1337860,dopamine,S,Dopamine +1143374,ephedrine,S,Ephedrine +1343916,epinephrine,S,Epinephrine +1368671,milrinone,S,Milrinone +19119253,terlipressin,S,Terlipressin +1183554,isoproterenol,S,Isoproterenol +40173184,levosimendan,S,Levosimendan +1321341,norepinephrine,S,Norepinephrine +1135766,phenylephrine,S,Phenylephrine diff --git a/inst/extdata/phems_variable_list/is_standard/5.5_immunosuppressants.csv b/inst/extdata/phems_variable_list/is_standard/5.5_immunosuppressants.csv new file mode 100644 index 00000000..bc826410 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.5_immunosuppressants.csv @@ -0,0 +1,7 @@ +concept_id,concept_name,standard_concept,sourceCode +4273629,Chemotherapy,S,Chemotherapy +21603754,Monoclonal antibodies,C,Monoclonal Antibodies +1518254,dexamethasone,S,Dexamethasone +975125,hydrocortisone,S,Hydrocortisone +1506270,methylprednisolone,S,Methylprednisolone +1550557,prednisolone,S,Prednisolone diff --git a/inst/extdata/phems_variable_list/is_standard/5.6_antibiotic_medication.csv b/inst/extdata/phems_variable_list/is_standard/5.6_antibiotic_medication.csv new file mode 100644 index 00000000..d589492b --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.6_antibiotic_medication.csv @@ -0,0 +1,51 @@ +concept_id,concept_name,standard_concept,sourceCode +4273629,Chemotherapy,S,Chemotherapy +21603754,Monoclonal antibodies,C,Monoclonal Antibodies +1836430,sulfamethoxazole,S,Trimethoprim-Sulfamethoxazole +1836948,tetracycline,S,Tetracycline +902722,tobramycin,S,Tobramycin +1705674,trimethoprim,S,Trimethoprim-Sulfamethoxazole +1707687,vancomycin,S,Vancomycin +19010400,fusidate,S,Fusidic acid +45892419,gentamicin,S,Gentamicin +45892599,ceftolozane,S,Ceftolozane-Tazovactam +46221507,avibactam,S,Ceftazidime-Avibactam +1734104,azithromycin,S,Azithromycin +1736887,linezolid,S,Linezolid +1748975,cefepime,S,Cefepime +1750500,clarithromycin,S,Clarithromycin +1769535,cefadroxil,S,Cefadroxil +1771162,cefazolin,S,Cefazolin +1774470,cefotaxime,S,Cefotaxime +1776684,ceftazidime,S,Ceftazidime +1776684,ceftazidime,S,Ceftazidime-Avibactam +1778162,cefuroxime,S,Cefuroxime +1786617,daptomycin,S,Daptomycin +1797513,ciprofloxacin,S,Ciprofloxacin +997881,clindamycin,S,Clindamycin +901845,colistin,S,Colistin +1709170,meropenem,S,Meropenem +1717963,ertapenem,S,Ertapenem +1518254,dexamethasone,S,Dexamethasone +1741122,tazobactam,S,Piperacillin-Tazobactam +1741122,tazobactam,S,Ceftolozane-Tazovactam +1746940,erythromycin,S,Erythromycin +951511,mupirocin,S,Mupirocin +956653,fosfomycin,S,Fosfomycin +1759842,clavulanate,S,Amoxicillin clavulanate +975125,hydrocortisone,S,Hydrocortisone +1778262,imipenem,S,Imipenem +19078399,teicoplanin,S,Teicoplanin +1790868,amikacin,S,Amikacin +1506270,methylprednisolone,S,Methylprednisolone +1713332,amoxicillin,S,Amoxicillin clavulanate +1713332,amoxicillin,S,Amoxicillin +1717327,ampicillin,S,Ampicillin +920293,nitrofurantoin,S,Nitrofurantoin +1721543,norfloxacin,S,Norfloxacin +1724703,oxacillin,S,Oxacillin +1728416,penicillin G,S,Penicillin +1742253,levofloxacin,S,Levofloxacin +1746114,piperacillin,S,Piperacillin-Tazobactam +1550557,prednisolone,S,Prednisolone +1763204,rifampin,S,Rifampicin diff --git a/inst/extdata/phems_variable_list/is_standard/5.7_antifungals.csv b/inst/extdata/phems_variable_list/is_standard/5.7_antifungals.csv new file mode 100644 index 00000000..4dc0c783 --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.7_antifungals.csv @@ -0,0 +1,6 @@ +concept_id,concept_name,standard_concept,sourceCode +1714277,voriconazole,S,Voriconazole +35606695,isavuconazole,S,Isovuconazole +19018013,micafungin,S,Micafungin +19026450,anidulafungin,S,Andiulafungin +1754994,fluconazole,S,Fluconazole diff --git a/inst/extdata/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv b/inst/extdata/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv new file mode 100644 index 00000000..d36affad --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv @@ -0,0 +1,11 @@ +concept_id,concept_name,standard_concept,sourceCode +4019195,Methicillin resistant Staphylococcus aureus,S,MRSA +4257547,Extended spectrum beta-lactamase producing bacteria,S,ESBL +37017134,Multidrug-resistant bacteria,S,Drug-resistant +37017134,Multidrug-resistant bacteria,S,Multidrug-resistant +37017134,Multidrug-resistant bacteria,S,Clindamycin-resistant +37017134,Multidrug-resistant bacteria,S,Vancomycin-resistant +37017134,Multidrug-resistant bacteria,S,Erythromycin-resistant +1707687,vancomycin,S,Vancomycin-resistant +997881,clindamycin,S,Clindamycin-resistant +1746940,erythromycin,S,Erythromycin-resistant diff --git a/inst/extdata/phems_variable_list/is_standard/5.9_cardiac_surgery.csv b/inst/extdata/phems_variable_list/is_standard/5.9_cardiac_surgery.csv new file mode 100644 index 00000000..e50f982c --- /dev/null +++ b/inst/extdata/phems_variable_list/is_standard/5.9_cardiac_surgery.csv @@ -0,0 +1,42 @@ +concept_id,concept_name,standard_concept,sourceCode +4049734,Banding of pulmonary artery,S,Application of band to pulmonary artery +4019929,Repair of tetralogy of Fallot,S,Unspecified repair of tetralogy of fallot +4019932,Arterial switch operation,S,Repositioning of transposed great arteries +4017751,Repair of total anomalous pulmonary venous connection,S,Unspecified correction of total anomalous pulmonary  venous connection +4020376,Closure of defect of interatrial septum using pericardial patch,S,Primary repair of defect of interatrial septum NEC/repair of defect of interatrial septum using pericardial patch +4020506,Creation of valved conduit between right ventricle of heart and pulmonary artery,S,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec +4019950,Revision of valved cardiac conduit,S,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec +4020508,Repair of sinus venosus,S,Correction of persistent sinus venosus +4018441,Repair of partial anomalous pulmonary venous connection,S,Correction of partial anomalous pulmonary venous drainage +4020520,Open aortic valvotomy,S,Open aortic valvotomy +4018747,Operations on the left ventricular outflow tract,S,Repair of subaortic stenosis +4019233,Creation of shunt from subclavian artery to pulmonary artery using interposition tube prosthesis,S,Unspecified creation of shunt to pulmonary artery from subclavian artery using interposition tube pr +4019237,Anastomosis of vena cava to pulmonary artery,S,Creation of anastomosis to pulmonary artery from vena cava +4018926,Repair of pulmonary artery,S,Other specified : repair of pulmonary artery +4021725,Removal of band from pulmonary artery,S,Removal of band from pulmonary artery +4019026,Plastic repair of aorta,S,Other specified: plastic repair of aorta +4020812,Plastic repair of aorta and end-to-end anastomosis of aorta,S,Plastic repair of aorta and end to end anastomosis of aorta +4019028,Release of vascular ring of aorta,S,Release of vascular ring of aorta +44790092,Relief of left ventricular outflow tract obstruction,S,Relief of left ventricular outflow tract obstruction +44789857,Total cavopulmonary connection with extracardiac inferior caval vein to pulmonary artery conduit,S,Total cavopulmonary connection with extracardiac inferior caval vein topulmonary artery conduit +4336751,Allotransplant of heart,S,Unspecified other transplantation of heart/allotransplantation of heart NEC +4049979,Repair of double outlet right ventricle,S,Repair of double outlet right ventricle +4050114,Closure of ductus arteriosus with clip,S,Closure of patent ductus arteriosus NEC +4052536,Extracorporeal membrane oxygenation,S,Extracorporeal membrane oxygenation +44790415,Aortic root replacement using pulmonary valve autograft with right ventricle to pulmonary artery valved conduit and aortoventriculoplasty,S,Aortic root pulmonary valve autograft with right vent to pulmonary artery valved conduit/ aortic root pulmonary valve autograft with right vent to pulmonary artery aortoventriculoplasty +4144921,Implantation of cardiac pacemaker,S,Implantation of cardiac pacemaker system NEC +4137127,Transplantation of heart,S,Unspecified other transplantation of heart/allotransplantation of heart NEC +44793133,Aortopulmonary reconstruction with systemic to pulmonary arterial shunt,S,Aortopulmonary reconstruction with systemic to pulmonary arterial shunt +4293619,Repair of tricuspid valve,S,Tricuspid valve repair NEC +4296790,Transposition of coronary artery,S,Transposition of coronary artery NEC +4139214,Open implantation of cardiac ventricular assist device,S,Open implantation of ventricular assist device +4178479,Replacement of valved cardiac conduit,S,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec +40486525,Primary repair of defect of atrioventricular septum,S,Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum +4187380,Repair of ostium primum defect,S,Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum +4199899,Closure of ventricular septal defect,S,Unspecified repair of defect of interventricular septum +4203153,Replacement of mitral valve,S,Replacement of mitral valve NEC +4217615,Plication of diaphragm,S,Plication of diaphragm +4308136,Complete repair of tetralogy of Fallot with transannular patch,S,Repair of tetralogy of fallot using transannular patch +4312194,Repair of heart valve,S,Aortic valve repair NEC +4339184,Replacement of pulmonary valve,S,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec +4232476,Repair of ventricular septal defect with prosthesis,S,Repair of defect of interventricular septum using prosthetic patch/unspecified repair of defect of interventricular septum diff --git a/inst/extdata/standard_concepts/.gitkeep b/inst/extdata/standard_concepts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/inst/extdata/vocabularies/.gitkeep b/inst/extdata/vocabularies/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/inst/templates/cohortCapr.R b/inst/templates/cohortCapr.R new file mode 100644 index 00000000..e9aefe7b --- /dev/null +++ b/inst/templates/cohortCapr.R @@ -0,0 +1,253 @@ +## ----knitr, include=FALSE------------------------------------------------------------------------------------ +knitr::opts_chunk$set(echo = TRUE) + +# knitr::purl( +# input = './R/cohortCapr_md.Rmd', +# output = './R/cohortCapr.R' +# ) + + +## ----Get project configurations------------------------------------------------------------------------------ +connectionConfig <- config::get(config = 'config', file = './inst/config/connection_config.yml') +config_oth <- config::get(config = 'config', file = './inst/config/config.yml') + + +## ----Load libraries------------------------------------------------------------------------------------------ +library(RSQLite) +library(tibble) +library(DatabaseConnector) +library(CohortGenerator) +library(CirceR) +library(Capr) + + +## ----connect to database, eval=TRUE, include=TRUE------------------------------------------------------------ +# Use connection details from configuration +connectionDetails <- createConnectionDetails( + dbms = connectionConfig$dbms, + user = connectionConfig$user, + password = connectionConfig$password, + server = connectionConfig$server, + port = connectionConfig$port, + oracleDriver = connectionConfig$oracleDriver, + pathToDriver = connectionConfig$pathToDriver +) + + +## ----concept sets, echo=TRUE--------------------------------------------------------------------------------- +## Concept sets +source("./R/conceptSets.R") + +# Establish connection +con <- connect(connectionDetails) + +conceptSets$conceptSets <- conceptSets$conceptSets %>% + # Add details for all concepts (excl. descendants) + lapply(FUN = getConceptSetDetails, + con = con, + vocabularyDatabaseSchema = connectionConfig$vocabulary_schema) + +# Disconnect +disconnect(con) + + +## ----count occurences---------------------------------------------------------------------------------------- +## Count occurrences of each concept in data + +# Establish connection +con <- connect(connectionDetails) + +# Get countOccurrences function +source("./R/countOccurrences.R") + +# Get links between tables and fields as input +source("./R/table_linked_to_concept_field.R") + +# count occurrences of each concept 'x' and print results; cardiac complications as example +# cardiacComplicationsCounts <- +# countOccurrences( +# conceptSets$concepts$cardiacComplications, c("condition_occurrence", "procedure_occurrence"), links, con, connectionConfig$cdm_schema +# ) %>% print() +labTestsCounts <- + countOccurrences( + conceptSets$concepts$labTests, c("measurement"), links, con, connectionConfig$cdm_schema + ) %>% print() + +# Disconnect +disconnect(con) + + +## ----Standard non-standard check----------------------------------------------------------------------------- +# Connect to DB +con <- connect(connectionDetails) + +# Return table of non-standard concepts +source('./R/isStandard.R') +nonStandard <- isStandard( + db_connection = con, + data_concepts_path = config_oth$concepts_path, + # (optional) Save the results (with standard and non-standard concepts) + save_path = config_oth$save_path_isStandard +) + +# Disconnect +disconnect(con) + +# Print all non-standard concepts +nonStandard + + +## ----Standard non-standard check concept set----------------------------------------------------------------- +# connect to DB +con <- connect(connectionDetails) + +# run for labTests conceptSet +labTests <- conceptSets$conceptSets$labTests + +# check standardness across concept set +source('./R/isStandardCS.R') +nonStandardCS <- isStandardCS( + db_connection = con, + conceptSet = conceptSets$conceptSets$labTests, + save_path = config_oth$save_path_isStandard +) + +# Disconnect +disconnect(con) + +# print results (non-standard) +nonStandardCS + + +## ----Cohort definition--------------------------------------------------------------------------------------- +## Cohort definition +# Create cohort definition +ch <- cohort( + entry = entry( + # enter patients who have had a lab test + measurement(conceptSets$conceptSets$labTests), + observationWindow = continuousObservation(0, 0), + primaryCriteriaLimit = "All" + ), + attrition = attrition( + withAny( + # include all cardiac complications + atLeast( + x = 1, + # include all cardiac complications represented by condition concepts + query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications) + ), + atLeast( + x = 1, + # include all cardiac complications represented by procedure concepts + query = procedure(conceptSets$conceptSets$cardiacComplications) + ) + ), + withAny( + atLeast( + x = 1, + # include all cardiac surgeries + query = procedure(conceptSets$conceptSets$cardiacProcedures) + ) + ) + ), + exit = exit( + endStrategy = observationExit(), + censor = censoringEvents( + # exit if intubation has taken place + procedure(conceptSets$conceptSets$intubation) + ) + ) +) + + +## ----json and sql-------------------------------------------------------------------------------------------- +## Cohort json and sql +# Generate json for cohort +chJson <- ch %>% + Capr::toCirce() %>% + jsonlite::toJSON(pretty = TRUE, auto_unbox = TRUE) %>% + as.character() + +# Generate cohort sql query +sql <- CirceR::buildCohortQuery( + expression = CirceR::cohortExpressionFromJson(chJson), + options = CirceR::createGenerateOptions(generateStats = FALSE) +) + + +## ----Save cohort and concept set json------------------------------------------------------------------------ +write(chJson, paste0(config_oth$save_path_json, "/cohort.json")) +for (cs in names(conceptSets$conceptSets)) { + writeConceptSet( + x = conceptSets$conceptSets[[cs]], + path = paste(config_oth$save_path_json, "/", cs, "_cs.json", sep="") + ) +} + + +## ----Create and generate cohorts----------------------------------------------------------------------------- +# Establish connection +con <- connect(connectionDetails) + +# Cohorts to create +cohortsToCreate <- tibble::tibble( + cohortId = 9876, + cohortName = "cohort", + sql = sql +) + +# Cohort tables +cohortTableNames <- CohortGenerator::getCohortTableNames(cohortTable = "cohort") +CohortGenerator::createCohortTables( + connectionDetails = connectionDetails, + cohortDatabaseSchema = "cohort", + cohortTableNames = cohortTableNames, +) + +# Generate the cohorts +cohortsGenerated <- CohortGenerator::generateCohortSet( + connectionDetails = connectionDetails, + cdmDatabaseSchema = "cdm", + cohortDatabaseSchema = "cohort", + cohortTableNames = cohortTableNames, + cohortDefinitionSet = cohortsToCreate +) + +# Get cohort counts +cohortCounts <- CohortGenerator::getCohortCounts( + connectionDetails = connectionDetails, + cohortDatabaseSchema = "cohort", + cohortTable = cohortTableNames$cohortTable +) + +# Disconnect +disconnect(con) + + +cohortCounts + + +## ----Number of people in DB---------------------------------------------------------------------------------- +# Establish connection +con <- connect(connectionDetails) + +# Count unique person_id in the person table +query_person <- + paste0("SELECT COUNT(DISTINCT person_id) AS num_persons FROM ", connectionConfig$cdm_schema, ".person") +result_person <- dbGetQuery(con, query_person)$num_persons + +# Count unique subject_id in the cardiac_arrest table +query_cohort <- + paste0("SELECT COUNT(DISTINCT subject_id) AS num_persons FROM ", connectionConfig$cohort_schema, ".cohort") + +result_cohort <- dbGetQuery(con, query_cohort)$num_persons + +# Print results +cat("Number of persons in dataset: ", result_person, "\n") +cat("Number of persons in cohort: ", result_cohort, "\n") + + +# Disconnect +disconnect(con) + diff --git a/inst/templates/cohortCapr_md.Rmd b/inst/templates/cohortCapr_md.Rmd new file mode 100644 index 00000000..51e81e60 --- /dev/null +++ b/inst/templates/cohortCapr_md.Rmd @@ -0,0 +1,289 @@ +--- +title: "cohortCapr markdown" +author: "Guus @TheHyve" +date: "2024-07-17" +output: pdf_document +--- +## Set-up knitr +```{r knitr, include=FALSE} +knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) + +knitr::opts_chunk$set(echo = TRUE) + +# knitr::purl( +# input = './inst/templates/cohortCapr_md.Rmd', +# output = './inst/templates/cohortCapr.R' +# ) +``` + +## Set-up config +```{r Get project configurations} +connectionConfig <- config::get(config = 'config', file = './inst/config/connection_config.yml') +config_oth <- config::get(config = 'config', file = './inst/config/config.yml') +``` + +## Load libraries +```{r Load libraries} +library(RSQLite) +library(tibble) +library(DatabaseConnector) +library(CohortGenerator) +library(CirceR) +library(Capr) +``` + +## Connect to DB +```{r connect to database, eval=TRUE, include=TRUE} +# Use connection details from configuration +connectionDetails <- createConnectionDetails( + dbms = connectionConfig$dbms, + user = connectionConfig$user, + password = connectionConfig$password, + server = connectionConfig$server, + port = connectionConfig$port, + oracleDriver = connectionConfig$oracleDriver, + pathToDriver = connectionConfig$pathToDriver +) +``` + +## Concept sets +Define a measurement concept set using Capr and include all descendants +```{r concept sets, echo=TRUE} +## Concept sets +source("./R/conceptSets.R") + +# Establish connection +con <- connect(connectionDetails) + +conceptSets$conceptSets <- conceptSets$conceptSets %>% + # Add details for all concepts (excl. descendants) + lapply(FUN = getConceptSetDetails, + con = con, + vocabularyDatabaseSchema = connectionConfig$vocabulary_schema) + +# Disconnect +disconnect(con) +``` + +## Concept counts +Retrieve counts for a concept set +```{r count occurences} +## Count occurrences of each concept in data + +# Establish connection +con <- connect(connectionDetails) + +# Get countOccurrences function +source("./R/countOccurrences.R") + +# Get links between tables and fields as input +source("./R/table_linked_to_concept_field.R") + +# count occurrences of each concept 'x' and print results; cardiac complications as example +# cardiacComplicationsCounts <- +# countOccurrences( +# conceptSets$concepts$cardiacComplications, c("condition_occurrence", "procedure_occurrence"), links, con, connectionConfig$cdm_schema +# ) %>% print() +labTestsCounts <- + countOccurrences( + conceptSets$concepts$labTests, c("measurement"), links, con, connectionConfig$cdm_schema, connectionConfig$vocabulary_schema + ) %>% print() + +# Disconnect +disconnect(con) +``` + +## Standard and non-standard concepts given a list of concept IDs +To check for each concept in a list of concept_ids and source codes, the "isStandard.R" function +can be used. This takes as input a list of concept_ids and source codes and returns a table of non-standard concepts. +See inst/extdata/phems-variable-list for examples of CSVs tables in the expected format. +```{r Standard non-standard check} +# Connect to DB +con <- connect(connectionDetails) + +# Return table of non-standard concepts +source('./R/isStandard.R') +nonStandard <- isStandard( + db_connection = con, + data_concepts_path = config_oth$concepts_path, + vocab_schema = connectionConfig$vocabulary_schema, + # (optional) Save the results (with standard and non-standard concepts) + save_path = config_oth$save_path_isStandard +) + +# Disconnect +disconnect(con) + +# Print all non-standard concepts +nonStandard + +``` + +## Standard and non-standard concepts given a concept set +Similarly to isStandard(), isStandardCS() can be used to check the standardness of concepts, but rather given a concept set than a list. +```{r Standard non-standard check concept set} +# connect to DB +con <- connect(connectionDetails) + +# run for labTests conceptSet +labTests <- conceptSets$conceptSets$labTests + +# check standardness across concept set +source('./R/isStandardCS.R') +nonStandardCS <- isStandardCS( + db_connection = con, + conceptSet = conceptSets$conceptSets$labTests, + # (optional) Save the results (with standard and non-standard concepts) + save_path = config_oth$save_path_isStandard +) + +# Disconnect +disconnect(con) + +# print results (non-standard) +nonStandardCS +``` + + +## Initial event cohort +People having any of the following: +any of the lab test measurements +limit to first/earliest occurrence of any of the above measurements (+descendants) per person +```{r Cohort definition} +## Cohort definition +# Create cohort definition +ch <- cohort( + entry = entry( + # enter patients who have had cardiac surgery + procedure(conceptSets$conceptSets$cardiacSurgery), + observationWindow = continuousObservation(0, 0), + primaryCriteriaLimit = "All" + ), + attrition = attrition( + withAny( + # include all cardiac complications + atLeast( + x = 1, + # include all cardiac complications represented by condition concepts + query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications) + ), + atLeast( + x = 1, + # include all cardiac complications represented by procedure concepts + query = procedure(conceptSets$conceptSets$cardiacComplications) + ) + ), + withAny( + atLeast( + x = 1, + # include patients who have had cardiac surgery + query = procedure(conceptSets$conceptSets$cardiacSurgery) + ) + ), + withAny( + atLeast( + x = 1, + # include patients who have had laboratory measurements + query = measurement(conceptSets$conceptSets$labTests) + ) + ) + ), + exit = exit( + endStrategy = observationExit() + ) +) +``` + +## Write json expressions and sql queries +```{r json and sql} +## Cohort json and sql +# Generate json for cohort +chJson <- ch %>% + Capr::toCirce() %>% + jsonlite::toJSON(pretty = TRUE, auto_unbox = TRUE) %>% + as.character() + +# Generate cohort sql query +sql <- CirceR::buildCohortQuery( + expression = CirceR::cohortExpressionFromJson(chJson), + options = CirceR::createGenerateOptions(generateStats = FALSE) +) +``` + +Save the cohort and concept set jsons; these can be imported into ATLAS +```{r Save cohort and concept set json} +write(chJson, paste0(config_oth$save_path_json, "/cohort.json")) +for (cs in names(conceptSets$conceptSets)) { + writeConceptSet( + x = conceptSets$conceptSets[[cs]], + path = paste(config_oth$save_path_json, "/", cs, "_cs.json", sep="") + ) +} +``` + +```{r Create and generate cohorts} +# Establish connection +con <- connect(connectionDetails) + +# Cohorts to create +cohortsToCreate <- tibble::tibble( + cohortId = 9876, + cohortName = "cohort", + sql = sql +) + +# Cohort tables +cohortTableNames <- CohortGenerator::getCohortTableNames(cohortTable = "cohort") +CohortGenerator::createCohortTables( + connectionDetails = connectionDetails, + cohortDatabaseSchema = "cohort", + cohortTableNames = cohortTableNames, +) + +# Generate the cohorts +cohortsGenerated <- CohortGenerator::generateCohortSet( + connectionDetails = connectionDetails, + cdmDatabaseSchema = "cdm", + cohortDatabaseSchema = "cohort", + cohortTableNames = cohortTableNames, + cohortDefinitionSet = cohortsToCreate +) + +# Get cohort counts +cohortCounts <- CohortGenerator::getCohortCounts( + connectionDetails = connectionDetails, + cohortDatabaseSchema = "cohort", + cohortTable = cohortTableNames$cohortTable +) + +# Disconnect +disconnect(con) + + +cohortCounts +``` + +## Number of people in db +```{r Number of people in DB} +# Establish connection +con <- connect(connectionDetails) + +# Count unique person_id in the person table +query_person <- + paste0("SELECT COUNT(DISTINCT person_id) AS num_persons FROM ", connectionConfig$cdm_schema, ".person") +result_person <- dbGetQuery(con, query_person)$num_persons + +# Count unique subject_id in the cardiac_arrest table +query_cohort <- + paste0("SELECT COUNT(DISTINCT subject_id) AS num_persons FROM ", connectionConfig$cohort_schema, ".cohort") + +result_cohort <- dbGetQuery(con, query_cohort)$num_persons + +# Print results +cat("Number of persons in dataset: ", result_person, "\n") +cat("Number of persons in cohort: ", result_cohort, "\n") + + +# Disconnect +disconnect(con) +``` diff --git a/man/Capr-package.Rd b/man/Capr-PHEMS-package.Rd similarity index 78% rename from man/Capr-package.Rd rename to man/Capr-PHEMS-package.Rd index f4dc5516..628b6a72 100644 --- a/man/Capr-package.Rd +++ b/man/Capr-PHEMS-package.Rd @@ -1,14 +1,14 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/Capr.R \docType{package} -\name{Capr-package} -\alias{Capr} -\alias{Capr-package} -\title{Capr: Cohort Definition Application Programming} +\name{Capr-PHEMS-package} +\alias{Capr-PHEMS} +\alias{Capr-PHEMS-package} +\title{Capr-PHEMS: Cohort Definition Application Programming - project specific for PHEMS} \description{ \if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} -Provides a programming language for defining cohort definitions in R to use in studies for Observational Health Data Sciences and Informatics (OHDSI). The functions in 'Capr' allow for the programmatic creation of OHDSI concept sets and cohorts that can be serialized to 'OHDSI' compatible 'json' files or to 'OHDSI-SQL'. 'Capr' functions can be used to create, save, and load component parts to a cohort definition allowing R programmers to easily reuse cohort logic. 'Capr' provides tools to create a large number of OHDSI cohorts while also helping bridge the gap between human readable descriptions of clinical phenotypes and their computational implementation. +Provides a programming language for defining cohort definitions in R to use in studies for Observational Health Data Sciences and Informatics (OHDSI). The functions in 'Capr' allow for the programmatic creation of OHDSI concept sets and cohorts that can be serialized to 'OHDSI' compatible 'json' files or to 'OHDSI-SQL'. 'Capr' functions can be used to create, save, and load component parts to a cohort definition allowing R programmers to easily reuse cohort logic. 'Capr' provides tools to create a large number of OHDSI cohorts while also helping bridge the gap between human readable descriptions of clinical phenotypes and their computational implementation. For PHEMS this package has been extended with additional functions to support PHEMS cohort creation. } \seealso{ Useful links: @@ -25,6 +25,7 @@ Useful links: Authors: \itemize{ \item Adam Black \email{black@ohdsi.org} + \item Guus Wilmink \email{guus@thehyve.nl} } } diff --git a/man/conceptSets.Rd b/man/conceptSets.Rd new file mode 100644 index 00000000..fbf9568a --- /dev/null +++ b/man/conceptSets.Rd @@ -0,0 +1,17 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/conceptSets.R +\name{conceptSets} +\alias{conceptSets} +\title{Medical Concept Sets Definition and Expansion} +\description{ +This script defines and expands various concept sets related to medical data. It utilizes the Capr library to fetch all descendant concepts +for each defined concept set, ensuring comprehensive coverage of related medical concepts. +} +\details{ +The script initializes by defining multiple concept sets within a list structure. Each concept set contains unique identifiers for medical concepts, +which are expanded to include all descendant concepts using the Capr library's functionality. The expanded concept sets are then stored in a new list within +the `conceptSets` object. Finally, the script outputs a confirmation message indicating successful sourcing and expansion of concept sets. +} +\note{ +This script requires the Capr library to be installed and loaded for proper execution. +} diff --git a/man/countOccurrences.Rd b/man/countOccurrences.Rd new file mode 100644 index 00000000..93627cff --- /dev/null +++ b/man/countOccurrences.Rd @@ -0,0 +1,41 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/countOccurrences.R +\name{countOccurrences} +\alias{countOccurrences} +\title{Count Occurrences of Values in Database Tables} +\usage{ +countOccurrences(v, tables, links, db_connection, cdm_schema, vocab_schema) +} +\arguments{ +\item{v}{A vector of concept_ids to count occurrences for.} + +\item{tables}{A character vector of CDM table names to search within.} + +\item{links}{A list linking each table to its respective concept_id field.} + +\item{db_connection}{A database connection object through which queries will be executed.} + +\item{cdm_schema}{The database cdm_schema in which the tables are located.} + +\item{vocab_schema}{The database vocab_schema in which the concept tables are located.} +} +\value{ +A tibble with columns for the number of times any concept from 'v' occurs: direct count of persons, + direct count of records, descendant count of persons, and descendant count of records. + The tibble also includes the concept names derived from `v` and is arranged by the total + record count (direct + descendant). +} +\description{ +This function counts the occurrences of specified concept ids within specified tables in a OMOP database, +including direct occurrences and occurrences through descendants, based on a provided cdm_schema and links. +It returns a tibble summarizing the counts across persons and across records. +} +\examples{ +# Assuming `db_connection` is a valid database connection, `cdm_schema` is set to "public", +# `tables` contains the names of the tables to search, `links` defines the relevant fields, +# and `v` contains the values to search for: +results <- countOccurrences(v = c(1, 2), tables = c("observation", "condition_occurrence"), + links = list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id", ...), + db_connection = db_connection, cdm_schema = "public") + +} diff --git a/man/cs.Rd b/man/cs.Rd index 0f1e8a7c..cbc89be3 100644 --- a/man/cs.Rd +++ b/man/cs.Rd @@ -1,61 +1,66 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/conceptSet.R -\name{cs} -\alias{cs} -\alias{exclude} -\alias{mapped} -\alias{descendants} -\title{Create a concept set} -\usage{ -cs(..., name, id = NULL) - -exclude(...) - -mapped(...) - -descendants(...) -} -\arguments{ -\item{...}{One or more numeric vectors that can be coerced to integers, or -Calls to helper functions "exclude", "descendants", or "mapped".} - -\item{name}{A name for the concept set} - -\item{id}{An id for the concept set} -} -\value{ -A Capr Concept Set Object - -A list of Capr concepts - -A list of Capr concepts - -A list of Capr concepts -} -\description{ -cs is used to create concept set expressions. - -`exclude` is meant to be used inside `cs` when creating a new concept set. - -`mapped` is meant to be used inside `cs` when creating a new concept set. - -`descendants` is meant to be used inside `cs` when creating a new concept set. -} -\section{Functions}{ -\itemize{ -\item \code{exclude()}: exclude concepts - -\item \code{mapped()}: Include mapped concepts - -\item \code{descendants()}: Include descendants - -}} -\examples{ -cs(1, 2, name = "concepts") -cs(1, c(10, 11, 2), name = "concepts") -cs(1, seq(2, 10, 2), name = "concepts") -cs(1, 2, 3, exclude(4, 5), name = "concepts") -cs(1, 2, 3, exclude(4, 5), mapped(6, 7), name = "concepts") -cs(1, 2, 3, exclude(4, 5), mapped(6, 7), descendants(8, 9), name = "concepts") -cs(descendants(1, 2, 3), exclude(descendants(8, 9)), name = "concepts") -} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/conceptSet.R +\docType{data} +\name{cs} +\alias{cs} +\alias{exclude} +\alias{mapped} +\alias{descendants} +\title{Create a concept set} +\format{ +An object of class \code{character} of length 1. +} +\usage{ +cs + +exclude(...) + +mapped(...) + +descendants(...) +} +\arguments{ +\item{...}{One or more numeric vectors that can be coerced to integers, or +Calls to helper functions "exclude", "descendants", or "mapped".} + +\item{name}{A name for the concept set} + +\item{id}{An id for the concept set} +} +\value{ +A Capr Concept Set Object + +A list of Capr concepts + +A list of Capr concepts + +A list of Capr concepts +} +\description{ +cs is used to create concept set expressions. + +`exclude` is meant to be used inside `cs` when creating a new concept set. + +`mapped` is meant to be used inside `cs` when creating a new concept set. + +`descendants` is meant to be used inside `cs` when creating a new concept set. +} +\section{Functions}{ +\itemize{ +\item \code{exclude()}: exclude concepts + +\item \code{mapped()}: Include mapped concepts + +\item \code{descendants()}: Include descendants + +}} +\examples{ +cs(1, 2, name = "concepts") +cs(1, c(10, 11, 2), name = "concepts") +cs(1, seq(2, 10, 2), name = "concepts") +cs(1, 2, 3, exclude(4, 5), name = "concepts") +cs(1, 2, 3, exclude(4, 5), mapped(6, 7), name = "concepts") +cs(1, 2, 3, exclude(4, 5), mapped(6, 7), descendants(8, 9), name = "concepts") +cs(descendants(1, 2, 3), exclude(descendants(8, 9)), name = "concepts") +} +\keyword{datasets} diff --git a/man/isStandard.Rd b/man/isStandard.Rd new file mode 100644 index 00000000..6ae9f117 --- /dev/null +++ b/man/isStandard.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/isStandard.R +\name{isStandard} +\alias{isStandard} +\title{Check for Non-Standard Concepts in Database Tables} +\usage{ +isStandard(db_connection, data_concepts_path, vocab_schema, save_path = NULL) +} +\arguments{ +\item{db_connection}{A DBI database connection object to the SQL database containing the standard concepts table.} + +\item{data_concepts_path}{The file path to the directory containing CSV files of tables to be checked against the standard concepts table. Each CSV file should contain at least the columns `sourceCode` and `concept_id`.} + +\item{vocab_schema}{The schema name of the vocabulary database containing the standard concepts table.} + +\item{save_path}{(Optional) The file path where the joined tables containing non-standard concepts should be saved. If not provided, the tables will not be saved but will still be checked for non-standard concepts.} +} +\value{ +A tibble containing the columns `concept_id`, `concept_name`, `source_code`, and `source_table`, which represent the concept ID, concept name, source code, and source table name for each non-standard concept found. +} +\description{ +This function examines a set of tables for non-standard concepts by comparing them against a standard concepts table in a SQL database. It identifies non-standard concepts and optionally saves the joined tables that contain these non-standard concepts. +} +\details{ +The function first queries the `cdm.concept` table from the provided SQL database to retrieve the standard concepts. It then reads each CSV file in the specified directory, preparing and joining it with the standard concepts table based on the concept ID. Non-standard concepts are identified based on the `standard_concept` column not being 'S' or 'C'. Information about these non-standard concepts is collected and returned as a tibble. + +If a `save_path` is provided, each joined table that contains at least one non-standard concept is saved to the specified directory with the same name as the original table file. +} +\examples{ +# Assuming you have a valid DBI connection `db_conn` and your tables are located in "path/to/data_concepts": +non_standard_concepts <- isStandard(db_conn, "path/to/data_concepts", "path/to/save_non_standard/") + +} diff --git a/man/isStandardCS.Rd b/man/isStandardCS.Rd new file mode 100644 index 00000000..4fb8a475 --- /dev/null +++ b/man/isStandardCS.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/isStandardCS.R +\name{isStandardCS} +\alias{isStandardCS} +\title{Check for Non-Standard Concepts in Concept Sets} +\usage{ +isStandardCS(db_connection, conceptSet, save_path = NULL) +} +\arguments{ +\item{db_connection}{A DBI database connection object to the SQL database containing the standard concepts table. This parameter is currently not used in the function but intended for future use where database queries might be necessary.} + +\item{conceptSet}{An object representing a set of concepts, containing details such as concept ID, concept name, and whether it is a standard concept. The structure of this object should support `@Expression` to access the individual concepts and their properties.} + +\item{save_path}{(Optional) The file path where the details of non-standard concepts should be saved as a CSV file. If not provided, the information will not be saved but will still be checked for non-standard concepts.} +} +\value{ +A tibble containing the columns `concept_name`, `concept_id`, `concept_set`, and `standard`, which represent the concept name, concept ID, the name of the concept set, and the standard status for each concept found to be non-standard or not classified as standard. +} +\description{ +This function examines a concept set for non-standard concepts by comparing them against a standard concepts table in a SQL database. It identifies non-standard concepts and optionally saves the details of these non-standard concepts to a specified path. +} +\details{ +The function processes a given concept set to identify non-standard concepts. Non-standard concepts are those not marked as 'S' (Standard) or 'C' (Classification) in their `standard_concept` attribute. The function creates a data frame with concept details, filters out standard and classification concepts, and if a `save_path` is provided, saves this information to a CSV file. If no non-standard concepts are found, appropriate messages are displayed. +} +\examples{ +# Assuming you have a concept set `conceptSet`: +non_standard_concepts <- isStandardCS(db_conn, conceptSet, "path/to/save_standard_AND_non_standard/") + +} diff --git a/man/table_linked_to_concept_field.Rd b/man/table_linked_to_concept_field.Rd new file mode 100644 index 00000000..6da32f4f --- /dev/null +++ b/man/table_linked_to_concept_field.Rd @@ -0,0 +1,44 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/table_linked_to_concept_field.R +\docType{data} +\name{table_linked_to_concept_field} +\alias{table_linked_to_concept_field} +\alias{links} +\title{Link Table Names to Respective Concept ID Fields} +\format{ +An object of class \code{list} of length 9. +} +\usage{ +links +} +\description{ +This script creates a list mapping various table names to their respective +concept ID fields. This mapping is useful for dynamically referencing +concept IDs across different tables in a database schema, particularly +within the context of healthcare data where tables represent different +aspects of patient information (e.g., conditions, drug exposures). +} +\details{ +The `links` list object contains key-value pairs where each key is +a table name and the corresponding value is the name of the field that +contains the concept ID within that table. This object can be used to +programmatically access concept ID fields by table name. + +The following tables and their concept ID fields are included: +- `condition_occurrence`: `condition_concept_id` +- `death`: `cause_concept_id` +- `device_exposure`: `device_concept_id` +- `drug_exposure`: `drug_concept_id` +- `measurement`: `measurement_concept_id` +- `observation`: `observation_concept_id` +- `procedure_occurrence`: `procedure_concept_id` +- `specimen`: `specimen_concept_id` +- `visit_occurrence`: `visit_concept_id` +} +\examples{ +# Access the concept ID field for the condition_occurrence table +concept_field <- links$condition_occurrence +print(concept_field) + +} +\keyword{datasets} diff --git a/project/PHEMS-mappings-main.Rproj b/project/PHEMS-mappings-main.Rproj deleted file mode 100644 index 8e3c2ebc..00000000 --- a/project/PHEMS-mappings-main.Rproj +++ /dev/null @@ -1,13 +0,0 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX diff --git a/project/R/cdm.R b/project/R/cdm.R deleted file mode 100644 index 85de4b0e..00000000 --- a/project/R/cdm.R +++ /dev/null @@ -1,544 +0,0 @@ -cdm <- list( - person = c( - "person_id", - "gender_concept_id", - "year_of_birth", - "month_of_birth", - "day_of_birth", - "birth_datetime", - "race_concept_id", - "ethnicity_concept_id", - "location_id", - "provider_id", - "care_site_id", - "person_source_value", - "gender_source_value", - "gender_source_concept_id", - "race_source_value", - "race_source_concept_id", - "ethnicity_source_value", - "ethnicity_source_concept_id" - ), - observation_period = c( - "observation_period_id", - "person_id", - "observation_period_start_date", - "observation_period_end_date", - "period_type_concept_id" - ), - visit_occurrence = c( - "visit_occurrence_id", - "person_id", - "visit_concept_id", - "visit_start_date", - "visit_start_datetime", - "visit_end_date", - "visit_end_datetime", - "visit_type_concept_id", - "provider_id", - "care_site_id", - "visit_source_value", - "visit_source_concept_id", - "admitting_source_concept_id", - "admitting_source_value", - "discharge_to_concept_id", - "discharge_to_source_value", - "preceding_visit_occurrence_id" - ), - visit_detail = c( - "visit_detail_id", - "person_id", - "visit_detail_concept_id", - "visit_detail_start_date", - "visit_detail_start_datetime", - "visit_detail_end_date", - "visit_detail_end_datetime", - "visit_detail_type_concept_id", - "provider_id", - "care_site_id", - "visit_detail_source_value", - "visit_detail_source_concept_id", - "admitting_source_concept_id", - "admitting_source_value", - "discharge_to_concept_id", - "discharge_to_source_value", - "preceding_visit_detail_id", - "parent_visit_detail_id", - "visit_occurrence_id" - ), - condition_occurrence = c( - "condition_occurrence_id", - "person_id", - "condition_concept_id", - "condition_start_date", - "condition_start_datetime", - "condition_end_date", - "condition_end_datetime", - "condition_type_concept_id", - "condition_status_concept_id", - "stop_reason", - "provider_id", - "visit_occurrence_id", - "visit_detail_id", - "condition_source_value", - "condition_source_concept_id", - "condition_status_source_value" - ), - drug_exposure = c( - "drug_exposure_id", - "person_id", - "drug_concept_id", - "drug_exposure_start_date", - "drug_exposure_start_datetime", - "drug_exposure_end_date", - "drug_exposure_end_datetime", - "verbatim_end_date", - "drug_type_concept_id", - "stop_reason", - "refills", - "quantity", - "days_supply", - "sig", - "route_concept_id", - "lot_number", - "provider_id", - "visit_occurrence_id", - "visit_detail_id", - "drug_source_value", - "drug_source_concept_id", - "route_source_value", - "dose_unit_source_value" - ), - procedure_occurrence = c( - "procedure_occurrence_id", - "person_id", - "procedure_concept_id", - "procedure_date", - "procedure_datetime", - "procedure_type_concept_id", - "modifier_concept_id", - "quantity", - "provider_id", - "visit_occurrence_id", - "visit_detail_id", - "procedure_source_value", - "procedure_source_concept_id", - "modifier_source_value" - ), - device_exposure = c( - "device_exposure_id", - "person_id", - "device_concept_id", - "device_exposure_start_date", - "device_exposure_start_datetime", - "device_exposure_end_date", - "device_exposure_end_datetime", - "device_type_concept_id", - "unique_device_id", - "quantity", - "provider_id", - "visit_occurrence_id", - "visit_detail_id", - "device_source_value", - "device_source_concept_id" - ), - measurement = c( - "measurement_id", - "person_id", - "measurement_concept_id", - "measurement_date", - "measurement_datetime", - "measurement_type_concept_id", - "operator_concept_id", - "value_as_number", - "value_as_concept_id", - "unit_concept_id", - "range_low", - "range_high", - "provider_id", - "visit_occurrence_id", - "visit_detail_id", - "measurement_source_value", - "measurement_source_concept_id", - "unit_source_value", - "value_source_value" - ), - observation = c( - "observation_id", - "person_id", - "observation_concept_id", - "observation_date", - "observation_datetime", - "observation_type_concept_id", - "value_as_number", - "value_as_string", - "value_as_concept_id", - "qualifier_concept_id", - "unit_concept_id", - "provider_id", - "visit_occurrence_id", - "visit_detail_id", - "observation_source_value", - "observation_source_concept_id", - "unit_source_value", - "qualifier_source_value" - ), - note = c( - "note_id", - "person_id", - "note_date", - "note_datetime", - "note_type_concept_id", - "note_class_concept_id", - "note_title", - "note_text", - "encoding_concept_id", - "language_concept_id", - "provider_id", - "visit_occurrence_id", - "visit_detail_id", - "note_source_value" - ), - note_nlp = c( - "note_nlp_id", - "note_id", - "section_concept_id", - "snippet", - "offset", - "lexical_variant", - "note_nlp_concept_id", - "note_nlp_source_concept_id", - "nlp_system", - "nlp_date", - "nlp_datetime", - "term_exists", - "term_temporal", - "term_modifiers" - ), - speciman = c( - "specimen_id", - "person_id", - "specimen_concept_id", - "specimen_type_concept_id", - "specimen_date", - "specimen_datetime", - "quantity", - "unit_concept_id", - "anatomic_site_concept_id", - "disease_status_concept_id", - "specimen_source_id", - "specimen_source_value", - "unit_source_value", - "anatomic_site_source_value", - "disease_status_source_value" - ), - fact_relationship = c( - "domain_concept_id_1", - "fact_id_1", - "domain_concept_id_2", - "fact_id_2", - "relationship_concept_id" - ), - survey_conduct = c( - "survey_conduct_id", - "person_id", - "survey_concept_id", - "survey_start_date", - "survey_start_datetime", - "survey_end_date", - "survey_end_datetime", - "provider_id", - "assisted_concept_id", - "respondent_type_concept_id", - "timing_concept_id", - "collection_method_concept_id", - "survey_source_value", - "survey_source_concept_id", - "validated_survey_concept_id", - "validated_survey_source_value", - "survey_version_number", - "survey_version_value" - ), - death = c( - "person_id", - "death_date", - "death_datetime", - "death_type_concept_id", - "cause_concept_id", - "cause_source_value", - "cause_source_concept_id" - ), - location = c( - "location_id", - "address_1", - "address_2", - "city", - "state", - "zip", - "county", - "location_source_value" - ), - care_site = c( - "care_site_id", - "care_site_name", - "place_of_service_concept_id", - "location_id", - "care_site_source_value", - "place_of_service_source_value" - ), - provider = c( - "provider_id", - "provider_name", - "NPI", - "DEA", - "specialty_concept_id", - "care_site_id", - "year_of_birth", - "gender_concept_id", - "provider_source_value", - "specialty_source_value", - "specialty_source_concept_id", - "gender_source_value", - "gender_source_concept_id" - ), - payer_plan_period = c( - "payer_plan_period_id", - "person_id", - "payer_concept_id", - "payer_source_value", - "payer_source_concept_id", - "plan_concept_id", - "plan_source_value", - "plan_source_concept_id", - "sponsor_concept_id", - "sponsor_source_value", - "sponsor_source_concept_id", - "family_source_value", - "family_source_concept_id", - "stop_reason_concept_id", - "stop_reason_source_value", - "stop_reason_source_concept_id" - ), - cost = c( - "cost_id", - "cost_event_id", - "cost_domain_id", - "cost_type_concept_id", - "currency_concept_id", - "total_charge", - "total_cost", - "total_paid", - "paid_by_payer", - "paid_by_patient", - "paid_patient_copay", - "paid_patient_coinsurance", - "paid_patient_deductible", - "paid_by_primary", - "paid_ingredient_cost", - "paid_dispensing_fee", - "payer_plan_period_id", - "amount_allowed", - "revenue_code_concept_id", - "revenue_code_source_value", - "drg_concept_id", - "drg_source_value" - ), - drug_era = c( - "drug_era_id", - "person_id", - "drug_concept_id", - "drug_era_start_date", - "drug_era_end_date", - "drug_exposure_count", - "gap_days" - ), - dose_era = c( - "dose_era_id", - "person_id", - "drug_concept_id", - "unit_concept_id", - "dose_value", - "dose_era_start_date", - "dose_era_end_date" - ), - condition_era = c( - "condition_era_id", - "person_id", - "condition_concept_id", - "condition_era_start_date", - "condition_era_end_date", - "condition_occurrence_count" - ), - metadata = c( - "metadata_concept_id", - "metadata_type_concept_id", - "name_as_concept_id", - "value_as_number", - "value_as_concept_id", - "value_as_string", - "value_as_datetime", - "metadata_date", - "metadata_datetime" - ), - attribute_definition = c( - "attribute_definition_id", - "attribute_name", - "attribute_description", - "attribute_type_concept_id", - "attribute_syntax" - ), - cdm_source = c( - "cdm_source_name", - "cdm_source_abbreviation", - "cdm_holder", - "source_description", - "source_documentation_reference", - "cdm_etl_reference", - "source_release_date", - "cdm_release_date", - "cdm_version", - "vocabulary_version" - ), - vocabulary = c( - "vocabulary_id", - "vocabulary_name", - "vocabulary_reference", - "vocabulary_version", - "vocabulary_concept_id" - ), - concept = c( - "concept_id", - "concept_name", - "domain_id", - "vocabulary_id", - "concept_class_id", - "standard_concept", - "concept_code", - "valid_start_date", - "valid_end_date", - "invalid_reason" - ), - concept_ancestor = c( - "ancestor_concept_id", - "descendant_concept_id", - "min_levels_of_separation", - "max_levels_of_separation" - ), - concept_class = c( - "concept_class_id", - "concept_class_name", - "concept_class_concept_id" - ), - concept_relationship = c( - "concept_id_1", - "concept_id_2", - "relationship_id", - "valid_start_date", - "valid_end_date", - "invalid_reason" - ), - concept_synonym = c( - "concept_id", - "concept_synonym_name", - "language_concept_id" - ), - domain = c( - "domain_id", - "domain_name", - "domain_concept_id" - ), - drug_strength = c( - "drug_concept_id", - "ingredient_concept_id", - "amount_value", - "amount_unit_concept_id", - "numerator_value", - "numerator_unit_concept_id", - "denominator_value", - "denominator_unit_concept_id", - "box_size", - "valid_start_date", - "valid_end_date", - "invalid_reason" - ), - relationship = c( - "relationship_id", - "relationship_name", - "is_hierarchical", - "defines_ancestry", - "reverse_relationship_id", - "relationship_concept_id" - ), - source_to_concept_map = c( - "source_code", - "source_concept_id", - "source_vocabulary_id", - "source_code_description", - "target_concept_id", - "target_vocabulary_id", - "valid_start_date", - "valid_end_date", - "invalid_reason" - ), - concept_relationship = c( - "concept_id_1", - "concept_id_2", - "relationship_id", - "valid_start_date", - "valid_end_date", - "invalid_reason" - ), - relationship = c( - "relationship_id", - "relationship_name", - "defines_ancestry", - "reverse_relationship_id", - "relationship_concept_id" - ), - concept_synonym = c( - "concept_id", - "concept_synonym_name", - "language_concept_id" - ), - concept_ancestor = c( - "ancestor_concept_id", - "descendant_concept_id", - "min_levels_of_separation", - "max_levels_of_separation" - ), - source_to_concept_map = c( - "source_code", - "source_concept_id", - "source_vocabulary_id", - "source_code_description", - "target_concept_id", - "target_vocabulary_id", - "valid_start_date", - "valid_end_date", - "invalid_reason" - ), - cohort = c( - "drug_concept_id", - "ingredient_concept_id", - "amount_value", - "amount_unit_concept_id", - "numerator_value", - "numerator_unit_concept_id", - "denominator_value", - "denominator_unit_concept_id", - "box_size", - "valid_start_date", - "valid_end_date", - "invalid_reason" - ), - cohort_definition = c( - "cohort_definition_id", - "cohort_definition_name", - "cohort_definition_description", - "definition_type_concept_id", - "cohort_definition_syntax", - "subject_concept_id", - "cohort_initiation_date" - ) -) - diff --git a/project/R/cohortCapr.R b/project/R/cohortCapr.R deleted file mode 100644 index 7c8dcbb2..00000000 --- a/project/R/cohortCapr.R +++ /dev/null @@ -1,285 +0,0 @@ -## ----knitr, include=FALSE--------------------------------------------------------------- -knitr::opts_chunk$set(echo = TRUE) - -knitr::purl( - input = './cohortCapr_md.Rmd', - output = './cohortCapr.R' -) - - -## ----activate renv, include=FALSE------------------------------------------------------- -## R environment activation -# Get renv library -if (!require(renv)) { - install.packages("renv@v1.0.7") -} -# Get project path -path <- dirname(dirname(rstudioapi::getSourceEditorContext()$path)) -if (!("renv" %in% list.files(path))) { - stop("Working directory is not set correctly. Make sure the working directory is set to the project directory.") -} - -## Activate renv -# renv::activate(path) - - -## ----housekeeping, echo=FALSE----------------------------------------------------------- -## housekeeping -# libraries -library(devtools) -library(RSQLite) -library(tibble) -library(DatabaseConnector) -library(CohortGenerator) -library(CirceR) -library(Capr) - - -## ----connection details Eunomia, eval=TRUE, include=TRUE-------------------------------- -## Eunomia GI bleed data set -connectionDetails <- Eunomia::getEunomiaConnectionDetails() - - -## ----load data, messages=FALSE, echo=TRUE----------------------------------------------- -## Load data -# Connect to database -con <- connect(connectionDetails) - -# List all tables -tables <- dbListTables(con) - -# Exclude sqlite_sequence (contains table information) -tables <- tables[tables != "sqlite_sequence"] - -lDataFramesPre <- vector("list", length=length(tables)) -names(lDataFramesPre) <- tables - -# Create a data.frame for each table -for (i in seq(along=tables)) { - lDataFramesPre[[i]] <- dbGetQuery(conn=con, statement=paste("SELECT * FROM '", tables[[i]], "'", sep="")) -} - -# Disconnect -disconnect(con) - -cat("\n\nTABLES:\n ") -writeLines(tables, sep = "\n ") - - -## ----concept sets, echo=TRUE------------------------------------------------------------ -## Concept sets -source("./conceptSets.R") -# source("./connectVocabularies.R") - -# Establish connection -con <- connect(connectionDetails) - -conceptSets$conceptSets <- conceptSets$conceptSets %>% - # Add details for all concepts (excl. descendants) - lapply(FUN = getConceptSetDetails, con = con, vocabularyDatabaseSchema = "main") - -# Disconnect -disconnect(con) - - -## ----count occurences, echo=TRUE-------------------------------------------------------- -## Count occurrences of each concept in data -# Get countOccurrences function -source("./countOccurrences.R") - -# Get links between tables and fields as input -source("./table_linked_to_concept_field.R") - -# count occurrences of each concept 'x' and print results; cardiac complications as example -cardiacComplicationsCounts <- - countOccurrences( - conceptSets$concepts$cardiacComplications, c("condition_occurrence", "procedure_occurrence"), - lDataFramesPre, links - ) %>% print() -labTestsCounts <- - countOccurrences( - conceptSets$concepts$labTests, c("measurement"), - lDataFramesPre, links - ) %>% print() - - -## ----Standard non-standard check-------------------------------------------------------- -source('./isStandard.R') -nonStandard <- isStandard( - concept_table_path = "./project/data/vocabs_14-May-2024/CONCEPT.csv", - data_concepts_path = "./project/data/phems_variable_list/" - # save_path = "./project/data/phems_variable_list/is_standard/" - ) - -nonStandard - - -## ----Cohort definition------------------------------------------------------------------ -## Cohort definition -# Create cohort definition -ch <- cohort( - entry = entry( - # enter patients < 80 years old who have had a lab test - measurement(conceptSets$conceptSets$labTests, age(lt(80))), - observationWindow = continuousObservation(0, 0), - primaryCriteriaLimit = "All" - ), - attrition = attrition( - withAny( - # include all cardiac complications - atLeast( - x = 1, - # include all cardiac complications represented by condition concepts - query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications) - ), - atLeast( - x = 1, - # include all cardiac complications represented by procedure concepts - query = procedure(conceptSets$conceptSets$cardiacComplications) - ) - ), - withAny( - atLeast( - x = 1, - # include all cardiac surgeries - query = procedure(conceptSets$conceptSets$cardiacProcedures) - ) - ) - ), - exit = exit( - endStrategy = observationExit(), - censor = censoringEvents( - # exit if intubation has taken place - procedure(conceptSets$conceptSets$intubation) - ) - ) -) - - -## ----json and sql----------------------------------------------------------------------- -## Cohort json and sql -# Generate json for cohort -chJson <- ch %>% - toCirce() %>% - jsonlite::toJSON(pretty = TRUE, auto_unbox = TRUE) %>% - as.character() - -# Generate cohort sql query -sql <- CirceR::buildCohortQuery( - expression = CirceR::cohortExpressionFromJson(chJson), - options = CirceR::createGenerateOptions(generateStats = FALSE) -) - - -## ----Save cohort and concept set json--------------------------------------------------- -write(chJson, paste(path, "./json/cohort.json", sep="")) -for (cs in names(conceptSets$conceptSets)) { - writeConceptSet( - x = conceptSets$conceptSets[[cs]], - path = paste("../json/", cs, "_cs.json", sep="") - ) -} - - -## ----Create and generate cohorts-------------------------------------------------------- -# Establish connection -con <- connect(connectionDetails) - -# Cohorts to create -cohortsToCreate <- tibble::tibble( - cohortId = 9876, - cohortName = "cardiac_arrest", - sql = sql -) - -# Cohort tables -cohortTableNames <- CohortGenerator::getCohortTableNames(cohortTable = "cardiac_arrest") -CohortGenerator::createCohortTables( - connectionDetails = connectionDetails, - cohortDatabaseSchema = "main", - cohortTableNames = cohortTableNames, -) - -# Generate the cohorts -cohortsGenerated <- CohortGenerator::generateCohortSet( - connectionDetails = connectionDetails, - cdmDatabaseSchema = "main", - cohortDatabaseSchema = "main", - cohortTableNames = cohortTableNames, - cohortDefinitionSet = cohortsToCreate -) - -# Get cohort counts -cohortCounts <- CohortGenerator::getCohortCounts( - connectionDetails = connectionDetails, - cohortDatabaseSchema = "main", - cohortTable = cohortTableNames$cohortTable -) - -# Disconnect -disconnect(con) - - -cohortCounts - - -## ----retrieve updated DB---------------------------------------------------------------- -# Establish connection -con <- connect(connectionDetails) - -# List all tables -tables <- dbListTables(con) - -# Exclude sqlite_sequence (contains table information) -tables <- tables[tables != "sqlite_sequence"] - -lDataFramesPost <- vector("list", length=length(tables)) -names(lDataFramesPost) <- tables - -# Create a data.frame for each table -for (i in seq(along=tables)) { - lDataFramesPost[[i]] <- dbGetQuery(conn=con, statement=paste("SELECT * FROM '", tables[[i]], "'", sep="")) -} - -# Disconnect -disconnect(con) - - -cat("Number of persons in dataset: ", length(unique(lDataFramesPost$person$person_id)), - "\nNumber of persons in cohort: ", length(unique(lDataFramesPost$cardiac_arrest$subject_id))) - - -## ----cohort filter---------------------------------------------------------------------- -cohort_df <- list() -cohort_person_ids <- lDataFramesPost$cardiac_arrest$subject_id -for (table in names(lDataFramesPost)) { - if ("person_id" %in% names(lDataFramesPost[[table]])) { - cohort_df[[table]] <- - lDataFramesPost[[table]] %>% - dplyr::filter(person_id %in% cohort_person_ids) - } else { - cohort_df[[table]] <- lDataFramesPost[[table]] - } -} - - -## ----Create new dataset with 1k samples, eval=FALSE, include=FALSE---------------------- -## new_data <- list() -## cohort_person_ids_plus <- append(cohort_person_ids, -## # draw a random sample to make 1000 people including the cohort subjects -## sample( -## unique(lDataFramesPost$person$person_id), -## # sample size = 1k -## size = 1000 - length(cohort_person_ids) -## ) -## ) -## for (table in names(lDataFramesPost)) { -## if ("person_id" %in% names(lDataFramesPost[[table]])) { -## new_data[[table]] <- -## lDataFramesPost[[table]] %>% -## dplyr::filter(person_id %in% cohort_person_ids_plus) -## } else { -## new_data[[table]] <- lDataFramesPost[[table]] -## } -## } - diff --git a/project/R/cohortCapr_md.Rmd b/project/R/cohortCapr_md.Rmd deleted file mode 100644 index a757d8f3..00000000 --- a/project/R/cohortCapr_md.Rmd +++ /dev/null @@ -1,312 +0,0 @@ ---- -title: "cohortCapr markdown" -author: "Guus @TheHyve" -date: "2024-07-01" -output: html_document ---- -## Set-up knitr -```{r knitr, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) - -knitr::purl( - input = './cohortCapr_md.Rmd', - output = './cohortCapr.R' -) -``` - -## Activate renv -```{r activate renv, include=FALSE} -## R environment activation -# Get renv library -if (!require(renv)) { - install.packages("renv@v1.0.7") -} -# Get project path -path <- dirname(dirname(rstudioapi::getSourceEditorContext()$path)) -if (!("renv" %in% list.files(path))) { - stop("Working directory is not set correctly. Make sure the working directory is set to the project directory.") -} - -## Activate renv -# renv::activate(path) -``` - -## Set-up libraries -Set up the required libraries, and working directory -```{r housekeeping, echo=FALSE} -## housekeeping -# libraries -library(devtools) -library(RSQLite) -library(tibble) -library(DatabaseConnector) -library(CohortGenerator) -library(CirceR) -library(Capr) -``` - -##Connect to database -```{r connection details Eunomia, eval=TRUE, include=TRUE} -## Eunomia GI bleed data set -connectionDetails <- Eunomia::getEunomiaConnectionDetails() -``` - -## Load data set -Use dbConnector library to specified DB and retrieve the GI bleed (default) dataset. -Load this data into a dataframe as well for inspection -```{r load data, messages=FALSE, echo=TRUE} -## Load data -# Connect to database -con <- connect(connectionDetails) - -# List all tables -tables <- dbListTables(con) - -# Exclude sqlite_sequence (contains table information) -tables <- tables[tables != "sqlite_sequence"] - -lDataFramesPre <- vector("list", length=length(tables)) -names(lDataFramesPre) <- tables - -# Create a data.frame for each table -for (i in seq(along=tables)) { - lDataFramesPre[[i]] <- dbGetQuery(conn=con, statement=paste("SELECT * FROM '", tables[[i]], "'", sep="")) -} - -# Disconnect -disconnect(con) - -cat("\n\nTABLES:\n ") -writeLines(tables, sep = "\n ") -``` - -## Concept sets -Define a measurement concept set using Capr and include all descendants -```{r concept sets, echo=TRUE} -## Concept sets -source("./conceptSets.R") -# source("./connectVocabularies.R") - -# Establish connection -con <- connect(connectionDetails) - -conceptSets$conceptSets <- conceptSets$conceptSets %>% - # Add details for all concepts (excl. descendants) - lapply(FUN = getConceptSetDetails, con = con, vocabularyDatabaseSchema = "main") - -# Disconnect -disconnect(con) -``` - -## Included and excluded concepts -Retrieve concepts that have been included/excluded (does not capture descendants) -```{r count occurences, echo=TRUE} -## Count occurrences of each concept in data -# Get countOccurrences function -source("./countOccurrences.R") - -# Get links between tables and fields as input -source("./table_linked_to_concept_field.R") - -# count occurrences of each concept 'x' and print results; cardiac complications as example -cardiacComplicationsCounts <- - countOccurrences( - conceptSets$concepts$cardiacComplications, c("condition_occurrence", "procedure_occurrence"), - lDataFramesPre, links - ) %>% print() -labTestsCounts <- - countOccurrences( - conceptSets$concepts$labTests, c("measurement"), - lDataFramesPre, links - ) %>% print() -``` - -## Standard and non-standard concepts -```{r Standard non-standard check} -source('./isStandard.R') -nonStandard <- isStandard( - concept_table_path = "./project/data/vocabs_14-May-2024/CONCEPT.csv", - data_concepts_path = "./project/data/phems_variable_list/" - # save_path = "./project/data/phems_variable_list/is_standard/" - ) - -nonStandard -``` - -## Initial event cohort -```{r Cohort definition, eval=FALSE} -## Cohort definition -# Create cohort definition -ch <- cohort( - entry = entry( - # enter patients < 70 years old who have had a lab test - procedure(conceptSets$conceptSets$cardiacSurgery, age(lt(70))), - observationWindow = continuousObservation(0, 0), - primaryCriteriaLimit = "All" - ), - attrition = attrition( - withAny( - # include all cardiac complications - atLeast( - x = 1, - # include all cardiac complications represented by condition concepts - query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications) - ), - atLeast( - x = 1, - # include all cardiac complications represented by procedure concepts - query = procedure(conceptSets$conceptSets$cardiacComplications) - ) - ), - withAny( - atLeast( - x = 1, - # include patients who have had cardiac surgery - query = procedure(conceptSets$conceptSets$cardiacSurgery) - ) - ), - withAny( - atLeast( - x = 1, - # include patients who have had laboratory measurements - query = measurement(conceptSets$conceptSets$labTests) - ) - ) - ), - exit = exit( - endStrategy = observationExit() - ) -) -``` - -## Write json expressions and sql queries -```{r json and sql} -## Cohort json and sql -# Generate json for cohort -chJson <- ch %>% - toCirce() %>% - jsonlite::toJSON(pretty = TRUE, auto_unbox = TRUE) %>% - as.character() - -# Generate cohort sql query -sql <- CirceR::buildCohortQuery( - expression = CirceR::cohortExpressionFromJson(chJson), - options = CirceR::createGenerateOptions(generateStats = FALSE) -) -``` - -Save the cohort and concept set jsons; these can be imported into ATLAS -```{r Save cohort and concept set json} -write(chJson, paste(path, "./json/cohort.json", sep="")) -for (cs in names(conceptSets$conceptSets)) { - writeConceptSet( - x = conceptSets$conceptSets[[cs]], - path = paste("../json/", cs, "_cs.json", sep="") - ) -} -``` - -```{r Create and generate cohorts} -# Establish connection -con <- connect(connectionDetails) - -# Cohorts to create -cohortsToCreate <- tibble::tibble( - cohortId = 9876, - cohortName = "cardiac_arrest", - sql = sql -) - -# Cohort tables -cohortTableNames <- CohortGenerator::getCohortTableNames(cohortTable = "cardiac_arrest") -CohortGenerator::createCohortTables( - connectionDetails = connectionDetails, - cohortDatabaseSchema = "main", - cohortTableNames = cohortTableNames, -) - -# Generate the cohorts -cohortsGenerated <- CohortGenerator::generateCohortSet( - connectionDetails = connectionDetails, - cdmDatabaseSchema = "main", - cohortDatabaseSchema = "main", - cohortTableNames = cohortTableNames, - cohortDefinitionSet = cohortsToCreate -) - -# Get cohort counts -cohortCounts <- CohortGenerator::getCohortCounts( - connectionDetails = connectionDetails, - cohortDatabaseSchema = "main", - cohortTable = cohortTableNames$cohortTable -) - -# Disconnect -disconnect(con) - - -cohortCounts -``` - -## Get updated DB after querying cohorts -```{r retrieve updated DB} -# Establish connection -con <- connect(connectionDetails) - -# List all tables -tables <- dbListTables(con) - -# Exclude sqlite_sequence (contains table information) -tables <- tables[tables != "sqlite_sequence"] - -lDataFramesPost <- vector("list", length=length(tables)) -names(lDataFramesPost) <- tables - -# Create a data.frame for each table -for (i in seq(along=tables)) { - lDataFramesPost[[i]] <- dbGetQuery(conn=con, statement=paste("SELECT * FROM '", tables[[i]], "'", sep="")) -} - -# Disconnect -disconnect(con) - - -cat("Number of persons in dataset: ", length(unique(lDataFramesPost$person$person_id)), - "\nNumber of persons in cohort: ", length(unique(lDataFramesPost$cardiac_arrest$subject_id))) -``` - -## Filter loaded database for cohort -```{r cohort filter} -cohort_df <- list() -cohort_person_ids <- lDataFramesPost$cardiac_arrest$subject_id -for (table in names(lDataFramesPost)) { - if ("person_id" %in% names(lDataFramesPost[[table]])) { - cohort_df[[table]] <- - lDataFramesPost[[table]] %>% - dplyr::filter(person_id %in% cohort_person_ids) - } else { - cohort_df[[table]] <- lDataFramesPost[[table]] - } -} -``` - -```{r Create new dataset with 1k samples, eval=FALSE, include=FALSE} -new_data <- list() -cohort_person_ids_plus <- append(cohort_person_ids, - # draw a random sample to make 1000 people including the cohort subjects - sample( - unique(lDataFramesPost$person$person_id), - # sample size = 1k - size = 1000 - length(cohort_person_ids) - ) -) -for (table in names(lDataFramesPost)) { - if ("person_id" %in% names(lDataFramesPost[[table]])) { - new_data[[table]] <- - lDataFramesPost[[table]] %>% - dplyr::filter(person_id %in% cohort_person_ids_plus) - } else { - new_data[[table]] <- lDataFramesPost[[table]] - } -} -``` diff --git a/project/R/cohortCapr_md.html b/project/R/cohortCapr_md.html deleted file mode 100644 index 8b9e28a8..00000000 --- a/project/R/cohortCapr_md.html +++ /dev/null @@ -1,771 +0,0 @@ - - - - - - - - - - - - - - - -cohortCapr markdown - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
-

Set-up knitr

-
-
-

Activate renv

-
-
-

Set-up libraries

-

Set up the required libraries, and working directory

-
## Warning: package 'devtools' was built under R version 4.4.1
-
## Loading required package: usethis
-
## Warning: package 'usethis' was built under R version 4.4.1
-
## 
-## Attaching package: 'devtools'
-
## The following object is masked from 'package:renv':
-## 
-##     install
-
## Warning: package 'RSQLite' was built under R version 4.4.1
-
## Loading required package: R6
-

##Connect to database

-
## Eunomia GI bleed data set
-connectionDetails <- Eunomia::getEunomiaConnectionDetails()
-
## attempting to download GiBleed
-
## attempting to extract and load: C:\Users\guusw\AppData\Local\Temp\RtmpiYt1Dq/GiBleed_5.3.zip to: C:\Users\guusw\AppData\Local\Temp\RtmpiYt1Dq/GiBleed_5.3.sqlite
-
-
-

Load data set

-

Use dbConnector library to specified DB and retrieve the GI bleed -(default) dataset. Load this data into a dataframe as well for -inspection

-
## Load data
-# Connect to database
-con <- connect(connectionDetails)
-
## Connecting using SQLite driver
-
# List all tables
-tables <- dbListTables(con)
-
-# Exclude sqlite_sequence (contains table information)
-tables <- tables[tables != "sqlite_sequence"]
-
-lDataFramesPre <- vector("list", length=length(tables))
-names(lDataFramesPre) <- tables
-
-# Create a data.frame for each table
-for (i in seq(along=tables)) {
-  lDataFramesPre[[i]] <- dbGetQuery(conn=con, statement=paste("SELECT * FROM '", tables[[i]], "'", sep=""))
-}
-
-# Disconnect
-disconnect(con)
-
-cat("\n\nTABLES:\n  ")
-
## 
-## 
-## TABLES:
-## 
-
writeLines(tables, sep = "\n  ")
-
## attribute_definition
-##   care_site
-##   cdm_source
-##   cohort
-##   cohort_attribute
-##   cohort_definition
-##   concept
-##   concept_ancestor
-##   concept_class
-##   concept_relationship
-##   concept_synonym
-##   condition_era
-##   condition_occurrence
-##   cost
-##   death
-##   device_exposure
-##   domain
-##   dose_era
-##   drug_era
-##   drug_exposure
-##   drug_strength
-##   fact_relationship
-##   location
-##   measurement
-##   metadata
-##   note
-##   note_nlp
-##   observation
-##   observation_period
-##   payer_plan_period
-##   person
-##   procedure_occurrence
-##   provider
-##   relationship
-##   source_to_concept_map
-##   specimen
-##   visit_detail
-##   visit_occurrence
-##   vocabulary
-## 
-
-
-

Concept sets

-

Define a measurement concept set using Capr and include all -descendants

-
## Concept sets
-source("./conceptSets.R")
-
## Sourced concept sets
-
# source("./connectVocabularies.R")
-
-# Establish connection
-con <- connect(connectionDetails)
-
## Connecting using SQLite driver
-
conceptSets$conceptSets <- conceptSets$conceptSets %>%
-  # Add details for all concepts (excl. descendants)
-  lapply(FUN = getConceptSetDetails, con = con, vocabularyDatabaseSchema = "main")
-
## Warning: Input SQL has already been translated, so not translating again
-## This warning is displayed once every 8 hours.
-
# Disconnect
-disconnect(con)
-
-
-

Included and excluded concepts

-

Retrieve concepts that have been included/excluded (does not capture -descendants)

-
## Count occurrences of each concept in data
-# Get countOccurrences function
-source("./countOccurrences.R")
-
-# Get links between tables and fields as input
-source("./table_linked_to_concept_field.R")
-
## Sourced links object
-
# count occurrences of each concept 'x' and print results; cardiac complications as example
-cardiacComplicationsCounts <- 
-  countOccurrences(
-    conceptSets$concepts$cardiacComplications, c("condition_occurrence", "procedure_occurrence"), 
-    lDataFramesPre, links
-  ) %>% print()
-
## # A tibble: 4 × 6
-##   concept_id count_persons count_records descendant_count_person
-##        <dbl>         <int>         <dbl>                   <int>
-## 1     321042           138           138                     138
-## 2    4324124             0             0                       0
-## 3    4051330             0             0                       0
-## 4    4185565             0             0                       0
-## # ℹ 2 more variables: descendant_count_record <dbl>, included <lgl>
-
labTestsCounts <- 
-  countOccurrences(
-    conceptSets$concepts$labTests, c("measurement"), 
-    lDataFramesPre, links
-  ) %>% print()
-
## # A tibble: 29 × 6
-##    concept_id count_persons count_records descendant_count_person
-##         <dbl>         <int>         <dbl>                   <int>
-##  1    3009542           136           137                     136
-##  2    3024561            35            35                      35
-##  3    3019550            35            35                      35
-##  4    3006923            35            35                      35
-##  5    3013721            35            35                      35
-##  6    4298431             0             0                       0
-##  7    3007670             0             0                       0
-##  8   40762351             0             0                       0
-##  9   37393863             0             0                       0
-## 10    3034426             0             0                       0
-## # ℹ 19 more rows
-## # ℹ 2 more variables: descendant_count_record <dbl>, included <lgl>
-
-
-

Standard and non-standard concepts

-
source('./isStandard.R')
-
## 
-## Attaching package: 'dplyr'
-
## The following objects are masked from 'package:stats':
-## 
-##     filter, lag
-
## The following objects are masked from 'package:base':
-## 
-##     intersect, setdiff, setequal, union
-
nonStandard <- isStandard(
-  concept_table_path = "./project/data/vocabs_14-May-2024/CONCEPT.csv",
-  data_concepts_path = "./project/data/phems_variable_list/"
-  # save_path = "./project/data/phems_variable_list/is_standard_r/",
-  )
-
-nonStandard
-
## # A tibble: 11 × 4
-##    concept_id concept_name             source_code                  source_table
-##    <chr>      <chr>                    <chr>                        <list>      
-##  1 4152194    Systolic blood pressure  SBP (Systolic Blood Pressur… <chr [1]>   
-##  2 4154790    Diastolic blood pressure DBP (Dyastolic Blood Pressu… <chr [1]>   
-##  3 4239408    Heart rate               Age-dependent HR             <chr [1]>   
-##  4 4313591    Respiratory rate         Age-dependent RR             <chr [1]>   
-##  5 0          No matching concept      Extracardiac anomalies - di… <chr [1]>   
-##  6 607590     Body height              Height                       <chr [1]>   
-##  7 0          No matching concept      Aristotle's score of surgery <chr [1]>   
-##  8 0          No matching concept      ventilation                  <chr [1]>   
-##  9 0          No matching concept      Type of vasoactive infusion  <chr [1]>   
-## 10 0          No matching concept      VIS score of vasoactive inf… <chr [1]>   
-## 11 0          No matching concept      Total ventilation start dat… <chr [1]>
-
-
-

Initial event cohort

-

People having any of the following: any of the lab test measurements -limit to first/earliest occurrence of any of the above measurements -(+descendants) per person

-
## Cohort definition
-# Create cohort definition
-ch <- cohort(
-  entry = entry(
-    # enter patients < 80 years old who have had a lab test
-    measurement(conceptSets$conceptSets$labTests, age(lt(80))),
-    observationWindow = continuousObservation(0, 0),
-    primaryCriteriaLimit = "All"
-  ),
-  attrition = attrition(
-    withAny(
-      # include all cardiac complications
-      atLeast(
-        x = 1,
-        # include all cardiac complications represented by condition concepts
-        query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications)
-      ),
-      atLeast(
-        x = 1,
-        # include all cardiac complications represented by procedure concepts
-        query = procedure(conceptSets$conceptSets$cardiacComplications)
-      )
-    ),
-    withAny(
-      atLeast(
-        x = 1,
-        # include all cardiac surgeries
-        query = procedure(conceptSets$conceptSets$cardiacProcedures)
-      )
-    )
-  ),
-  exit = exit(
-    endStrategy = observationExit(),
-    censor = censoringEvents(
-      # exit if intubation has taken place
-      procedure(conceptSets$conceptSets$intubation)
-    )
-  )
-)
-
-
-

Write json expressions and sql queries

-
## Cohort json and sql
-# Generate json for cohort
-chJson <- ch %>%
-  toCirce() %>%
-  jsonlite::toJSON(pretty = TRUE, auto_unbox = TRUE) %>%
-  as.character()
-
-# Generate cohort sql query
-sql <- CirceR::buildCohortQuery(
-  expression = CirceR::cohortExpressionFromJson(chJson),
-  options = CirceR::createGenerateOptions(generateStats = FALSE)
-)
-

Save the cohort and concept set jsons; these can be imported into -ATLAS

-
write(chJson, paste(path, "./json/cohort.json", sep=""))
-for (cs in names(conceptSets$conceptSets)) {
-  writeConceptSet(
-    x = conceptSets$conceptSets[[cs]],
-    path = paste("../json/", cs, "_cs.json", sep="")
-  )
-}
-
# Establish connection
-con <- connect(connectionDetails)
-
## Connecting using SQLite driver
-
# Cohorts to create
-cohortsToCreate <- tibble::tibble(
-  cohortId = 9876,
-  cohortName = "cardiac_arrest",
-  sql = sql
-)
-
-# Cohort tables
-cohortTableNames <- CohortGenerator::getCohortTableNames(cohortTable = "cardiac_arrest")
-CohortGenerator::createCohortTables(
-  connectionDetails = connectionDetails,
-  cohortDatabaseSchema = "main",
-  cohortTableNames = cohortTableNames,
-)
-
## Connecting using SQLite driver
-
## Creating cohort tables
-## - Created table main.cardiac_arrest
-## - Created table main.cardiac_arrest
-## - Created table main.cardiac_arrest_inclusion
-## - Created table main.cardiac_arrest_inclusion_result
-## - Created table main.cardiac_arrest_inclusion_stats
-## - Created table main.cardiac_arrest_summary_stats
-## - Created table main.cardiac_arrest_censor_stats
-## Creating cohort tables took 0.06secs
-
# Generate the cohorts
-cohortsGenerated <- CohortGenerator::generateCohortSet(
-  connectionDetails = connectionDetails,
-  cdmDatabaseSchema = "main",
-  cohortDatabaseSchema = "main",
-  cohortTableNames = cohortTableNames,
-  cohortDefinitionSet = cohortsToCreate
-)
-
## Connecting using SQLite driver
-
## Initiating cluster consisting only of main thread
-## 1/1- Generating cohort: cardiac_arrest (id = 9876)
-##   |                                                                              |                                                                      |   0%  |                                                                              |==                                                                    |   3%  |                                                                              |====                                                                  |   6%  |                                                                              |======                                                                |   9%  |                                                                              |========                                                              |  11%  |                                                                              |==========                                                            |  14%  |                                                                              |============                                                          |  17%  |                                                                              |==============                                                        |  20%  |                                                                              |================                                                      |  23%  |                                                                              |==================                                                    |  26%  |                                                                              |====================                                                  |  29%  |                                                                              |======================                                                |  31%  |                                                                              |========================                                              |  34%  |                                                                              |==========================                                            |  37%  |                                                                              |============================                                          |  40%  |                                                                              |==============================                                        |  43%  |                                                                              |================================                                      |  46%  |                                                                              |==================================                                    |  49%  |                                                                              |====================================                                  |  51%  |                                                                              |======================================                                |  54%  |                                                                              |========================================                              |  57%  |                                                                              |==========================================                            |  60%  |                                                                              |============================================                          |  63%  |                                                                              |==============================================                        |  66%  |                                                                              |================================================                      |  69%  |                                                                              |==================================================                    |  71%  |                                                                              |====================================================                  |  74%  |                                                                              |======================================================                |  77%  |                                                                              |========================================================              |  80%  |                                                                              |==========================================================            |  83%  |                                                                              |============================================================          |  86%  |                                                                              |==============================================================        |  89%  |                                                                              |================================================================      |  91%  |                                                                              |==================================================================    |  94%  |                                                                              |====================================================================  |  97%  |                                                                              |======================================================================| 100%
-
## Executing SQL took 0.0956 secs
-
## Generating cohort set took 0.22 secs
-
# Get cohort counts
-cohortCounts <- CohortGenerator::getCohortCounts(
-  connectionDetails = connectionDetails,
-  cohortDatabaseSchema = "main",
-  cohortTable = cohortTableNames$cohortTable
-)
-
## Connecting using SQLite driver
-
## Counting cohorts took 0.0272 secs
-
# Disconnect
-disconnect(con)
-
-
-cohortCounts
-
## [1] cohortId       cohortEntries  cohortSubjects
-## <0 rows> (or 0-length row.names)
-
-
-

Get updated DB after querying cohorts

-
# Establish connection
-con <- connect(connectionDetails)
-
## Connecting using SQLite driver
-
# List all tables
-tables <- dbListTables(con)
-
-# Exclude sqlite_sequence (contains table information)
-tables <- tables[tables != "sqlite_sequence"]
-
-lDataFramesPost <- vector("list", length=length(tables))
-names(lDataFramesPost) <- tables
-
-# Create a data.frame for each table
-for (i in seq(along=tables)) {
-  lDataFramesPost[[i]] <- dbGetQuery(conn=con, statement=paste("SELECT * FROM '", tables[[i]], "'", sep=""))
-}
-
-# Disconnect
-disconnect(con)
-
-
-cat("Number of persons in dataset: ", length(unique(lDataFramesPost$person$person_id)), 
-    "\nNumber of persons in cohort:  ", length(unique(lDataFramesPost$cardiac_arrest$subject_id)))
-
## Number of persons in dataset:  2694 
-## Number of persons in cohort:   0
-
-
-

Filter loaded database for cohort

-
cohort_df <- list()
-cohort_person_ids <- lDataFramesPost$cardiac_arrest$subject_id
-for (table in names(lDataFramesPost)) {
-  if ("person_id" %in% names(lDataFramesPost[[table]])) {
-    cohort_df[[table]] <- 
-      lDataFramesPost[[table]] %>%
-      dplyr::filter(person_id %in% cohort_person_ids)
-  } else {
-    cohort_df[[table]] <- lDataFramesPost[[table]]
-  }
-}
-
- - - - -
- - - - - - - - - - - - - - - diff --git a/project/R/countOccurrences.R b/project/R/countOccurrences.R deleted file mode 100644 index f5caa198..00000000 --- a/project/R/countOccurrences.R +++ /dev/null @@ -1,66 +0,0 @@ -countOccurrences <- function(v, tables, list_of_df, links) { - stopifnot(is.vector(v)) - stopifnot(is.character(tables) & is.vector(tables)) - stopifnot(is.list(list_of_df)) - stopifnot(is.list(links)) - - if (!any(tables %in% names(links))) { - stop("Table is not one of the tables listed underneath with linked concept_id fields, \nPlease provide a different table or update the table -- concept_id links. \nTerminating") - } - - unique_person_ids <- vector("list", length(v)) - records <- numeric(length(v)) - records_descendant <- numeric(length(v)) - unique_person_ids_descendant <- vector("list", length(v)) - - for (table in tables) { - df <- list_of_df[[table]] - concept_id_field <- links[[table]] - if (!all(c("person_id", concept_id_field) %in% names(df))) { - stop("Data frame does not contain expected columns.") - } - anc <- list_of_df$concept_ancestor$ancestor_concept_id - desc <- list_of_df$concept_ancestor$descendant_concept_id - - if (!all(c("ancestor_concept_id", "descendant_concept_id") %in% names(list_of_df$concept_ancestor))) { - stop("Concept ancestor data frame does not contain expected columns.") - } - - for (i in seq_along(v)) { - val <- v[i] - direct_df <- df[df[, concept_id_field] == val, ] - desc_val <- c(anc[which(desc == val)], desc[which(anc == val)]) %>% unique() - descendant_df <- df[df[, concept_id_field] %in% desc_val, ] - - # Counting total records directly - if (nrow(direct_df) > 0) { - unique_person_ids[[i]] <- unique(c(unique_person_ids[[i]], direct_df$person_id)) - records[i] <- records[i] + nrow(direct_df) - } - - # Counting total records for descendants - if (nrow(descendant_df) > 0) { - unique_person_ids_descendant[[i]] <- unique(c(unique_person_ids_descendant[[i]], descendant_df$person_id)) - records_descendant[i] <- records_descendant[i] + nrow(descendant_df) - } - } - } - - count_persons <- sapply(unique_person_ids, length) - count_records <- records - descendant_count_person <- sapply(unique_person_ids_descendant, length) - descendant_count_record <- records_descendant - - res <- tibble::tibble( - concept_name = names(v), - concept_id = v, - count_persons = count_persons, - count_records = count_records, - descendant_count_person = descendant_count_person, - descendant_count_record = descendant_count_record, - included = (count_records + descendant_count_record) > 0 - ) %>% - dplyr::arrange(dplyr::desc(count_records + descendant_count_record)) - - return(res) -} \ No newline at end of file diff --git a/project/R/isStandard.R b/project/R/isStandard.R deleted file mode 100644 index 9790d5ea..00000000 --- a/project/R/isStandard.R +++ /dev/null @@ -1,105 +0,0 @@ -library(readr) -library(dplyr) - -isStandard <- function(concept_table_path, data_concepts_path, save_path = NULL) { - -# Filters CONCEPT.csv from Athena vocabulary download for included concepts per -# a table of source codes and provided concepts. The accepted format is CSV files with -# at least fields 'sourceCode' to store source codes or source terms and 'concept_id' -# to store concept_ids. -# These tables are read from data_concepts_path. -# -# If a save_path is provided, results are written as filtered versions of the CONCEPT -# table to the directory save_path points to; with one table for each provided table -# of concepts. It is recommended to provide one table of concepts per source table. -# If no save_path is provided, results are not saved. -# -# The function will always return a tibble of non-standard concepts -# that can be inspected in the R environment or directly printed to the console. -# -# Arguments: -# concept_table_path: -# path to CONCEPT.csv from Athena vocabulary download -# -# data_concepts_path: -# path to directory of CSVs with fields sourceCode and concept_id -# see ./project/data/phems_variable/list/*.csv for examples -# -# save_path: -# path to directory to save filtered concept table with only included concepts -# ! Can be null if write_tables = FALSE -# -# write_tables: -# Boolean toggle for whether to save the results - - - # Set working directory - path <- rstudioapi::getSourceEditorContext()$path %>% - dirname() %>% - dirname() %>% - dirname() - original_wd <- getwd() - setwd(path) - - # Read concept table - concept_table <- read_delim(concept_table_path, - delim = '\t', - col_types = cols(concept_id = col_character())) %>% - mutate(concept_id = as.character(concept_id)) %>% # Ensure concept_id is character - mutate(concept_id = tolower(trimws(concept_id))) - - # Initialize vector of non-standard (or not in vocabularies) concept ids - nonStandard <- c() - # Initialize vector of non-standard concept names - conceptNameNonStandard <- c() - # Initialize vector of source codes/terms for non-standard concepts - sourceCodeNonStandard <- c() - # Initialize vector of source tables for non-standard concepts - sourceTableNonStandard <- c() - - # Get tables - tables <- list.files(path = data_concepts_path, pattern = "\\.csv$", full.names = TRUE) - for (table_path in tables) { - table_name <- basename(table_path) - - # Read and prepare table - tb <- read_csv(table_path, col_types = cols(sourceCode = col_character(), concept_id = col_character())) %>% - mutate(across(c(sourceCode, concept_id), ~gsub("\u00A0", " ", .))) %>% # Replace non-breaking space with regular space - mutate(across(c(sourceCode, concept_id), ~trimws(.))) %>% - filter(!is.na(sourceCode), !is.na(concept_id)) %>% - mutate(concept_id = tolower(concept_id), - concept_id = as.character(concept_id)) - - # Join tables - joined <- inner_join(concept_table, tb, by = "concept_id") - - # Add non-standard concept info to vectors - ind <- which(!(joined$standard_concept %in% c('S', 'C'))) - nonStandard <- append(nonStandard, joined$concept_id[ind]) - conceptNameNonStandard <- append(conceptNameNonStandard, joined$concept_name[ind]) - sourceCodeNonStandard <- append(sourceCodeNonStandard, joined$sourceCode[ind]) - sourceTableNonStandard <- append(sourceTableNonStandard, - replicate(length(ind), table_name, simplify="vector")) - - # Save if not empty - if (!(is.null(save_path))) { - if(nrow(joined) > 0) { - message(paste("saving file: ", table_name)) - write_csv(joined, paste0(save_path, table_name)) - } else { - message(paste("No matches found for table:", table_name, "\n")) - } - } - } - # Create table of non-standard concepts - res <- tibble::tibble( - concept_id = nonStandard, - concept_name = conceptNameNonStandard, - source_code = sourceCodeNonStandard, - source_table = sourceTableNonStandard - ) - - # reset working directory - setwd(original_wd) - return(res) -} diff --git a/project/R/table_linked_to_concept_field.R b/project/R/table_linked_to_concept_field.R deleted file mode 100644 index a871b6cf..00000000 --- a/project/R/table_linked_to_concept_field.R +++ /dev/null @@ -1,14 +0,0 @@ -# Link table names to respective concept_id field -links <- list( - condition_occurrence = "condition_concept_id", - death = "cause_concept_id", - device_exposure = "device_concept_id", - drug_exposure = "drug_concept_id", - measurement = "measurement_concept_id", - observation = "observation_concept_id", - procedure_occurrence = "procedure_concept_id", - specimen = "specimen_concept_id", - visit_occurrence = "visit_concept_id" -) - -cat("Sourced links object") \ No newline at end of file diff --git a/project/data/phems_variable_list/5.15_vital_signs.csv b/project/data/phems_variable_list/5.15_vital_signs.csv deleted file mode 100644 index 1ec90f04..00000000 --- a/project/data/phems_variable_list/5.15_vital_signs.csv +++ /dev/null @@ -1,11 +0,0 @@ -sourceCode,concept_id -Age-dependent HR ,4239408  -Age-dependent HR ,8483  -Age-dependent RR ,4313591  -Age-dependent RR ,8483  -DBP (Dyastolic Blood Pressure) ,4154790  -DBP (Dyastolic Blood Pressure) ,8876  -SBP (Systolic Blood Pressure) ,4152194  -SBP (Systolic Blood Pressure) ,8876  -SpO2 ,4096101  -SpO2 ,8554  diff --git a/project/data/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv b/project/data/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv deleted file mode 100644 index b7171725..00000000 --- a/project/data/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv +++ /dev/null @@ -1,85 +0,0 @@ -sourceCode,concept_id -Abcess,444202 -Antibiotics,4085730 -Antineoplastics,4181511 -Antivirals,4140762 -Arterial blood pressure catheter,45758028 -Cancer,443392 -Central venous catheter,4179206 -"Chest opening, chest drainage",4074689 -Corticoids,21602722 -Crohn's disease,201606 -Cushing's disease,195212 -Diagnosis of SIRS,434821 -Diagnosis of acute infection having the potential for progression to sepsis1+2,37174269 -Diagnosis of acute infection having the potential for progression to sepsis1+2,4271450 -Diagnosis of chronic condition,443783 -Diagnosis of chronic condition,312723 -Diagnosis of chronic condition,201820 -Diagnosis of chronic condition,255573 -Diagnosis of condition producing immunodeficiency,4140977 -Diagnosis of organ system dysfunction,4080011 -Dialysis,4032243 -Dialysis,4051330 -Down's syndrome,439125 -ECMO,4052536 -ECMO type,37206601 -ECMO type,37206603 -Endotracheal tube,4097216 -FiO2,720868 -FiO2,42869590 -FiO2,8510 -FiO2,8554 -Immunosuppressors,4314777 -Invasive ventilation,44790095 -Mean Airway Pressure (MAP),8876 -Mean Airway Pressure (MAP),44777590 -Mean Airway Pressure (MAP),42527086 -Mean Airway Pressure (MAP),44777602 -Meningo-encephalitis,4322814 -Nasogastric/orogastric tube,42538045 -Non-invasive ventilation,4177224 -Origin (external),44790567 -Origin (internal),4294886 -Oxygenation index,8529 -Oxygenation index,4193843 -Peripheral IV cannulas,4177205 -Peritoneal dialysis,4324124 -Previous diagnosis of sepsis measure,132797 -Previous diagnosis of sepsis measure,1340204 -Reason for admission,44803020 -Surgical admission (non-urgent),4084670 -Surgical admission (urgent),4123946 -Tracheostomy,44783799 -UTI,4331815 -Urinary catheter,4070667 -Ventricular assist device (VAD),4235043 -acute kidney injury,197320 -appendicitis,440448 -asplenia,45768671 -bacteremia,132736 -candidiasis,433968 -cardiac arrest,321042 -cellulitis,435613 -cerebral palsy,4134120 -endocarditis,441589 -hepatitis,4243475 -immunodeficiency,433740 -injury with open wound,444187 -meningitis,435785 -miocarditis,314383 -mitochondrial disease,81539 -necrotizing enterocolitis,44807226 -nephrotic syndrome,195314 -neutropenia,604243 -organ transplant,4208341 -peritonitis,196152 -pneumonia,255848 -renal insufficiency,36716945 -rheumatoid arthritis,80809 -sickle cell disease,22281 -surgery previous to prediction time point,4301351 -surgical site inflammation,4300243 -tuberculosis,4103588 -ulcerative colitis,81893 -viremia,133327 diff --git a/project/data/phems_variable_list/is_standard/5.10_cardiac_radiology.csv b/project/data/phems_variable_list/is_standard/5.10_cardiac_radiology.csv deleted file mode 100644 index c0939d39..00000000 --- a/project/data/phems_variable_list/is_standard/5.10_cardiac_radiology.csv +++ /dev/null @@ -1,43 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -4019824,Transesophageal echocardiography,Procedure,SNOMED,Procedure,S,105376000,20020131,20991231,NA,US transoesophageal echocardiogram (toe) -4032404,Bronchoscopy,Procedure,SNOMED,Procedure,S,10847001,20020131,20991231,NA,IR bronchoscopy -4065416,Exercise tolerance test,Procedure,SNOMED,Procedure,S,165079009,20020131,20991231,NA,Exercise test (non-CPET) -4345925,Videofluoroscopy swallow,Procedure,SNOMED,Procedure,S,241149003,20020131,20991231,NA,FL video swallow -4083106,US scan of head,Procedure,SNOMED,Procedure,S,241449005,20020131,20991231,NA,US cranial contents -4083108,US scan of neck,Procedure,SNOMED,Procedure,S,241453007,20020131,20991231,NA,US neck -4082979,MRI of head,Procedure,SNOMED,Procedure,S,241601008,20020131,20991231,NA,MRI head -4093436,Ultrasonography of thorax,Procedure,SNOMED,Procedure,S,25850001,20020131,20991231,NA,US thorax and pleural cavity -4125350,CT of head,Procedure,SNOMED,Procedure,S,303653007,20020131,20991231,NA,CT head -4125530,US urinary tract,Procedure,SNOMED,Procedure,S,303917008,20020131,20991231,NA,US urinary tract -44802640,MRI study for cardiac congenital anomaly,Procedure,SNOMED,Procedure,S,322731000000101,20080401,20991231,NA,MRI cardiac complex congenital -4163872,Plain chest X-ray,Procedure,SNOMED,Procedure,S,399208008,20030731,20991231,NA,XR chest -4167029,Ultrasonography of inguinal region,Procedure,SNOMED,Procedure,S,418105000,20060131,20991231,NA,US doppler groin both -4167052,Doppler ultrasonography of kidney,Procedure,SNOMED,Procedure,S,418354002,20060131,20991231,NA,US doppler renal both -4305221,US scan of abdomen and pelvis,Procedure,SNOMED,Procedure,S,418394000,20060131,20991231,NA,US abdomen and pelvis/ US abdomen -4303522,US scan of diaphragm,Procedure,SNOMED,Procedure,S,418889006,20060131,20991231,NA,US diaphragmatic region -4306317,CT angiography of coronary artery with contrast,Procedure,SNOMED,Procedure,S,419545005,20060131,20991231,NA,CT heart with contrast/ CT cardiac angiogram coronary/ CT cardiac gated with contrast -4169275,X-ray of chest and abdomen,Procedure,SNOMED,Procedure,S,420233006,20060131,20991231,NA,XR chest and abdomen -4322380,Insertion of peripherally inserted central catheter,Procedure,SNOMED,Procedure,S,425196008,20070131,20991231,NA,IR PICC line insertion -4140473,Holter extended electrocardiographic recording,Procedure,SNOMED,Procedure,S,427047002,20070731,20991231,NA,24h holter monitor -4329508,Ultrasonography of pleural cavity,Procedure,SNOMED,Procedure,S,431757007,20080731,20991231,NA,US thorax and pleural cavity -4335392,Doppler ultrasonography of vein of lower limb,Procedure,SNOMED,Procedure,S,432336004,20080731,20991231,NA,US doppler lower limb veins both -4203365,Epicardial echocardiography,Procedure,SNOMED,Procedure,S,433232009,20080731,20991231,NA,Epicardial echocardiogram -4335825,Transthoracic echocardiography,Procedure,SNOMED,Procedure,S,433236007,20080731,20991231,NA,US transthoracic echocardiogram/ us transthoracic echocardiogram (pre- admission)/ US transthoracic echocardiogram (sedated) -40482732,Insertion of tunneled venous catheter,Procedure,SNOMED,Procedure,S,442309004,20090731,20991231,NA,IR tunnelled central venous line insertion -40489841,Doppler ultrasonography of jugular vein,Procedure,SNOMED,Procedure,S,446849004,20110131,20991231,NA,US doppler jugular vein both -40492338,Cardiopulmonary exercise test,Procedure,SNOMED,Procedure,S,447346005,20110131,20991231,NA,Cardiopulmonary exercise test (CPET) -40488431,Interrogation of cardiac pacemaker,Procedure,SNOMED,Procedure,S,448150008,20110731,20991231,NA,Pacemaker/ICD interrogation (in clinic)/ pacemaker/ICD interrogation (other) -42873079,Removal of tunneled central venous catheter,Procedure,SNOMED,Procedure,S,450330005,20120731,20991231,NA,IR tunnelled central venous line removal -4261497,Ultrasonography of abdomen,Procedure,SNOMED,Procedure,S,45036003,20020131,20991231,NA,US abdomen and pelvis/ US abdomen -4205144,Portable electroencephalogram,Procedure,SNOMED,Procedure,S,54061003,20020131,20991231,NA,EEG routine portable -4181917,Electroencephalogram,Procedure,SNOMED,Procedure,S,54550000,20020131,20991231,NA,EEG routine -4264477,Diagnostic radiography of abdomen,Procedure,SNOMED,Procedure,S,60654006,20020131,20991231,NA,XR abdomen -45764527,Electrocardiographic Holter analyzer,Device,SNOMED,Physical Object,S,701233001,20140731,20991231,NA,24h holter monitor -45765560,Cardiovascular monitor,Device,SNOMED,Physical Object,S,702527008,20140731,20991231,NA,Event monitor -4327032,CT of thorax with contrast,Procedure,SNOMED,Procedure,S,75385009,20020131,20991231,NA,CT thorax with contrast -35622931,Doppler ultrasound,Procedure,SNOMED,Procedure,S,765172009,20180731,20991231,NA,US doppler groin both -35622931,Doppler ultrasound,Procedure,SNOMED,Procedure,S,765172009,20180731,20991231,NA,US doppler -44813863,Ultrasonography of vocal cord,Procedure,SNOMED,Procedure,S,844621000000101,20121001,20991231,NA,US vocal cord -4312208,Contrast bronchogram,Procedure,SNOMED,Procedure,S,85895003,20020131,20991231,NA,IR bronchogram -4235141,Check artificial pacemaker,Procedure,SNOMED,Procedure,S,9061001,20020131,20991231,NA,Pacemaker/ICD device check - remote patient initiated -4235141,Check artificial pacemaker,Procedure,SNOMED,Procedure,S,9061001,20020131,20991231,NA,Pacemaker/ICD device check - remote device initiated diff --git a/project/data/phems_variable_list/is_standard/5.11_cardiac_los.csv b/project/data/phems_variable_list/is_standard/5.11_cardiac_los.csv deleted file mode 100644 index 847976b0..00000000 --- a/project/data/phems_variable_list/is_standard/5.11_cardiac_los.csv +++ /dev/null @@ -1,5 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -4123933,Admission to pediatric intensive care unit,Observation,SNOMED,Procedure,S,305353001,20020131,20991231,NA,ICU admission (start datetime and end datetime) -8715,Hospital admission,Observation,SNOMED,Procedure,S,32485007,20020131,20991231,NA,Total hospital admission (start datetime and end datetime) -4161811,Admission to high dependency unit,Observation,SNOMED,Procedure,S,398162007,20030731,20991231,NA,HDU admission (start datetime and end datetime) -36675203,Admission to pediatric cardiology department,Observation,SNOMED,Procedure,S,771550009,20190131,20991231,NA,Cardiology ward admission (start datetime and end datetime) diff --git a/project/data/phems_variable_list/is_standard/5.12_additional.csv b/project/data/phems_variable_list/is_standard/5.12_additional.csv deleted file mode 100644 index d98f85e4..00000000 --- a/project/data/phems_variable_list/is_standard/5.12_additional.csv +++ /dev/null @@ -1,36 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -5083,Telehealth,Visit,CMS Place of Service,Visit,S,02,20160101,20991231,NA,Outpatient appointment type (telephone/ clinic visit etc.) -42869590,Oxygen/Gas total [Pure volume fraction] Inhaled gas,Measurement,LOINC,Clinical Observation,S,71835-3,20120521,20991231,NA,FiO2 -3027946,Carbon dioxide [Partial pressure] in Arterial blood,Measurement,LOINC,Lab Test,S,2019-8,19700101,20991231,NA,PaCO2 -3004249,Systolic blood pressure,Measurement,LOINC,Clinical Observation,S,8480-6,19960906,20991231,NA,Systolic blood pressure -4124462,None,Meas Value,SNOMED,Qualifier Value,S,260413007,20020131,20991231,NA,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -4095105,Base deficit measurement,Measurement,SNOMED,Procedure,S,26154000,20020131,20991231,NA,Base Excess -4123933,Admission to pediatric intensive care unit,Observation,SNOMED,Procedure,S,305353001,20020131,20991231,NA,Elective ICU admission -4234469,Diagnosis,Observation,SNOMED,Observable Entity,S,439401001,20090131,20991231,NA,Diagnoses -40493026,Mechanical ventilator,Device,SNOMED,Physical Object,S,449071006,20110731,20991231,NA,Mechanical ventilation -44803020,Primary reason for admission,Observation,SNOMED,Observable Entity,S,507151000000102,20091001,20991231,NA,"Reason for ICU admission: (Main reason for ICU admission is not recovery from surgery or a procedure, Recovery from a bypass cardiac procedure, recovery from a non-bypass cardiac procedure, recovery from non-cardiac procedure)" -4209008,Pupillary function,Observation,SNOMED,Observable Entity,S,56777005,20020131,20991231,NA,Pupillary reaction -260134,Croup,Condition,SNOMED,Disorder,S,71186008,20020131,20991231,NA,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -432571,Malignant lymphoma,Condition,SNOMED,Disorder,S,118600007,20020131,20991231,NA,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -4029498,Seizure disorder,Condition,SNOMED,Disorder,S,128613002,20020131,20991231,NA,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -317009,Asthma,Condition,SNOMED,Disorder,S,195967001,20020131,20991231,NA,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -201957,Necrotizing enterocolitis in fetus OR newborn,Condition,SNOMED,Disorder,S,2707005,20020131,20991231,NA,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -43530727,Spontaneous cerebral hemorrhage,Condition,SNOMED,Disorder,S,291571000119106,20130731,20991231,NA,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -29783,Severe combined immunodeficiency disease,Condition,SNOMED,Disorder,S,31323000,20020131,20991231,NA,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -321042,Cardiac arrest,Condition,SNOMED,Disorder,S,410429000,20040731,20991231,NA,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -4165112,Bronchiolitis,Condition,SNOMED,Disorder,S,4120002,20020131,20991231,NA,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -443727,Diabetic ketoacidosis,Condition,SNOMED,Disorder,S,420422005,20060731,20991231,NA,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -314383,Myocarditis,Condition,SNOMED,Disorder,S,50920009,20020131,20991231,NA,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -4245975,Hepatic failure,Condition,SNOMED,Disorder,S,59927004,20020131,20991231,NA,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -440207,Hypoplastic left heart syndrome,Condition,SNOMED,Disorder,S,62067003,20020131,20991231,NA,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -42537745,Bone marrow transplant present,Observation,SNOMED,Clinical Finding,S,737300001,20180131,20991231,NA,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -442588,Obstructive sleep apnea syndrome,Condition,SNOMED,Disorder,S,78275009,20020131,20991231,NA,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -4213310,Degenerative disease of the central nervous system,Condition,SNOMED,Disorder,S,80690008,20020131,20991231,NA,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -321319,Cardiomyopathy,Condition,SNOMED,Disorder,S,85898001,20020131,20991231,NA,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -317510,Leukemia,Condition,SNOMED,Disorder,S,93143009,20020131,20991231,NA,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -8554,percent,Unit,UCUM,Unit,S,%,19700101,20991231,NA,FiO2 -44777602,kilopascal,Unit,UCUM,Unit,S,kPa,19700101,20991231,NA,PaCO2 -8876,millimeter mercury column,Unit,UCUM,Unit,S,mm[Hg],19700101,20991231,NA,Systolic blood pressure -8876,millimeter mercury column,Unit,UCUM,Unit,S,mm[Hg],19700101,20991231,NA,PaCO2 -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Base Excess -9202,Outpatient Visit,Visit,Visit,Visit,S,OP,19700101,20991231,NA,"Outpatient appointments start datetime, end datetime" diff --git a/project/data/phems_variable_list/is_standard/5.13_laboratory_tests.csv b/project/data/phems_variable_list/is_standard/5.13_laboratory_tests.csv deleted file mode 100644 index dd0af1e4..00000000 --- a/project/data/phems_variable_list/is_standard/5.13_laboratory_tests.csv +++ /dev/null @@ -1,61 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -3005456,Potassium [Moles/volume] in Blood,Measurement,LOINC,Lab Test,S,6298-4,19700101,20991231,NA,Potassium -3018572,Chloride [Moles/volume] in Blood,Measurement,LOINC,Lab Test,S,2069-3,19700101,20991231,NA,Chloride -3051825,Creatinine [Mass/volume] in Blood,Measurement,LOINC,Lab Test,S,38483-4,20041020,20991231,NA,Creatinine -3027273,Bicarbonate [Moles/volume] in Venous blood,Measurement,LOINC,Lab Test,S,14627-4,19980116,20991231,NA,Bicarbonate (venous) -3006140,Bilirubin.total [Moles/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,14631-6,19700101,20991231,NA,Bilirubin -3013826,Glucose [Moles/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,14749-6,19980116,20991231,NA,Glucose -3003458,Phosphate [Moles/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,14879-1,19980116,20991231,NA,Phosphate -3024641,Urea nitrogen [Moles/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,14937-7,19980116,20991231,NA,Blood urea nitrogen -3006923,Alanine aminotransferase [Enzymatic activity/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,1742-6,19700101,20991231,NA,ALT -3024561,Albumin [Mass/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,1751-7,19700101,20991231,NA,Albumin -3013721,Aspartate aminotransferase [Enzymatic activity/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,1920-8,19700101,20991231,NA,AST -3008152,Bicarbonate [Moles/volume] in Arterial blood,Measurement,LOINC,Lab Test,S,1960-4,19700101,20991231,NA,Bicarbonate (arterial) -3020460,C reactive protein [Mass/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,1988-5,19700101,20991231,NA,CRP -3015377,Calcium [Moles/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,2000-8,19700101,20991231,NA,Calcium -3027946,Carbon dioxide [Partial pressure] in Arterial blood,Measurement,LOINC,Lab Test,S,2019-8,19700101,20991231,NA,pCO2 (arterial) -3021447,Carbon dioxide [Partial pressure] in Venous blood,Measurement,LOINC,Lab Test,S,2021-4,19700101,20991231,NA,pCO2 (venous) -3009542,Hematocrit [Volume Fraction] of Blood,Measurement,LOINC,Lab Test,S,20570-8,19700101,20991231,NA,Hematocrit -3033836,Magnesium [Moles/volume] in Blood,Measurement,LOINC,Lab Test,S,2593-2,19700101,20991231,NA,Magnesium -3027801,Oxygen [Partial pressure] in Arterial blood,Measurement,LOINC,Lab Test,S,2703-7,19700101,20991231,NA,pO2 (arterial) -3024354,Oxygen [Partial pressure] in Venous blood,Measurement,LOINC,Lab Test,S,2705-2,19700101,20991231,NA,pO2 (venous) -3019550,Sodium [Moles/volume] in Serum or Plasma,Measurement,LOINC,Lab Test,S,2951-2,19700101,20991231,NA,Sodium -3047181,Lactate [Moles/volume] in Blood,Measurement,LOINC,Lab Test,S,32693-4,20021014,20991231,NA,Lactate -3007670,Neutrophil Ab [Units/volume] in Serum,Measurement,LOINC,Lab Test,S,5171-4,19700101,20991231,NA,Neutrophil count -3034426,Prothrombin time (PT),Measurement,LOINC,Lab Test,S,5902-2,19700101,20991231,NA,INR prothrombin time -40762351,Hemoglobin [Moles/volume] in Blood,Measurement,LOINC,Lab Test,S,59260-0,20100329,20991231,NA,Hemoglobin -37399161,Blood arterial pH,Measurement,SNOMED,Observable Entity,S,1007061000000103,20160401,20991231,NA,pH (arterial) -37392672,Blood venous pH,Measurement,SNOMED,Observable Entity,S,1007071000000105,20160401,20991231,NA,pH (venous) -4267147,Platelet count,Measurement,SNOMED,Procedure,S,61928009,20020131,20991231,NA,Platelet count -4298431,White blood cell count,Measurement,SNOMED,Procedure,S,767002,20020131,20991231,NA,Immature WBC count -8554,percent,Unit,UCUM,Unit,S,%,19700101,20991231,NA,Hematocrit -8713,gram per deciliter,Unit,UCUM,Unit,S,g/dL,19700101,20991231,NA,Hemoglobin -8713,gram per deciliter,Unit,UCUM,Unit,S,g/dL,19700101,20991231,NA,Albumin -8636,gram per liter,Unit,UCUM,Unit,S,g/L,19700101,20991231,NA,Hemoglobin -8636,gram per liter,Unit,UCUM,Unit,S,g/L,19700101,20991231,NA,Albumin -44777602,kilopascal,Unit,UCUM,Unit,S,kPa,19700101,20991231,NA,pCO2 (venous) -8840,milligram per deciliter,Unit,UCUM,Unit,S,mg/dL,19700101,20991231,NA,Creatinine -8751,milligram per liter,Unit,UCUM,Unit,S,mg/L,19700101,20991231,NA,CRP -8876,millimeter mercury column,Unit,UCUM,Unit,S,mm[Hg],19700101,20991231,NA,pCO2 (venous) -8876,millimeter mercury column,Unit,UCUM,Unit,S,mm[Hg],19700101,20991231,NA,pCO2 (arterial) -8876,millimeter mercury column,Unit,UCUM,Unit,S,mm[Hg],19700101,20991231,NA,pO2 (venous) -8876,millimeter mercury column,Unit,UCUM,Unit,S,mm[Hg],19700101,20991231,NA,pO2 (arterial) -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Lactate -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Blood urea nitrogen -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Glucose -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Sodium -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Potassium -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Magnesium -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Chloride -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Calcium -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Phosphate -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Bicarbonate (venous) -8753,millimole per liter,Unit,UCUM,Unit,S,mmol/L,19700101,20991231,NA,Bicarbonate (arterial) -8555,second,Unit,UCUM,Unit,S,s,19700101,20991231,NA,INR prothrombin time -8647,per microliter,Unit,UCUM,Unit,S,/uL,19700101,20991231,NA,Immature WBC count -8647,per microliter,Unit,UCUM,Unit,S,/uL,19700101,20991231,NA,Neutrophil count -8647,per microliter,Unit,UCUM,Unit,S,/uL,19700101,20991231,NA,Platelet count -8645,unit per liter,Unit,UCUM,Unit,S,[U]/L,19700101,20991231,NA,ALT -8645,unit per liter,Unit,UCUM,Unit,S,[U]/L,19700101,20991231,NA,AST -8749,micromole per liter,Unit,UCUM,Unit,S,umol/L,19700101,20991231,NA,Creatinine -8749,micromole per liter,Unit,UCUM,Unit,S,umol/L,19700101,20991231,NA,Bilirubin diff --git a/project/data/phems_variable_list/is_standard/5.14_cardiac_complications.csv b/project/data/phems_variable_list/is_standard/5.14_cardiac_complications.csv deleted file mode 100644 index 64b3cdbd..00000000 --- a/project/data/phems_variable_list/is_standard/5.14_cardiac_complications.csv +++ /dev/null @@ -1,13 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -4051330,Continuous venovenous hemofiltration,Procedure,SNOMED,Procedure,S,233585000,20020131,20991231,NA,LCOS - renal support (CVVH/ PD) -4123933,Admission to pediatric intensive care unit,Observation,SNOMED,Procedure,S,305353001,20020131,20991231,NA,ICU ward stay -4295705,Exploratory incision,Procedure,SNOMED,Procedure,S,76145000,20020131,20991231,NA,Surgical injury - Reexplore for bleeding -377091,Seizure,Condition,SNOMED,Clinical Finding,S,91175000,20020131,20991231,NA,Neurological injury - seizure -439847,Intracranial hemorrhage,Condition,SNOMED,Disorder,S,1386000,20020131,20991231,NA,Neurological injury - intracranial haemmhorage/ intracranial bleeding -4308537,Injury to blood vessel during surgery,Condition,SNOMED,Disorder,S,213266005,20020131,20991231,NA,Surgical injury - Blood Loss -321042,Cardiac arrest,Condition,SNOMED,Disorder,S,410429000,20040731,20991231,NA,LCOS - Cardiac arrest -443454,Cerebral infarction,Condition,SNOMED,Disorder,S,432504007,20080731,20991231,NA,Neurological injury - infarction -4185565,Low cardiac output syndrome,Condition,SNOMED,Disorder,S,44088000,20020131,20991231,NA,Low cardiac output state (LCOS) - ECMO -4185565,Low cardiac output syndrome,Condition,SNOMED,Disorder,S,44088000,20020131,20991231,NA,LCOS - NEC requiring treatment -42537043,CLABSI - central line associated bloodstream infection,Condition,SNOMED,Disorder,S,736152001,20180131,20991231,NA,CVL infections -4306136,Chylothorax,Condition,SNOMED,Disorder,S,83035003,20020131,20991231,NA,Surgical injury - Chylothorax diff --git a/project/data/phems_variable_list/is_standard/5.15_vital_signs.csv b/project/data/phems_variable_list/is_standard/5.15_vital_signs.csv deleted file mode 100644 index 158c7c27..00000000 --- a/project/data/phems_variable_list/is_standard/5.15_vital_signs.csv +++ /dev/null @@ -1,11 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -4096101,Measurement of oxygen saturation at periphery,Measurement,SNOMED,Procedure,S,250554003,20020131,20991231,NA,SpO2 -4152194,Systolic blood pressure,Measurement,SNOMED,Observable Entity,NA,271649006,20020131,20991231,NA,SBP (Systolic Blood Pressure) -4154790,Diastolic blood pressure,Measurement,SNOMED,Observable Entity,NA,271650006,20020131,20991231,NA,DBP (Dyastolic Blood Pressure) -4239408,Heart rate,Measurement,SNOMED,Observable Entity,NA,364075005,20020131,20991231,NA,Age-dependent HR -4313591,Respiratory rate,Measurement,SNOMED,Observable Entity,NA,86290005,20020131,20991231,NA,Age-dependent RR -8554,percent,Unit,UCUM,Unit,S,%,19700101,20991231,NA,SpO2 -8483,counts per minute,Unit,UCUM,Unit,S,{counts}/min,19700101,20991231,NA,Age-dependent HR -8483,counts per minute,Unit,UCUM,Unit,S,{counts}/min,19700101,20991231,NA,Age-dependent RR -8876,millimeter mercury column,Unit,UCUM,Unit,S,mm[Hg],19700101,20991231,NA,SBP (Systolic Blood Pressure) -8876,millimeter mercury column,Unit,UCUM,Unit,S,mm[Hg],19700101,20991231,NA,DBP (Dyastolic Blood Pressure) diff --git a/project/data/phems_variable_list/is_standard/5.16_hsjd_clinical.csv b/project/data/phems_variable_list/is_standard/5.16_hsjd_clinical.csv deleted file mode 100644 index 51c09f11..00000000 --- a/project/data/phems_variable_list/is_standard/5.16_hsjd_clinical.csv +++ /dev/null @@ -1,9 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -3025315,Body weight,Measurement,LOINC,Clinical Observation,S,29463-7,19700101,20991231,NA,Weight -0,No matching concept,Metadata,None,Undefined,NA,No matching concept,19700101,20991231,NA,Extracardiac anomalies - diagnoses -607590,Body height,Measurement,SNOMED,Observable Entity,NA,1153637007,20210731,20991231,NA,Height -4201235,Body surface area,Measurement,SNOMED,Observable Entity,S,301898006,20020131,20991231,NA,Body Surface Area (BSA) - Combination of weight and height -4275564,Operation on heart,Procedure,SNOMED,Procedure,S,64915003,20020131,20991231,NA,Cardiac surgeries (Interventions) -8582,centimeter,Unit,UCUM,Unit,S,cm,19700101,20991231,NA,Height -9529,kilogram,Unit,UCUM,Unit,S,kg,19700101,20991231,NA,Weight -8617,square meter,Unit,UCUM,Unit,S,m2,19700101,20991231,NA,Body Surface Area (BSA) - Combination of weight and height diff --git a/project/data/phems_variable_list/is_standard/5.17_hsjd_surgery.csv b/project/data/phems_variable_list/is_standard/5.17_hsjd_surgery.csv deleted file mode 100644 index e9bf646e..00000000 --- a/project/data/phems_variable_list/is_standard/5.17_hsjd_surgery.csv +++ /dev/null @@ -1,9 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -0,No matching concept,Metadata,None,Undefined,NA,No matching concept,19700101,20991231,NA,Aristotle's score of surgery -44790138,Induced circulatory arrest,Procedure,SNOMED,Procedure,S,232211000000108,20061002,20991231,NA,"Deep hypothermic circulatory arrest start datetime, end datetime" -4336464,Coronary artery bypass graft,Procedure,SNOMED,Procedure,S,232717009,20020131,20991231,NA,"Cardiac bypass start datetime, end datetime" -4150627,Removal of endotracheal tube,Procedure,SNOMED,Procedure,S,271280005,20020131,20991231,NA,Extubation event -4201547,Placement of arterial cross clamp,Procedure,SNOMED,Procedure,S,301880007,20020131,20991231,NA,"Cross-clamping start datetime, end datetime" -4301351,Surgical procedure,Procedure,SNOMED,Procedure,S,387713003,20030131,20991231,NA,"Surgery start datetime, end datetime" -40490494,Society of Thoracic Surgeons risk calculator,Measurement,SNOMED,Staging / Scales,S,448586003,20110731,20991231,NA,STAT/EACTS score of surgery -4272324,Cardiopulmonary bypass operation,Procedure,SNOMED,Procedure,S,63697000,20020131,20991231,NA,"Antegrade Cerebral Perfusion start datetime, end datetime" diff --git a/project/data/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv b/project/data/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv deleted file mode 100644 index ab2852cb..00000000 --- a/project/data/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv +++ /dev/null @@ -1,11 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -0,No matching concept,Metadata,None,Undefined,NA,No matching concept,19700101,20991231,NA,ventilation -0,No matching concept,Metadata,None,Undefined,NA,No matching concept,19700101,20991231,NA,Type of vasoactive infusion -0,No matching concept,Metadata,None,Undefined,NA,No matching concept,19700101,20991231,NA,VIS score of vasoactive infusion -0,No matching concept,Metadata,None,Undefined,NA,No matching concept,19700101,20991231,NA,"Total ventilation start datetime, end datetime" -794078,vasoactive intestinal peptide,Drug,RxNorm,Ingredient,S,1942960,20180205,20991231,NA,Dose of vasoactive infusion (rate - mcg/kg/hr) -37158404,Invasive mechanical ventilation,Procedure,SNOMED,Procedure,S,1258985005,20221130,20991231,NA,Invasive Mechanical Ventilation LOS -4177224,Non-invasive ventilation,Procedure,SNOMED,Procedure,S,428311008,20080131,20991231,NA,Non-Invasive Mechanical Ventilation LOS -44803020,Primary reason for admission,Observation,SNOMED,Observable Entity,S,507151000000102,20091001,20991231,NA,Admission reason -4179206,Central venous catheter,Device,SNOMED,Physical Object,S,52124006,20020131,20991231,NA,"Postop central venous catheter in/start datetime, out/ end datetime" -42539650,Administration of intravenous vasoactive drug,Procedure,SNOMED,Procedure,S,736765002,20180131,20991231,NA,"Vasoactive infusion start datetime, end datetime" diff --git a/project/data/phems_variable_list/is_standard/5.19_hsjd_complication.csv b/project/data/phems_variable_list/is_standard/5.19_hsjd_complication.csv deleted file mode 100644 index cd26514d..00000000 --- a/project/data/phems_variable_list/is_standard/5.19_hsjd_complication.csv +++ /dev/null @@ -1,21 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -46234437,ivabradine,Drug,RxNorm,Ingredient,S,1649480,20150706,20991231,NA,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" -1354860,flecainide,Drug,RxNorm,Ingredient,S,4441,19700101,20991231,NA,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" -1309944,amiodarone,Drug,RxNorm,Ingredient,S,703,19700101,20991231,NA,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" -4044892,Procedure on sternum,Procedure,SNOMED,Procedure,S,129198003,20020131,20991231,NA,Sternum reopening (procedure undertaken) -4046868,Vocal cord dysfunction,Condition,SNOMED,Clinical Finding,S,134290008,20020131,20991231,NA,Vocal Cord Dysfunction -4049398,Temporary cardiac pacemaker procedure,Procedure,SNOMED,Procedure,S,233175008,20020131,20991231,NA,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" -4051940,Permanent cardiac pacemaker procedure,Procedure,SNOMED,Procedure,S,233182007,20020131,20991231,NA,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" -4353741,Cardioversion,Procedure,SNOMED,Procedure,S,250980009,20020131,20991231,NA,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" -4117045,Atrial overdrive pacing,Procedure,SNOMED,Procedure,S,287696002,20020131,20991231,NA,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" -253796,Pneumothorax,Condition,SNOMED,Disorder,S,36118008,20020131,20991231,NA,Pneumothorax -609312,Awaiting transplantation of heart,Observation,SNOMED,Context-dependent,S,374847481000119108,20210131,20991231,NA,Listed for heart transplantation -4202832,Intubation,Procedure,SNOMED,Procedure,S,52765003,20020131,20991231,NA,intubation -315643,Tachyarrhythmia,Condition,SNOMED,Disorder,S,6285003,20020131,20991231,NA,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4275564,Operation on heart,Procedure,SNOMED,Procedure,S,64915003,20020131,20991231,NA,Cardiac surgeries (interventions) -44783799,Exteriorization of trachea,Procedure,SNOMED,Procedure,S,697984004,20140131,20991231,NA,Tracheostomy -44784217,Cardiac arrhythmia,Condition,SNOMED,Disorder,S,698247007,20140131,20991231,NA,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4068155,Atrial arrhythmia,Condition,SNOMED,Disorder,S,17366009,20020131,20991231,NA,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4228448,Bradyarrhythmia,Condition,SNOMED,Disorder,S,421869004,20060731,20991231,NA,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4185572,Ventricular arrhythmia,Condition,SNOMED,Disorder,S,44103008,20020131,20991231,NA,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4275136,Paralysis of diaphragm,Condition,SNOMED,Disorder,S,64228003,20020131,20991231,NA,Diaphragmatic Paralysis diff --git a/project/data/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv b/project/data/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv deleted file mode 100644 index a5c3f4c3..00000000 --- a/project/data/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv +++ /dev/null @@ -1 +0,0 @@ -sourceCode,concept_id,standard_concept diff --git a/project/data/phems_variable_list/is_standard/5.3_vis_score_medications.csv b/project/data/phems_variable_list/is_standard/5.3_vis_score_medications.csv deleted file mode 100644 index 2e5ba0f1..00000000 --- a/project/data/phems_variable_list/is_standard/5.3_vis_score_medications.csv +++ /dev/null @@ -1,7 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -1507835,vasopressin (USP),Drug,RxNorm,Ingredient,S,11149,19700101,20991231,NA,vasopressin -1337720,dobutamine,Drug,RxNorm,Ingredient,S,3616,19700101,20991231,NA,dobutamine -1337860,dopamine,Drug,RxNorm,Ingredient,S,3628,19700101,20991231,NA,dopamine -1343916,epinephrine,Drug,RxNorm,Ingredient,S,3992,19700101,20991231,NA,epinephrine -1368671,milrinone,Drug,RxNorm,Ingredient,S,52769,19700101,20991231,NA,milrinone -1321341,norepinephrine,Drug,RxNorm,Ingredient,S,7512,19700101,20991231,NA,norepinephrin diff --git a/project/data/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv b/project/data/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv deleted file mode 100644 index a2487e75..00000000 --- a/project/data/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv +++ /dev/null @@ -1,12 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -1507835,vasopressin (USP),Drug,RxNorm,Ingredient,S,11149,19700101,20991231,NA,Vasopressin -1337720,dobutamine,Drug,RxNorm,Ingredient,S,3616,19700101,20991231,NA,Dobutamine -1337860,dopamine,Drug,RxNorm,Ingredient,S,3628,19700101,20991231,NA,Dopamine -1143374,ephedrine,Drug,RxNorm,Ingredient,S,3966,19700101,20991231,NA,Ephedrine -1343916,epinephrine,Drug,RxNorm,Ingredient,S,3992,19700101,20991231,NA,Epinephrine -1368671,milrinone,Drug,RxNorm,Ingredient,S,52769,19700101,20991231,NA,Milrinone -19119253,terlipressin,Drug,RxNorm,Ingredient,S,57048,19700101,20991231,NA,Terlipressin -1183554,isoproterenol,Drug,RxNorm,Ingredient,S,6054,19700101,20991231,NA,Isoproterenol -40173184,levosimendan,Drug,RxNorm,Ingredient,S,73107,20100228,20991231,NA,Levosimendan -1321341,norepinephrine,Drug,RxNorm,Ingredient,S,7512,19700101,20991231,NA,Norepinephrine -1135766,phenylephrine,Drug,RxNorm,Ingredient,S,8163,19700101,20991231,NA,Phenylephrine diff --git a/project/data/phems_variable_list/is_standard/5.5_immunosuppressants.csv b/project/data/phems_variable_list/is_standard/5.5_immunosuppressants.csv deleted file mode 100644 index 0776db33..00000000 --- a/project/data/phems_variable_list/is_standard/5.5_immunosuppressants.csv +++ /dev/null @@ -1,7 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -21603754,Monoclonal antibodies,Drug,ATC,ATC 4th,C,L01XC,19700101,20991231,NA,Monoclonal Antibodies -1518254,dexamethasone,Drug,RxNorm,Ingredient,S,3264,19700101,20991231,NA,Dexamethasone -975125,hydrocortisone,Drug,RxNorm,Ingredient,S,5492,19700101,20991231,NA,Hydrocortisone -1506270,methylprednisolone,Drug,RxNorm,Ingredient,S,6902,19700101,20991231,NA,Methylprednisolone -1550557,prednisolone,Drug,RxNorm,Ingredient,S,8638,19700101,20991231,NA,Prednisolone -4273629,Chemotherapy,Procedure,SNOMED,Procedure,S,367336001,20020131,20991231,NA,Chemotherapy diff --git a/project/data/phems_variable_list/is_standard/5.6_antibiotic_medication.csv b/project/data/phems_variable_list/is_standard/5.6_antibiotic_medication.csv deleted file mode 100644 index 51626b4c..00000000 --- a/project/data/phems_variable_list/is_standard/5.6_antibiotic_medication.csv +++ /dev/null @@ -1,51 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -21603754,Monoclonal antibodies,Drug,ATC,ATC 4th,C,L01XC,19700101,20991231,NA,Monoclonal Antibodies -1836430,sulfamethoxazole,Drug,RxNorm,Ingredient,S,10180,19700101,20991231,NA,Trimethoprim-Sulfamethoxazole -1836948,tetracycline,Drug,RxNorm,Ingredient,S,10395,19700101,20991231,NA,Tetracycline -902722,tobramycin,Drug,RxNorm,Ingredient,S,10627,19700101,20991231,NA,Tobramycin -1705674,trimethoprim,Drug,RxNorm,Ingredient,S,10829,19700101,20991231,NA,Trimethoprim-Sulfamethoxazole -1707687,vancomycin,Drug,RxNorm,Ingredient,S,11124,19700101,20991231,NA,Vancomycin -19010400,fusidate,Drug,RxNorm,Ingredient,S,113608,20060514,20991231,NA,Fusidic acid -45892419,gentamicin,Drug,RxNorm,Ingredient,S,1596450,20150302,20991231,NA,Gentamicin -45892599,ceftolozane,Drug,RxNorm,Ingredient,S,1597609,20150302,20991231,NA,Ceftolozane-Tazovactam -46221507,avibactam,Drug,RxNorm,Ingredient,S,1603834,20150504,20991231,NA,Ceftazidime-Avibactam -1734104,azithromycin,Drug,RxNorm,Ingredient,S,18631,19700101,20991231,NA,Azithromycin -1736887,linezolid,Drug,RxNorm,Ingredient,S,190376,19700101,20991231,NA,Linezolid -1748975,cefepime,Drug,RxNorm,Ingredient,S,20481,19700101,20991231,NA,Cefepime -1750500,clarithromycin,Drug,RxNorm,Ingredient,S,21212,19700101,20991231,NA,Clarithromycin -1769535,cefadroxil,Drug,RxNorm,Ingredient,S,2177,19700101,20991231,NA,Cefadroxil -1771162,cefazolin,Drug,RxNorm,Ingredient,S,2180,19700101,20991231,NA,Cefazolin -1774470,cefotaxime,Drug,RxNorm,Ingredient,S,2186,19700101,20991231,NA,Cefotaxime -1776684,ceftazidime,Drug,RxNorm,Ingredient,S,2191,19700101,20991231,NA,Ceftazidime -1776684,ceftazidime,Drug,RxNorm,Ingredient,S,2191,19700101,20991231,NA,Ceftazidime-Avibactam -1778162,cefuroxime,Drug,RxNorm,Ingredient,S,2194,19700101,20991231,NA,Cefuroxime -1786617,daptomycin,Drug,RxNorm,Ingredient,S,22299,19700101,20991231,NA,Daptomycin -1797513,ciprofloxacin,Drug,RxNorm,Ingredient,S,2551,19700101,20991231,NA,Ciprofloxacin -997881,clindamycin,Drug,RxNorm,Ingredient,S,2582,19700101,20991231,NA,Clindamycin -901845,colistin,Drug,RxNorm,Ingredient,S,2709,19700101,20991231,NA,Colistin -1709170,meropenem,Drug,RxNorm,Ingredient,S,29561,19700101,20991231,NA,Meropenem -1717963,ertapenem,Drug,RxNorm,Ingredient,S,325642,19700101,20991231,NA,Ertapenem -1518254,dexamethasone,Drug,RxNorm,Ingredient,S,3264,19700101,20991231,NA,Dexamethasone -1741122,tazobactam,Drug,RxNorm,Ingredient,S,37617,19700101,20991231,NA,Piperacillin-Tazobactam -1741122,tazobactam,Drug,RxNorm,Ingredient,S,37617,19700101,20991231,NA,Ceftolozane-Tazovactam -1746940,erythromycin,Drug,RxNorm,Ingredient,S,4053,19700101,20991231,NA,Erythromycin -951511,mupirocin,Drug,RxNorm,Ingredient,S,42372,19700101,20991231,NA,Mupirocin -956653,fosfomycin,Drug,RxNorm,Ingredient,S,4550,19700101,20991231,NA,Fosfomycin -1759842,clavulanate,Drug,RxNorm,Ingredient,S,48203,19700101,20991231,NA,Amoxicillin clavulanate -975125,hydrocortisone,Drug,RxNorm,Ingredient,S,5492,19700101,20991231,NA,Hydrocortisone -1778262,imipenem,Drug,RxNorm,Ingredient,S,5690,19700101,20991231,NA,Imipenem -19078399,teicoplanin,Drug,RxNorm,Ingredient,S,57021,19700101,20991231,NA,Teicoplanin -1790868,amikacin,Drug,RxNorm,Ingredient,S,641,19700101,20991231,NA,Amikacin -1506270,methylprednisolone,Drug,RxNorm,Ingredient,S,6902,19700101,20991231,NA,Methylprednisolone -1713332,amoxicillin,Drug,RxNorm,Ingredient,S,723,19700101,20991231,NA,Amoxicillin clavulanate -1713332,amoxicillin,Drug,RxNorm,Ingredient,S,723,19700101,20991231,NA,Amoxicillin -1717327,ampicillin,Drug,RxNorm,Ingredient,S,733,19700101,20991231,NA,Ampicillin -920293,nitrofurantoin,Drug,RxNorm,Ingredient,S,7454,19700101,20991231,NA,Nitrofurantoin -1721543,norfloxacin,Drug,RxNorm,Ingredient,S,7517,19700101,20991231,NA,Norfloxacin -1724703,oxacillin,Drug,RxNorm,Ingredient,S,7773,19700101,20991231,NA,Oxacillin -1728416,penicillin G,Drug,RxNorm,Ingredient,S,7980,19700101,20991231,NA,Penicillin -1742253,levofloxacin,Drug,RxNorm,Ingredient,S,82122,19700101,20991231,NA,Levofloxacin -1746114,piperacillin,Drug,RxNorm,Ingredient,S,8339,19700101,20991231,NA,Piperacillin-Tazobactam -1550557,prednisolone,Drug,RxNorm,Ingredient,S,8638,19700101,20991231,NA,Prednisolone -1763204,rifampin,Drug,RxNorm,Ingredient,S,9384,19700101,20991231,NA,Rifampicin -4273629,Chemotherapy,Procedure,SNOMED,Procedure,S,367336001,20020131,20991231,NA,Chemotherapy diff --git a/project/data/phems_variable_list/is_standard/5.7_antifungals.csv b/project/data/phems_variable_list/is_standard/5.7_antifungals.csv deleted file mode 100644 index cdd03cdc..00000000 --- a/project/data/phems_variable_list/is_standard/5.7_antifungals.csv +++ /dev/null @@ -1,6 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -1714277,voriconazole,Drug,RxNorm,Ingredient,S,121243,19700101,20991231,NA,Voriconazole -35606695,isavuconazole,Drug,RxNorm,Ingredient,S,1720882,20160502,20991231,NA,Isovuconazole -19018013,micafungin,Drug,RxNorm,Ingredient,S,325887,20051113,20991231,NA,Micafungin -19026450,anidulafungin,Drug,RxNorm,Ingredient,S,341018,20060514,20991231,NA,Andiulafungin -1754994,fluconazole,Drug,RxNorm,Ingredient,S,4450,19700101,20991231,NA,Fluconazole diff --git a/project/data/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv b/project/data/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv deleted file mode 100644 index 5e9e8db7..00000000 --- a/project/data/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv +++ /dev/null @@ -1,11 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -1707687,vancomycin,Drug,RxNorm,Ingredient,S,11124,19700101,20991231,NA,Vancomycin-resistant -997881,clindamycin,Drug,RxNorm,Ingredient,S,2582,19700101,20991231,NA,Clindamycin-resistant -1746940,erythromycin,Drug,RxNorm,Ingredient,S,4053,19700101,20991231,NA,Erythromycin-resistant -4019195,Methicillin resistant Staphylococcus aureus,Observation,SNOMED,Organism,S,115329001,20020131,20991231,NA,MRSA -4257547,Extended spectrum beta-lactamase producing bacteria,Observation,SNOMED,Organism,S,409799006,20040731,20991231,NA,ESBL -37017134,Multidrug-resistant bacteria,Observation,SNOMED,Organism,S,713351000,20160131,20991231,NA,Drug-resistant -37017134,Multidrug-resistant bacteria,Observation,SNOMED,Organism,S,713351000,20160131,20991231,NA,Multidrug-resistant -37017134,Multidrug-resistant bacteria,Observation,SNOMED,Organism,S,713351000,20160131,20991231,NA,Clindamycin-resistant -37017134,Multidrug-resistant bacteria,Observation,SNOMED,Organism,S,713351000,20160131,20991231,NA,Vancomycin-resistant -37017134,Multidrug-resistant bacteria,Observation,SNOMED,Organism,S,713351000,20160131,20991231,NA,Erythromycin-resistant diff --git a/project/data/phems_variable_list/is_standard/5.9_cardiac_surgery.csv b/project/data/phems_variable_list/is_standard/5.9_cardiac_surgery.csv deleted file mode 100644 index 0b8dc5d9..00000000 --- a/project/data/phems_variable_list/is_standard/5.9_cardiac_surgery.csv +++ /dev/null @@ -1,42 +0,0 @@ -concept_id,concept_name,domain_id,vocabulary_id,concept_class_id,standard_concept,concept_code,valid_start_date,valid_end_date,invalid_reason,sourceCode -4049734,Banding of pulmonary artery,Procedure,SNOMED,Procedure,S,15648005,20020131,20991231,NA,Application of band to pulmonary artery -4019929,Repair of tetralogy of Fallot,Procedure,SNOMED,Procedure,S,174814003,20020131,20991231,NA,Unspecified repair of tetralogy of fallot -4019932,Arterial switch operation,Procedure,SNOMED,Procedure,S,174826008,20020131,20991231,NA,Repositioning of transposed great arteries -4017751,Repair of total anomalous pulmonary venous connection,Procedure,SNOMED,Procedure,S,174830006,20020131,20991231,NA,Unspecified correction of total anomalous pulmonary  venous connection -4020376,Closure of defect of interatrial septum using pericardial patch,Procedure,SNOMED,Procedure,S,174845004,20020131,20991231,NA,Primary repair of defect of interatrial septum NEC/repair of defect of interatrial septum using pericardial patch -4020506,Creation of valved conduit between right ventricle of heart and pulmonary artery,Procedure,SNOMED,Procedure,S,174883003,20020131,20991231,NA,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec -4019950,Revision of valved cardiac conduit,Procedure,SNOMED,Procedure,S,174885005,20020131,20991231,NA,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec -4020508,Repair of sinus venosus,Procedure,SNOMED,Procedure,S,174899009,20020131,20991231,NA,Correction of persistent sinus venosus -4018441,Repair of partial anomalous pulmonary venous connection,Procedure,SNOMED,Procedure,S,174900004,20020131,20991231,NA,Correction of partial anomalous pulmonary venous drainage -4020520,Open aortic valvotomy,Procedure,SNOMED,Procedure,S,174968009,20020131,20991231,NA,Open aortic valvotomy -4018747,Operations on the left ventricular outflow tract,Procedure,SNOMED,Procedure,S,174997007,20020131,20991231,NA,Repair of subaortic stenosis -4019233,Creation of shunt from subclavian artery to pulmonary artery using interposition tube prosthesis,Procedure,SNOMED,Procedure,S,175236000,20020131,20991231,NA,Unspecified creation of shunt to pulmonary artery from subclavian artery using interposition tube pr -4019237,Anastomosis of vena cava to pulmonary artery,Procedure,SNOMED,Procedure,S,175249005,20020131,20991231,NA,Creation of anastomosis to pulmonary artery from vena cava -4018926,Repair of pulmonary artery,Procedure,SNOMED,Procedure,S,175253007,20020131,20991231,NA,Other specified : repair of pulmonary artery -4021725,Removal of band from pulmonary artery,Procedure,SNOMED,Procedure,S,175261002,20020131,20991231,NA,Removal of band from pulmonary artery -4019026,Plastic repair of aorta,Procedure,SNOMED,Procedure,S,175337007,20020131,20991231,NA,Other specified: plastic repair of aorta -4020812,Plastic repair of aorta and end-to-end anastomosis of aorta,Procedure,SNOMED,Procedure,S,175338002,20020131,20991231,NA,Plastic repair of aorta and end to end anastomosis of aorta -4019028,Release of vascular ring of aorta,Procedure,SNOMED,Procedure,S,175341006,20020131,20991231,NA,Release of vascular ring of aorta -44790092,Relief of left ventricular outflow tract obstruction,Procedure,SNOMED,Procedure,S,223341000000109,20061002,20991231,NA,Relief of left ventricular outflow tract obstruction -44789857,Total cavopulmonary connection with extracardiac inferior caval vein to pulmonary artery conduit,Procedure,SNOMED,Procedure,S,224111000000108,20061002,20991231,NA,Total cavopulmonary connection with extracardiac inferior caval vein topulmonary artery conduit -4336751,Allotransplant of heart,Procedure,SNOMED,Procedure,S,232973007,20020131,20991231,NA,Unspecified other transplantation of heart/allotransplantation of heart NEC -4049979,Repair of double outlet right ventricle,Procedure,SNOMED,Procedure,S,233126007,20020131,20991231,NA,Repair of double outlet right ventricle -4050114,Closure of ductus arteriosus with clip,Procedure,SNOMED,Procedure,S,233199008,20020131,20991231,NA,Closure of patent ductus arteriosus NEC -4052536,Extracorporeal membrane oxygenation,Procedure,SNOMED,Procedure,S,233573008,20020131,20991231,NA,Extracorporeal membrane oxygenation -44790415,Aortic root replacement using pulmonary valve autograft with right ventricle to pulmonary artery valved conduit and aortoventriculoplasty,Procedure,SNOMED,Procedure,S,233601000000100,20061002,20991231,NA,Aortic root pulmonary valve autograft with right vent to pulmonary artery valved conduit/ aortic root pulmonary valve autograft with right vent to pulmonary artery aortoventriculoplasty -4144921,Implantation of cardiac pacemaker,Procedure,SNOMED,Procedure,S,307280005,20020131,20991231,NA,Implantation of cardiac pacemaker system NEC -4137127,Transplantation of heart,Procedure,SNOMED,Procedure,S,32413006,20020131,20991231,NA,Unspecified other transplantation of heart/allotransplantation of heart NEC -44793133,Aortopulmonary reconstruction with systemic to pulmonary arterial shunt,Procedure,SNOMED,Procedure,S,378121000000101,20090401,20991231,NA,Aortopulmonary reconstruction with systemic to pulmonary arterial shunt -4293619,Repair of tricuspid valve,Procedure,SNOMED,Procedure,S,384643000,20030131,20991231,NA,Tricuspid valve repair NEC -4296790,Transposition of coronary artery,Procedure,SNOMED,Procedure,S,384678000,20030131,20991231,NA,Transposition of coronary artery NEC -4139214,Open implantation of cardiac ventricular assist device,Procedure,SNOMED,Procedure,S,426568003,20070731,20991231,NA,Open implantation of ventricular assist device -4178479,Replacement of valved cardiac conduit,Procedure,SNOMED,Procedure,S,428893001,20080131,20991231,NA,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec -40486525,Primary repair of defect of atrioventricular septum,Procedure,SNOMED,Procedure,S,447748008,20110731,20991231,NA,Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum -4187380,Repair of ostium primum defect,Procedure,SNOMED,Procedure,S,47195003,20020131,20991231,NA,Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum -4199899,Closure of ventricular septal defect,Procedure,SNOMED,Procedure,S,52930005,20020131,20991231,NA,Unspecified repair of defect of interventricular septum -4203153,Replacement of mitral valve,Procedure,SNOMED,Procedure,S,53059001,20020131,20991231,NA,Replacement of mitral valve NEC -4217615,Plication of diaphragm,Procedure,SNOMED,Procedure,S,81913003,20020131,20991231,NA,Plication of diaphragm -4308136,Complete repair of tetralogy of Fallot with transannular patch,Procedure,SNOMED,Procedure,S,83698002,20020131,20991231,NA,Repair of tetralogy of fallot using transannular patch -4312194,Repair of heart valve,Procedure,SNOMED,Procedure,S,85830006,20020131,20991231,NA,Aortic valve repair NEC -4339184,Replacement of pulmonary valve,Procedure,SNOMED,Procedure,S,88045004,20020131,20991231,NA,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec -4232476,Repair of ventricular septal defect with prosthesis,Procedure,SNOMED,Procedure,S,89814007,20020131,20991231,NA,Repair of defect of interventricular septum using prosthetic patch/unspecified repair of defect of interventricular septum diff --git a/project/json/cardiacComplications_cs.json b/project/json/cardiacComplications_cs.json deleted file mode 100644 index 0d20ef0a..00000000 --- a/project/json/cardiacComplications_cs.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "items": [ - { - "concept": { - "CONCEPT_ID": 4324124, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4051330, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4185565, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 321042, - "CONCEPT_NAME": "Cardiac arrest", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "410429000", - "DOMAIN_ID": "Condition", - "VOCABULARY_ID": "SNOMED", - "CONCEPT_CLASS_ID": "Clinical Finding" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - } - ] -} diff --git a/project/json/cardiacProcedures_cs.json b/project/json/cardiacProcedures_cs.json deleted file mode 100644 index d8dc6abc..00000000 --- a/project/json/cardiacProcedures_cs.json +++ /dev/null @@ -1,429 +0,0 @@ -{ - "items": [ - { - "concept": { - "CONCEPT_ID": 4296790, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4137127, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 44789857, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4019950, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4178479, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4339184, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4203153, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4232476, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4293619, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4017751, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4019929, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4020508, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4018926, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4018441, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4187380, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4312194, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4049979, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4021725, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 44790092, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4019028, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 40486525, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4217615, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4020812, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4019026, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 44510968, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - } - ] -} diff --git a/project/json/cohort.json b/project/json/cohort.json deleted file mode 100644 index 7edd8ce7..00000000 --- a/project/json/cohort.json +++ /dev/null @@ -1,1163 +0,0 @@ -{ - "ConceptSets": [ - { - "id": 0, - "name": "labTests", - "expression": { - "items": [ - { - "concept": { - "CONCEPT_ID": 4298431, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3007670, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 40762351, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 37393863, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3009542, - "CONCEPT_NAME": "Hematocrit", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "20570-8", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3034426, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3047181, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3051825, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3024561, - "CONCEPT_NAME": "Albumin serum/plasma", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "1751-7", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3024641, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3013826, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3006140, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3019550, - "CONCEPT_NAME": "Sodium serum/plasma", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "2951-2", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3005456, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3033836, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3018572, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3015377, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3003458, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3020460, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3006923, - "CONCEPT_NAME": "Alanine aminotransferase serum/plasma", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "1742-6", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3013721, - "CONCEPT_NAME": "Aspartate aminotransferase serum/plasma", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "1920-8", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 37392672, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 37399161, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3021447, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3027946, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3024354, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3027801, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3027273, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3008152, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - } - ] - } - }, - { - "id": 1, - "name": "cardiacComplications", - "expression": { - "items": [ - { - "concept": { - "CONCEPT_ID": 4324124, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4051330, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4185565, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 321042, - "CONCEPT_NAME": "Cardiac arrest", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "410429000", - "DOMAIN_ID": "Condition", - "VOCABULARY_ID": "SNOMED", - "CONCEPT_CLASS_ID": "Clinical Finding" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - } - ] - } - }, - { - "id": 2, - "name": "cardiacProcedures", - "expression": { - "items": [ - { - "concept": { - "CONCEPT_ID": 4296790, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4137127, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 44789857, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4019950, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4178479, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4339184, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4203153, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4232476, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4293619, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4017751, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4019929, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4020508, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4018926, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4018441, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4187380, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4312194, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4049979, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4021725, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 44790092, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4019028, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 40486525, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4217615, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4020812, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 4019026, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 44510968, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - } - ] - } - }, - { - "id": 3, - "name": "intubation", - "expression": { - "items": [ - { - "concept": { - "CONCEPT_ID": 4202832, - "CONCEPT_NAME": "Intubation", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "52765003", - "DOMAIN_ID": "Procedure", - "VOCABULARY_ID": "SNOMED", - "CONCEPT_CLASS_ID": "Procedure" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - } - ] - } - } - ], - "PrimaryCriteria": { - "CriteriaList": [ - { - "Measurement": { - "CodesetId": 0, - "Age": { - "Op": "lt", - "Value": 80 - } - } - } - ], - "ObservationWindow": { - "PriorDays": 0, - "PostDays": 0 - }, - "PrimaryCriteriaLimit": { - "Type": "All" - } - }, - "QualifiedLimit": { - "Type": "First" - }, - "ExpressionLimit": { - "Type": "First" - }, - "InclusionRules": [ - { - "name": "rule1", - "expression": { - "Type": "ANY", - "CriteriaList": [ - { - "Criteria": { - "ConditionOccurrence": { - "CodesetId": 1 - } - }, - "StartWindow": { - "Start": { - "Coeff": -1 - }, - "End": { - "Coeff": 1 - }, - "UseIndexEnd": false, - "UseEventEnd": false - }, - "Occurrence": { - "Type": 2, - "Count": 1 - } - }, - { - "Criteria": { - "ProcedureOccurrence": { - "CodesetId": 1 - } - }, - "StartWindow": { - "Start": { - "Coeff": -1 - }, - "End": { - "Coeff": 1 - }, - "UseIndexEnd": false, - "UseEventEnd": false - }, - "Occurrence": { - "Type": 2, - "Count": 1 - } - } - ], - "DemographicCriteriaList": [], - "Groups": [] - } - }, - { - "name": "rule2", - "expression": { - "Type": "ANY", - "CriteriaList": [ - { - "Criteria": { - "ProcedureOccurrence": { - "CodesetId": 2 - } - }, - "StartWindow": { - "Start": { - "Coeff": -1 - }, - "End": { - "Coeff": 1 - }, - "UseIndexEnd": false, - "UseEventEnd": false - }, - "Occurrence": { - "Type": 2, - "Count": 1 - } - } - ], - "DemographicCriteriaList": [], - "Groups": [] - } - } - ], - "CensoringCriteria": [ - { - "ProcedureOccurrence": { - "CodesetId": 3 - } - } - ], - "CollapseSettings": { - "CollapseType": "ERA", - "EraPad": 0 - }, - "CensorWindow": {}, - "cdmVersionRange": ">=5.0.0" -} diff --git a/project/json/intubation_cs.json b/project/json/intubation_cs.json deleted file mode 100644 index d8af3e3d..00000000 --- a/project/json/intubation_cs.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "items": [ - { - "concept": { - "CONCEPT_ID": 4202832, - "CONCEPT_NAME": "Intubation", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "52765003", - "DOMAIN_ID": "Procedure", - "VOCABULARY_ID": "SNOMED", - "CONCEPT_CLASS_ID": "Procedure" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - } - ] -} diff --git a/project/json/labTests_cs.json b/project/json/labTests_cs.json deleted file mode 100644 index 2d673d34..00000000 --- a/project/json/labTests_cs.json +++ /dev/null @@ -1,497 +0,0 @@ -{ - "items": [ - { - "concept": { - "CONCEPT_ID": 4298431, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3007670, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 40762351, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 37393863, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3009542, - "CONCEPT_NAME": "Hematocrit", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "20570-8", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3034426, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3047181, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3051825, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3024561, - "CONCEPT_NAME": "Albumin serum/plasma", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "1751-7", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3024641, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3013826, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3006140, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3019550, - "CONCEPT_NAME": "Sodium serum/plasma", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "2951-2", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3005456, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3033836, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3018572, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3015377, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3003458, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3020460, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3006923, - "CONCEPT_NAME": "Alanine aminotransferase serum/plasma", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "1742-6", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3013721, - "CONCEPT_NAME": "Aspartate aminotransferase serum/plasma", - "STANDARD_CONCEPT": "S", - "STANDARD_CONCEPT_CAPTION": "Standard", - "INVALID_REASON": "V", - "INVALID_REASON_CAPTION": "Valid", - "CONCEPT_CODE": "1920-8", - "DOMAIN_ID": "Measurement", - "VOCABULARY_ID": "LOINC", - "CONCEPT_CLASS_ID": "Lab Test" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 37392672, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 37399161, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3021447, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3027946, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3024354, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3027801, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3027273, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - }, - { - "concept": { - "CONCEPT_ID": 3008152, - "CONCEPT_NAME": "", - "STANDARD_CONCEPT": "", - "STANDARD_CONCEPT_CAPTION": "", - "INVALID_REASON": "", - "INVALID_REASON_CAPTION": "", - "CONCEPT_CODE": "", - "DOMAIN_ID": "", - "VOCABULARY_ID": "", - "CONCEPT_CLASS_ID": "" - }, - "isExcluded": false, - "includeDescendants": true, - "includeMapped": false - } - ] -} diff --git a/project/renv.lock b/project/renv.lock deleted file mode 100644 index 81b52b23..00000000 --- a/project/renv.lock +++ /dev/null @@ -1,1884 +0,0 @@ -{ - "R": { - "Version": "4.4.0", - "Repositories": [ - { - "Name": "CRAN", - "URL": "https://packagemanager.posit.co/cran/latest" - } - ] - }, - "Packages": { - "Capr": { - "Package": "Capr", - "Version": "2.0.8", - "Source": "GitHub", - "RemoteType": "github", - "RemoteHost": "api.github.com", - "RemoteRepo": "Capr", - "RemoteUsername": "ohdsi", - "RemoteRef": "v2.0.8", - "RemoteSha": "c25f7365476b05af79497201e165d33acd1f110a", - "Requirements": [ - "CirceR", - "DBI", - "DatabaseConnector", - "R", - "SqlRender", - "checkmate", - "cli", - "digest", - "dplyr", - "fs", - "generics", - "glue", - "jsonlite", - "lubridate", - "magrittr", - "methods", - "purrr", - "readr", - "rlang", - "stringr", - "tibble", - "tidyr" - ], - "Hash": "5c14cb5c92bf80da1542420717c7c7e8" - }, - "CirceR": { - "Package": "CirceR", - "Version": "1.3.3", - "Source": "GitHub", - "RemoteType": "github", - "RemoteHost": "api.github.com", - "RemoteRepo": "CirceR", - "RemoteUsername": "ohdsi", - "RemoteRef": "HEAD", - "RemoteSha": "30303ec28bfd3bd4deffc9f84e7b8f9ddbf93c77", - "Requirements": [ - "R", - "RJSONIO", - "rJava" - ], - "Hash": "3e9b4a57bbac2222751f20d4d59a390f" - }, - "CohortGenerator": { - "Package": "CohortGenerator", - "Version": "0.9.0", - "Source": "GitHub", - "Remotes": "ohdsi/CirceR, ohdsi/Eunomia, ohdsi/ROhdsiWebApi", - "RemoteType": "github", - "RemoteHost": "api.github.com", - "RemoteRepo": "CohortGenerator", - "RemoteUsername": "ohdsi", - "RemoteRef": "HEAD", - "RemoteSha": "e3efad630b8b2c0376431a88fde89e6c4bbac38c", - "Requirements": [ - "DatabaseConnector", - "ParallelLogger", - "R", - "R6", - "RJSONIO", - "SqlRender", - "bit64", - "checkmate", - "digest", - "dplyr", - "jsonlite", - "lubridate", - "readr", - "rlang", - "stringi" - ], - "Hash": "1ba1b2d91607742e1d53676af13f506f" - }, - "CommonDataModel": { - "Package": "CommonDataModel", - "Version": "0.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "DBI", - "DatabaseConnector", - "SqlRender", - "dplyr", - "rJava", - "readr", - "rmarkdown", - "stringr" - ], - "Hash": "d009324efba4c142b431202580eb09d1" - }, - "DBI": { - "Package": "DBI", - "Version": "1.2.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "methods" - ], - "Hash": "065ae649b05f1ff66bb0c793107508f5" - }, - "DatabaseConnector": { - "Package": "DatabaseConnector", - "Version": "6.3.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "DBI", - "R", - "SqlRender", - "bit64", - "checkmate", - "dbplyr", - "digest", - "methods", - "rJava", - "readr", - "rlang", - "stringr", - "urltools", - "utils" - ], - "Hash": "1ef65614602c6534a6c666e872c3b647" - }, - "Eunomia": { - "Package": "Eunomia", - "Version": "2.0.0", - "Source": "GitHub", - "RemoteType": "github", - "RemoteHost": "api.github.com", - "RemoteRepo": "Eunomia", - "RemoteUsername": "ohdsi", - "RemoteRef": "HEAD", - "RemoteSha": "79c89443c8fe424e9dc19ea10e80c1d8d36efa0c", - "Requirements": [ - "CommonDataModel", - "DBI", - "RSQLite", - "arrow", - "readr", - "rlang" - ], - "Hash": "a4cd8b6a4182cc97a6aef3e9b0ab358e" - }, - "ParallelLogger": { - "Package": "ParallelLogger", - "Version": "3.3.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "jsonlite", - "methods", - "snow", - "utils", - "xml2" - ], - "Hash": "fd636fc067099b75b8ad17e9104b10f3" - }, - "R6": { - "Package": "R6", - "Version": "2.5.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "470851b6d5d0ac559e9d01bb352b4021" - }, - "RJSONIO": { - "Package": "RJSONIO", - "Version": "1.3-1.9", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "methods" - ], - "Hash": "2f89abc0f88c647d3386c672632f4baf" - }, - "RSQLite": { - "Package": "RSQLite", - "Version": "2.3.7", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "DBI", - "R", - "bit64", - "blob", - "cpp11", - "memoise", - "methods", - "pkgconfig", - "plogr", - "rlang" - ], - "Hash": "46b45a4dd7bb0e0f4e3fc22245817240" - }, - "Rcpp": { - "Package": "Rcpp", - "Version": "1.0.12", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "methods", - "utils" - ], - "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" - }, - "SqlRender": { - "Package": "SqlRender", - "Version": "1.18.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "checkmate", - "rJava", - "rlang" - ], - "Hash": "e1762de0f08b14658d74989c10e2f265" - }, - "arrow": { - "Package": "arrow", - "Version": "16.1.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "assertthat", - "bit64", - "cpp11", - "glue", - "methods", - "purrr", - "rlang", - "stats", - "tidyselect", - "utils", - "vctrs" - ], - "Hash": "d9cb18a8fc53895548150650cadde3a6" - }, - "askpass": { - "Package": "askpass", - "Version": "1.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "sys" - ], - "Hash": "cad6cf7f1d5f6e906700b9d3e718c796" - }, - "assertthat": { - "Package": "assertthat", - "Version": "0.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "tools" - ], - "Hash": "50c838a310445e954bc13f26f26a6ecf" - }, - "backports": { - "Package": "backports", - "Version": "1.5.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "e1e1b9d75c37401117b636b7ae50827a" - }, - "base64enc": { - "Package": "base64enc", - "Version": "0.1-3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "543776ae6848fde2f48ff3816d0628bc" - }, - "bit": { - "Package": "bit", - "Version": "4.0.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "d242abec29412ce988848d0294b208fd" - }, - "bit64": { - "Package": "bit64", - "Version": "4.0.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "bit", - "methods", - "stats", - "utils" - ], - "Hash": "9fe98599ca456d6552421db0d6772d8f" - }, - "blob": { - "Package": "blob", - "Version": "1.2.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "methods", - "rlang", - "vctrs" - ], - "Hash": "40415719b5a479b87949f3aa0aee737c" - }, - "brew": { - "Package": "brew", - "Version": "1.0-10", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "8f4a384e19dccd8c65356dc096847b76" - }, - "brio": { - "Package": "brio", - "Version": "1.1.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "c1ee497a6d999947c2c224ae46799b1a" - }, - "bslib": { - "Package": "bslib", - "Version": "0.7.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "base64enc", - "cachem", - "fastmap", - "grDevices", - "htmltools", - "jquerylib", - "jsonlite", - "lifecycle", - "memoise", - "mime", - "rlang", - "sass" - ], - "Hash": "8644cc53f43828f19133548195d7e59e" - }, - "cachem": { - "Package": "cachem", - "Version": "1.1.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "fastmap", - "rlang" - ], - "Hash": "cd9a672193789068eb5a2aad65a0dedf" - }, - "callr": { - "Package": "callr", - "Version": "3.7.6", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "processx", - "utils" - ], - "Hash": "d7e13f49c19103ece9e58ad2d83a7354" - }, - "checkmate": { - "Package": "checkmate", - "Version": "2.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "backports", - "utils" - ], - "Hash": "c01cab1cb0f9125211a6fc99d540e315" - }, - "cli": { - "Package": "cli", - "Version": "3.6.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "utils" - ], - "Hash": "1216ac65ac55ec0058a6f75d7ca0fd52" - }, - "clipr": { - "Package": "clipr", - "Version": "0.8.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "utils" - ], - "Hash": "3f038e5ac7f41d4ac41ce658c85e3042" - }, - "commonmark": { - "Package": "commonmark", - "Version": "1.9.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "5d8225445acb167abf7797de48b2ee3c" - }, - "cpp11": { - "Package": "cpp11", - "Version": "0.4.7", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "5a295d7d963cc5035284dcdbaf334f4e" - }, - "crayon": { - "Package": "crayon", - "Version": "1.5.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "grDevices", - "methods", - "utils" - ], - "Hash": "859d96e65ef198fd43e82b9628d593ef" - }, - "credentials": { - "Package": "credentials", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "askpass", - "curl", - "jsonlite", - "openssl", - "sys" - ], - "Hash": "c7844b32098dcbd1c59cbd8dddb4ecc6" - }, - "curl": { - "Package": "curl", - "Version": "5.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "411ca2c03b1ce5f548345d2fc2685f7a" - }, - "dbplyr": { - "Package": "dbplyr", - "Version": "2.5.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "DBI", - "R", - "R6", - "blob", - "cli", - "dplyr", - "glue", - "lifecycle", - "magrittr", - "methods", - "pillar", - "purrr", - "rlang", - "tibble", - "tidyr", - "tidyselect", - "utils", - "vctrs", - "withr" - ], - "Hash": "39b2e002522bfd258039ee4e889e0fd1" - }, - "desc": { - "Package": "desc", - "Version": "1.4.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "cli", - "utils" - ], - "Hash": "99b79fcbd6c4d1ce087f5c5c758b384f" - }, - "devtools": { - "Package": "devtools", - "Version": "2.4.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "desc", - "ellipsis", - "fs", - "lifecycle", - "memoise", - "miniUI", - "pkgbuild", - "pkgdown", - "pkgload", - "profvis", - "rcmdcheck", - "remotes", - "rlang", - "roxygen2", - "rversions", - "sessioninfo", - "stats", - "testthat", - "tools", - "urlchecker", - "usethis", - "utils", - "withr" - ], - "Hash": "ea5bc8b4a6a01e4f12d98b58329930bb" - }, - "diffobj": { - "Package": "diffobj", - "Version": "0.3.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "crayon", - "methods", - "stats", - "tools", - "utils" - ], - "Hash": "bcaa8b95f8d7d01a5dedfd959ce88ab8" - }, - "digest": { - "Package": "digest", - "Version": "0.6.35", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "utils" - ], - "Hash": "698ece7ba5a4fa4559e3d537e7ec3d31" - }, - "downlit": { - "Package": "downlit", - "Version": "0.4.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "brio", - "desc", - "digest", - "evaluate", - "fansi", - "memoise", - "rlang", - "vctrs", - "withr", - "yaml" - ], - "Hash": "45a6a596bf0108ee1ff16a040a2df897" - }, - "dplyr": { - "Package": "dplyr", - "Version": "1.1.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "cli", - "generics", - "glue", - "lifecycle", - "magrittr", - "methods", - "pillar", - "rlang", - "tibble", - "tidyselect", - "utils", - "vctrs" - ], - "Hash": "fedd9d00c2944ff00a0e2696ccf048ec" - }, - "ellipsis": { - "Package": "ellipsis", - "Version": "0.3.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "rlang" - ], - "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077" - }, - "evaluate": { - "Package": "evaluate", - "Version": "0.24.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "methods" - ], - "Hash": "a1066cbc05caee9a4bf6d90f194ff4da" - }, - "fansi": { - "Package": "fansi", - "Version": "1.0.6", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "grDevices", - "utils" - ], - "Hash": "962174cf2aeb5b9eea581522286a911f" - }, - "fastmap": { - "Package": "fastmap", - "Version": "1.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" - }, - "fontawesome": { - "Package": "fontawesome", - "Version": "0.5.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "htmltools", - "rlang" - ], - "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" - }, - "fs": { - "Package": "fs", - "Version": "1.6.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "methods" - ], - "Hash": "15aeb8c27f5ea5161f9f6a641fafd93a" - }, - "generics": { - "Package": "generics", - "Version": "0.1.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "methods" - ], - "Hash": "15e9634c0fcd294799e9b2e929ed1b86" - }, - "gert": { - "Package": "gert", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "askpass", - "credentials", - "openssl", - "rstudioapi", - "sys", - "zip" - ], - "Hash": "f70d3fe2d9e7654213a946963d1591eb" - }, - "gh": { - "Package": "gh", - "Version": "1.4.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "gitcreds", - "glue", - "httr2", - "ini", - "jsonlite", - "lifecycle", - "rlang" - ], - "Hash": "fbbbc48eba7a6626a08bb365e44b563b" - }, - "gitcreds": { - "Package": "gitcreds", - "Version": "0.1.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "ab08ac61f3e1be454ae21911eb8bc2fe" - }, - "glue": { - "Package": "glue", - "Version": "1.7.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "methods" - ], - "Hash": "e0b3a53876554bd45879e596cdb10a52" - }, - "highr": { - "Package": "highr", - "Version": "0.11", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "xfun" - ], - "Hash": "d65ba49117ca223614f71b60d85b8ab7" - }, - "hms": { - "Package": "hms", - "Version": "1.1.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "lifecycle", - "methods", - "pkgconfig", - "rlang", - "vctrs" - ], - "Hash": "b59377caa7ed00fa41808342002138f9" - }, - "htmltools": { - "Package": "htmltools", - "Version": "0.5.8.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "base64enc", - "digest", - "fastmap", - "grDevices", - "rlang", - "utils" - ], - "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" - }, - "htmlwidgets": { - "Package": "htmlwidgets", - "Version": "1.6.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "grDevices", - "htmltools", - "jsonlite", - "knitr", - "rmarkdown", - "yaml" - ], - "Hash": "04291cc45198225444a397606810ac37" - }, - "httpuv": { - "Package": "httpuv", - "Version": "1.6.15", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "Rcpp", - "later", - "promises", - "utils" - ], - "Hash": "d55aa087c47a63ead0f6fc10f8fa1ee0" - }, - "httr": { - "Package": "httr", - "Version": "1.4.7", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "curl", - "jsonlite", - "mime", - "openssl" - ], - "Hash": "ac107251d9d9fd72f0ca8049988f1d7f" - }, - "httr2": { - "Package": "httr2", - "Version": "1.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "cli", - "curl", - "glue", - "lifecycle", - "magrittr", - "openssl", - "rappdirs", - "rlang", - "vctrs", - "withr" - ], - "Hash": "03d741c92fda96d98c3a3f22494e3b4a" - }, - "ini": { - "Package": "ini", - "Version": "0.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "6154ec2223172bce8162d4153cda21f7" - }, - "jquerylib": { - "Package": "jquerylib", - "Version": "0.1.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "htmltools" - ], - "Hash": "5aab57a3bd297eee1c1d862735972182" - }, - "jsonlite": { - "Package": "jsonlite", - "Version": "1.8.8", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "methods" - ], - "Hash": "e1b9c55281c5adc4dd113652d9e26768" - }, - "knitr": { - "Package": "knitr", - "Version": "1.47", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "evaluate", - "highr", - "methods", - "tools", - "xfun", - "yaml" - ], - "Hash": "7c99b2d55584b982717fcc0950378612" - }, - "later": { - "Package": "later", - "Version": "1.3.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "Rcpp", - "rlang" - ], - "Hash": "a3e051d405326b8b0012377434c62b37" - }, - "lifecycle": { - "Package": "lifecycle", - "Version": "1.0.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "glue", - "rlang" - ], - "Hash": "b8552d117e1b808b09a832f589b79035" - }, - "lubridate": { - "Package": "lubridate", - "Version": "1.9.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "generics", - "methods", - "timechange" - ], - "Hash": "680ad542fbcf801442c83a6ac5a2126c" - }, - "magrittr": { - "Package": "magrittr", - "Version": "2.0.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "7ce2733a9826b3aeb1775d56fd305472" - }, - "memoise": { - "Package": "memoise", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "cachem", - "rlang" - ], - "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c" - }, - "mime": { - "Package": "mime", - "Version": "0.12", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "tools" - ], - "Hash": "18e9c28c1d3ca1560ce30658b22ce104" - }, - "miniUI": { - "Package": "miniUI", - "Version": "0.1.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "htmltools", - "shiny", - "utils" - ], - "Hash": "fec5f52652d60615fdb3957b3d74324a" - }, - "openssl": { - "Package": "openssl", - "Version": "2.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "askpass" - ], - "Hash": "2bcca3848e4734eb3b16103bc9aa4b8e" - }, - "pillar": { - "Package": "pillar", - "Version": "1.9.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "cli", - "fansi", - "glue", - "lifecycle", - "rlang", - "utf8", - "utils", - "vctrs" - ], - "Hash": "15da5a8412f317beeee6175fbc76f4bb" - }, - "pkgbuild": { - "Package": "pkgbuild", - "Version": "1.4.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "callr", - "cli", - "desc", - "processx" - ], - "Hash": "a29e8e134a460a01e0ca67a4763c595b" - }, - "pkgconfig": { - "Package": "pkgconfig", - "Version": "2.0.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "utils" - ], - "Hash": "01f28d4278f15c76cddbea05899c5d6f" - }, - "pkgdown": { - "Package": "pkgdown", - "Version": "2.0.9", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "bslib", - "callr", - "cli", - "desc", - "digest", - "downlit", - "fs", - "httr", - "jsonlite", - "magrittr", - "memoise", - "purrr", - "ragg", - "rlang", - "rmarkdown", - "tibble", - "whisker", - "withr", - "xml2", - "yaml" - ], - "Hash": "8bf1151ed1a48328d71b937e651117a6" - }, - "pkgload": { - "Package": "pkgload", - "Version": "1.3.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "crayon", - "desc", - "fs", - "glue", - "methods", - "pkgbuild", - "rlang", - "rprojroot", - "utils", - "withr" - ], - "Hash": "876c618df5ae610be84356d5d7a5d124" - }, - "plogr": { - "Package": "plogr", - "Version": "0.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "09eb987710984fc2905c7129c7d85e65" - }, - "praise": { - "Package": "praise", - "Version": "1.0.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "a555924add98c99d2f411e37e7d25e9f" - }, - "prettyunits": { - "Package": "prettyunits", - "Version": "1.2.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7" - }, - "processx": { - "Package": "processx", - "Version": "3.8.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "ps", - "utils" - ], - "Hash": "0c90a7d71988856bad2a2a45dd871bb9" - }, - "profvis": { - "Package": "profvis", - "Version": "0.3.8", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "htmlwidgets", - "purrr", - "rlang", - "stringr", - "vctrs" - ], - "Hash": "aa5a3864397ce6ae03458f98618395a1" - }, - "progress": { - "Package": "progress", - "Version": "1.2.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "crayon", - "hms", - "prettyunits" - ], - "Hash": "f4625e061cb2865f111b47ff163a5ca6" - }, - "promises": { - "Package": "promises", - "Version": "1.3.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R6", - "Rcpp", - "fastmap", - "later", - "magrittr", - "rlang", - "stats" - ], - "Hash": "434cd5388a3979e74be5c219bcd6e77d" - }, - "ps": { - "Package": "ps", - "Version": "1.7.6", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "utils" - ], - "Hash": "dd2b9319ee0656c8acf45c7f40c59de7" - }, - "purrr": { - "Package": "purrr", - "Version": "1.0.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "lifecycle", - "magrittr", - "rlang", - "vctrs" - ], - "Hash": "1cba04a4e9414bdefc9dcaa99649a8dc" - }, - "rJava": { - "Package": "rJava", - "Version": "1.0-11", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "methods" - ], - "Hash": "524167e771b81342f8dd7a891ed3afa8" - }, - "ragg": { - "Package": "ragg", - "Version": "1.3.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "systemfonts", - "textshaping" - ], - "Hash": "e3087db406e079a8a2fd87f413918ed3" - }, - "rappdirs": { - "Package": "rappdirs", - "Version": "0.3.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "5e3c5dc0b071b21fa128676560dbe94d" - }, - "rcmdcheck": { - "Package": "rcmdcheck", - "Version": "1.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R6", - "callr", - "cli", - "curl", - "desc", - "digest", - "pkgbuild", - "prettyunits", - "rprojroot", - "sessioninfo", - "utils", - "withr", - "xopen" - ], - "Hash": "8f25ebe2ec38b1f2aef3b0d2ef76f6c4" - }, - "readr": { - "Package": "readr", - "Version": "2.1.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "cli", - "clipr", - "cpp11", - "crayon", - "hms", - "lifecycle", - "methods", - "rlang", - "tibble", - "tzdb", - "utils", - "vroom" - ], - "Hash": "9de96463d2117f6ac49980577939dfb3" - }, - "rematch2": { - "Package": "rematch2", - "Version": "2.1.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "tibble" - ], - "Hash": "76c9e04c712a05848ae7a23d2f170a40" - }, - "remotes": { - "Package": "remotes", - "Version": "2.5.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "methods", - "stats", - "tools", - "utils" - ], - "Hash": "3ee025083e66f18db6cf27b56e23e141" - }, - "renv": { - "Package": "renv", - "Version": "1.0.7", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "utils" - ], - "Hash": "397b7b2a265bc5a7a06852524dabae20" - }, - "rlang": { - "Package": "rlang", - "Version": "1.1.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "utils" - ], - "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" - }, - "rmarkdown": { - "Package": "rmarkdown", - "Version": "2.27", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "bslib", - "evaluate", - "fontawesome", - "htmltools", - "jquerylib", - "jsonlite", - "knitr", - "methods", - "tinytex", - "tools", - "utils", - "xfun", - "yaml" - ], - "Hash": "27f9502e1cdbfa195f94e03b0f517484" - }, - "roxygen2": { - "Package": "roxygen2", - "Version": "7.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "brew", - "cli", - "commonmark", - "cpp11", - "desc", - "knitr", - "methods", - "pkgload", - "purrr", - "rlang", - "stringi", - "stringr", - "utils", - "withr", - "xml2" - ], - "Hash": "c25fe7b2d8cba73d1b63c947bf7afdb9" - }, - "rprojroot": { - "Package": "rprojroot", - "Version": "2.0.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "4c8415e0ec1e29f3f4f6fc108bef0144" - }, - "rstudioapi": { - "Package": "rstudioapi", - "Version": "0.16.0", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "96710351d642b70e8f02ddeb237c46a7" - }, - "rversions": { - "Package": "rversions", - "Version": "2.1.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "curl", - "utils", - "xml2" - ], - "Hash": "a9881dfed103e83f9de151dc17002cd1" - }, - "sass": { - "Package": "sass", - "Version": "0.4.9", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R6", - "fs", - "htmltools", - "rappdirs", - "rlang" - ], - "Hash": "d53dbfddf695303ea4ad66f86e99b95d" - }, - "sessioninfo": { - "Package": "sessioninfo", - "Version": "1.2.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "tools", - "utils" - ], - "Hash": "3f9796a8d0a0e8c6eb49a4b029359d1f" - }, - "shiny": { - "Package": "shiny", - "Version": "1.8.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "bslib", - "cachem", - "commonmark", - "crayon", - "fastmap", - "fontawesome", - "glue", - "grDevices", - "htmltools", - "httpuv", - "jsonlite", - "later", - "lifecycle", - "methods", - "mime", - "promises", - "rlang", - "sourcetools", - "tools", - "utils", - "withr", - "xtable" - ], - "Hash": "54b26646816af9960a4c64d8ceec75d6" - }, - "snow": { - "Package": "snow", - "Version": "0.4-4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "utils" - ], - "Hash": "40b74690debd20c57d93d8c246b305d4" - }, - "sourcetools": { - "Package": "sourcetools", - "Version": "0.1.7-1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "5f5a7629f956619d519205ec475fe647" - }, - "stringi": { - "Package": "stringi", - "Version": "1.8.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "stats", - "tools", - "utils" - ], - "Hash": "39e1144fd75428983dc3f63aa53dfa91" - }, - "stringr": { - "Package": "stringr", - "Version": "1.5.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "glue", - "lifecycle", - "magrittr", - "rlang", - "stringi", - "vctrs" - ], - "Hash": "960e2ae9e09656611e0b8214ad543207" - }, - "sys": { - "Package": "sys", - "Version": "3.4.2", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "3a1be13d68d47a8cd0bfd74739ca1555" - }, - "systemfonts": { - "Package": "systemfonts", - "Version": "1.1.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cpp11", - "lifecycle" - ], - "Hash": "213b6b8ed5afbf934843e6c3b090d418" - }, - "testthat": { - "Package": "testthat", - "Version": "3.2.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "R6", - "brio", - "callr", - "cli", - "desc", - "digest", - "evaluate", - "jsonlite", - "lifecycle", - "magrittr", - "methods", - "pkgload", - "praise", - "processx", - "ps", - "rlang", - "utils", - "waldo", - "withr" - ], - "Hash": "3f6e7e5e2220856ff865e4834766bf2b" - }, - "textshaping": { - "Package": "textshaping", - "Version": "0.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cpp11", - "lifecycle", - "systemfonts" - ], - "Hash": "5142f8bc78ed3d819d26461b641627ce" - }, - "tibble": { - "Package": "tibble", - "Version": "3.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "fansi", - "lifecycle", - "magrittr", - "methods", - "pillar", - "pkgconfig", - "rlang", - "utils", - "vctrs" - ], - "Hash": "a84e2cc86d07289b3b6f5069df7a004c" - }, - "tidyr": { - "Package": "tidyr", - "Version": "1.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "cpp11", - "dplyr", - "glue", - "lifecycle", - "magrittr", - "purrr", - "rlang", - "stringr", - "tibble", - "tidyselect", - "utils", - "vctrs" - ], - "Hash": "915fb7ce036c22a6a33b5a8adb712eb1" - }, - "tidyselect": { - "Package": "tidyselect", - "Version": "1.2.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "glue", - "lifecycle", - "rlang", - "vctrs", - "withr" - ], - "Hash": "829f27b9c4919c16b593794a6344d6c0" - }, - "timechange": { - "Package": "timechange", - "Version": "0.3.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cpp11" - ], - "Hash": "c5f3c201b931cd6474d17d8700ccb1c8" - }, - "tinytex": { - "Package": "tinytex", - "Version": "0.51", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "xfun" - ], - "Hash": "d44e2fcd2e4e076f0aac540208559d1d" - }, - "triebeard": { - "Package": "triebeard", - "Version": "0.4.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "Rcpp" - ], - "Hash": "642507a148b0dd9b5620177e0a044413" - }, - "tzdb": { - "Package": "tzdb", - "Version": "0.4.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cpp11" - ], - "Hash": "f561504ec2897f4d46f0c7657e488ae1" - }, - "urlchecker": { - "Package": "urlchecker", - "Version": "1.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "curl", - "tools", - "xml2" - ], - "Hash": "409328b8e1253c8d729a7836fe7f7a16" - }, - "urltools": { - "Package": "urltools", - "Version": "1.7.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "Rcpp", - "methods", - "triebeard" - ], - "Hash": "e86a704261a105f4703f653e05defa3e" - }, - "usethis": { - "Package": "usethis", - "Version": "2.2.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "clipr", - "crayon", - "curl", - "desc", - "fs", - "gert", - "gh", - "glue", - "jsonlite", - "lifecycle", - "purrr", - "rappdirs", - "rlang", - "rprojroot", - "rstudioapi", - "stats", - "utils", - "whisker", - "withr", - "yaml" - ], - "Hash": "d524fd42c517035027f866064417d7e6" - }, - "utf8": { - "Package": "utf8", - "Version": "1.2.4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "62b65c52671e6665f803ff02954446e9" - }, - "vctrs": { - "Package": "vctrs", - "Version": "0.6.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "glue", - "lifecycle", - "rlang" - ], - "Hash": "c03fa420630029418f7e6da3667aac4a" - }, - "vroom": { - "Package": "vroom", - "Version": "1.6.5", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "bit64", - "cli", - "cpp11", - "crayon", - "glue", - "hms", - "lifecycle", - "methods", - "progress", - "rlang", - "stats", - "tibble", - "tidyselect", - "tzdb", - "vctrs", - "withr" - ], - "Hash": "390f9315bc0025be03012054103d227c" - }, - "waldo": { - "Package": "waldo", - "Version": "0.5.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "diffobj", - "fansi", - "glue", - "methods", - "rematch2", - "rlang", - "tibble" - ], - "Hash": "c7d3fd6d29ab077cbac8f0e2751449e6" - }, - "whisker": { - "Package": "whisker", - "Version": "0.4.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "c6abfa47a46d281a7d5159d0a8891e88" - }, - "withr": { - "Package": "withr", - "Version": "3.0.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "grDevices", - "graphics" - ], - "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" - }, - "xfun": { - "Package": "xfun", - "Version": "0.45", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "grDevices", - "stats", - "tools" - ], - "Hash": "ca59c87fe305b16a9141a5874c3a7889" - }, - "xml2": { - "Package": "xml2", - "Version": "1.3.6", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "cli", - "methods", - "rlang" - ], - "Hash": "1d0336142f4cd25d8d23cd3ba7a8fb61" - }, - "xopen": { - "Package": "xopen", - "Version": "1.0.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "processx" - ], - "Hash": "423df1e86d5533fcb73c6b02b4923b49" - }, - "xtable": { - "Package": "xtable", - "Version": "1.8-4", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "stats", - "utils" - ], - "Hash": "b8acdf8af494d9ec19ccb2481a9b11c2" - }, - "yaml": { - "Package": "yaml", - "Version": "2.3.8", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "29240487a071f535f5e5d5a323b7afbd" - }, - "zip": { - "Package": "zip", - "Version": "2.3.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "fcc4bd8e6da2d2011eb64a5e5cc685ab" - } - } -} diff --git a/project/renv/.gitignore b/project/renv/.gitignore deleted file mode 100644 index 0ec0cbba..00000000 --- a/project/renv/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -library/ -local/ -cellar/ -lock/ -python/ -sandbox/ -staging/ diff --git a/project/renv/activate.R b/project/renv/activate.R deleted file mode 100644 index d13f9932..00000000 --- a/project/renv/activate.R +++ /dev/null @@ -1,1220 +0,0 @@ - -local({ - - # the requested version of renv - version <- "1.0.7" - attr(version, "sha") <- NULL - - # the project directory - project <- Sys.getenv("RENV_PROJECT") - if (!nzchar(project)) - project <- getwd() - - # use start-up diagnostics if enabled - diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") - if (diagnostics) { - start <- Sys.time() - profile <- tempfile("renv-startup-", fileext = ".Rprof") - utils::Rprof(profile) - on.exit({ - utils::Rprof(NULL) - elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L) - writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed))) - writeLines(sprintf("- Profile: %s", profile)) - print(utils::summaryRprof(profile)) - }, add = TRUE) - } - - # figure out whether the autoloader is enabled - enabled <- local({ - - # first, check config option - override <- getOption("renv.config.autoloader.enabled") - if (!is.null(override)) - return(override) - - # if we're being run in a context where R_LIBS is already set, - # don't load -- presumably we're being run as a sub-process and - # the parent process has already set up library paths for us - rcmd <- Sys.getenv("R_CMD", unset = NA) - rlibs <- Sys.getenv("R_LIBS", unset = NA) - if (!is.na(rlibs) && !is.na(rcmd)) - return(FALSE) - - # next, check environment variables - # TODO: prefer using the configuration one in the future - envvars <- c( - "RENV_CONFIG_AUTOLOADER_ENABLED", - "RENV_AUTOLOADER_ENABLED", - "RENV_ACTIVATE_PROJECT" - ) - - for (envvar in envvars) { - envval <- Sys.getenv(envvar, unset = NA) - if (!is.na(envval)) - return(tolower(envval) %in% c("true", "t", "1")) - } - - # enable by default - TRUE - - }) - - # bail if we're not enabled - if (!enabled) { - - # if we're not enabled, we might still need to manually load - # the user profile here - profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") - if (file.exists(profile)) { - cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") - if (tolower(cfg) %in% c("true", "t", "1")) - sys.source(profile, envir = globalenv()) - } - - return(FALSE) - - } - - # avoid recursion - if (identical(getOption("renv.autoloader.running"), TRUE)) { - warning("ignoring recursive attempt to run renv autoloader") - return(invisible(TRUE)) - } - - # signal that we're loading renv during R startup - options(renv.autoloader.running = TRUE) - on.exit(options(renv.autoloader.running = NULL), add = TRUE) - - # signal that we've consented to use renv - options(renv.consent = TRUE) - - # load the 'utils' package eagerly -- this ensures that renv shims, which - # mask 'utils' packages, will come first on the search path - library(utils, lib.loc = .Library) - - # unload renv if it's already been loaded - if ("renv" %in% loadedNamespaces()) - unloadNamespace("renv") - - # load bootstrap tools - `%||%` <- function(x, y) { - if (is.null(x)) y else x - } - - catf <- function(fmt, ..., appendLF = TRUE) { - - quiet <- getOption("renv.bootstrap.quiet", default = FALSE) - if (quiet) - return(invisible()) - - msg <- sprintf(fmt, ...) - cat(msg, file = stdout(), sep = if (appendLF) "\n" else "") - - invisible(msg) - - } - - header <- function(label, - ..., - prefix = "#", - suffix = "-", - n = min(getOption("width"), 78)) - { - label <- sprintf(label, ...) - n <- max(n - nchar(label) - nchar(prefix) - 2L, 8L) - if (n <= 0) - return(paste(prefix, label)) - - tail <- paste(rep.int(suffix, n), collapse = "") - paste0(prefix, " ", label, " ", tail) - - } - - heredoc <- function(text, leave = 0) { - - # remove leading, trailing whitespace - trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text) - - # split into lines - lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]] - - # compute common indent - indent <- regexpr("[^[:space:]]", lines) - common <- min(setdiff(indent, -1L)) - leave - paste(substring(lines, common), collapse = "\n") - - } - - startswith <- function(string, prefix) { - substring(string, 1, nchar(prefix)) == prefix - } - - bootstrap <- function(version, library) { - - friendly <- renv_bootstrap_version_friendly(version) - section <- header(sprintf("Bootstrapping renv %s", friendly)) - catf(section) - - # attempt to download renv - catf("- Downloading renv ... ", appendLF = FALSE) - withCallingHandlers( - tarball <- renv_bootstrap_download(version), - error = function(err) { - catf("FAILED") - stop("failed to download:\n", conditionMessage(err)) - } - ) - catf("OK") - on.exit(unlink(tarball), add = TRUE) - - # now attempt to install - catf("- Installing renv ... ", appendLF = FALSE) - withCallingHandlers( - status <- renv_bootstrap_install(version, tarball, library), - error = function(err) { - catf("FAILED") - stop("failed to install:\n", conditionMessage(err)) - } - ) - catf("OK") - - # add empty line to break up bootstrapping from normal output - catf("") - - return(invisible()) - } - - renv_bootstrap_tests_running <- function() { - getOption("renv.tests.running", default = FALSE) - } - - renv_bootstrap_repos <- function() { - - # get CRAN repository - cran <- getOption("renv.repos.cran", "https://cloud.r-project.org") - - # check for repos override - repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) - if (!is.na(repos)) { - - # check for RSPM; if set, use a fallback repository for renv - rspm <- Sys.getenv("RSPM", unset = NA) - if (identical(rspm, repos)) - repos <- c(RSPM = rspm, CRAN = cran) - - return(repos) - - } - - # check for lockfile repositories - repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity) - if (!inherits(repos, "error") && length(repos)) - return(repos) - - # retrieve current repos - repos <- getOption("repos") - - # ensure @CRAN@ entries are resolved - repos[repos == "@CRAN@"] <- cran - - # add in renv.bootstrap.repos if set - default <- c(FALLBACK = "https://cloud.r-project.org") - extra <- getOption("renv.bootstrap.repos", default = default) - repos <- c(repos, extra) - - # remove duplicates that might've snuck in - dupes <- duplicated(repos) | duplicated(names(repos)) - repos[!dupes] - - } - - renv_bootstrap_repos_lockfile <- function() { - - lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock") - if (!file.exists(lockpath)) - return(NULL) - - lockfile <- tryCatch(renv_json_read(lockpath), error = identity) - if (inherits(lockfile, "error")) { - warning(lockfile) - return(NULL) - } - - repos <- lockfile$R$Repositories - if (length(repos) == 0) - return(NULL) - - keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1)) - vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1)) - names(vals) <- keys - - return(vals) - - } - - renv_bootstrap_download <- function(version) { - - sha <- attr(version, "sha", exact = TRUE) - - methods <- if (!is.null(sha)) { - - # attempting to bootstrap a development version of renv - c( - function() renv_bootstrap_download_tarball(sha), - function() renv_bootstrap_download_github(sha) - ) - - } else { - - # attempting to bootstrap a release version of renv - c( - function() renv_bootstrap_download_tarball(version), - function() renv_bootstrap_download_cran_latest(version), - function() renv_bootstrap_download_cran_archive(version) - ) - - } - - for (method in methods) { - path <- tryCatch(method(), error = identity) - if (is.character(path) && file.exists(path)) - return(path) - } - - stop("All download methods failed") - - } - - renv_bootstrap_download_impl <- function(url, destfile) { - - mode <- "wb" - - # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 - fixup <- - Sys.info()[["sysname"]] == "Windows" && - substring(url, 1L, 5L) == "file:" - - if (fixup) - mode <- "w+b" - - args <- list( - url = url, - destfile = destfile, - mode = mode, - quiet = TRUE - ) - - if ("headers" %in% names(formals(utils::download.file))) - args$headers <- renv_bootstrap_download_custom_headers(url) - - do.call(utils::download.file, args) - - } - - renv_bootstrap_download_custom_headers <- function(url) { - - headers <- getOption("renv.download.headers") - if (is.null(headers)) - return(character()) - - if (!is.function(headers)) - stopf("'renv.download.headers' is not a function") - - headers <- headers(url) - if (length(headers) == 0L) - return(character()) - - if (is.list(headers)) - headers <- unlist(headers, recursive = FALSE, use.names = TRUE) - - ok <- - is.character(headers) && - is.character(names(headers)) && - all(nzchar(names(headers))) - - if (!ok) - stop("invocation of 'renv.download.headers' did not return a named character vector") - - headers - - } - - renv_bootstrap_download_cran_latest <- function(version) { - - spec <- renv_bootstrap_download_cran_latest_find(version) - type <- spec$type - repos <- spec$repos - - baseurl <- utils::contrib.url(repos = repos, type = type) - ext <- if (identical(type, "source")) - ".tar.gz" - else if (Sys.info()[["sysname"]] == "Windows") - ".zip" - else - ".tgz" - name <- sprintf("renv_%s%s", version, ext) - url <- paste(baseurl, name, sep = "/") - - destfile <- file.path(tempdir(), name) - status <- tryCatch( - renv_bootstrap_download_impl(url, destfile), - condition = identity - ) - - if (inherits(status, "condition")) - return(FALSE) - - # report success and return - destfile - - } - - renv_bootstrap_download_cran_latest_find <- function(version) { - - # check whether binaries are supported on this system - binary <- - getOption("renv.bootstrap.binary", default = TRUE) && - !identical(.Platform$pkgType, "source") && - !identical(getOption("pkgType"), "source") && - Sys.info()[["sysname"]] %in% c("Darwin", "Windows") - - types <- c(if (binary) "binary", "source") - - # iterate over types + repositories - for (type in types) { - for (repos in renv_bootstrap_repos()) { - - # retrieve package database - db <- tryCatch( - as.data.frame( - utils::available.packages(type = type, repos = repos), - stringsAsFactors = FALSE - ), - error = identity - ) - - if (inherits(db, "error")) - next - - # check for compatible entry - entry <- db[db$Package %in% "renv" & db$Version %in% version, ] - if (nrow(entry) == 0) - next - - # found it; return spec to caller - spec <- list(entry = entry, type = type, repos = repos) - return(spec) - - } - } - - # if we got here, we failed to find renv - fmt <- "renv %s is not available from your declared package repositories" - stop(sprintf(fmt, version)) - - } - - renv_bootstrap_download_cran_archive <- function(version) { - - name <- sprintf("renv_%s.tar.gz", version) - repos <- renv_bootstrap_repos() - urls <- file.path(repos, "src/contrib/Archive/renv", name) - destfile <- file.path(tempdir(), name) - - for (url in urls) { - - status <- tryCatch( - renv_bootstrap_download_impl(url, destfile), - condition = identity - ) - - if (identical(status, 0L)) - return(destfile) - - } - - return(FALSE) - - } - - renv_bootstrap_download_tarball <- function(version) { - - # if the user has provided the path to a tarball via - # an environment variable, then use it - tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA) - if (is.na(tarball)) - return() - - # allow directories - if (dir.exists(tarball)) { - name <- sprintf("renv_%s.tar.gz", version) - tarball <- file.path(tarball, name) - } - - # bail if it doesn't exist - if (!file.exists(tarball)) { - - # let the user know we weren't able to honour their request - fmt <- "- RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." - msg <- sprintf(fmt, tarball) - warning(msg) - - # bail - return() - - } - - catf("- Using local tarball '%s'.", tarball) - tarball - - } - - renv_bootstrap_download_github <- function(version) { - - enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") - if (!identical(enabled, "TRUE")) - return(FALSE) - - # prepare download options - pat <- Sys.getenv("GITHUB_PAT") - if (nzchar(Sys.which("curl")) && nzchar(pat)) { - fmt <- "--location --fail --header \"Authorization: token %s\"" - extra <- sprintf(fmt, pat) - saved <- options("download.file.method", "download.file.extra") - options(download.file.method = "curl", download.file.extra = extra) - on.exit(do.call(base::options, saved), add = TRUE) - } else if (nzchar(Sys.which("wget")) && nzchar(pat)) { - fmt <- "--header=\"Authorization: token %s\"" - extra <- sprintf(fmt, pat) - saved <- options("download.file.method", "download.file.extra") - options(download.file.method = "wget", download.file.extra = extra) - on.exit(do.call(base::options, saved), add = TRUE) - } - - url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) - name <- sprintf("renv_%s.tar.gz", version) - destfile <- file.path(tempdir(), name) - - status <- tryCatch( - renv_bootstrap_download_impl(url, destfile), - condition = identity - ) - - if (!identical(status, 0L)) - return(FALSE) - - renv_bootstrap_download_augment(destfile) - - return(destfile) - - } - - # Add Sha to DESCRIPTION. This is stop gap until #890, after which we - # can use renv::install() to fully capture metadata. - renv_bootstrap_download_augment <- function(destfile) { - sha <- renv_bootstrap_git_extract_sha1_tar(destfile) - if (is.null(sha)) { - return() - } - - # Untar - tempdir <- tempfile("renv-github-") - on.exit(unlink(tempdir, recursive = TRUE), add = TRUE) - untar(destfile, exdir = tempdir) - pkgdir <- dir(tempdir, full.names = TRUE)[[1]] - - # Modify description - desc_path <- file.path(pkgdir, "DESCRIPTION") - desc_lines <- readLines(desc_path) - remotes_fields <- c( - "RemoteType: github", - "RemoteHost: api.github.com", - "RemoteRepo: renv", - "RemoteUsername: rstudio", - "RemotePkgRef: rstudio/renv", - paste("RemoteRef: ", sha), - paste("RemoteSha: ", sha) - ) - writeLines(c(desc_lines[desc_lines != ""], remotes_fields), con = desc_path) - - # Re-tar - local({ - old <- setwd(tempdir) - on.exit(setwd(old), add = TRUE) - - tar(destfile, compression = "gzip") - }) - invisible() - } - - # Extract the commit hash from a git archive. Git archives include the SHA1 - # hash as the comment field of the tarball pax extended header - # (see https://www.kernel.org/pub/software/scm/git/docs/git-archive.html) - # For GitHub archives this should be the first header after the default one - # (512 byte) header. - renv_bootstrap_git_extract_sha1_tar <- function(bundle) { - - # open the bundle for reading - # We use gzcon for everything because (from ?gzcon) - # > Reading from a connection which does not supply a 'gzip' magic - # > header is equivalent to reading from the original connection - conn <- gzcon(file(bundle, open = "rb", raw = TRUE)) - on.exit(close(conn)) - - # The default pax header is 512 bytes long and the first pax extended header - # with the comment should be 51 bytes long - # `52 comment=` (11 chars) + 40 byte SHA1 hash - len <- 0x200 + 0x33 - res <- rawToChar(readBin(conn, "raw", n = len)[0x201:len]) - - if (grepl("^52 comment=", res)) { - sub("52 comment=", "", res) - } else { - NULL - } - } - - renv_bootstrap_install <- function(version, tarball, library) { - - # attempt to install it into project library - dir.create(library, showWarnings = FALSE, recursive = TRUE) - output <- renv_bootstrap_install_impl(library, tarball) - - # check for successful install - status <- attr(output, "status") - if (is.null(status) || identical(status, 0L)) - return(status) - - # an error occurred; report it - header <- "installation of renv failed" - lines <- paste(rep.int("=", nchar(header)), collapse = "") - text <- paste(c(header, lines, output), collapse = "\n") - stop(text) - - } - - renv_bootstrap_install_impl <- function(library, tarball) { - - # invoke using system2 so we can capture and report output - bin <- R.home("bin") - exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" - R <- file.path(bin, exe) - - args <- c( - "--vanilla", "CMD", "INSTALL", "--no-multiarch", - "-l", shQuote(path.expand(library)), - shQuote(path.expand(tarball)) - ) - - system2(R, args, stdout = TRUE, stderr = TRUE) - - } - - renv_bootstrap_platform_prefix <- function() { - - # construct version prefix - version <- paste(R.version$major, R.version$minor, sep = ".") - prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-") - - # include SVN revision for development versions of R - # (to avoid sharing platform-specific artefacts with released versions of R) - devel <- - identical(R.version[["status"]], "Under development (unstable)") || - identical(R.version[["nickname"]], "Unsuffered Consequences") - - if (devel) - prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r") - - # build list of path components - components <- c(prefix, R.version$platform) - - # include prefix if provided by user - prefix <- renv_bootstrap_platform_prefix_impl() - if (!is.na(prefix) && nzchar(prefix)) - components <- c(prefix, components) - - # build prefix - paste(components, collapse = "/") - - } - - renv_bootstrap_platform_prefix_impl <- function() { - - # if an explicit prefix has been supplied, use it - prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) - if (!is.na(prefix)) - return(prefix) - - # if the user has requested an automatic prefix, generate it - auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) - if (is.na(auto) && getRversion() >= "4.4.0") - auto <- "TRUE" - - if (auto %in% c("TRUE", "True", "true", "1")) - return(renv_bootstrap_platform_prefix_auto()) - - # empty string on failure - "" - - } - - renv_bootstrap_platform_prefix_auto <- function() { - - prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) - if (inherits(prefix, "error") || prefix %in% "unknown") { - - msg <- paste( - "failed to infer current operating system", - "please file a bug report at https://github.com/rstudio/renv/issues", - sep = "; " - ) - - warning(msg) - - } - - prefix - - } - - renv_bootstrap_platform_os <- function() { - - sysinfo <- Sys.info() - sysname <- sysinfo[["sysname"]] - - # handle Windows + macOS up front - if (sysname == "Windows") - return("windows") - else if (sysname == "Darwin") - return("macos") - - # check for os-release files - for (file in c("/etc/os-release", "/usr/lib/os-release")) - if (file.exists(file)) - return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) - - # check for redhat-release files - if (file.exists("/etc/redhat-release")) - return(renv_bootstrap_platform_os_via_redhat_release()) - - "unknown" - - } - - renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { - - # read /etc/os-release - release <- utils::read.table( - file = file, - sep = "=", - quote = c("\"", "'"), - col.names = c("Key", "Value"), - comment.char = "#", - stringsAsFactors = FALSE - ) - - vars <- as.list(release$Value) - names(vars) <- release$Key - - # get os name - os <- tolower(sysinfo[["sysname"]]) - - # read id - id <- "unknown" - for (field in c("ID", "ID_LIKE")) { - if (field %in% names(vars) && nzchar(vars[[field]])) { - id <- vars[[field]] - break - } - } - - # read version - version <- "unknown" - for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { - if (field %in% names(vars) && nzchar(vars[[field]])) { - version <- vars[[field]] - break - } - } - - # join together - paste(c(os, id, version), collapse = "-") - - } - - renv_bootstrap_platform_os_via_redhat_release <- function() { - - # read /etc/redhat-release - contents <- readLines("/etc/redhat-release", warn = FALSE) - - # infer id - id <- if (grepl("centos", contents, ignore.case = TRUE)) - "centos" - else if (grepl("redhat", contents, ignore.case = TRUE)) - "redhat" - else - "unknown" - - # try to find a version component (very hacky) - version <- "unknown" - - parts <- strsplit(contents, "[[:space:]]")[[1L]] - for (part in parts) { - - nv <- tryCatch(numeric_version(part), error = identity) - if (inherits(nv, "error")) - next - - version <- nv[1, 1] - break - - } - - paste(c("linux", id, version), collapse = "-") - - } - - renv_bootstrap_library_root_name <- function(project) { - - # use project name as-is if requested - asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") - if (asis) - return(basename(project)) - - # otherwise, disambiguate based on project's path - id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) - paste(basename(project), id, sep = "-") - - } - - renv_bootstrap_library_root <- function(project) { - - prefix <- renv_bootstrap_profile_prefix() - - path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) - if (!is.na(path)) - return(paste(c(path, prefix), collapse = "/")) - - path <- renv_bootstrap_library_root_impl(project) - if (!is.null(path)) { - name <- renv_bootstrap_library_root_name(project) - return(paste(c(path, prefix, name), collapse = "/")) - } - - renv_bootstrap_paths_renv("library", project = project) - - } - - renv_bootstrap_library_root_impl <- function(project) { - - root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) - if (!is.na(root)) - return(root) - - type <- renv_bootstrap_project_type(project) - if (identical(type, "package")) { - userdir <- renv_bootstrap_user_dir() - return(file.path(userdir, "library")) - } - - } - - renv_bootstrap_validate_version <- function(version, description = NULL) { - - # resolve description file - # - # avoid passing lib.loc to `packageDescription()` below, since R will - # use the loaded version of the package by default anyhow. note that - # this function should only be called after 'renv' is loaded - # https://github.com/rstudio/renv/issues/1625 - description <- description %||% packageDescription("renv") - - # check whether requested version 'version' matches loaded version of renv - sha <- attr(version, "sha", exact = TRUE) - valid <- if (!is.null(sha)) - renv_bootstrap_validate_version_dev(sha, description) - else - renv_bootstrap_validate_version_release(version, description) - - if (valid) - return(TRUE) - - # the loaded version of renv doesn't match the requested version; - # give the user instructions on how to proceed - dev <- identical(description[["RemoteType"]], "github") - remote <- if (dev) - paste("rstudio/renv", description[["RemoteSha"]], sep = "@") - else - paste("renv", description[["Version"]], sep = "@") - - # display both loaded version + sha if available - friendly <- renv_bootstrap_version_friendly( - version = description[["Version"]], - sha = if (dev) description[["RemoteSha"]] - ) - - fmt <- heredoc(" - renv %1$s was loaded from project library, but this project is configured to use renv %2$s. - - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile. - - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library. - ") - catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) - - FALSE - - } - - renv_bootstrap_validate_version_dev <- function(version, description) { - expected <- description[["RemoteSha"]] - is.character(expected) && startswith(expected, version) - } - - renv_bootstrap_validate_version_release <- function(version, description) { - expected <- description[["Version"]] - is.character(expected) && identical(expected, version) - } - - renv_bootstrap_hash_text <- function(text) { - - hashfile <- tempfile("renv-hash-") - on.exit(unlink(hashfile), add = TRUE) - - writeLines(text, con = hashfile) - tools::md5sum(hashfile) - - } - - renv_bootstrap_load <- function(project, libpath, version) { - - # try to load renv from the project library - if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) - return(FALSE) - - # warn if the version of renv loaded does not match - renv_bootstrap_validate_version(version) - - # execute renv load hooks, if any - hooks <- getHook("renv::autoload") - for (hook in hooks) - if (is.function(hook)) - tryCatch(hook(), error = warnify) - - # load the project - renv::load(project) - - TRUE - - } - - renv_bootstrap_profile_load <- function(project) { - - # if RENV_PROFILE is already set, just use that - profile <- Sys.getenv("RENV_PROFILE", unset = NA) - if (!is.na(profile) && nzchar(profile)) - return(profile) - - # check for a profile file (nothing to do if it doesn't exist) - path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project) - if (!file.exists(path)) - return(NULL) - - # read the profile, and set it if it exists - contents <- readLines(path, warn = FALSE) - if (length(contents) == 0L) - return(NULL) - - # set RENV_PROFILE - profile <- contents[[1L]] - if (!profile %in% c("", "default")) - Sys.setenv(RENV_PROFILE = profile) - - profile - - } - - renv_bootstrap_profile_prefix <- function() { - profile <- renv_bootstrap_profile_get() - if (!is.null(profile)) - return(file.path("profiles", profile, "renv")) - } - - renv_bootstrap_profile_get <- function() { - profile <- Sys.getenv("RENV_PROFILE", unset = "") - renv_bootstrap_profile_normalize(profile) - } - - renv_bootstrap_profile_set <- function(profile) { - profile <- renv_bootstrap_profile_normalize(profile) - if (is.null(profile)) - Sys.unsetenv("RENV_PROFILE") - else - Sys.setenv(RENV_PROFILE = profile) - } - - renv_bootstrap_profile_normalize <- function(profile) { - - if (is.null(profile) || profile %in% c("", "default")) - return(NULL) - - profile - - } - - renv_bootstrap_path_absolute <- function(path) { - - substr(path, 1L, 1L) %in% c("~", "/", "\\") || ( - substr(path, 1L, 1L) %in% c(letters, LETTERS) && - substr(path, 2L, 3L) %in% c(":/", ":\\") - ) - - } - - renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) { - renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv") - root <- if (renv_bootstrap_path_absolute(renv)) NULL else project - prefix <- if (profile) renv_bootstrap_profile_prefix() - components <- c(root, renv, prefix, ...) - paste(components, collapse = "/") - } - - renv_bootstrap_project_type <- function(path) { - - descpath <- file.path(path, "DESCRIPTION") - if (!file.exists(descpath)) - return("unknown") - - desc <- tryCatch( - read.dcf(descpath, all = TRUE), - error = identity - ) - - if (inherits(desc, "error")) - return("unknown") - - type <- desc$Type - if (!is.null(type)) - return(tolower(type)) - - package <- desc$Package - if (!is.null(package)) - return("package") - - "unknown" - - } - - renv_bootstrap_user_dir <- function() { - dir <- renv_bootstrap_user_dir_impl() - path.expand(chartr("\\", "/", dir)) - } - - renv_bootstrap_user_dir_impl <- function() { - - # use local override if set - override <- getOption("renv.userdir.override") - if (!is.null(override)) - return(override) - - # use R_user_dir if available - tools <- asNamespace("tools") - if (is.function(tools$R_user_dir)) - return(tools$R_user_dir("renv", "cache")) - - # try using our own backfill for older versions of R - envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME") - for (envvar in envvars) { - root <- Sys.getenv(envvar, unset = NA) - if (!is.na(root)) - return(file.path(root, "R/renv")) - } - - # use platform-specific default fallbacks - if (Sys.info()[["sysname"]] == "Windows") - file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv") - else if (Sys.info()[["sysname"]] == "Darwin") - "~/Library/Caches/org.R-project.R/R/renv" - else - "~/.cache/R/renv" - - } - - renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) { - sha <- sha %||% attr(version, "sha", exact = TRUE) - parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L))) - paste(parts, collapse = "") - } - - renv_bootstrap_exec <- function(project, libpath, version) { - if (!renv_bootstrap_load(project, libpath, version)) - renv_bootstrap_run(version, libpath) - } - - renv_bootstrap_run <- function(version, libpath) { - - # perform bootstrap - bootstrap(version, libpath) - - # exit early if we're just testing bootstrap - if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) - return(TRUE) - - # try again to load - if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { - return(renv::load(project = getwd())) - } - - # failed to download or load renv; warn the user - msg <- c( - "Failed to find an renv installation: the project will not be loaded.", - "Use `renv::activate()` to re-initialize the project." - ) - - warning(paste(msg, collapse = "\n"), call. = FALSE) - - } - - renv_json_read <- function(file = NULL, text = NULL) { - - jlerr <- NULL - - # if jsonlite is loaded, use that instead - if ("jsonlite" %in% loadedNamespaces()) { - - json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) - if (!inherits(json, "error")) - return(json) - - jlerr <- json - - } - - # otherwise, fall back to the default JSON reader - json <- tryCatch(renv_json_read_default(file, text), error = identity) - if (!inherits(json, "error")) - return(json) - - # report an error - if (!is.null(jlerr)) - stop(jlerr) - else - stop(json) - - } - - renv_json_read_jsonlite <- function(file = NULL, text = NULL) { - text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") - jsonlite::fromJSON(txt = text, simplifyVector = FALSE) - } - - renv_json_read_default <- function(file = NULL, text = NULL) { - - # find strings in the JSON - text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") - pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' - locs <- gregexpr(pattern, text, perl = TRUE)[[1]] - - # if any are found, replace them with placeholders - replaced <- text - strings <- character() - replacements <- character() - - if (!identical(c(locs), -1L)) { - - # get the string values - starts <- locs - ends <- locs + attr(locs, "match.length") - 1L - strings <- substring(text, starts, ends) - - # only keep those requiring escaping - strings <- grep("[[\\]{}:]", strings, perl = TRUE, value = TRUE) - - # compute replacements - replacements <- sprintf('"\032%i\032"', seq_along(strings)) - - # replace the strings - mapply(function(string, replacement) { - replaced <<- sub(string, replacement, replaced, fixed = TRUE) - }, strings, replacements) - - } - - # transform the JSON into something the R parser understands - transformed <- replaced - transformed <- gsub("{}", "`names<-`(list(), character())", transformed, fixed = TRUE) - transformed <- gsub("[[{]", "list(", transformed, perl = TRUE) - transformed <- gsub("[]}]", ")", transformed, perl = TRUE) - transformed <- gsub(":", "=", transformed, fixed = TRUE) - text <- paste(transformed, collapse = "\n") - - # parse it - json <- parse(text = text, keep.source = FALSE, srcfile = NULL)[[1L]] - - # construct map between source strings, replaced strings - map <- as.character(parse(text = strings)) - names(map) <- as.character(parse(text = replacements)) - - # convert to list - map <- as.list(map) - - # remap strings in object - remapped <- renv_json_read_remap(json, map) - - # evaluate - eval(remapped, envir = baseenv()) - - } - - renv_json_read_remap <- function(json, map) { - - # fix names - if (!is.null(names(json))) { - lhs <- match(names(json), names(map), nomatch = 0L) - rhs <- match(names(map), names(json), nomatch = 0L) - names(json)[rhs] <- map[lhs] - } - - # fix values - if (is.character(json)) - return(map[[json]] %||% json) - - # handle true, false, null - if (is.name(json)) { - text <- as.character(json) - if (text == "true") - return(TRUE) - else if (text == "false") - return(FALSE) - else if (text == "null") - return(NULL) - } - - # recurse - if (is.recursive(json)) { - for (i in seq_along(json)) { - json[i] <- list(renv_json_read_remap(json[[i]], map)) - } - } - - json - - } - - # load the renv profile, if any - renv_bootstrap_profile_load(project) - - # construct path to library root - root <- renv_bootstrap_library_root(project) - - # construct library prefix for platform - prefix <- renv_bootstrap_platform_prefix() - - # construct full libpath - libpath <- file.path(root, prefix) - - # run bootstrap code - renv_bootstrap_exec(project, libpath, version) - - invisible() - -}) diff --git a/project/renv/settings.json b/project/renv/settings.json deleted file mode 100644 index ffdbb320..00000000 --- a/project/renv/settings.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "bioconductor.version": null, - "external.libraries": [], - "ignored.packages": [], - "package.dependency.fields": [ - "Imports", - "Depends", - "LinkingTo" - ], - "ppm.enabled": null, - "ppm.ignored.urls": [], - "r.version": null, - "snapshot.type": "implicit", - "use.cache": true, - "vcs.ignore.cellar": true, - "vcs.ignore.library": true, - "vcs.ignore.local": true, - "vcs.manage.ignores": true -} diff --git a/renv.lock b/renv.lock new file mode 100644 index 00000000..ab095ac1 --- /dev/null +++ b/renv.lock @@ -0,0 +1,696 @@ +{ + "R": { + "Version": "4.4.1", + "Repositories": [ + { + "Name": "CRAN", + "URL": "https://cran.rstudio.com" + } + ] + }, + "Packages": { + "CirceR": { + "Package": "CirceR", + "Version": "1.3.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "RJSONIO", + "rJava" + ], + "Hash": "2f9522a81dac11183e90b4236afa441d" + }, + "DBI": { + "Package": "DBI", + "Version": "1.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "065ae649b05f1ff66bb0c793107508f5" + }, + "DatabaseConnector": { + "Package": "DatabaseConnector", + "Version": "6.3.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "DBI", + "R", + "SqlRender", + "bit64", + "checkmate", + "dbplyr", + "digest", + "methods", + "rJava", + "readr", + "rlang", + "stringr", + "urltools", + "utils" + ], + "Hash": "1ef65614602c6534a6c666e872c3b647" + }, + "R6": { + "Package": "R6", + "Version": "2.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "470851b6d5d0ac559e9d01bb352b4021" + }, + "RJSONIO": { + "Package": "RJSONIO", + "Version": "1.3-1.9", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods" + ], + "Hash": "2f89abc0f88c647d3386c672632f4baf" + }, + "Rcpp": { + "Package": "Rcpp", + "Version": "1.0.12", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods", + "utils" + ], + "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" + }, + "SqlRender": { + "Package": "SqlRender", + "Version": "1.18.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "checkmate", + "rJava", + "rlang" + ], + "Hash": "e1762de0f08b14658d74989c10e2f265" + }, + "backports": { + "Package": "backports", + "Version": "1.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "e1e1b9d75c37401117b636b7ae50827a" + }, + "bit": { + "Package": "bit", + "Version": "4.0.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "d242abec29412ce988848d0294b208fd" + }, + "bit64": { + "Package": "bit64", + "Version": "4.0.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bit", + "methods", + "stats", + "utils" + ], + "Hash": "9fe98599ca456d6552421db0d6772d8f" + }, + "blob": { + "Package": "blob", + "Version": "1.2.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods", + "rlang", + "vctrs" + ], + "Hash": "40415719b5a479b87949f3aa0aee737c" + }, + "checkmate": { + "Package": "checkmate", + "Version": "2.3.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "backports", + "utils" + ], + "Hash": "c01cab1cb0f9125211a6fc99d540e315" + }, + "cli": { + "Package": "cli", + "Version": "3.6.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "b21916dd77a27642b447374a5d30ecf3" + }, + "clipr": { + "Package": "clipr", + "Version": "0.8.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "3f038e5ac7f41d4ac41ce658c85e3042" + }, + "codetools": { + "Package": "codetools", + "Version": "0.2-20", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "61e097f35917d342622f21cdc79c256e" + }, + "cpp11": { + "Package": "cpp11", + "Version": "0.4.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "5a295d7d963cc5035284dcdbaf334f4e" + }, + "crayon": { + "Package": "crayon", + "Version": "1.5.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grDevices", + "methods", + "utils" + ], + "Hash": "859d96e65ef198fd43e82b9628d593ef" + }, + "dbplyr": { + "Package": "dbplyr", + "Version": "2.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "DBI", + "R", + "R6", + "blob", + "cli", + "dplyr", + "glue", + "lifecycle", + "magrittr", + "methods", + "pillar", + "purrr", + "rlang", + "tibble", + "tidyr", + "tidyselect", + "utils", + "vctrs", + "withr" + ], + "Hash": "39b2e002522bfd258039ee4e889e0fd1" + }, + "digest": { + "Package": "digest", + "Version": "0.6.36", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "fd6824ad91ede64151e93af67df6376b" + }, + "dplyr": { + "Package": "dplyr", + "Version": "1.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "generics", + "glue", + "lifecycle", + "magrittr", + "methods", + "pillar", + "rlang", + "tibble", + "tidyselect", + "utils", + "vctrs" + ], + "Hash": "fedd9d00c2944ff00a0e2696ccf048ec" + }, + "fansi": { + "Package": "fansi", + "Version": "1.0.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "utils" + ], + "Hash": "962174cf2aeb5b9eea581522286a911f" + }, + "fs": { + "Package": "fs", + "Version": "1.6.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "15aeb8c27f5ea5161f9f6a641fafd93a" + }, + "generics": { + "Package": "generics", + "Version": "0.1.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "15e9634c0fcd294799e9b2e929ed1b86" + }, + "glue": { + "Package": "glue", + "Version": "1.7.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "e0b3a53876554bd45879e596cdb10a52" + }, + "hms": { + "Package": "hms", + "Version": "1.1.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "lifecycle", + "methods", + "pkgconfig", + "rlang", + "vctrs" + ], + "Hash": "b59377caa7ed00fa41808342002138f9" + }, + "jsonlite": { + "Package": "jsonlite", + "Version": "1.8.8", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods" + ], + "Hash": "e1b9c55281c5adc4dd113652d9e26768" + }, + "lifecycle": { + "Package": "lifecycle", + "Version": "1.0.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "rlang" + ], + "Hash": "b8552d117e1b808b09a832f589b79035" + }, + "lubridate": { + "Package": "lubridate", + "Version": "1.9.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "generics", + "methods", + "timechange" + ], + "Hash": "680ad542fbcf801442c83a6ac5a2126c" + }, + "magrittr": { + "Package": "magrittr", + "Version": "2.0.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "7ce2733a9826b3aeb1775d56fd305472" + }, + "pillar": { + "Package": "pillar", + "Version": "1.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "cli", + "fansi", + "glue", + "lifecycle", + "rlang", + "utf8", + "utils", + "vctrs" + ], + "Hash": "15da5a8412f317beeee6175fbc76f4bb" + }, + "pkgconfig": { + "Package": "pkgconfig", + "Version": "2.0.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "01f28d4278f15c76cddbea05899c5d6f" + }, + "prettyunits": { + "Package": "prettyunits", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7" + }, + "progress": { + "Package": "progress", + "Version": "1.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "crayon", + "hms", + "prettyunits" + ], + "Hash": "f4625e061cb2865f111b47ff163a5ca6" + }, + "purrr": { + "Package": "purrr", + "Version": "1.0.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "lifecycle", + "magrittr", + "rlang", + "vctrs" + ], + "Hash": "1cba04a4e9414bdefc9dcaa99649a8dc" + }, + "rJava": { + "Package": "rJava", + "Version": "1.0-11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "524167e771b81342f8dd7a891ed3afa8" + }, + "readr": { + "Package": "readr", + "Version": "2.1.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "clipr", + "cpp11", + "crayon", + "hms", + "lifecycle", + "methods", + "rlang", + "tibble", + "tzdb", + "utils", + "vroom" + ], + "Hash": "9de96463d2117f6ac49980577939dfb3" + }, + "renv": { + "Package": "renv", + "Version": "1.0.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "397b7b2a265bc5a7a06852524dabae20" + }, + "rlang": { + "Package": "rlang", + "Version": "1.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" + }, + "stringi": { + "Package": "stringi", + "Version": "1.8.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats", + "tools", + "utils" + ], + "Hash": "39e1144fd75428983dc3f63aa53dfa91" + }, + "stringr": { + "Package": "stringr", + "Version": "1.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "magrittr", + "rlang", + "stringi", + "vctrs" + ], + "Hash": "960e2ae9e09656611e0b8214ad543207" + }, + "tibble": { + "Package": "tibble", + "Version": "3.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "fansi", + "lifecycle", + "magrittr", + "methods", + "pillar", + "pkgconfig", + "rlang", + "utils", + "vctrs" + ], + "Hash": "a84e2cc86d07289b3b6f5069df7a004c" + }, + "tidyr": { + "Package": "tidyr", + "Version": "1.3.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "cpp11", + "dplyr", + "glue", + "lifecycle", + "magrittr", + "purrr", + "rlang", + "stringr", + "tibble", + "tidyselect", + "utils", + "vctrs" + ], + "Hash": "915fb7ce036c22a6a33b5a8adb712eb1" + }, + "tidyselect": { + "Package": "tidyselect", + "Version": "1.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "rlang", + "vctrs", + "withr" + ], + "Hash": "829f27b9c4919c16b593794a6344d6c0" + }, + "timechange": { + "Package": "timechange", + "Version": "0.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11" + ], + "Hash": "c5f3c201b931cd6474d17d8700ccb1c8" + }, + "triebeard": { + "Package": "triebeard", + "Version": "0.4.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Rcpp" + ], + "Hash": "642507a148b0dd9b5620177e0a044413" + }, + "tzdb": { + "Package": "tzdb", + "Version": "0.4.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11" + ], + "Hash": "f561504ec2897f4d46f0c7657e488ae1" + }, + "urltools": { + "Package": "urltools", + "Version": "1.7.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "methods", + "triebeard" + ], + "Hash": "e86a704261a105f4703f653e05defa3e" + }, + "utf8": { + "Package": "utf8", + "Version": "1.2.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "62b65c52671e6665f803ff02954446e9" + }, + "vctrs": { + "Package": "vctrs", + "Version": "0.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "rlang" + ], + "Hash": "c03fa420630029418f7e6da3667aac4a" + }, + "vroom": { + "Package": "vroom", + "Version": "1.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bit64", + "cli", + "cpp11", + "crayon", + "glue", + "hms", + "lifecycle", + "methods", + "progress", + "rlang", + "stats", + "tibble", + "tidyselect", + "tzdb", + "vctrs", + "withr" + ], + "Hash": "390f9315bc0025be03012054103d227c" + }, + "withr": { + "Package": "withr", + "Version": "3.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics" + ], + "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" + } + } +}