Skip to content

Commit

Permalink
Added mode of temperature collection and mode of oxygen saturation co…
Browse files Browse the repository at this point in the history
…llection in triage etl
  • Loading branch information
njorocs committed Aug 7, 2024
1 parent ee641c3 commit e61f48e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions omod/src/main/resources/sql/DDL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1605,9 +1605,11 @@ SELECT "Successfully created etl_ART_preparation table";
systolic_pressure DOUBLE,
diastolic_pressure DOUBLE,
temperature DOUBLE,
temperature_collection_mode INT(11),
pulse_rate DOUBLE,
respiratory_rate DOUBLE,
oxygen_saturation DOUBLE,
oxygen_saturation_collection_mode INT(11),
muac DOUBLE,
z_score_absolute DOUBLE DEFAULT NULL,
z_score INT(11),
Expand Down
6 changes: 5 additions & 1 deletion omod/src/main/resources/sql/DML.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3440,9 +3440,11 @@ CREATE PROCEDURE sp_populate_etl_patient_triage()
systolic_pressure,
diastolic_pressure,
temperature,
temperature_collection_mode,
pulse_rate,
respiratory_rate,
oxygen_saturation,
oxygen_saturation_collection_mode,
muac,
z_score_absolute,
z_score,
Expand Down Expand Up @@ -3470,9 +3472,11 @@ CREATE PROCEDURE sp_populate_etl_patient_triage()
max(if(o.concept_id=5085,o.value_numeric,null)) as systolic_pressure,
max(if(o.concept_id=5086,o.value_numeric,null)) as diastolic_pressure,
max(if(o.concept_id=5088,o.value_numeric,null)) as temperature,
max(if(o.concept_id=167231,o.value_coded,null)) as temperature_collection_mode,
max(if(o.concept_id=5087,o.value_numeric,null)) as pulse_rate,
max(if(o.concept_id=5242,o.value_numeric,null)) as respiratory_rate,
max(if(o.concept_id=5092,o.value_numeric,null)) as oxygen_saturation,
max(if(o.concept_id=165932,o.value_coded,null)) as oxygen_saturation_collection_mode,
max(if(o.concept_id=1343,o.value_numeric,null)) as muac,
max(if(o.concept_id=162584,o.value_numeric,null)) as z_score_absolute,
max(if(o.concept_id=163515,o.value_coded,null)) as z_score,
Expand All @@ -3489,7 +3493,7 @@ CREATE PROCEDURE sp_populate_etl_patient_triage()
select encounter_type_id, uuid, name from encounter_type where uuid in('d1059fb9-a079-4feb-a749-eedd709ae542','a0034eee-1940-4e35-847f-97537a35d05e','465a92f2-baf8-42e9-9612-53064be868e8')
) et on et.encounter_type_id=e.encounter_type
left outer join obs o on o.encounter_id=e.encounter_id and o.voided=0
and o.concept_id in (160430,1154,159368,5089,5090,5085,5086,5088,5087,5242,5092,1343,163515,167392,1427,160325,162584,163304)
and o.concept_id in (160430,1154,159368,5089,5090,5085,5086,5088,5087,5242,5092,1343,163515,167392,1427,160325,162584,163304,167231,165932)
where e.voided=0
group by e.patient_id, visit_date
;
Expand Down
2 changes: 2 additions & 0 deletions omod/src/main/resources/sql/DataTools.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,11 @@ SELECT "Successfully created enhanced adherence table";
systolic_pressure,
diastolic_pressure,
temperature,
case temperature_collection_mode when 5112 then 'Axiliary' when 166242 then 'Forehead thermometer gun' when 160240 then 'Oral' end as temperature_collection_mode,
pulse_rate,
respiratory_rate,
oxygen_saturation,
case oxygen_saturation_collection_mode when 162735 then 'Room air' when 162738 then 'On supplemental oxygen' end as oxygen_saturation_collection_mode,
muac,
z_score_absolute,
(case z_score when 1115 then "Normal (Median)" when 123814 then "Mild (-1 SD)" when 123815 then "Moderate (-2 SD)" when 164131 then "Severe (-3 SD and -4 SD)" else "" end) as z_score,
Expand Down
8 changes: 6 additions & 2 deletions omod/src/main/resources/sql/Scheduled_Updates.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3366,9 +3366,11 @@ CREATE PROCEDURE sp_update_etl_patient_triage(IN last_update_time DATETIME)
systolic_pressure,
diastolic_pressure,
temperature,
temperature_collection_mode,
pulse_rate,
respiratory_rate,
oxygen_saturation,
oxygen_saturation_collection_mode,
muac,
z_score_absolute,
z_score,
Expand Down Expand Up @@ -3396,9 +3398,11 @@ CREATE PROCEDURE sp_update_etl_patient_triage(IN last_update_time DATETIME)
max(if(o.concept_id=5085,o.value_numeric,null)) as systolic_pressure,
max(if(o.concept_id=5086,o.value_numeric,null)) as diastolic_pressure,
max(if(o.concept_id=5088,o.value_numeric,null)) as temperature,
max(if(o.concept_id=167231,o.value_coded,null)) as temperature_collection_mode,
max(if(o.concept_id=5087,o.value_numeric,null)) as pulse_rate,
max(if(o.concept_id=5242,o.value_numeric,null)) as respiratory_rate,
max(if(o.concept_id=5092,o.value_numeric,null)) as oxygen_saturation,
max(if(o.concept_id=165932,o.value_coded,null)) as oxygen_saturation_collection_mode,
max(if(o.concept_id=1343,o.value_numeric,null)) as muac,
max(if(o.concept_id=162584,o.value_numeric,null)) as z_score_absolute,
max(if(o.concept_id=163515,o.value_coded,null)) as z_score,
Expand All @@ -3414,7 +3418,7 @@ CREATE PROCEDURE sp_update_etl_patient_triage(IN last_update_time DATETIME)
select encounter_type_id, uuid, name from encounter_type where uuid in('d1059fb9-a079-4feb-a749-eedd709ae542','a0034eee-1940-4e35-847f-97537a35d05e','465a92f2-baf8-42e9-9612-53064be868e8')
) et on et.encounter_type_id=e.encounter_type
left outer join obs o on o.encounter_id=e.encounter_id and o.voided=0
and o.concept_id in (160430,5089,5090,5085,5086,5088,5087,5242,5092,1343,163515,167392,1427,160325,162584,1154,159368,163304)
and o.concept_id in (160430,5089,5090,5085,5086,5088,5087,5242,5092,1343,163515,167392,1427,160325,162584,1154,159368,163304,167231,165932)
where e.voided=0 and e.date_created >= last_update_time
or e.date_changed >= last_update_time
or e.date_voided >= last_update_time
Expand All @@ -3423,7 +3427,7 @@ CREATE PROCEDURE sp_update_etl_patient_triage(IN last_update_time DATETIME)
group by e.patient_id, visit_date
ON DUPLICATE KEY UPDATE visit_date=VALUES(visit_date),encounter_provider=VALUES(encounter_provider),weight=VALUES(weight),height=VALUES(height),systolic_pressure=VALUES(systolic_pressure),diastolic_pressure=VALUES(diastolic_pressure),
temperature=VALUES(temperature),pulse_rate=VALUES(pulse_rate),respiratory_rate=VALUES(respiratory_rate),complaint_today=VALUES(complaint_today),complaint_duration=VALUES(complaint_duration),
oxygen_saturation=VALUES(oxygen_saturation),muac=VALUES(muac),z_score=VALUES(z_score),nutritional_status=VALUES(nutritional_status),nutritional_intervention=VALUES(nutritional_intervention),last_menstrual_period=VALUES(last_menstrual_period),hpv_vaccinated=VALUES(hpv_vaccinated),voided=VALUES(voided),z_score_absolute=VALUES(z_score_absolute);
oxygen_saturation=VALUES(oxygen_saturation),muac=VALUES(muac),z_score=VALUES(z_score),nutritional_status=VALUES(nutritional_status),nutritional_intervention=VALUES(nutritional_intervention),last_menstrual_period=VALUES(last_menstrual_period),hpv_vaccinated=VALUES(hpv_vaccinated),voided=VALUES(voided),z_score_absolute=VALUES(z_score_absolute),oxygen_saturation_collection_mode=VALUES(oxygen_saturation_collection_mode),temperature_collection_mode=VALUES(temperature_collection_mode);

