Skip to content

Commit

Permalink
HIV-872: Fix family planning indicators in poc (AMPATH#1119)
Browse files Browse the repository at this point in the history
  • Loading branch information
jecihjoy authored Dec 8, 2021
1 parent 89d3863 commit ff65c22
Show file tree
Hide file tree
Showing 12 changed files with 967 additions and 20,639 deletions.
30 changes: 30 additions & 0 deletions app/reporting-framework/hiv/indicator-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,30 @@
"description": "# of patient(s) who have been on ARVs for the last 52 weeks or less and their Viral Load is Less Than or Equal to 1000",
"expression": "timestampdiff(week,arv_start_date,encounter_datetime) <= 52 and timestampdiff(week,vl_1_date,encounter_datetime) <= 52 and vl_1 <= 1000"
},
{
"name": "women_of_reproductive_age",
"label": "Women of reproductive age",
"description": "# of female clients of reproductive age",
"expression": "extract(year from (from_days(datediff(now(),p.birthdate)))) between 15 and 49"
},
{
"name": "women_with_pregnancy_intentions",
"label": "Women with pregnancy intentions",
"description": "# of female clients of reproductive age pregnant or having pregnancy intentions",
"expression": "extract(year from (from_days(datediff(now(),p.birthdate)))) between 15 and 49 and fhs.is_pregnant is not null"
},
{
"name": "eligible_for_family_planning",
"label": "Women eligible for contraceptives",
"description": "# of female clients of reproductive age not pregnant and not having pregnancy intentions",
"expression": "extract(year from (from_days(datediff(now(),p.birthdate)))) between 15 and 49 and fhs.is_pregnant is null"
},
{
"name": "due_for_contraception_refill",
"label": "Due for modern contraception screening",
"description": "# of female clients of reproductive age not pregnant and not having pregnancy intentions",
"expression": "extract(year from (from_days(datediff(now(),p.birthdate)))) between 15 and 49 and fhs.is_pregnant is null and fhs.on_modern_contraceptive is null AND fhs.contraceptive_method IN (6701, 5276,9510,9511,9734,9735,8300,5279,6218,6217)"
},
{
"name": "on_modern_contraception",
"label": "on modern contraception",
Expand All @@ -169,6 +193,12 @@
"description": "# of patients not on modern contraception in a given time period",
"expression": "(fhs.contraceptive_method IS NULL OR fhs.contraceptive_method in (6219 , 1624, 6707, 1067, 1107, 10956, 5622, 5277))"
},
{
"name": "on_other_contraception",
"label": "on other contraception",
"description": "# of patients on modern contraception in a given time period",
"expression": "fhs.contraceptive_method IS NOT NULL AND fhs.contraceptive_method NOT IN (190 , 780, 907, 6218, 6217, 5841, 6717, 6718, 6725, 8134, 5274, 8300, 5279 , 5278, 5275, 5276, 6220, 6700, 6701, 9510, 9511, 9734, 9735, 10817)"
},
{
"name": "on_short_term_modern_contraception",
"label": "On short term modern contraception",
Expand Down
17 changes: 16 additions & 1 deletion app/reporting-framework/hiv/moh-731-2017.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,25 @@
"ref": "HV03-089",
"indicator": "f_gte_18_visits"
},
{
"label": "Women of reproductive age",
"ref": "HV03-090",
"indicator": "women_of_reproductive_age"
},
{
"label": "Women eligible for contraception",
"ref": "HV03-090",
"indicator": "women_eligible_for_contraception"
},
{
"label": "Women with pregnancy intentions",
"ref": "HV03-090",
"indicator": "women_with_pregnancy_intentions"
},
{
"label": "On modern FP F15+",
"ref": "HV03-090",
"indicator": "dc__age_range__15_and_above__on_modern_contraception"
"indicator": "on_modern_contraception"
}
]
},
Expand Down
52 changes: 52 additions & 0 deletions app/reporting-framework/json-reports/clinical-reminder-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,58 @@
"expressionOptions": {
"expression": "case when t1.patient_care_status in (10502,1287,9068,1593,159,5622,9083) then 1 else 0 end"
}
},
{
"type": "derived_column",
"alias": "due_for_contraception_refill",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "case when (contraceptive_method in (9510,9511,9734,9735) AND continue_on_fp = 1 and on_modern_contraceptive is null and date(encounter_datetime) not between modern_contraceptive_reporting_date and date_add(modern_contraceptive_reporting_date, interval 6 month)) OR (contraceptive_method in (8300,5279) and on_modern_contraceptive is null and date(encounter_datetime) not between modern_contraceptive_reporting_date and date_add(modern_contraceptive_reporting_date, interval 3 month)) then 1 else 0 end"
}
},
{
"type": "derived_column",
"alias": "not_on_modern_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "case when extract(year from (from_days(datediff(now(),t5.birthdate)))) between 10 and 49 and t5.gender = 'F' and t1.is_pregnant is null and t1.with_pregnancy_intentions is null and (t1.contraceptive_method IS NULL OR t1.contraceptive_method NOT IN (190 , 780, 907, 6218, 6217, 5841, 6717, 6718, 6725, 8134, 5274, 8300, 5279 , 5278, 5275, 5276, 6220, 6700, 6701, 9510, 9511, 9734, 9735, 10817)) then 1 else 0 end"
}
},
{
"type": "simple_column",
"alias": "modern_contraceptive_reporting_date",
"column": "t1.modern_contraceptive_reporting_date"
},
{
"type": "simple_column",
"alias": "contraceptive_method",
"column": "t1.contraceptive_method"
},
{
"type": "simple_column",
"alias": "modern_contraceptive_method_start_date",
"column": "date_format(modern_contraceptive_method_start_date,'%d-%m-%Y')"
},
{
"type": "simple_column",
"alias": "contraceptive_method",
"column": "contraceptive_method"
},
{
"type": "derived_column",
"alias": "contraception_method_name",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "case when contraceptive_method = 9510 then '3-year implant' when contraceptive_method = 9511 then '5-year implant' else null end"
}
},
{
"type": "derived_column",
"alias": "has_contraception_expired",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "case when ((contraceptive_method = 9510 AND TIMESTAMPDIFF(MONTH, modern_contraceptive_method_start_date, encounter_datetime) > 36) OR (contraceptive_method = 9511 AND TIMESTAMPDIFF(MONTH, modern_contraceptive_method_start_date, encounter_datetime) > 60) OR (contraceptive_method in (9734,9735) AND TIMESTAMPDIFF(MONTH, modern_contraceptive_method_start_date, encounter_datetime) > 120)) then 1 else 0 end"
}
}
],
"indexDirectives": [
Expand Down
40 changes: 40 additions & 0 deletions app/reporting-framework/json-reports/hiv-summary-aggregate.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,46 @@
"expression": "count(distinct concat(on_modern_contraception, hsb.person_id))"
}
},
{
"type": "derived_column",
"alias": "women_of_reproductive_age",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "count(distinct concat(women_of_reproductive_age, hsb.person_id))"
}
},
{
"type": "derived_column",
"alias": "women_with_pregnancy_intentions",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "count(distinct concat(women_with_pregnancy_intentions, hsb.person_id))"
}
},
{
"type": "derived_column",
"alias": "eligible_for_family_planning",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "count(distinct concat(eligible_for_family_planning, hsb.person_id))"
}
},
{
"type": "derived_column",
"alias": "due_for_contraception_refill",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "count(distinct concat(due_for_contraception_refill, hsb.person_id))"
}
},
{
"type": "derived_column",
"alias": "on_other_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "count(distinct concat(on_other_contraception, hsb.person_id))"
}
},
{
"type": "derived_column",
"alias": "on_short_term_modern_contraception",
Expand Down
90 changes: 65 additions & 25 deletions app/reporting-framework/json-reports/hiv-summary-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,114 +234,154 @@
},
{
"type": "derived_column",
"alias": "on_modern_contraception",
"alias": "women_of_reproductive_age",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if((fhs.contraceptive_method IS NOT NULL AND fhs.contraceptive_method IN (190 , 780, 907, 6218, 6217, 5841, 6717, 6718, 6725, 8134, 5274, 8300, 5279 , 5278, 5275, 5276, 6220, 6700, 6701, 9510, 9511, 9734, 9735, 10817)),1,null)"
"expression": "if(extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F',1,null)"
}
},
{
"type": "derived_column",
"alias": "on_short_term_modern_contraception",
"alias": "women_with_pregnancy_intentions",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.contraceptive_method is not null AND fhs.contraceptive_method in (190,780,907,6218,6217,5841,6717,6718,6725,8134,5274,8300),1,null)"
"expression": "if(extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F' and fhs.is_pregnant is null and fhs.with_pregnancy_intentions = 1 ,1,null)"
}
},
{
"type": "derived_column",
"alias": "on_long_term_modern_contraception",
"alias": "eligible_for_family_planning",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.contraceptive_method in (5279,5278,5275,5276,6220,6700,6701,9510,9511,9734,9735,10817),1,null)"
"expression": "if(extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F' and fhs.is_pregnant is null and fhs.with_pregnancy_intentions is null,1,null)"
}
},
{
"type": "derived_column",
"alias": "on_short_term_modern_contraception_pnc",
"alias": "due_for_contraception_refill",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.visit_type in (68, 55, 52, 18) AND fhs.contraceptive_method is not null AND fhs.contraceptive_method in (190,780,907,6218,6217,5841,6717,6718,6725,8134,5274,8300), 1, null)"
"expression": "if(extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F' and fhs.is_pregnant is null and fhs.with_pregnancy_intentions is null and fhs.on_modern_contraceptive is null AND fhs.continue_on_fp = 1 AND fhs.contraceptive_method IN (9510,9511,9734,9735,8300,5279),1,null)"
}
},
{
"type": "derived_column",
"alias": "on_long_term_modern_contraception_pnc",
"alias": "on_other_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.visit_type in (68, 55, 52, 18) AND fhs.contraceptive_method in (5279,5278,5275,5276,6220,6700,6701,9510,9511,9734,9735,10817), 1, null)"
"expression": "if(extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F' and fhs.is_pregnant is null and (fhs.contraceptive_method IS NOT NULL AND fhs.contraceptive_method NOT IN (5276,6701,9510,9511,9734,9735,5279,6218,6217,8300,1107)),1,null)"
}
},
{
"type": "derived_column",
"alias": "on_modern_contraception_pnc",
"alias": "on_modern_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.contraceptive_method IS NOT NULL AND fhs.contraceptive_method IN (190 , 780, 907, 6218, 6217, 5841, 6717, 6718, 6725, 8134, 5274, 8300, 5279 , 5278, 5275, 5276, 6220, 6700, 6701, 9510, 9511, 9734, 9735, 10817) AND fhs.visit_type in (68, 55, 52, 18), 1, null)"
"expression": "if(extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F' and fhs.is_pregnant is null and fhs.with_pregnancy_intentions is null and (fhs.on_modern_contraceptive = 1 or fhs.contraceptive_method in (6218,6217) and fhs.rtc_date >= '{endDate}'),1,null)"
}
},
{
"type": "derived_column",
"alias": "not_on_modern_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if((fhs.contraceptive_method IS NULL or fhs.contraceptive_method in (6219 , 1624, 6707, 1067, 1107, 10956, 5622, 5277)),1,null)"
"expression": "if(extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F' and fhs.is_pregnant is null and (fhs.contraceptive_method IS NULL OR fhs.contraceptive_method NOT IN (190 , 780, 907, 6218, 6217, 5841, 6717, 6718, 6725, 8134, 5274, 8300, 5279 , 5278, 5275, 5276, 6220, 6700, 6701, 9510, 9511, 9734, 9735, 10817)),1,null)"
}
},
{
"type": "derived_column",
"alias": "not_on_modern_contraception_pnc",
"alias": "on_art_and_not_on_modern_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if((fhs.contraceptive_method IS NULL or fhs.contraceptive_method in (6219 , 1624, 6707, 1067, 1107, 10956, 5622, 5277)) AND fhs.visit_type in (68, 55, 52, 18) ,1,null)"
"expression": "if(fhs.cur_arv_line is not null and extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F' and fhs.is_pregnant is null and (fhs.contraceptive_method IS NULL OR fhs.contraceptive_method = 1107),1,null)"
}
},
{
"type": "derived_column",
"alias": "in_pnc",
"alias": "on_short_term_modern_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.visit_type in (68, 55, 52, 18) ,1,null)"
"expression": "if(fhs.contraceptive_method is not null AND fhs.contraceptive_method in (190,780,907,6218,6217,5841,6717,6718,6725,8134,5274,8300) and extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F',1,null)"
}
},
{
"type": "derived_column",
"alias": "on_art_and_not_on_modern_contraception",
"alias": "on_long_term_modern_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.contraceptive_method in (5279,5278,5275,5276,6220,6700,6701,9510,9511,9734,9735,10817) and extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F',1,null)"
}
},
{
"type": "derived_column",
"alias": "on_short_term_modern_contraception_pnc",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.visit_type in (68, 55, 52, 18) AND fhs.contraceptive_method is not null AND fhs.contraceptive_method in (190,780,907,6218,6217,5841,6717,6718,6725,8134,5274,8300) and extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F', 1, null)"
}
},
{
"type": "derived_column",
"alias": "on_long_term_modern_contraception_pnc",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if((fhs.contraceptive_method IS NULL OR fhs.contraceptive_method = 1107) and fhs.cur_arv_line is not null,1,null)"
"expression": "if(fhs.visit_type in (68, 55, 52, 18) AND fhs.contraceptive_method in (5279,5278,5275,5276,6220,6700,6701,9510,9511,9734,9735,10817) and extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F', 1, null)"
}
},
{
"type": "derived_column",
"alias": "on_modern_contraception_pnc",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.contraceptive_method IS NOT NULL AND fhs.contraceptive_method IN (190 , 780, 907, 6218, 6217, 5841, 6717, 6718, 6725, 8134, 5274, 8300, 5279 , 5278, 5275, 5276, 6220, 6700, 6701, 9510, 9511, 9734, 9735, 10817) AND fhs.visit_type in (68, 55, 52, 18) and extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F', 1, null)"
}
},
{
"type": "derived_column",
"alias": "not_on_modern_contraception_pnc",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if((fhs.contraceptive_method IS NULL or fhs.contraceptive_method in (6219 , 1624, 6707, 1067, 1107, 10956, 5622, 5277)) AND fhs.visit_type in (68, 55, 52, 18) and extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F',1,null)"
}
},
{
"type": "derived_column",
"alias": "in_pnc",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.visit_type in (68, 55, 52, 18) ,1,null)"
}
},
{
"type": "derived_column",
"alias": "started_modern_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(date(fhs.modern_contraceptive_method_start_date) between '{startDate}' and '{endDate}',1,null)"
"expression": "if(date(fhs.modern_contraceptive_method_start_date) between '{startDate}' and '{endDate}' and extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and p.gender = 'F',1,null)"
}
},
{
"type": "derived_column",
"alias": "pregnant",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.is_pregnant is not null,1,null)"
"expression": "if(extract(year from (from_days(datediff(now(),p.birthdate)))) between 10 and 49 and fhs.is_pregnant is not null and p.gender = 'F',1,null)"
}
},
{
"type": "derived_column",
"alias": "pregnant_and_on_arvs",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.is_pregnant is not null and fhs.cur_arv_line is not null,1,null)"
"expression": "if(fhs.is_pregnant is not null and p.gender = 'F' and fhs.cur_arv_line is not null,1,null)"
}
},
{
"type": "derived_column",
"alias": "pregnant_and_started_art",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "if(fhs.is_pregnant is not null and date(fhs.arv_first_regimen_start_date) between '{startDate}' and '{endDate}',1,null)"
"expression": "if(fhs.is_pregnant is not null and p.gender = 'F' and date(fhs.arv_first_regimen_start_date) between '{startDate}' and '{endDate}',1,null)"
}
},
{
Expand Down Expand Up @@ -494,8 +534,8 @@
},
{
"filterType": "tableColumns",
"conditionExpression": "fhs.location_uuid in ?",
"parameterName": "locationUuids"
"conditionExpression": "fhs.location_id in ?",
"parameterName": "locations"
},
{
"filterType": "tableColumns",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,30 @@
"expression": "sum(hmsd.condoms_provided)"
}
},
{
"type": "derived_column",
"alias": "women_of_reproductive_age",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "sum(hmsd.women_of_reproductive_age)"
}
},
{
"type": "derived_column",
"alias": "women_eligible_for_contraception",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "sum(hmsd.women_eligible_for_contraception)"
}
},
{
"type": "derived_column",
"alias": "women_with_pregnancy_intentions",
"expressionType": "simple_expression",
"expressionOptions": {
"expression": "sum(hmsd.women_with_pregnancy_intentions)"
}
},
{
"type": "derived_column",
"alias": "on_modern_contraception",
Expand Down
Loading

0 comments on commit ff65c22

Please sign in to comment.