Skip to content

Commit

Permalink
MLW-1657: Add sickle cell encounter types to ncd diagnoses and visits…
Browse files Browse the repository at this point in the history
… tables
  • Loading branch information
b-ngongonda committed Feb 20, 2025
1 parent 38127c5 commit a46bab6
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 19 deletions.
2 changes: 2 additions & 0 deletions jobs/pentaho/malawi/schema/table/mw_ncd_visits.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ create table mw_ncd_visits (
chf_followup BOOLEAN,
ncd_other_initial BOOLEAN,
ncd_other_followup BOOLEAN,
sickle_cell_initial BOOLEAN,
sickle_cell_followup BOOLEAN,
next_appointment_date DATE,
systolic_bp DECIMAL(10,2),
diastolic_bp DECIMAL(10,2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ from omrs_obs o
where o.concept = "Chronic care diagnosis"
and encounter_type IN ("DIABETES HYPERTENSION INITIAL VISIT","CHRONIC_CARE_INITIAL",
"MENTAL_HEALTH_INITIAL","EPILEPSY_INITIAL","CKD_INITIAL","CHF_INITIAL",
"NCD_OTHER_INITIAL","ASTHMA_INITIAL")
"NCD_OTHER_INITIAL","ASTHMA_INITIAL","SICKLE_CELL_DISEASE_INITIAL")
order by patient_id, obs_group_id, encounter_type, location</sql>
<limit>0</limit>
<lookup/>
Expand Down
182 changes: 164 additions & 18 deletions jobs/pentaho/malawi/transforms/import-into-mw-ncd-visits.ktr
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@
chf_followup BOOLEAN,
ncd_other_initial BOOLEAN,
ncd_other_followup BOOLEAN,
sickle_cell_initial BOOLEAN,
sickle_cell_followup BOOLEAN,
next_appointment_date DATE,
systolic_bp DOUBLE,
diastolic_bp DOUBLE,
Expand All @@ -468,7 +470,7 @@
<xloc>976</xloc>
<yloc>80</yloc>
<width>452</width>
<heigth>503</heigth>
<heigth>537</heigth>
<fontname>Ubuntu</fontname>
<fontsize>11</fontsize>
<fontbold>N</fontbold>
Expand Down Expand Up @@ -943,6 +945,12 @@ var chf_initial = visit_types.indexOf('CHF_INITIAL') != -1;
var chf_followup = visit_types.indexOf('CHF_FOLLOWUP') != -1;
var ncd_other_initial = visit_types.indexOf('NCD_OTHER_INITIAL') != -1;
var ncd_other_followup = visit_types.indexOf('NCD_OTHER_FOLLOWUP') != -1;
var sickle_cell_initial = visit_types.indexOf('SICKLE_CELL_DISEASE_INITIAL') != -1;
var sickle_cell_followup = visit_types.indexOf('SICKLE_CELL_DISEASE_FOLLOWUP') != -1;




</jsScript_script>
</jsScript>
</jsScripts>
Expand Down Expand Up @@ -1155,6 +1163,150 @@ var ncd_other_followup = visit_types.indexOf('NCD_OTHER_FOLLOWUP') != -1;
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>cc_initial</name>
<rename>cc_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>cc_followup</name>
<rename>cc_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>diabetes_htn_initial</name>
<rename>diabetes_htn_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>diabetes_htn_followup</name>
<rename>diabetes_htn_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>asthma_initial</name>
<rename>asthma_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>asthma_followup</name>
<rename>asthma_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>epilepsy_initial</name>
<rename>epilepsy_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>epilepsy_followup</name>
<rename>epilepsy_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>mental_health_initial</name>
<rename>mental_health_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>mental_health_followup</name>
<rename>mental_health_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>ckd_initial</name>
<rename>ckd_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>ckd_followup</name>
<rename>ckd_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>chf_initial</name>
<rename>chf_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>chf_followup</name>
<rename>chf_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>ncd_other_initial</name>
<rename>ncd_other_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>ncd_other_followup</name>
<rename>ncd_other_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>sickle_cell_initial</name>
<rename>sickle_cell_initial</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
<field>
<name>sickle_cell_followup</name>
<rename>sickle_cell_followup</rename>
<type>Boolean</type>
<length>-1</length>
<precision>-1</precision>
<replace>N</replace>
</field>
</fields>
<attributes/>
<cluster_schema/>
Expand Down Expand Up @@ -1718,7 +1870,9 @@ where e.encounter_type in (
'CHF_INITIAL',
'CHF_FOLLOWUP',
'NCD_OTHER_INITIAL',
'NCD_OTHER_FOLLOWUP'
'NCD_OTHER_FOLLOWUP',
'SICKLE_CELL_DISEASE_INITIAL',
'SICKLE_CELL_DISEASE_FOLLOWUP'

)
group by e.patient_id, e.encounter_date, e.location
Expand Down Expand Up @@ -2920,6 +3074,14 @@ order by patient_id, visit_date, location</sql>
<column_name>ncd_other_followup</column_name>
<stream_name>ncd_other_followup</stream_name>
</field>
<field>
<column_name>sickle_cell_initial</column_name>
<stream_name>sickle_cell_initial</stream_name>
</field>
<field>
<column_name>sickle_cell_followup</column_name>
<stream_name>sickle_cell_followup</stream_name>
</field>
<field>
<column_name>next_appointment_date</column_name>
<stream_name>next_appointment_date</stream_name>
Expand Down Expand Up @@ -2992,22 +3154,6 @@ order by patient_id, visit_date, location</sql>
<column_name>num_seizures</column_name>
<stream_name>num_seizures</stream_name>
</field>
<field>
<column_name>seizure_activity</column_name>
<stream_name>seizure_activity_since_last_visit</stream_name>
</field>
<field>
<column_name>hospitalized_since_last_visit</column_name>
<stream_name>hospitalized</stream_name>
</field>
<field>
<column_name>hiv_result</column_name>
<stream_name>hiv_test_result</stream_name>
</field>
<field>
<column_name>foot_check</column_name>
<stream_name>foot_exam</stream_name>
</field>
</fields>
<attributes/>
<cluster_schema/>
Expand Down

0 comments on commit a46bab6

Please sign in to comment.