From ae71db6a98ff5653edff07544572e5b361ebb8b1 Mon Sep 17 00:00:00 2001 From: Evanette Burrows Date: Wed, 18 Sep 2024 10:13:26 -0400 Subject: [PATCH] Add updated condition and procedure support for v3.3.0 --- .../v531/insert_condition_occurrence.sql | 15 +++++++++++++++ .../v531/insert_procedure_occurrence.sql | 13 ++++++++++++- .../v540/insert_procedure_occurrence.sql | 15 ++++++++++++++- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/inst/sql/sql_server/cdm_version/v531/insert_condition_occurrence.sql b/inst/sql/sql_server/cdm_version/v531/insert_condition_occurrence.sql index aaf159c..c34e1e9 100644 --- a/inst/sql/sql_server/cdm_version/v531/insert_condition_occurrence.sql +++ b/inst/sql/sql_server/cdm_version/v531/insert_condition_occurrence.sql @@ -42,12 +42,27 @@ join @cdm_schema.source_to_standard_vocab_map srctostdvm on srctostdvm.source_code = c.code and srctostdvm.target_domain_id = 'Condition' and srctostdvm.target_vocabulary_id = 'SNOMED' + {@synthea_version == "2.7.0" | @synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0"} ? { and srctostdvm.source_vocabulary_id = 'SNOMED' +} + +{@synthea_version == "3.3.0"} ? { + and srctostdvm.source_vocabulary_id in ( 'SNOMED','ICD10CM') +} + and srctostdvm.target_standard_concept = 'S' and srctostdvm.target_invalid_reason is null join @cdm_schema.source_to_source_vocab_map srctosrcvm on srctosrcvm.source_code = c.code + +{@synthea_version == "2.7.0" | @synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0"} ? { and srctosrcvm.source_vocabulary_id = 'SNOMED' +} + +{@synthea_version == "3.3.0"} ? { + and srctosrcvm.source_vocabulary_id in ('SNOMED','ICD10CM') +} + and srctosrcvm.source_domain_id = 'Condition' left join @cdm_schema.final_visit_ids fv on fv.encounter_id = c.encounter diff --git a/inst/sql/sql_server/cdm_version/v531/insert_procedure_occurrence.sql b/inst/sql/sql_server/cdm_version/v531/insert_procedure_occurrence.sql index f21b070..c42ef7e 100644 --- a/inst/sql/sql_server/cdm_version/v531/insert_procedure_occurrence.sql +++ b/inst/sql/sql_server/cdm_version/v531/insert_procedure_occurrence.sql @@ -44,12 +44,23 @@ join @cdm_schema.source_to_standard_vocab_map srctostdvm on srctostdvm.source_code = pr.code and srctostdvm.target_domain_id = 'Procedure' and srctostdvm.target_vocabulary_id = 'SNOMED' - and srctostdvm.source_vocabulary_id = 'SNOMED' +{@synthea_version == "2.7.0" | @synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? { + and srctostdvm.source_vocabulary_id = 'SNOMED' +} +{@synthea_version == "3.3.0" } ? { + and srctostdvm.source_vocabulary_id in ('SNOMED','HCPCS') +} and srctostdvm.target_standard_concept = 'S' and srctostdvm.target_invalid_reason is null join @cdm_schema.source_to_source_vocab_map srctosrcvm on srctosrcvm.source_code = pr.code +{@synthea_version == "2.7.0" | @synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? { and srctosrcvm.source_vocabulary_id = 'SNOMED' +} + +{@synthea_version == "3.3.0" } ? { + and srctosrcvm.source_vocabulary_id in ('SNOMED','HCPCS') +} left join @cdm_schema.final_visit_ids fv on fv.encounter_id = pr.encounter left join @synthea_schema.encounters e diff --git a/inst/sql/sql_server/cdm_version/v540/insert_procedure_occurrence.sql b/inst/sql/sql_server/cdm_version/v540/insert_procedure_occurrence.sql index 597b788..ad21557 100644 --- a/inst/sql/sql_server/cdm_version/v540/insert_procedure_occurrence.sql +++ b/inst/sql/sql_server/cdm_version/v540/insert_procedure_occurrence.sql @@ -50,12 +50,25 @@ join @cdm_schema.source_to_standard_vocab_map srctostdvm on srctostdvm.source_code = pr.code and srctostdvm.target_domain_id = 'Procedure' and srctostdvm.target_vocabulary_id = 'SNOMED' - and srctostdvm.source_vocabulary_id = 'SNOMED' + +{@synthea_version == "2.7.0" | @synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? { + and srctostdvm.source_vocabulary_id = 'SNOMED' +} +{@synthea_version == "3.3.0" } ? { + and srctostdvm.source_vocabulary_id in ('SNOMED','HCPCS') +} and srctostdvm.target_standard_concept = 'S' and srctostdvm.target_invalid_reason is null join @cdm_schema.source_to_source_vocab_map srctosrcvm on srctosrcvm.source_code = pr.code +{@synthea_version == "2.7.0" | @synthea_version == "3.0.0" | @synthea_version == "3.1.0" | @synthea_version == "3.2.0" } ? { and srctosrcvm.source_vocabulary_id = 'SNOMED' +} + +{@synthea_version == "3.3.0" } ? { + and srctosrcvm.source_vocabulary_id in ('SNOMED','HCPCS') +} + left join @cdm_schema.final_visit_ids fv on fv.encounter_id = pr.encounter left join @synthea_schema.encounters e