END $$
-- ------------- populate etl_generalized_anxiety_disorder-------------------------
Expand Down
2 changes: 2 additions & 0 deletions omod/src/main/resources/sql/dwapi/DDL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1580,9 +1580,11 @@ SELECT "Successfully created etl_ART_preparation table";
systolic_pressure DOUBLE,
diastolic_pressure DOUBLE,
temperature DOUBLE,
temperature_collection_mode INT(11),
pulse_rate DOUBLE,
respiratory_rate DOUBLE,
oxygen_saturation DOUBLE,
oxygen_saturation_collection_mode INT(11),
muac DOUBLE,
z_score_absolute DOUBLE DEFAULT NULL,
z_score INT(11),
Expand Down
6 changes: 5 additions & 1 deletion omod/src/main/resources/sql/dwapi/DML.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3275,9 +3275,11 @@ CREATE PROCEDURE sp_populate_dwapi_patient_triage()
systolic_pressure,
diastolic_pressure,
temperature,
temperature_collection_mode,
pulse_rate,
respiratory_rate,
oxygen_saturation,
oxygen_saturation_collection_mode,
muac,
z_score_absolute,
z_score,
Expand Down Expand Up @@ -3305,9 +3307,11 @@ CREATE PROCEDURE sp_populate_dwapi_patient_triage()
max(if(o.concept_id=5085,o.value_numeric,null)) as systolic_pressure,
max(if(o.concept_id=5086,o.value_numeric,null)) as diastolic_pressure,
max(if(o.concept_id=5088,o.value_numeric,null)) as temperature,
max(if(o.concept_id=167231,o.value_coded,null)) as temperature_collection_mode,
max(if(o.concept_id=5087,o.value_numeric,null)) as pulse_rate,
max(if(o.concept_id=5242,o.value_numeric,null)) as respiratory_rate,
max(if(o.concept_id=5092,o.value_numeric,null)) as oxygen_saturation,
max(if(o.concept_id=165932,o.value_coded,null)) as oxygen_saturation_collection_mode,
max(if(o.concept_id=1343,o.value_numeric,null)) as muac,
max(if(o.concept_id=162584,o.value_numeric,null)) as z_score_absolute,
max(if(o.concept_id=163515,o.value_coded,null)) as z_score,
Expand All @@ -3324,7 +3328,7 @@ CREATE PROCEDURE sp_populate_dwapi_patient_triage()
select encounter_type_id, uuid, name from encounter_type where uuid in('d1059fb9-a079-4feb-a749-eedd709ae542','a0034eee-1940-4e35-847f-97537a35d05e','465a92f2-baf8-42e9-9612-53064be868e8')
) et on et.encounter_type_id=e.encounter_type
left outer join obs o on o.encounter_id=e.encounter_id and o.voided=0
and o.concept_id in (160430,1154,159368,5089,5090,5085,5086,5088,5087,5242,5092,1343,163515,167392,1427,160325,162584)
and o.concept_id in (160430,1154,159368,5089,5090,5085,5086,5088,5087,5242,5092,1343,163515,167392,1427,160325,162584,163304,167231,165932)
group by e.patient_id, visit_date
;
SELECT "Completed processing Patient Triage data ", CONCAT("Time: ", NOW());
Expand Down

0 comments on commit e61f48e

Please sign in to comment.