Merge pull request #558 from OHDSI/fix-557
Documentation fix for cdm_source example sql
This commit is contained in:
commit
77831c5326
|
@ -11,9 +11,9 @@
|
|||
|
||||
|
||||
|
||||
<title>sqlScripts.knit</title>
|
||||
<title>SQL Scripts</title>
|
||||
|
||||
<script src="site_libs/header-attrs-2.16/header-attrs.js"></script>
|
||||
<script src="site_libs/header-attrs-2.21/header-attrs.js"></script>
|
||||
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
|
||||
|
@ -35,8 +35,8 @@
|
|||
<script src="site_libs/navigation-1.1/tabsets.js"></script>
|
||||
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
|
||||
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
|
||||
<link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" />
|
||||
<link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" />
|
||||
<link href="site_libs/font-awesome-6.2.1/css/all.min.css" rel="stylesheet" />
|
||||
<link href="site_libs/font-awesome-6.2.1/css/v4-shims.min.css" rel="stylesheet" />
|
||||
<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
|
||||
|
||||
<style type="text/css">
|
||||
|
@ -185,8 +185,8 @@ $(document).ready(function () {
|
|||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.tabset-dropdown > .nav-tabs > li.active:before {
|
||||
content: "";
|
||||
.tabset-dropdown > .nav-tabs > li.active:before, .tabset-dropdown > .nav-tabs.nav-tabs-open:before {
|
||||
content: "\e259";
|
||||
font-family: 'Glyphicons Halflings';
|
||||
display: inline-block;
|
||||
padding: 10px;
|
||||
|
@ -194,16 +194,9 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
|
||||
content: "";
|
||||
border: none;
|
||||
}
|
||||
|
||||
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
|
||||
content: "";
|
||||
content: "\e258";
|
||||
font-family: 'Glyphicons Halflings';
|
||||
display: inline-block;
|
||||
padding: 10px;
|
||||
border-right: 1px solid #ddd;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.tabset-dropdown > .nav-tabs > li.active {
|
||||
|
@ -402,6 +395,9 @@ div.tocify {
|
|||
<li>
|
||||
<a href="cdm54Changes.html">Changes from CDM v5.3</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="cdm54erd.html">Entity Relationships</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -908,35 +904,69 @@ SELECT * FROM #tmp_de;</code></pre>
|
|||
<p>The script below is an example for how to fill in the CDM_SOURCE
|
||||
table. This table is required for the <a
|
||||
href="https://github.com/OHDSI/DataQualityDashboard">Data Quality
|
||||
Dashboard</a> package to run. This was taken from the <a
|
||||
Dashboard</a> package to run.</p>
|
||||
<div id="v5.3" class="section level4">
|
||||
<h4>v5.3</h4>
|
||||
<p>This example was taken from the <a
|
||||
href="https://github.com/OHDSI/ETL-Synthea">ETL-Synthea</a> package, a
|
||||
good example on how to write a complete extract-transform-load script
|
||||
from start to finish, including vocabulary import.</p>
|
||||
<pre class="sql"><code>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
|
||||
<pre class="sql"><code>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';</code></pre>
|
||||
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';</code></pre>
|
||||
</div>
|
||||
<div id="v5.4" class="section level4">
|
||||
<h4>v5.4</h4>
|
||||
<pre class="sql"><code>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
|
||||
'<your_cdm_source_name>',
|
||||
'<your_cdm_source_abbreviation>',
|
||||
'<your_cdm_holder>',
|
||||
'<your_source_description>',
|
||||
'<your_source_documentation_reference>', -- e.g. link to source data dictionary
|
||||
'<your_etl_reference>', -- e.g. link to ETL documentation
|
||||
'<your_source_release_date>', -- when the source data was pulled
|
||||
getdate(), -- or the date of ETL run
|
||||
'v5.4',
|
||||
vocabulary_version,
|
||||
756265 -- 'OMOP CDM Version 5.4.0'
|
||||
FROM @cdm_schema.vocabulary
|
||||
WHERE vocabulary_id = 'None';</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bonus-queries" class="section level2">
|
||||
|
@ -955,11 +985,11 @@ Details. For more information on how this can be done, please see the <a
|
|||
href="https://ohdsi.github.io/ETL-LambdaBuilder/Optum%20Clinformatics/Optum_visit_occurrence.html">Optum
|
||||
Extended ETL documentation</a>.</p>
|
||||
<pre class="sql"><code>SELECT concept_id, concept_name
|
||||
FROM concept
|
||||
LEFT JOIN concept_ancestor
|
||||
FROM concept
|
||||
LEFT JOIN concept_ancestor
|
||||
ON concept_id=descendant_concept_id
|
||||
AND ancestor_concept_id!=descendant_concept_id
|
||||
WHERE domain_id='Visit'
|
||||
WHERE domain_id='Visit'
|
||||
AND standard_concept='S'
|
||||
AND ancestor_concept_id IS NULL</code></pre>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
title: 'SQL Scripts'
|
||||
output:
|
||||
html_document:
|
||||
toc: TRUE
|
||||
|
@ -404,34 +405,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
|
||||
'<your_cdm_source_name>',
|
||||
'<your_cdm_source_abbreviation>',
|
||||
'<your_cdm_holder>',
|
||||
'<your_source_description>',
|
||||
'<your_source_documentation_reference>', -- e.g. link to source data dictionary
|
||||
'<your_etl_reference>', -- e.g. link to ETL documentation
|
||||
'<your_source_release_date>', -- when the source data was pulled
|
||||
getdate(), -- or the date of ETL run
|
||||
'v5.4',
|
||||
vocabulary_version,
|
||||
756265 -- 'OMOP CDM Version 5.4.0'
|
||||
FROM @cdm_schema.vocabulary
|
||||
WHERE vocabulary_id = 'None';
|
||||
```
|
||||
|
||||
## **Bonus Queries**
|
||||
|
@ -442,11 +479,11 @@ The query below will utilize the Visit Concept hierarcy to find the highest-leve
|
|||
|
||||
```{sql eval=FALSE, echo=TRUE}
|
||||
SELECT concept_id, concept_name
|
||||
FROM concept
|
||||
LEFT JOIN concept_ancestor
|
||||
FROM concept
|
||||
LEFT JOIN concept_ancestor
|
||||
ON concept_id=descendant_concept_id
|
||||
AND ancestor_concept_id!=descendant_concept_id
|
||||
WHERE domain_id='Visit'
|
||||
WHERE domain_id='Visit'
|
||||
AND standard_concept='S'
|
||||
AND ancestor_concept_id IS NULL
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue