Skip to content

Commit

Permalink
Ensure queries and documentation are up to date (#186)
Browse files Browse the repository at this point in the history
* Update instructions

* Update measurement and procedure logic

* Update payer plan period logic

* Ensure documentation is up to date
  • Loading branch information
burrowse authored Feb 23, 2024
1 parent a034b71 commit cba3503
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 83 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Follow the steps on the [synthea wiki](https://github.com/synthetichealth/synthe
# The ETLSyntheaBuilder package leverages the OHDSI/CommonDataModel package for CDM creation.
# Valid CDM versions are determined by executing CommonDataModel::listSupportedVersions().
# The strings representing supported CDM versions are currently "5.3" and "5.4".
# The Synthea version we use in this example is 2.7.0. However, at this time we also support 3.0.0, 3.1.0 and 3.2.0.
# The Synthea version we use in this example is 2.7.0.
# However, at this time we also support 3.0.0, 3.1.0 and 3.2.0.
# Please note that Synthea's MASTER branch is always active and this package will be updated to support
# future versions as possible.
# The schema to load the Synthea tables is called "native".
Expand Down Expand Up @@ -52,7 +53,7 @@ ETLSyntheaBuilder::LoadVocabFromCsv(connectionDetails = cd, cdmSchema = cdmSchem
ETLSyntheaBuilder::CreateMapAndRollupTables(connectionDetails = cd, cdmSchema = cdmSchema, syntheaSchema = syntheaSchema, cdmVersion = cdmVersion, syntheaVersion = syntheaVersion)

## Optional Step to create extra indices
ETLSyntheaBuilder::CreateExtraIndices(connectionDetails = cd, cdmSchema = cdmSchema, syntheaSchema = syntheaSchema, cdmVersion = cdmVersion, syntheaVersion = syntheaVersion)
ETLSyntheaBuilder::CreateExtraIndices(connectionDetails = cd, cdmSchema = cdmSchema, syntheaSchema = syntheaSchema, syntheaVersion = syntheaVersion)

ETLSyntheaBuilder::LoadEventTables(connectionDetails = cd, cdmSchema = cdmSchema, syntheaSchema = syntheaSchema, cdmVersion = cdmVersion, syntheaVersion = syntheaVersion)
```
Expand Down
5 changes: 3 additions & 2 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ articles:
provider: provider.html
visit_detail: visit_detail.html
visit_occurrence: visit_occurrence.html
last_built: 2024-02-06T20:39Z
last_built: 2024-02-23T16:59Z

2 changes: 1 addition & 1 deletion docs/reference/CreateCDMIndices.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/CreateCDMTables.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ select
pr.date measurement_time,
}

{@synthea_version == "3.0.0"} ? {
{@synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? {
pr.start measurement_date,
pr.start measurement_datetime,
pr.start measurement_time,
Expand Down
75 changes: 38 additions & 37 deletions inst/sql/sql_server/cdm_version/v531/insert_payer_plan_period.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

insert into @cdm_schema.payer_plan_period (
payer_plan_period_id,
person_id,
Expand All @@ -19,42 +18,44 @@ insert into @cdm_schema.payer_plan_period (
stop_reason_source_concept_id
)

select ROW_NUMBER()OVER(ORDER BY pat.id, pt.start_year) payer_plan_period_id,
select ROW_NUMBER()OVER(ORDER BY person_id, payer_plan_period_start_date) payer_plan_period_id,
*
from (select
per.person_id person_id,

{@synthea_version == "2.7.0"} ? {
CAST(CONCAT('01-JAN-',CAST(pt.start_year AS VARCHAR)) AS DATE) payer_plan_period_start_date,
CAST(CONCAT('31-DEC-',CAST(pt.end_year AS VARCHAR)) AS DATE) payer_plan_period_end_date,
}

{@synthea_version == "3.0.0"} ? {
CAST(pt.start_year AS DATE) payer_plan_period_start_date,
CAST(pt.end_year AS DATE) payer_plan_period_end_date,
}
{@synthea_version == "2.7.0"} ? {
CAST(CONCAT('01-JAN-',CAST(pt.start_year AS VARCHAR)) AS DATE) payer_plan_period_start_date,
CAST(CONCAT('31-DEC-',CAST(pt.end_year AS VARCHAR)) AS DATE) payer_plan_period_end_date,
}

{@synthea_version == "3.0.0"} ? {
CAST(pt.start_year AS DATE) payer_plan_period_start_date,
CAST(pt.end_year AS DATE) payer_plan_period_end_date,
}

{@synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? {
CAST(pt.start_date AS DATE) payer_plan_period_start_date,
CAST(pt.end_date AS DATE) payer_plan_period_end_date,
}

{@synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? {
CAST(pt.start_date AS DATE) payer_plan_period_start_date,
CAST(pt.end_date AS DATE) payer_plan_period_end_date,
}

0 payer_concept_id,
pt.payer payer_source_value,
0 payer_source_concept_id,
0 plan_concept_id,
pay.name plan_source_value,
0 plan_source_concept_id,
0 sponsor_concept_id,
CAST(NULL AS VARCHAR) sponsor_source_value,
0 sponsor_source_concept_id,
CAST(NULL AS VARCHAR) family_source_value,
0 stop_reason_concept_id,
CAST(NULL AS VARCHAR) stop_reason_source_value,
0 stop_reason_source_concept_id
from @synthea_schema.payers pay
join @synthea_schema.payer_transitions pt
on pay.id = pt.payer
join @synthea_schema.patients pat
on pt.patient = pat.id
join @cdm_schema.person per
on pat.id = per.person_source_value
;
0 payer_concept_id,
pt.payer payer_source_value,
0 payer_source_concept_id,
0 plan_concept_id,
pay.name plan_source_value,
0 plan_source_concept_id,
0 sponsor_concept_id,
CAST(NULL AS VARCHAR) sponsor_source_value,
0 sponsor_source_concept_id,
CAST(NULL AS VARCHAR) family_source_value,
0 stop_reason_concept_id,
CAST(NULL AS VARCHAR) stop_reason_source_value,
0 stop_reason_source_concept_id
from @synthea_schema.payers pay
join @synthea_schema.payer_transitions pt
on pay.id = pt.payer
join @synthea_schema.patients pat
on pt.patient = pat.id
join @cdm_schema.person per
on pat.id = per.person_source_value) person_payer_windows
;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pr.date procedure_date,
pr.date procedure_datetime,
}

{@synthea_version == "3.0.0"} ? {
{@synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? {
pr.start procedure_date,
pr.start procedure_datetime,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ select
pr.date measurement_time,
}

{@synthea_version == "3.0.0"} ? {
{@synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? {
pr.start measurement_date,
pr.start measurement_datetime,
pr.start measurement_time,
Expand Down
72 changes: 37 additions & 35 deletions inst/sql/sql_server/cdm_version/v540/insert_payer_plan_period.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,44 @@ insert into @cdm_schema.payer_plan_period (
stop_reason_source_concept_id
)

select ROW_NUMBER()OVER(ORDER BY pat.id, pt.start_year) payer_plan_period_id,
select ROW_NUMBER()OVER(ORDER BY person_id, payer_plan_period_start_date) payer_plan_period_id,
*
from (select
per.person_id person_id,

{@synthea_version == "2.7.0"} ? {
CAST(CONCAT('01-JAN-',CAST(pt.start_year AS VARCHAR)) AS DATE) payer_plan_period_start_date,
CAST(CONCAT('31-DEC-',CAST(pt.end_year AS VARCHAR)) AS DATE) payer_plan_period_end_date,
}

{@synthea_version == "3.0.0"} ? {
CAST(pt.start_year AS DATE) payer_plan_period_start_date,
CAST(pt.end_year AS DATE) payer_plan_period_end_date,
}
{@synthea_version == "2.7.0"} ? {
CAST(CONCAT('01-JAN-',CAST(pt.start_year AS VARCHAR)) AS DATE) payer_plan_period_start_date,
CAST(CONCAT('31-DEC-',CAST(pt.end_year AS VARCHAR)) AS DATE) payer_plan_period_end_date,
}

{@synthea_version == "3.0.0"} ? {
CAST(pt.start_year AS DATE) payer_plan_period_start_date,
CAST(pt.end_year AS DATE) payer_plan_period_end_date,
}

{@synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? {
CAST(pt.start_date AS DATE) payer_plan_period_start_date,
CAST(pt.end_date AS DATE) payer_plan_period_end_date,
}
0 payer_concept_id,
pt.payer payer_source_value,
0 payer_source_concept_id,
0 plan_concept_id,
pay.name plan_source_value,
0 plan_source_concept_id,
0 sponsor_concept_id,
CAST(NULL AS VARCHAR) sponsor_source_value,
0 sponsor_source_concept_id,
CAST(NULL AS VARCHAR) family_source_value,
0 stop_reason_concept_id,
CAST(NULL AS VARCHAR) stop_reason_source_value,
0 stop_reason_source_concept_id
from @synthea_schema.payers pay
join @synthea_schema.payer_transitions pt
on pay.id = pt.payer
join @synthea_schema.patients pat
on pt.patient = pat.id
join @cdm_schema.person per
on pat.id = per.person_source_value
;
CAST(pt.start_date AS DATE) payer_plan_period_start_date,
CAST(pt.end_date AS DATE) payer_plan_period_end_date,
}

0 payer_concept_id,
pt.payer payer_source_value,
0 payer_source_concept_id,
0 plan_concept_id,
pay.name plan_source_value,
0 plan_source_concept_id,
0 sponsor_concept_id,
CAST(NULL AS VARCHAR) sponsor_source_value,
0 sponsor_source_concept_id,
CAST(NULL AS VARCHAR) family_source_value,
0 stop_reason_concept_id,
CAST(NULL AS VARCHAR) stop_reason_source_value,
0 stop_reason_source_concept_id
from @synthea_schema.payers pay
join @synthea_schema.payer_transitions pt
on pay.id = pt.payer
join @synthea_schema.patients pat
on pt.patient = pat.id
join @cdm_schema.person per
on pat.id = per.person_source_value) person_payer_windows
;
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pr.date procedure_end_date,
pr.date procedure_end_datetime,
}

{@synthea_version == "3.0.0"} ? {
{@synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? {
pr.start procedure_date,
pr.start procedure_datetime,
pr.stop procedure_end_date,
Expand Down

0 comments on commit cba3503

Please sign in to comment.