From 9392b87b25c0ab271165bf2adc42acb4b0602865 Mon Sep 17 00:00:00 2001 From: Evanette Burrows Date: Thu, 8 Feb 2024 16:05:06 -0500 Subject: [PATCH] Add location and caresite support #177 (#181) * Add scripts and vignettes for location and care_site support --- R/CreateVocabMapTables.r | 5 +- R/LoadEventTables.r | 22 ++ docs/404.html | 20 +- docs/articles/Condition_occurrence.html | 22 +- docs/articles/Cost.html | 22 +- docs/articles/Device_exposure.html | 25 +- docs/articles/Drug_exposure.html | 22 +- docs/articles/Measurement.html | 22 +- docs/articles/Payer_plan_period.html | 22 +- docs/articles/care_site.html | 211 ++++++++++++++++ docs/articles/death.html | 20 +- docs/articles/index.html | 42 ++-- docs/articles/location.html | 230 ++++++++++++++++++ docs/articles/observation.html | 20 +- docs/articles/observation_period.html | 20 +- docs/articles/person.html | 20 +- docs/articles/procedure_occurrence.html | 20 +- docs/articles/provider.html | 20 +- docs/articles/visit_detail.html | 20 +- docs/articles/visit_occurrence.html | 20 +- docs/authors.html | 20 +- docs/index.html | 22 +- docs/pkgdown.yml | 16 +- .../CreateCDMIndexAndConstraintScripts.html | 20 +- docs/reference/CreateCDMIndices.html | 20 +- docs/reference/CreateCDMTables.html | 20 +- docs/reference/CreateMapAndRollupTables.html | 20 +- docs/reference/CreateSyntheaTables.html | 20 +- docs/reference/CreateVisitRollupTables.html | 20 +- docs/reference/CreateVocabMapTables.html | 20 +- docs/reference/DropEventTables.html | 20 +- docs/reference/DropMapAndRollupTables.html | 20 +- docs/reference/DropSyntheaTables.html | 20 +- docs/reference/DropVocabTables.html | 20 +- docs/reference/ETLSyntheaBuilder-package.html | 20 +- docs/reference/LoadEventTables.html | 20 +- docs/reference/LoadSyntheaTables.html | 20 +- docs/reference/LoadVocabFromCsv.html | 20 +- docs/reference/LoadVocabFromSchema.html | 20 +- docs/reference/TruncateEventTables.html | 20 +- docs/reference/TruncateVocabTables.html | 20 +- docs/reference/backupCDM.html | 20 +- docs/reference/createExtraIndices.html | 22 +- docs/reference/createPrunedTables.html | 20 +- docs/reference/exportToSQLite.html | 20 +- docs/reference/getEventConceptId.html | 20 +- docs/reference/index.html | 28 ++- docs/reference/pruneCDM.html | 20 +- docs/reference/restoreCDMTables.html | 20 +- docs/sitemap.xml | 6 + .../cdm_version/v531/create_states_map.sql | 57 +++++ .../cdm_version/v531/insert_care_site.sql | 21 ++ .../cdm_version/v531/insert_location.sql | 27 ++ .../cdm_version/v531/insert_person.sql | 9 +- .../v531/insert_visit_occurrence.sql | 26 +- .../cdm_version/v540/create_states_map.sql | 57 +++++ .../cdm_version/v540/insert_care_site.sql | 21 ++ .../cdm_version/v540/insert_location.sql | 27 ++ .../cdm_version/v540/insert_person.sql | 112 +++++---- vignettes/Device_exposure.Rmd | 2 +- vignettes/care_site.Rmd | 23 ++ vignettes/index.md | 2 + vignettes/location.Rmd | 25 ++ 63 files changed, 1424 insertions(+), 404 deletions(-) create mode 100644 docs/articles/care_site.html create mode 100644 docs/articles/location.html create mode 100644 inst/sql/sql_server/cdm_version/v531/create_states_map.sql create mode 100644 inst/sql/sql_server/cdm_version/v531/insert_care_site.sql create mode 100644 inst/sql/sql_server/cdm_version/v531/insert_location.sql create mode 100644 inst/sql/sql_server/cdm_version/v540/create_states_map.sql create mode 100644 inst/sql/sql_server/cdm_version/v540/insert_care_site.sql create mode 100644 inst/sql/sql_server/cdm_version/v540/insert_location.sql create mode 100644 vignettes/care_site.Rmd create mode 100644 vignettes/location.Rmd diff --git a/R/CreateVocabMapTables.r b/R/CreateVocabMapTables.r index 60a653c..4a42f92 100644 --- a/R/CreateVocabMapTables.r +++ b/R/CreateVocabMapTables.r @@ -9,7 +9,7 @@ #' \code{DatabaseConnector} package. #' @param cdmSchema The name of the database schema that will contain the Vocab mapping #' tables. Requires read and write permissions to this database. On SQL -#' Server, this should specifiy both the database and the schema, +#' Server, this should specify both the database and the schema, #' so for example 'cdm_instance.dbo'. #' @param cdmVersion The version of your CDM. Currently "5.3" and "5.4" are supported. #' @param sqlOnly A boolean that determines whether or not to perform the load or generate SQL scripts. Default is FALSE. @@ -33,7 +33,8 @@ CreateVocabMapTables <- queries <- c( "create_source_to_standard_vocab_map.sql", - "create_source_to_source_vocab_map.sql" + "create_source_to_source_vocab_map.sql", + "create_states_map.sql" ) if (!sqlOnly) { diff --git a/R/LoadEventTables.r b/R/LoadEventTables.r index c0dfea8..9ffe996 100644 --- a/R/LoadEventTables.r +++ b/R/LoadEventTables.r @@ -93,6 +93,28 @@ LoadEventTables <- function(connectionDetails, } } + # location + fileQuery <- "insert_location.sql" + sql <- SqlRender::loadRenderTranslateSql( + sqlFilename = file.path(sqlFilePath, fileQuery), + packageName = "ETLSyntheaBuilder", + dbms = connectionDetails$dbms, + cdm_schema = cdmSchema, + synthea_schema = syntheaSchema + ) + runStep(sql, fileQuery) + + # care_site + fileQuery <- "insert_care_site.sql" + sql <- SqlRender::loadRenderTranslateSql( + sqlFilename = file.path(sqlFilePath, fileQuery), + packageName = "ETLSyntheaBuilder", + dbms = connectionDetails$dbms, + cdm_schema = cdmSchema, + synthea_schema = syntheaSchema + ) + runStep(sql, fileQuery) + # person fileQuery <- "insert_person.sql" sql <- SqlRender::loadRenderTranslateSql( diff --git a/docs/404.html b/docs/404.html index 2536686..96ef43e 100644 --- a/docs/404.html +++ b/docs/404.html @@ -49,25 +49,28 @@