Skip to content

Commit

Permalink
Update type concepts in ETL scripts (#172)
Browse files Browse the repository at this point in the history
Resolves #170
  • Loading branch information
burrowse authored Dec 15, 2023
1 parent eb86d2d commit bd9049b
Show file tree
Hide file tree
Showing 27 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion inst/sql/sql_server/cdm_version/v531/insert_death.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ insert into @cdm_schema.death (
select p.person_id person_id,
e.start death_date,
e.start death_datetime,
38003566 death_type_concept_id,
32817 death_type_concept_id,
srctostdvm.target_concept_id cause_concept_id,
e.reasoncode cause_source_value,
srctostdvm.source_concept_id cause_source_concept_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ d.start device_exposure_start_date,
d.start device_exposure_start_datetime,
d.stop device_exposure_end_date,
d.stop device_exposure_end_datetime,
38000267 device_type_concept_id,
32827 device_type_concept_id,
d.udi unique_device_id,
cast(null as int) quantity,
pr.provider_id provider_id,
Expand Down
4 changes: 2 additions & 2 deletions inst/sql/sql_server/cdm_version/v531/insert_drug_exposure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ m.start drug_exposure_start_datetime,
coalesce(m.stop,m.start) drug_exposure_end_date,
coalesce(m.stop,m.start) drug_exposure_end_datetime,
m.stop verbatim_end_date,
32869 drug_type_concept_id,
32838 drug_type_concept_id,
cast(null as varchar) stop_reason,
0 refills,
0 quantity,
Expand Down Expand Up @@ -105,7 +105,7 @@ i.date drug_exposure_start_datetime,
i.date drug_exposure_end_date,
i.date drug_exposure_end_datetime,
i.date verbatim_end_date,
32869 drug_type_concept_id,
32827 drug_type_concept_id,
cast(null as varchar) stop_reason,
0 refills,
0 quantity,
Expand Down
4 changes: 2 additions & 2 deletions inst/sql/sql_server/cdm_version/v531/insert_measurement.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ select
pr.start measurement_time,
}

38000267 measurement_type_concept_id,
32827 measurement_type_concept_id,
0 operator_concept_id,
cast(null as float) value_as_number,
0 value_as_concept_id,
Expand Down Expand Up @@ -101,7 +101,7 @@ select
o.date measurement_date,
o.date measurement_datetime,
o.date measurement_time,
38000267 measurement_type_concept_id,
32827 measurement_type_concept_id,
0 operator_concept_id,
case
when isnumeric(o.value) = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ p.person_id person_id,
srctostdvm.target_concept_id observation_concept_id,
a.start observation_date,
a.start observation_datetime,
38000280 observation_type_concept_id,
32827 observation_type_concept_id,
cast(null as float) value_as_number,
cast(null as varchar) value_as_string,
0 value_as_concept_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ select row_number()over(order by person_id),
person_id,
start_date,
end_date,
44814724 period_type_concept_id
32882 period_type_concept_id
from (
select p.person_id,
min(e.start) start_date,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pr.start procedure_date,
pr.start procedure_datetime,
}

38000267 procedure_type_concept_id,
32827 procedure_type_concept_id,
0 modifier_concept_id,
cast(null as integer) quantity,
prv.provider_id provider_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ select
av.visit_start_date visit_detail_start_datetime,
av.visit_end_date visit_detail_end_date,
av.visit_end_date visit_detail_end_datetime,
44818517 visit_detail_type_concept_id,
32827 visit_detail_type_concept_id,
pr.provider_id provider_id,
null care_site_id,
0 admitting_source_concept_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ select
av.visit_start_date,
av.visit_end_date,
av.visit_end_date,
44818517,
32827,
pr.provider_id,
null,
av.encounter_id,
Expand Down
2 changes: 1 addition & 1 deletion inst/sql/sql_server/cdm_version/v540/insert_death.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ insert into @cdm_schema.death (
select p.person_id person_id,
e.start death_date,
e.start death_datetime,
38003566 death_type_concept_id,
32817 death_type_concept_id,
srctostdvm.target_concept_id cause_concept_id,
e.reasoncode cause_source_value,
srctostdvm.source_concept_id cause_source_concept_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ d.start device_exposure_start_date,
d.start device_exposure_start_datetime,
d.stop device_exposure_end_date,
d.stop device_exposure_end_datetime,
38000267 device_type_concept_id,
32827 device_type_concept_id,
d.udi unique_device_id,
cast(null as varchar) production_id,
cast(null as int) quantity,
Expand Down
4 changes: 2 additions & 2 deletions inst/sql/sql_server/cdm_version/v540/insert_drug_exposure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ m.start drug_exposure_start_datetime,
coalesce(m.stop,m.start) drug_exposure_end_date,
coalesce(m.stop,m.start) drug_exposure_end_datetime,
m.stop verbatim_end_date,
32869 drug_type_concept_id,
32838 drug_type_concept_id,
cast(null as varchar) stop_reason,
0 refills,
0 quantity,
Expand Down Expand Up @@ -105,7 +105,7 @@ i.date drug_exposure_start_datetime,
i.date drug_exposure_end_date,
i.date drug_exposure_end_datetime,
i.date verbatim_end_date,
32869 drug_type_concept_id,
32827 drug_type_concept_id,
cast(null as varchar) stop_reason,
0 refills,
0 quantity,
Expand Down
4 changes: 2 additions & 2 deletions inst/sql/sql_server/cdm_version/v540/insert_measurement.sql
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ select
pr.start measurement_time,
}

38000267 measurement_type_concept_id,
32827 measurement_type_concept_id,
0 operator_concept_id,
cast(null as float) value_as_number,
0 value_as_concept_id,
Expand Down Expand Up @@ -111,7 +111,7 @@ select
o.date measurement_date,
o.date measurement_datetime,
o.date measurement_time,
38000267 measurement_type_concept_id,
32827 measurement_type_concept_id,
0 operator_concept_id,
case
when isnumeric(o.value) = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ p.person_id person_id,
srctostdvm.target_concept_id observation_concept_id,
a.start observation_date,
a.start observation_datetime,
38000280 observation_type_concept_id,
32827 observation_type_concept_id,
cast(null as float) value_as_number,
cast(null as varchar) value_as_string,
0 value_as_concept_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ select row_number()over(order by person_id),
person_id,
start_date,
end_date,
44814724 period_type_concept_id
32882 period_type_concept_id
from (
select p.person_id,
min(e.start) start_date,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pr.stop procedure_end_date,
pr.stop procedure_end_datetime,
}

38000267 procedure_type_concept_id,
32827 procedure_type_concept_id,
0 modifier_concept_id,
cast(null as integer) quantity,
prv.provider_id provider_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ select
av.visit_start_date visit_detail_start_datetime,
av.visit_end_date visit_detail_end_date,
av.visit_end_date visit_detail_end_datetime,
44818517 visit_detail_type_concept_id,
32827 visit_detail_type_concept_id,
pr.provider_id provider_id,
null care_site_id,
0 admitted_from_source_concept_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ select
av.visit_start_date,
av.visit_end_date,
av.visit_end_date,
44818517,
32827,
pr.provider_id,
null,
av.encounter_id,
Expand Down
2 changes: 1 addition & 1 deletion vignettes/Device_exposure.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ vignette: >
| device_exposure_start_datetime | start | | |
| device_exposure_end_date | stop | | |
| device_exposure_end_datetime | stop | | |
| device_type_concept_id | | Set to 38000267 (Outpatient Detail) for all records | |
| device_type_concept_id | | Set to 32827 (EHR encounter record) for all records | |
| unique_device_id |udi | | |
| quantity | | cast(null as integer) | |
| provider_id | provider | Look up provider_id using provider, joining to the provider.provider_source_value field in the omop table | |
Expand Down
4 changes: 2 additions & 2 deletions vignettes/Drug_exposure.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ vignette: >
| drug_exposure_end_date | stop start | (coalesce(stop,start)) | |
| drug_exposure_end_datetime | stop start |coalesce(stop,start) Use 00:00:00 as the time. | |
| verbatim_end_date | stop | | |
| drug_type_concept_id | | |Use the concept_id 32869 (Pharmacy Claim). |
| drug_type_concept_id | | |Use the concept_id 32838 (EHR prescription). |
| stop_reason | | | |
| refills | | | |
| quantity | | | |
Expand Down Expand Up @@ -51,7 +51,7 @@ vignette: >
| drug_exposure_end_date | date | | |
| drug_exposure_end_datetime | date | Use 00:00:00 as the time. | |
| verbatim_end_date | date | | |
| drug_type_concept_id | | | Use the concept_id 32869 (Pharmacy Claim). |
| drug_type_concept_id | | | Use the concept_id 32827 (EHR encounter record). |
| stop_reason | | cast(null as varchar) | |
| refills | | Set to 0 for all records | |
| quantity | |Set to 0 for all record | |
Expand Down
4 changes: 2 additions & 2 deletions vignettes/Measurement.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ vignette: >
| measurement_date | date (v2.7.0) start (v3.0.0) | | |
| measurement_datetime | date (v2.7.0) start (v3.0.0) | Use 00:00:00 as the time. | |
| measurement_time | date (v2.7.0) start (v3.0.0) | | |
| measurement_type_concept_id | | | Use concept_id 38000267 (Outpatient detail - 1st position) for all records |
| measurement_type_concept_id | | | Use concept_id 32827 (EHR encounter record) for all records |
| operator_concept_id | | Set to 0 for all records | |
| value_as_number | |cast(null as float) | |
| value_as_concept_id | | Set to 0 for all records | |
Expand All @@ -46,7 +46,7 @@ vignette: >
| measurement_date | date | | |
| measurement_datetime | date | Use 00:00:00 as time. | |
| measurement_time | | | |
| measurement_type_concept_id | | | Use concept_id 38000267 (Outpatient detail - 1st position) for all records |
| measurement_type_concept_id | | | Use concept_id 32827 (EHR encounter record) for all records |
| operator_concept_id | | Set as 0 for all records | |
| value_as_number | value | | |
| value_as_concept_id | value | units | Use code to lookup target_concept_id in CTE_TARGET_VOCAB_MAP: select ctvm.target_concept_id from observations o join cte_target_vocab_map ctvm on ctvm.source_code = o.value and ctvm.target_domain_id = 'Meas value' and ctvm.target_standard_concept = 'S' and ctvm.target_invalid_reason is NULL | |
Expand Down
2 changes: 1 addition & 1 deletion vignettes/death.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ vignette: >
| person_id | patient | Map by mapping person.person_source_value to patient. Find person.person_id by mapping encounters.patient to person.person_source_value. | | | |
| death_date| start| | |
| death_datetime | start | | |
| death_type_concept_id | | Set to 38003566 (Medical claim discharge status "Died") for all records | |
| death_type_concept_id | | Set to 32817 (EHR) for all records | |
| cause_concept_id | reasoncode | Use the following SQL code to lookup target_concept_id in CTE_SOURCE_VOCAB_MAP: select csvm.target_concept_id from encounters e join cte_source_vocab_map csvm on csvm.source_code = e.reasoncode and csvm.target_domain_id = 'Condition' and csvm.source_domain_id = 'Condition' and csvm.target_vocabulary_id = 'SNOMED' and csvm.source_vocabulary_id = 'SNOMED' and csvm.target_invalid_reason is NULL and csvm.target_standard_concept = 'S' | |
| cause_source_value | reasoncode | | |
| cause_source_concept_id | reasoncode | Use the following SQL code to lookup source_concept_id in CTE_SOURCE_VOCAB_MAP: select csvm.source_concept_id from encounters e join cte_source_vocab_map csvm on csvm.source_code = e.reasoncode and csvm.target_domain_id = 'Condition' and csvm.source_domain_id = 'Condition' and csvm.target_vocabulary_id = 'SNOMED' and csvm.source_vocabulary_id = 'SNOMED' and csvm.target_invalid_reason is NULL and csvm.target_standard_concept = 'S' | |
2 changes: 1 addition & 1 deletion vignettes/observation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ vignette: >
| observation_concept_id | code | Use code to lookup target_concept_id in CTE_TARGET_VOCAB_MAP: select ctvm.target_concept_id from observations o join cte_target_vocab_map ctvm on ctvm.source_code = o.code and ctvm.target_domain_id = 'Observation' and ctvm.target_vocabulary_id = 'LOINC' and ctvm.standard_concept_id = 'S' and ctvm.target_invalid_reason is null | |
| observation_date | date | | |
| observation_datetime | date | | |
| observation_type_concept_id | | Set as 38000280 (Observation recorded from EHR) for all records. | |
| observation_type_concept_id | | Set as 32827 (EHR encounter record) for all records. | |
| value_as_number | | cast(null as float) | |
| value_as_string | | cast(null as varchar) | |
| value_as_concept_id | | Set as 0 for all records | |
Expand Down
2 changes: 1 addition & 1 deletion vignettes/observation_period.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ vignette: >
| person_id | patient | Map by mapping person.person_source_value to patient. Find person.person_id by mapping encouters.patient to person.person_source_value. | |
| observation_period_start_date | start | min(start) group by patient Take the earliest START per patient | |
| observation_period_end_date | stop | max(stop) group by patient Take the latest STOP per patient | |
| period_type_concept_id | | Set as concept 44814724 (Period covering healthcare encounters) for all records | |
| period_type_concept_id | | Set as concept 32882 (Standard algorithm from EHR) for all records | |
2 changes: 1 addition & 1 deletion vignettes/procedure_occurrence.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ vignette: >
| procedure_datetime | date, start(v3.0.0) | Use 00:00:00 as the time. | |
| procedure_end_date | stop(v3.0.0) | | |
| procedure_end_datetime | stop(v3.0.0) | Use 00:00:00 as the time. | |
| procedure_type_concept_id | | | Use concept_id 38000267 (Outpatient detail - 1st position) for all records. |
| procedure_type_concept_id | | | Use concept_id 32827 (EHR encounter record) for all records. |
| modifier_concept_id | | Set to 0 for all records | |
| quantity | |cast(null as integer) | |
| provider_id | encounters.provider | | |
Expand Down
2 changes: 1 addition & 1 deletion vignettes/visit_detail.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ https://github.com/OHDSI/ETL-Synthea/blob/main/inst/sql/sql_server/cdm_version/v
| visit_detail__start_datetime | start | | |
| visi_detail_t_end_date | stop | | |
| visit_detail__end_datetime | stop | | |
| visit__detail_type_concept_id | | Set all records as concept_id 44818517 (Visit derived from encounter on claim). | |
| visit__detail_type_concept_id | | Set all records as concept_id 32827 (EHR encounter record). | |
| provider_id | encounters.provider | | |
| care_site_id | | Set to null for all records | |
| admitted_from_source_concept_id | | Set to 0 for all records | |
Expand Down
2 changes: 1 addition & 1 deletion vignettes/visit_occurrence.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ https://github.com/OHDSI/ETL-Synthea/blob/main/inst/sql/sql_server/cdm_version/v
| visit_start_datetime | start | | |
| visit_end_date | stop | | |
| visit_end_datetime | stop | | |
| visit_type_concept_id | | Set all records as concept_id 44818517 (Visit derived from encounter on claim). | |
| visit_type_concept_id | | Set all records as concept_id 32827 (EHR encounter record). | |
| provider_id |encounters.provider | | |
| care_site_id | | Set to null for all records | |
| visit_source_value | all_visits.encounters_id | | |
Expand Down

0 comments on commit bd9049b

Please sign in to comment.