From f0637ad97d041e39b77029cfbcd3b72eac6c09fc Mon Sep 17 00:00:00 2001 From: Maxim Moinat Date: Thu, 30 Mar 2023 16:00:23 +0200 Subject: [PATCH] fixes #557 --- rmd/sqlScripts.Rmd | 86 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 25 deletions(-) diff --git a/rmd/sqlScripts.Rmd b/rmd/sqlScripts.Rmd index 1b6a3c7..15b985b 100644 --- a/rmd/sqlScripts.Rmd +++ b/rmd/sqlScripts.Rmd @@ -404,34 +404,70 @@ SELECT * FROM #tmp_de; ### CDM_SOURCE Table -The script below is an example for how to fill in the CDM_SOURCE table. This table is required for the [Data Quality Dashboard](https://github.com/OHDSI/DataQualityDashboard) package to run. This was taken from the [ETL-Synthea](https://github.com/OHDSI/ETL-Synthea) package, a good example on how to write a complete extract-transform-load script from start to finish, including vocabulary import. +The script below is an example for how to fill in the CDM_SOURCE table. +This table is required for the [Data Quality Dashboard](https://github.com/OHDSI/DataQualityDashboard) package to run. + +#### v5.3 +This example was taken from the [ETL-Synthea](https://github.com/OHDSI/ETL-Synthea) package, +a good example on how to write a complete extract-transform-load script from start to finish, including vocabulary import. ```{sql eval = FALSE, echo = TRUE} -insert into @cdm_schema.cdm_source ( -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 +INSERT INTO @cdm_schema.cdm_source ( + 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 ) -select -'Synthea synthetic health database', -'Synthea', -'OHDSI Community', -'SyntheaTM is a Synthetic Patient Population Simulator. The goal is to output synthetic, realistic (but not real), patient data and associated health records in a variety of formats.', -'https://synthetichealth.github.io/synthea/', -'https://github.com/OHDSI/ETL-Synthea', -getdate(), -- NB: Set this value to the day the source data was pulled -getdate(), -'v5.3', -vocabulary_version -from @cdm_schema.vocabulary -where vocabulary_id = 'None'; +SELECT + 'Synthea synthetic health database', + 'Synthea', + 'OHDSI Community', + 'SyntheaTM is a Synthetic Patient Population Simulator. The goal is to output synthetic, realistic (but not real), patient data and associated health records in a variety of formats.', + 'https://synthetichealth.github.io/synthea/', + 'https://github.com/OHDSI/ETL-Synthea', + getdate(), -- NB: Set this value to the day the source data was pulled + getdate(), + 'v5.3', + vocabulary_version +FROM @cdm_schema.vocabulary +WHERE vocabulary_id = 'None'; +``` + +#### v5.4 +```{sql eval = FALSE, echo = TRUE} +INSERT INTO @cdm_schema.cdm_source ( + 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_version_concept_id +) +SELECT + '', + '', + '', + '', + '', -- e.g. link to source data dictionary + '', -- e.g. link to ETL documentation + '', -- when the source data was pulled + getdate(), + 'v5.4', + vocabulary_version, + 756265 -- OMOP CDM Version 5.4.0 +FROM @cdm_schema.vocabulary +WHERE vocabulary_id = 'None'; ``` ## **Bonus Queries**