-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSQL_i2b2_legacy.JSON
22 lines (22 loc) · 6.83 KB
/
SQL_i2b2_legacy.JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
"dt.patient": "SELECT\n\tpatient_num\tAS\t\"patient_identifier_value\"\nFROM\n\ti2b2miracum.patient_dimension\nORDER BY\n\tpatient_num;",
"dt.gender": "SELECT\n\tconcept_cd\tAS\t\"encounter_subject_patient_gender\",\npatient_num\tAS\t\"encounter_subject_patient_identifier_value\"\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'DEM|GESCHLECHT%'\nORDER BY\n\tpatient_num;",
"dt.zipcode": "SELECT\n\tpatient_num\tAS\t\"patient_identifier_value\",\nzip_cd\tAS\t\"patient_address_postalCode\"\nFROM\n\ti2b2miracum.patient_dimension\nORDER BY\n\tpatient_num;",
"dt.birthdate": "SELECT\n\tbirth_date\tAS\t\"patient_birthDate\",\npatient_num\tAS\t\"patient_identifier_value\"\nFROM\n\ti2b2miracum.patient_dimension\nORDER BY\n\tpatient_num;",
"dt.encounter": "SELECT\n\tencounter_num\tAS\t\"encounter_identifier_value\",\n\tpatient_num\tAS\t\"encounter_subject_patient_identifier_value\"\nFROM\n\ti2b2miracum.visit_dimension\nWHERE\n\tvisit_blob = 'True encounter'\nORDER BY\n\tencounter_num;",
"dt.encounterstart": "SELECT\n\tb.encounter_num\tAS\t\"encounter_identifier_value\",\n\ta.start_date::date\tAS\t\"encounter_period_start\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, start_date\nFROM\n\ti2b2miracum.visit_dimension) AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.encounterend": "SELECT\n\tb.encounter_num\tAS\t\"encounter_identifier_value\",\n\ta.end_date::date\tAS\t\"encounter_period_end\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, end_date\nFROM\n\ti2b2miracum.visit_dimension) AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.ageindays": "SELECT\n\tb.encounter_num\tAS\t\"encounter_identifier_value\",\n\ta.nval_num\tAS\t\"encounter_subject_patient_age_days\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, nval_num\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'DEM|AUFNAHMEALTERTAGE%') AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.ageinyears": "SELECT\n\tb.encounter_num\tAS\t\"encounter_identifier_value\",\n\ta.nval_num\tAS\t\"encounter_subject_patient_age_years\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, nval_num\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'DEM|AUFNAHMEALTERJAHRE%') AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.admission": "SELECT\n\tb.encounter_num\tAS\t\"encounter_identifier_value\",\n\ta.concept_cd\tAS\t\"encounter_hospitalization_admitSource\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, concept_cd\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'FALL|AUFNAHMEANLASS%') AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.hospitalization": "SELECT\n\tb.encounter_num\tAS\t\"encounter_identifier_value\",\n\ta.concept_cd\tAS\t\"encounter_hospitalization_class\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, concept_cd\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'FALL|AUFNAHMEGRUND%') AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.discharge": "SELECT\n\tb.encounter_num\tAS\t\"encounter_identifier_value\",\n\ta.concept_cd\tAS\t\"encounter_hospitalization_dischargeDisposition\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, concept_cd\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'FALL|ENTLASSGRUND%') AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.ventilation": "SELECT\n\tb.encounter_num\tAS\t\"procedure_encounter_identifier_value\",\n\ta.nval_num\tAS\t\"observation_code_coding_code\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, nval_num\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'LOINC:74201-5') AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.condition_principal": "SELECT\n\tb.encounter_num\tAS\t\"condition_encounter_identifier_value\",\n\ta.concept_cd\tAS\t\"condition_code_coding_code\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, concept_cd\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'ICD%' AND modifier_cd = 'DIAGNOSEART:HD' AND observation_blob NOT LIKE 'Code 2 from%'\n) AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.conditioncategory": "SELECT\n\tb.encounter_num\tAS\t\"condition_encounter_identifier_value\",\n\ta.modifier_cd\tAS\t\"encounter_diagnosis_rank\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, modifier_cd\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'ICD%' AND observation_blob NOT LIKE 'Code 2 from%') AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.condition_secondary": "SELECT\n\tb.encounter_num\tAS\t\"condition_encounter_identifier_value\",\n\ta.concept_cd\tAS\t\"condition_code_coding_code_rank2\"\nFROM\n\ti2b2miracum.visit_dimension AS b\nLEFT OUTER JOIN (\nSELECT\n\tencounter_num, concept_cd\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'ICD%' AND modifier_cd = 'DIAGNOSEART:ND' AND observation_blob NOT LIKE 'Code 2 from%') AS a ON\n\ta.encounter_num = b.encounter_num\nWHERE\n\tb.visit_blob = 'True encounter'\nORDER BY\n\tb.encounter_num;",
"dt.procedure": "SELECT\n\tencounter_num\tAS\t\"procedure_encounter_identifier_value\",\n\tconcept_cd\tAS\t\"procedure_code_coding_code\"\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'OPS%'\nORDER BY\n\tencounter_num;",
"dt.proceduredate": "SELECT\n\tencounter_num\tAS\t\"procedure_encounter_identifier_value\",\n\tstart_date::date\tAS\t\"procedure_performedDateTime\"\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'OPS%'\nORDER BY\n\tencounter_num;",
"dt.procedure_medication": "SELECT\n\tencounter_num\tAS\t\"procedure_encounter_identifier_value\",\n\tconcept_cd\tAS\t\"procedure_code_coding_code\"\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'OPS:6-00%'\nORDER BY\n\tencounter_num;",
"dt.laboratory": "SELECT\n\tconcept_cd\tAS\t\"observation_code_coding_code\",\nencounter_num\tAS\t\"encounter_identifier_value\"\nFROM\n\ti2b2miracum.observation_fact\nWHERE\n\tconcept_cd LIKE 'LOINC%';"
}