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>
|
<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" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
|
<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>
|
<script src="site_libs/navigation-1.1/tabsets.js"></script>
|
||||||
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
|
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
|
||||||
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
|
<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-6.2.1/css/all.min.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/v4-shims.min.css" rel="stylesheet" />
|
||||||
<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
|
<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
@ -185,8 +185,8 @@ $(document).ready(function () {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabset-dropdown > .nav-tabs > li.active:before {
|
.tabset-dropdown > .nav-tabs > li.active:before, .tabset-dropdown > .nav-tabs.nav-tabs-open:before {
|
||||||
content: "";
|
content: "\e259";
|
||||||
font-family: 'Glyphicons Halflings';
|
font-family: 'Glyphicons Halflings';
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
@ -194,16 +194,9 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
|
.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
|
||||||
content: "";
|
content: "\e258";
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
|
|
||||||
content: "";
|
|
||||||
font-family: 'Glyphicons Halflings';
|
font-family: 'Glyphicons Halflings';
|
||||||
display: inline-block;
|
border: none;
|
||||||
padding: 10px;
|
|
||||||
border-right: 1px solid #ddd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabset-dropdown > .nav-tabs > li.active {
|
.tabset-dropdown > .nav-tabs > li.active {
|
||||||
|
@ -402,6 +395,9 @@ div.tocify {
|
||||||
<li>
|
<li>
|
||||||
<a href="cdm54Changes.html">Changes from CDM v5.3</a>
|
<a href="cdm54Changes.html">Changes from CDM v5.3</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="cdm54erd.html">Entity Relationships</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</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
|
<p>The script below is an example for how to fill in the CDM_SOURCE
|
||||||
table. This table is required for the <a
|
table. This table is required for the <a
|
||||||
href="https://github.com/OHDSI/DataQualityDashboard">Data Quality
|
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
|
href="https://github.com/OHDSI/ETL-Synthea">ETL-Synthea</a> package, a
|
||||||
good example on how to write a complete extract-transform-load script
|
good example on how to write a complete extract-transform-load script
|
||||||
from start to finish, including vocabulary import.</p>
|
from start to finish, including vocabulary import.</p>
|
||||||
<pre class="sql"><code>insert into @cdm_schema.cdm_source (
|
<pre class="sql"><code>INSERT INTO @cdm_schema.cdm_source (
|
||||||
cdm_source_name,
|
cdm_source_name,
|
||||||
cdm_source_abbreviation,
|
cdm_source_abbreviation,
|
||||||
cdm_holder,
|
cdm_holder,
|
||||||
source_description,
|
source_description,
|
||||||
source_documentation_reference,
|
source_documentation_reference,
|
||||||
cdm_etl_reference,
|
cdm_etl_reference,
|
||||||
source_release_date,
|
source_release_date,
|
||||||
cdm_release_date,
|
cdm_release_date,
|
||||||
cdm_version,
|
cdm_version,
|
||||||
vocabulary_version
|
vocabulary_version
|
||||||
)
|
)
|
||||||
select
|
SELECT
|
||||||
'Synthea synthetic health database',
|
'Synthea synthetic health database',
|
||||||
'Synthea',
|
'Synthea',
|
||||||
'OHDSI Community',
|
'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.',
|
'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://synthetichealth.github.io/synthea/',
|
||||||
'https://github.com/OHDSI/ETL-Synthea',
|
'https://github.com/OHDSI/ETL-Synthea',
|
||||||
getdate(), -- NB: Set this value to the day the source data was pulled
|
getdate(), -- NB: Set this value to the day the source data was pulled
|
||||||
getdate(),
|
getdate(),
|
||||||
'v5.3',
|
'v5.3',
|
||||||
vocabulary_version
|
vocabulary_version
|
||||||
from @cdm_schema.vocabulary
|
FROM @cdm_schema.vocabulary
|
||||||
where vocabulary_id = 'None';</code></pre>
|
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>
|
</div>
|
||||||
<div id="bonus-queries" class="section level2">
|
<div id="bonus-queries" class="section level2">
|
||||||
|
@ -955,13 +985,13 @@ 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
|
href="https://ohdsi.github.io/ETL-LambdaBuilder/Optum%20Clinformatics/Optum_visit_occurrence.html">Optum
|
||||||
Extended ETL documentation</a>.</p>
|
Extended ETL documentation</a>.</p>
|
||||||
<pre class="sql"><code>SELECT concept_id, concept_name
|
<pre class="sql"><code>SELECT concept_id, concept_name
|
||||||
FROM concept
|
FROM concept
|
||||||
LEFT JOIN concept_ancestor
|
LEFT JOIN concept_ancestor
|
||||||
ON concept_id=descendant_concept_id
|
ON concept_id=descendant_concept_id
|
||||||
AND ancestor_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 standard_concept='S'
|
||||||
AND ancestor_concept_id IS NULL</code></pre>
|
AND ancestor_concept_id IS NULL</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
title: 'SQL Scripts'
|
||||||
output:
|
output:
|
||||||
html_document:
|
html_document:
|
||||||
toc: TRUE
|
toc: TRUE
|
||||||
|
@ -404,34 +405,70 @@ SELECT * FROM #tmp_de;
|
||||||
|
|
||||||
### CDM_SOURCE Table
|
### 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}
|
```{sql eval = FALSE, echo = TRUE}
|
||||||
insert into @cdm_schema.cdm_source (
|
INSERT INTO @cdm_schema.cdm_source (
|
||||||
cdm_source_name,
|
cdm_source_name,
|
||||||
cdm_source_abbreviation,
|
cdm_source_abbreviation,
|
||||||
cdm_holder,
|
cdm_holder,
|
||||||
source_description,
|
source_description,
|
||||||
source_documentation_reference,
|
source_documentation_reference,
|
||||||
cdm_etl_reference,
|
cdm_etl_reference,
|
||||||
source_release_date,
|
source_release_date,
|
||||||
cdm_release_date,
|
cdm_release_date,
|
||||||
cdm_version,
|
cdm_version,
|
||||||
vocabulary_version
|
vocabulary_version
|
||||||
)
|
)
|
||||||
select
|
SELECT
|
||||||
'Synthea synthetic health database',
|
'Synthea synthetic health database',
|
||||||
'Synthea',
|
'Synthea',
|
||||||
'OHDSI Community',
|
'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.',
|
'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://synthetichealth.github.io/synthea/',
|
||||||
'https://github.com/OHDSI/ETL-Synthea',
|
'https://github.com/OHDSI/ETL-Synthea',
|
||||||
getdate(), -- NB: Set this value to the day the source data was pulled
|
getdate(), -- NB: Set this value to the day the source data was pulled
|
||||||
getdate(),
|
getdate(),
|
||||||
'v5.3',
|
'v5.3',
|
||||||
vocabulary_version
|
vocabulary_version
|
||||||
from @cdm_schema.vocabulary
|
FROM @cdm_schema.vocabulary
|
||||||
where vocabulary_id = 'None';
|
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**
|
## **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}
|
```{sql eval=FALSE, echo=TRUE}
|
||||||
SELECT concept_id, concept_name
|
SELECT concept_id, concept_name
|
||||||
FROM concept
|
FROM concept
|
||||||
LEFT JOIN concept_ancestor
|
LEFT JOIN concept_ancestor
|
||||||
ON concept_id=descendant_concept_id
|
ON concept_id=descendant_concept_id
|
||||||
AND ancestor_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 standard_concept='S'
|
||||||
AND ancestor_concept_id IS NULL
|
AND ancestor_concept_id IS NULL
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue