diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index 6961f2216..d7128c4e9 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -384,6 +384,56 @@ import * as txrtt_aggregate_report from './json-reports/tx-reports/tx-rtt/tx-rtt import * as txrtt_base_report from './json-reports/tx-reports/tx-rtt/tx-rtt-report-base.json'; import * as txrtt_summary from './json-reports/txrtt-summary.json'; +//plhiv-ncd report +import * as plhiv_ncd_v2_monthly_report from './json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report.json'; + +import * as htn_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-base.json'; +import * as htn_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-aggregate.json'; + +import * as dm_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-base.json'; +import * as dm_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-aggregate.json'; + +import * as mh_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-base.json'; +import * as mh_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-aggregate.json'; + +import * as dep_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-base.json'; +import * as dep_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-aggregate.json'; + +import * as anx_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-base.json'; +import * as anx_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-aggregate.json'; + +import * as bip_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-base.json'; +import * as bip_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-aggregate.json'; + +import * as per_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-base.json'; +import * as per_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-aggregate.json'; + +import * as fed_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-base.json'; +import * as fed_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-aggregate.json'; + +import * as ocd_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-base.json'; +import * as ocd_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-aggregate.json'; + +import * as genMD_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-base.json'; +import * as genMD_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-aggregate.json'; + +import * as stMD_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-base.json'; +import * as stMD_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-aggregate.json'; + +import * as totMD_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-base.json'; +import * as totMD_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-aggregate.json'; + +import * as cvd_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-base.json'; +import * as cvd_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-aggregate.json'; + +import * as neu_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-base.json'; +import * as neu_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-aggregate.json'; + +import * as rhe_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-base.json'; +import * as rhe_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-aggregate.json'; + +import * as kd_plhiv_base from './json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-base.json'; +import * as kd_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-aggregate.json'; export class BaseMysqlReport { constructor(reportName, params) { this.reportName = reportName; @@ -1795,6 +1845,107 @@ export class BaseMysqlReport { main: this.cloneJsonSchema(txrtt_summary) }); break; + case 'plhiv-ncd-v2-monthly-report': + resolve({ + main: this.cloneJsonSchema(plhiv_ncd_v2_monthly_report) + }); + break; + case 'htnPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(htn_plhiv_aggregate), + htnPlhivBase: this.cloneJsonSchema(htn_plhiv_base) + }); + break; + case 'dmPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(dm_plhiv_aggregate), + dmPlhivBase: this.cloneJsonSchema(dm_plhiv_base) + }); + break; + + case 'depPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(dep_plhiv_aggregate), + depPlhivBase: this.cloneJsonSchema(dep_plhiv_base) + }); + break; + + case 'anxPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(anx_plhiv_aggregate), + anxPlhivBase: this.cloneJsonSchema(anx_plhiv_base) + }); + break; + + case 'bipPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(bip_plhiv_aggregate), + bipPlhivBase: this.cloneJsonSchema(bip_plhiv_base) + }); + break; + + case 'perPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(per_plhiv_aggregate), + perPlhivBase: this.cloneJsonSchema(per_plhiv_base) + }); + break; + case 'fedPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(fed_plhiv_aggregate), + fedPlhivBase: this.cloneJsonSchema(fed_plhiv_base) + }); + break; + + case 'ocdPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(ocd_plhiv_aggregate), + ocdPlhivBase: this.cloneJsonSchema(ocd_plhiv_base) + }); + break; + + case 'genMDPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(genMD_plhiv_aggregate), + genMDPlhivBase: this.cloneJsonSchema(genMD_plhiv_base) + }); + break; + case 'stMDPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(stMD_plhiv_aggregate), + stMDPlhivBase: this.cloneJsonSchema(stMD_plhiv_base) + }); + break; + case 'totMDPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(totMD_plhiv_aggregate), + totMDPlhivBase: this.cloneJsonSchema(totMD_plhiv_base) + }); + break; + case 'cvdPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(cvd_plhiv_aggregate), + cvdPlhivBase: this.cloneJsonSchema(cvd_plhiv_base) + }); + break; + case 'neuPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(neu_plhiv_aggregate), + neuPlhivBase: this.cloneJsonSchema(neu_plhiv_base) + }); + break; + case 'rhePlhivAggregate': + resolve({ + main: this.cloneJsonSchema(rhe_plhiv_aggregate), + rhePlhivBase: this.cloneJsonSchema(rhe_plhiv_base) + }); + break; + case 'kdPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(kd_plhiv_aggregate), + kdPlhivBase: this.cloneJsonSchema(kd_plhiv_base) + }); + break; default: reject('Unknown report ', reportName); break; diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-aggregate.json new file mode 100644 index 000000000..799765588 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-aggregate.json @@ -0,0 +1,238 @@ +{ + "name": "cvdPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "cvdPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "cvdPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "derived_column", + "alias": "nw_hf_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.nw_hf_f)" + } + }, + { + "type": "derived_column", + "alias": "nw_hf_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.nw_hf_m)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_hf", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_nw_hf)" + } + }, + { + "type": "derived_column", + "alias": "ct_hf_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.ct_hf_f)" + } + }, + { + "type": "derived_column", + "alias": "ct_hf_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.ct_hf_m)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_hf", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_ct_hf)" + } + }, + { + "type": "derived_column", + "alias": "nw_myo_inf_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.nw_myo_inf_f)" + } + }, + { + "type": "derived_column", + "alias": "nw_myo_inf_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.nw_myo_inf_m)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_myo_inf", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_nw_myo_inf)" + } + }, + { + "type": "derived_column", + "alias": "ct_myo_inf_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.ct_myo_inf_f)" + } + }, + { + "type": "derived_column", + "alias": "ct_myo_inf_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.ct_myo_inf_m)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_myo_inf", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_ct_myo_inf)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_cvd_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_cvd_m)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_cvd_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_cvd_f)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_cvd)" + } + }, + + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_cvd_m)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_cvd_f)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_cvd)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_nw_cvd)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_ct_cvd)" + } + }, + { + "type": "derived_column", + "alias": "tot_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_cvd)" + } + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-base.json new file mode 100644 index 000000000..28d86a6e7 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-base.json @@ -0,0 +1,282 @@ +{ + "name": "cvdPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_hf_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_hf_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_hf", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_hf_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_hf_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_hf", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_myo_inf_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_myo_inf_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_myo_inf", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_myo_inf_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_myo_inf_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_myo_inf", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_cvd_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_cvd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_cvd_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_cvd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'F' OR nmrd.gender = 'M') AND nmrd.has_cvd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_cvd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_cvd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'F' OR nmrd.gender = 'M') AND nmrd.has_cvd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_cvd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_cvd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_cvd = 1), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-aggregate.json new file mode 100644 index 000000000..a0a147f3e --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-aggregate.json @@ -0,0 +1,204 @@ +{ + "name": "dmPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "dmPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "dmPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_ctld_dm_f", + "column": "sum(b.nw_ctld_dm_f)" + }, + { + "type": "simple_column", + "alias": "nw_ctld_dm_m", + "column": "sum(b.nw_ctld_dm_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_ctld_dm", + "column": "sum(b.tot_nw_ctld_dm)" + }, + { + "type": "simple_column", + "alias": "ct_ctld_dm_f", + "column": "sum(b.ct_ctld_dm_f)" + }, + { + "type": "simple_column", + "alias": "ct_ctld_dm_m", + "column": "sum(b.ct_ctld_dm_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_ctld_dm", + "column": "sum(b.tot_ct_ctld_dm)" + }, + { + "type": "simple_column", + "alias": "nw_unctld_dm_f", + "column": "sum(b.nw_unctld_dm_f)" + }, + { + "type": "simple_column", + "alias": "nw_unctld_dm_m", + "column": "sum(b.nw_unctld_dm_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_unctld_dm", + "column": "sum(b.tot_nw_unctld_dm)" + }, + { + "type": "simple_column", + "alias": "ct_unctld_dm_f", + "column": "sum(b.ct_unctld_dm_f)" + }, + { + "type": "simple_column", + "alias": "ct_unctld_dm_m", + "column": "sum(b.ct_unctld_dm_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_unctld_dm", + "column": "sum(b.tot_ct_unctld_dm)" + }, + { + "type": "simple_column", + "alias": "nw_unk_dm_f", + "column": "sum(b.nw_unk_dm_f)" + }, + { + "type": "simple_column", + "alias": "nw_unk_dm_m", + "column": "sum(b.nw_unk_dm_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_unk_dm", + "column": "sum(b.tot_nw_unk_dm)" + }, + { + "type": "simple_column", + "alias": "ct_unk_dm_f", + "column": "sum(b.ct_unk_dm_f)" + }, + { + "type": "simple_column", + "alias": "ct_unk_dm_m", + "column": "sum(b.ct_unk_dm_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_unk_dm", + "column": "sum(b.tot_ct_unk_dm)" + }, + { + "type": "simple_column", + "alias": "nw_dm_m", + "column": "sum(b.nw_dm_m)" + }, + { + "type": "simple_column", + "alias": "nw_dm_f", + "column": "sum(b.nw_dm_f)" + }, + { + "type": "simple_column", + "alias": "nw_dm", + "column": "sum(b.nw_dm)" + }, + { + "type": "simple_column", + "alias": "ct_dm_m", + "column": "sum(b.ct_dm_m)" + }, + { + "type": "simple_column", + "alias": "ct_dm_f", + "column": "sum(b.ct_dm_f)" + }, + { + "type": "simple_column", + "alias": "ct_dm", + "column": "sum(b.ct_dm)" + }, + { + "type": "simple_column", + "alias": "tot_nw_dm", + "column": "sum(b.tot_nw_dm)" + }, + { + "type": "simple_column", + "alias": "tot_ct_dm", + "column": "sum(b.tot_ct_dm)" + }, + { + "type": "simple_column", + "alias": "tot_dm", + "column": "sum(b.tot_dm)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-base.json new file mode 100644 index 000000000..4e12f5e67 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-base.json @@ -0,0 +1,337 @@ +{ + "name": "dmPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "hmrd.person_id = nmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_ctld_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "nw_ctld_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_ctld_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND dm_state = 1 AND hmrd.started_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_ctld_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND dm_state = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_ctld_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND dm_state = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_ctld_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND dm_state = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_unctld_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "nw_unctld_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_unctld_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "ct_unctld_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND dm_state = 2 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_unctld_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND dm_state = 2 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_unctld_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND dm_state = 2 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_unk_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_unk_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_unk_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_unk_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_unk_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_unk_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1),1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0),1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0),1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0),1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1),1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0),1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_diabetic = 1),1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-aggregate.json new file mode 100644 index 000000000..402e07695 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-aggregate.json @@ -0,0 +1,204 @@ +{ + "name": "htnPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "htnPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "htnPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_ctld_htn_f", + "column": "sum(b.nw_ctld_htn_f)" + }, + { + "type": "simple_column", + "alias": "nw_ctld_htn_m", + "column": "sum(b.nw_ctld_htn_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_ctld_htn", + "column": "sum(b.tot_nw_ctld_htn)" + }, + { + "type": "simple_column", + "alias": "ct_ctld_htn_f", + "column": "sum(b.ct_ctld_htn_f)" + }, + { + "type": "simple_column", + "alias": "ct_ctld_htn_m", + "column": "sum(b.ct_ctld_htn_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_ctld_htn", + "column": "sum(b.tot_ct_ctld_htn)" + }, + { + "type": "simple_column", + "alias": "nw_unctld_htn_f", + "column": "nw_unctld_htn_f" + }, + { + "type": "simple_column", + "alias": "nw_unctld_htn_m", + "column": "nw_unctld_htn_m" + }, + { + "type": "simple_column", + "alias": "tot_nw_unctld_htn", + "column": "tot_nw_unctld_htn" + }, + { + "type": "simple_column", + "alias": "ct_unctld_htn_f", + "column": "sum(b.ct_unctld_htn_f)" + }, + { + "type": "simple_column", + "alias": "ct_unctld_htn_m", + "column": "sum(b.ct_unctld_htn_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_unctld_htn", + "column": "sum(b.tot_ct_unctld_htn)" + }, + { + "type": "simple_column", + "alias": "nw_unk_htn_f", + "column": "sum(b.nw_unk_htn_f)" + }, + { + "type": "simple_column", + "alias": "nw_unk_htn_m", + "column": "sum(b.nw_unk_htn_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_unk_htn", + "column": "sum(b.tot_nw_unk_htn)" + }, + { + "type": "simple_column", + "alias": "ct_unk_htn_f", + "column": "sum(b.ct_unk_htn_f)" + }, + { + "type": "simple_column", + "alias": "ct_unk_htn_m", + "column": "sum(b.ct_unk_htn_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_unk_htn", + "column": "sum(b.tot_ct_unk_htn)" + }, + { + "type": "simple_column", + "alias": "nw_htn_f", + "column": "sum(nw_htn_f)" + }, + { + "type": "simple_column", + "alias": "nw_htn_m", + "column": "sum(nw_htn_m)" + }, + { + "type": "simple_column", + "alias": "nw_htn", + "column": "sum(b.nw_htn)" + }, + { + "type": "simple_column", + "alias": "ct_htn_f", + "column": "sum(b.ct_htn_f)" + }, + { + "type": "simple_column", + "alias": "ct_htn_m", + "column": "sum(b.ct_htn_m)" + }, + { + "type": "simple_column", + "alias": "ct_htn", + "column": "sum(b.ct_htn)" + }, + { + "type": "simple_column", + "alias": "tot_nw_htn", + "column": "sum(b.tot_nw_htn)" + }, + { + "type": "simple_column", + "alias": "tot_ct_htn", + "column": "sum(b.tot_ct_htn)" + }, + { + "type": "simple_column", + "alias": "tot_htn", + "column": "sum(b.tot_htn)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-base.json new file mode 100644 index 000000000..dc50e3207 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-base.json @@ -0,0 +1,342 @@ +{ + "name": "htnPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_ctld_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "nw_ctld_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_ctld_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "ct_ctld_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_ctld_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_ctld_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_unctld_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "nw_unctld_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_unctld_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "ct_unctld_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_unctld_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_unctld_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_unk_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.started_art_this_month = 1) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_unk_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.started_art_this_month = 1) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_unk_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.started_art_this_month = 1) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_unk_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_unk_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_unk_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1),1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_hypertensive = 1 ),1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate = ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.endDate = ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"] + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-aggregate.json new file mode 100644 index 000000000..c6bbd294a --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-aggregate.json @@ -0,0 +1,893 @@ +{ + "name": "kdPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "kdPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "kdPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "derived_column", + "alias": "stg_1_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_1_nw_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_1_nw_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_1_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_1_ct_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_1_ct_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_1_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_1_nw_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_1_nw_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_1_nw_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_1_ct_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_1_ct_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_1_ct_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_2_nw_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_2_nw_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_2_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_2_ct_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_2_ct_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_2_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_2_nw_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_2_nw_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_2_nw_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_2_ct_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_2_ct_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_2_ct_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3_nw_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3_nw_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_3_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3_ct_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3_ct_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_3_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3_nw_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3_nw_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_3_nw_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3_ct_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3_ct_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_3_ct_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3a_nw_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3a_nw_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_3a_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3a_ct_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3a_ct_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_3a_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3a_nw_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3a_nw_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_3a_nw_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3a_ct_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3a_ct_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_3a_ct_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3b_nw_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3b_nw_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_3b_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3b_ct_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3b_ct_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_3b_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3b_nw_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3b_nw_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_3b_nw_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3b_ct_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_3b_ct_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_3b_ct_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_4_nw_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_4_nw_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_4_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_4_ct_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_4_ct_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_4_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_4_nw_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_4_nw_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_4_nw_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_4_ct_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_4_ct_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_4_ct_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_5_nw_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_5_nw_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_5_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_5_ct_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_5_ct_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_5_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_5_nw_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_5_nw_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_5_nw_acu" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_5_ct_acu_m" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.stg_5_ct_acu_f" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "b.tot_stg_5_ct_acu" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_chr_m)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_chr_f)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_acu)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_acu)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_chr)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_chr)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_acu)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_acu)" + } + }, + { + "type": "derived_column", + "alias": "tot_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_chr)" + } + }, + { + "type": "derived_column", + "alias": "tot_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_acu)" + } + }, + { + "type": "derived_column", + "alias": "tot_kd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_kd)" + } + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-base.json new file mode 100644 index 000000000..0d5a4f435 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-base.json @@ -0,0 +1,941 @@ +{ + "name": "kdPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "stg_1_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender ='M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender ='F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender ='M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender ='F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender ='M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender ='F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1)AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1)AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "null" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ckd = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ckd = 1 || has_kd = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_kd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_kd = 1), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id, nmrd.has_kd, nmrd.is_ckd"], + "excludeParam": "excludeParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/latest-hiv-ncd-triage.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/latest-hiv-ncd-triage.json new file mode 100644 index 000000000..9ea84740e --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/latest-hiv-ncd-triage.json @@ -0,0 +1,45 @@ +{ + "name": "ncdLatestClinicalEncounterDate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.flat_ncd", + "alias": "t1" + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "person_id", + "column": "t1.person_id" + }, + { + "type": "simple_column", + "alias": "latest_encounter_date", + "column": "MAX(t1.encounter_datetime)" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "t1.location_id" + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "t1.is_clinical_encounter = 1", + "parameterName": "" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["t1.person_id"], + "excludeParam": "excludeParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-aggregate.json new file mode 100644 index 000000000..28064dc3b --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-aggregate.json @@ -0,0 +1,99 @@ +{ + "name": "anxPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "anxPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "anxPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_anx_mh_f", + "column": "sum(b.nw_anx_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_anx_mh_m", + "column": "sum(b.nw_anx_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_anx_mh", + "column": "sum(b.tot_nw_anx_mh)" + }, + { + "type": "simple_column", + "alias": "ct_anx_mh_f", + "column": "sum(b.ct_anx_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_anx_mh_m", + "column": "sum(b.ct_anx_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_anx_mh", + "column": "sum(b.tot_ct_anx_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-base.json new file mode 100644 index 000000000..ae0775dfa --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-base.json @@ -0,0 +1,169 @@ +{ + "name": "anxPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_anx_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_anxiety_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_anx_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_anxiety_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_anx_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_anxiety_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_anx_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_anxiety_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_anx_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_anxiety_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_anx_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_anxiety_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-aggregate.json new file mode 100644 index 000000000..fae4706ae --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-aggregate.json @@ -0,0 +1,99 @@ +{ + "name": "bipPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "bipPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "bipPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_bip_mh_f", + "column": "sum(b.nw_bip_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_bip_mh_m", + "column": "sum(b.nw_bip_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_bip_mh", + "column": "sum(b.tot_nw_bip_mh)" + }, + { + "type": "simple_column", + "alias": "ct_bip_mh_f", + "column": "sum(b.ct_bip_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_bip_mh_m", + "column": "sum(b.ct_bip_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_bip_mh", + "column": "sum(b.tot_ct_bip_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-base.json new file mode 100644 index 000000000..08b976a95 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-base.json @@ -0,0 +1,169 @@ +{ + "name": "bipPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_bip_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_bipolar_and_related_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_bip_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_bipolar_and_related_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_bip_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_bipolar_and_related_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_bip_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_bipolar_and_related_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_bip_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_bipolar_and_related_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_bip_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_bipolar_and_related_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-aggregate.json new file mode 100644 index 000000000..c6774d71c --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-aggregate.json @@ -0,0 +1,99 @@ +{ + "name": "depPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "depPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "depPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_dp_mh_f", + "column": "sum(b.nw_dp_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_dp_mh_m", + "column": "sum(b.nw_dp_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_dp_mh", + "column": "sum(b.tot_nw_dp_mh)" + }, + { + "type": "simple_column", + "alias": "ct_dp_mh_f", + "column": "sum(b.ct_dp_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_dp_mh_m", + "column": "sum(b.ct_dp_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_dp_mh", + "column": "sum(b.tot_ct_dp_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-base.json new file mode 100644 index 000000000..09550954a --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-base.json @@ -0,0 +1,169 @@ +{ + "name": "depPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_dp_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_depressive_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_dp_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_depressive_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_dp_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_depressive_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_dp_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_depressive_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_dp_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_depressive_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_dp_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_depressive_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-aggregate.json new file mode 100644 index 000000000..cd0f31b6c --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-aggregate.json @@ -0,0 +1,99 @@ +{ + "name": "fedPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "fedPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "fedPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_fe_mh_f", + "column": "sum(b.nw_fe_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_fe_mh_m", + "column": "sum(b.nw_fe_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_fe_mh", + "column": "sum(b.tot_nw_fe_mh)" + }, + { + "type": "simple_column", + "alias": "ct_fe_mh_f", + "column": "sum(b.ct_fe_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_fe_mh_m", + "column": "sum(b.ct_fe_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_fe_mh", + "column": "sum(b.tot_ct_fe_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-base.json new file mode 100644 index 000000000..bbbd9bbed --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-base.json @@ -0,0 +1,169 @@ +{ + "name": "fedPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_fe_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_feeding_and_eating_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_fe_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_feeding_and_eating_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_fe_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_feeding_and_eating_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_fe_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_feeding_and_eating_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_fe_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_feeding_and_eating_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_fe_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_feeding_and_eating_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-aggregate.json new file mode 100644 index 000000000..f2664baaf --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-aggregate.json @@ -0,0 +1,99 @@ +{ + "name": "genMDPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "genMDPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "genMDPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_mh_f", + "column": "sum(b.nw_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_mh_m", + "column": "sum(b.nw_mh_m)" + }, + { + "type": "simple_column", + "alias": "nw_mh", + "column": "sum(b.nw_mh)" + }, + { + "type": "simple_column", + "alias": "ct_mh_f", + "column": "sum(b.ct_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_mh_m", + "column": "sum(b.ct_mh_m)" + }, + { + "type": "simple_column", + "alias": "ct_mh", + "column": "sum(b.ct_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-base.json new file mode 100644 index 000000000..d9ecc9f21 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-base.json @@ -0,0 +1,169 @@ +{ + "name": "genMDPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-aggregate.json new file mode 100644 index 000000000..2b2914a72 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-aggregate.json @@ -0,0 +1,294 @@ +{ + "name": "mhPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "mhPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "mhPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_dp_mh_f", + "column": "sum(b.nw_dp_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_dp_mh_m", + "column": "sum(b.nw_dp_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_dp_mh", + "column": "sum(b.tot_nw_dp_mh)" + }, + { + "type": "simple_column", + "alias": "ct_dp_mh_f", + "column": "sum(b.ct_dp_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_dp_mh_m", + "column": "sum(b.ct_dp_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_dp_mh", + "column": "sum(b.tot_ct_dp_mh)" + }, + { + "type": "simple_column", + "alias": "nw_anx_mh_f", + "column": "sum(b.nw_anx_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_anx_mh_m", + "column": "sum(b.nw_anx_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_anx_mh", + "column": "sum(b.tot_nw_anx_mh)" + }, + { + "type": "simple_column", + "alias": "ct_anx_mh_f", + "column": "sum(b.ct_anx_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_anx_mh_m", + "column": "sum(b.ct_anx_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_anx_mh", + "column": "sum(b.tot_ct_anx_mh)" + }, + { + "type": "simple_column", + "alias": "nw_bip_mh_f", + "column": "sum(b.nw_bip_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_bip_mh_m", + "column": "sum(b.nw_bip_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_bip_mh", + "column": "sum(b.tot_nw_bip_mh)" + }, + { + "type": "simple_column", + "alias": "ct_bip_mh_f", + "column": "sum(b.ct_bip_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_bip_mh_m", + "column": "sum(b.ct_bip_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_bip_mh", + "column": "sum(b.tot_ct_bip_mh)" + }, + { + "type": "simple_column", + "alias": "nw_per_mh_f", + "column": "sum(b.nw_per_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_per_mh_m", + "column": "sum(b.nw_per_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_per_mh", + "column": "sum(b.tot_nw_per_mh)" + }, + { + "type": "simple_column", + "alias": "ct_per_mh_f", + "column": "sum(b.ct_per_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_per_mh_m", + "column": "sum(b.ct_per_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_per_mh", + "column": "sum(b.tot_ct_per_mh)" + }, + { + "type": "simple_column", + "alias": "nw_fe_mh_f", + "column": "sum(b.nw_fe_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_fe_mh_m", + "column": "sum(b.nw_fe_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_fe_mh", + "column": "sum(b.tot_nw_fe_mh)" + }, + { + "type": "simple_column", + "alias": "ct_fe_mh_f", + "column": "sum(b.ct_fe_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_fe_mh_m", + "column": "sum(b.ct_fe_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_fe_mh", + "column": "sum(b.tot_ct_fe_mh)" + }, + { + "type": "simple_column", + "alias": "nw_obs_mh_f", + "column": "sum(b.nw_obs_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_obs_mh_m", + "column": "sum(b.nw_obs_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_obs_mh", + "column": "sum(b.tot_nw_obs_mh)" + }, + { + "type": "simple_column", + "alias": "ct_obs_mh_f", + "column": "sum(b.ct_obs_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_obs_mh_m", + "column": "sum(b.ct_obs_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_obs_mh", + "column": "sum(b.tot_ct_obs_mh)" + }, + { + "type": "simple_column", + "alias": "nw_mh_f", + "column": "sum(b.nw_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_mh_m", + "column": "sum(b.nw_mh_m)" + }, + { + "type": "simple_column", + "alias": "nw_mh", + "column": "sum(b.nw_mh)" + }, + { + "type": "simple_column", + "alias": "ct_mh_f", + "column": "sum(b.ct_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_mh_m", + "column": "sum(b.ct_mh_m)" + }, + { + "type": "simple_column", + "alias": "ct_mh", + "column": "sum(b.ct_mh)" + }, + { + "type": "simple_column", + "alias": "tot_nw_mh", + "column": "sum(b.tot_nw_mh)" + }, + { + "type": "simple_column", + "alias": "tot_ct_mh", + "column": "sum(b.tot_ct_mh)" + }, + { + "type": "simple_column", + "alias": "tot_mh", + "column": "sum(b.tot_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-base.json new file mode 100644 index 000000000..a5dcfa271 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-base.json @@ -0,0 +1,481 @@ +{ + "name": "mhPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_dp_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_depressive_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_dp_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_depressive_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_dp_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_depressive_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_dp_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_depressive_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_dp_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_depressive_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_dp_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_depressive_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_anx_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_anxiety_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_anx_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_anxiety_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_anx_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_anxiety_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_anx_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_anxiety_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_anx_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_anxiety_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_anx_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_anxiety_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_bip_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_bipolar_and_related_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_bip_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_bipolar_and_related_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_bip_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_bipolar_and_related_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_bip_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_bipolar_and_related_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_bip_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_bipolar_and_related_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_bip_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_bipolar_and_related_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_per_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_personality_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_per_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_personality_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_per_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_personality_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_per_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_personality_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_per_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_personality_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_per_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_personality_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_fe_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_feeding_and_eating_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_fe_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_feeding_and_eating_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_fe_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_feeding_and_eating_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_fe_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_feeding_and_eating_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_fe_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_feeding_and_eating_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_fe_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_feeding_and_eating_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_obs_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ocd_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_obs_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ocd_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_obs_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ocd_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_obs_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ocd_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_obs_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ocd_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_obs_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ocd_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-aggregate.json new file mode 100644 index 000000000..67e43f58b --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-aggregate.json @@ -0,0 +1,99 @@ +{ + "name": "ocdPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "ocdPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "ocdPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_obs_mh_f", + "column": "sum(b.nw_obs_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_obs_mh_m", + "column": "sum(b.nw_obs_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_obs_mh", + "column": "sum(b.tot_nw_obs_mh)" + }, + { + "type": "simple_column", + "alias": "ct_obs_mh_f", + "column": "sum(b.ct_obs_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_obs_mh_m", + "column": "sum(b.ct_obs_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_obs_mh", + "column": "sum(b.tot_ct_obs_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-base.json new file mode 100644 index 000000000..fc6fd78ff --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-base.json @@ -0,0 +1,169 @@ +{ + "name": "ocdPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_obs_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ocd_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_obs_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ocd_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_obs_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ocd_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_obs_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ocd_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_obs_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ocd_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_obs_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_ocd_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-aggregate.json new file mode 100644 index 000000000..15351177a --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-aggregate.json @@ -0,0 +1,99 @@ +{ + "name": "perPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "perPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "perPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "nw_per_mh_f", + "column": "sum(b.nw_per_mh_f)" + }, + { + "type": "simple_column", + "alias": "nw_per_mh_m", + "column": "sum(b.nw_per_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_per_mh", + "column": "sum(b.tot_nw_per_mh)" + }, + { + "type": "simple_column", + "alias": "ct_per_mh_f", + "column": "sum(b.ct_per_mh_f)" + }, + { + "type": "simple_column", + "alias": "ct_per_mh_m", + "column": "sum(b.ct_per_mh_m)" + }, + { + "type": "simple_column", + "alias": "tot_ct_per_mh", + "column": "sum(b.tot_ct_per_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-base.json new file mode 100644 index 000000000..2fe504d26 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-base.json @@ -0,0 +1,169 @@ +{ + "name": "perPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "nw_per_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_personality_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_per_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_personality_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_per_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_personality_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_per_mh_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_personality_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_per_mh_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_personality_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_per_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.is_personality_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-aggregate.json new file mode 100644 index 000000000..ca33d177d --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-aggregate.json @@ -0,0 +1,79 @@ +{ + "name": "stMDPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "stMDPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "stMDPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "tot_nw_mh", + "column": "sum(b.tot_nw_mh)" + }, + { + "type": "simple_column", + "alias": "tot_ct_mh", + "column": "sum(b.tot_ct_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-base.json new file mode 100644 index 000000000..e3b4874e3 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-base.json @@ -0,0 +1,137 @@ +{ + "name": "stMDPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "tot_nw_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-aggregate.json new file mode 100644 index 000000000..a563ddce9 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-aggregate.json @@ -0,0 +1,74 @@ +{ + "name": "totMDPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "totMDPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "totMDPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "tot_mh", + "column": "sum(b.tot_mh)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-base.json new file mode 100644 index 000000000..0cb65798c --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-base.json @@ -0,0 +1,129 @@ +{ + "name": "totMDPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "tot_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-aggregate.json new file mode 100644 index 000000000..ee8dae2b8 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-aggregate.json @@ -0,0 +1,174 @@ +{ + "name": "neuPlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "neuPlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "neuPlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "simple_column", + "alias": "mg_nw_m", + "column": "sum(b.mg_nw_m)" + }, + { + "type": "simple_column", + "alias": "mg_nw_f", + "column": "sum(b.mg_nw_f)" + }, + { + "type": "simple_column", + "alias": "tot_mg_nw", + "column": "sum(b.tot_mg_nw)" + }, + { + "type": "simple_column", + "alias": "mg_ct_m", + "column": "sum(b.mg_ct_m)" + }, + { + "type": "simple_column", + "alias": "mg_ct_f", + "column": "sum(b.mg_ct_f)" + }, + { + "type": "simple_column", + "alias": "tot_mg_ct", + "column": "sum(b.tot_mg_ct)" + }, + { + "type": "simple_column", + "alias": "cnv_nw_m", + "column": "sum(b.cnv_nw_m)" + }, + { + "type": "simple_column", + "alias": "cnv_nw_f", + "column": "sum(b.cnv_nw_f)" + }, + { + "type": "simple_column", + "alias": "tot_cnv_nw", + "column": "sum(b.tot_cnv_nw)" + }, + { + "type": "simple_column", + "alias": "cnv_ct_m", + "column": "sum(b.cnv_ct_m)" + }, + { + "type": "simple_column", + "alias": "cnv_ct_f", + "column": "sum(b.cnv_ct_f)" + }, + { + "type": "simple_column", + "alias": "tot_cnv_ct", + "column": "sum(b.tot_cnv_ct)" + }, + { + "type": "simple_column", + "alias": "sub_tot_nw_neu_m", + "column": "sum(b.sub_tot_nw_neu_m)" + }, + { + "type": "simple_column", + "alias": "sub_tot_nw_neu_f", + "column": "sum(b.sub_tot_nw_neu_f)" + }, + { + "type": "simple_column", + "alias": "sub_tot_nw_neu", + "column": "sum(b.sub_tot_nw_neu)" + }, + { + "type": "simple_column", + "alias": "sub_tot_ct_neu_m", + "column": "sum(b.sub_tot_ct_neu_m)" + }, + { + "type": "simple_column", + "alias": "sub_tot_ct_neu_f", + "column": "sum(b.sub_tot_ct_neu_f)" + }, + { + "type": "simple_column", + "alias": "sub_tot_ct_neu", + "column": "sum(b.sub_tot_ct_neu)" + }, + { + "type": "simple_column", + "alias": "tot_nw_neu", + "column": "sum(b.tot_nw_neu)" + }, + { + "type": "simple_column", + "alias": "tot_ct_neu", + "column": "sum(b.tot_ct_neu)" + }, + { + "type": "simple_column", + "alias": "tot_neu", + "column": "sum(b.tot_neu)" + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-base.json new file mode 100644 index 000000000..b5493a544 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-base.json @@ -0,0 +1,289 @@ +{ + "name": "neuPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "mg_nw_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_migraine = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "mg_nw_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_migraine = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_mg_nw", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.has_migraine = 1 and hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "mg_ct_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_migraine = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "mg_ct_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_migraine = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_mg_ct", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.has_migraine = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "cnv_nw_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_convulsive_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "cnv_nw_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_convulsive_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_cnv_nw", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.has_convulsive_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "cnv_ct_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_convulsive_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "cnv_ct_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_convulsive_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_cnv_ct", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.has_convulsive_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_neu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_neurological_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_neu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_neurological_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_neu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_neurological_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_neu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_neurological_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_neu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_neurological_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_neu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_neurological_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_neu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_neurological_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_neu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_neurological_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_neu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_neurological_disorder = 1), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["hmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-aggregate.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-aggregate.json new file mode 100644 index 000000000..a9f7690d4 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-aggregate.json @@ -0,0 +1,237 @@ +{ + "name": "rhePlhivAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "rhePlhivBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "rhePlhivBase", + "alias": "b" + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "join_location", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" + }, + { + "type": "simple_column", + "alias": "location", + "column": "b.location" + }, + { + "type": "derived_column", + "alias": "ra_nw_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.ra_nw_m)" + } + }, + { + "type": "derived_column", + "alias": "ra_nw_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.ra_nw_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_ra_nw", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_ra_nw)" + } + }, + { + "type": "derived_column", + "alias": "ra_ct_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.ra_ct_m)" + } + }, + { + "type": "derived_column", + "alias": "ra_ct_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.ra_ct_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_ra_ct", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_ra_ct)" + } + }, + { + "type": "derived_column", + "alias": "sle_nw_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sle_nw_m)" + } + }, + { + "type": "derived_column", + "alias": "sle_nw_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sle_nw_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_sle_nw", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_sle_nw)" + } + }, + { + "type": "derived_column", + "alias": "sle_ct_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sle_ct_m)" + } + }, + { + "type": "derived_column", + "alias": "sle_ct_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sle_ct_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_sle_ct", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_sle_ct)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_rhe_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_rhe_m)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_rhe_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_rhe_f)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_nw_rhe)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_rhe_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_rhe_m)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_rhe_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_rhe_f)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_ct_rhe)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_nw_rhe)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_ct_rhe)" + } + }, + { + "type": "derived_column", + "alias": "tot_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_rhe)" + } + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["b.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "patient-list-with-contacts-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-base.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-base.json new file mode 100644 index 000000000..85480798f --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-base.json @@ -0,0 +1,289 @@ +{ + "name": "rhePlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "nmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "nmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "nmrd.location_uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "nmrd.person_id" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "fi.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "fi.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "fi.nupi" + }, + { + "type": "simple_column", + "alias": "age", + "column": "nmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "nmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "nmrd.clinic" + }, + { + "type": "derived_column", + "alias": "ra_nw_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_arthritis = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ra_nw_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_arthritis = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ra_nw", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'F' OR nmrd.gender = 'M') AND nmrd.has_arthritis = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ra_ct_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_arthritis = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ra_ct_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_arthritis = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ra_ct", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'F' OR nmrd.gender = 'M') AND nmrd.has_arthritis = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sle_nw_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_SLE = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sle_nw_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_SLE = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_sle_nw", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'F' OR nmrd.gender = 'M') AND nmrd.has_SLE = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sle_ct_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_SLE = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sle_ct_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_SLE = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_sle_ct", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.has_SLE = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_rhe_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_rheumatologic_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_rhe_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_rheumatologic_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.has_rheumatologic_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_rhe_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_rheumatologic_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_rhe_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_rheumatologic_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(((nmrd.gender = 'F' OR nmrd.gender = 'M') AND nmrd.has_rheumatologic_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_rheumatologic_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_rheumatologic_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_rhe", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_rheumatologic_disorder = 1), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json new file mode 100644 index 000000000..84d1181f5 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json @@ -0,0 +1,2532 @@ +[ + { + "sectionTitle": "Hypertension", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Controlled BP(SBP <130 mmHg and DBP <80 mmHg)", + "indicator": [ + { + "type": "nw_ctld_htn_f", + "required": "0", + "description": "Female new in care and having controlled blood pressure" + }, + { + "type": "nw_ctld_htn_m", + "required": "0", + "description": "Male new in care and having controlled blood pressure" + }, + { + "type": "tot_nw_ctld_htn", + "required": "0", + "description": "PLHIV New in care and having controlled blood pressure" + }, + { + "type": "ct_ctld_htn_f", + "description": "Female continuing in care and having controlled blood pressure" + }, + { + "type": "ct_ctld_htn_m", + "description": "Male continuing in care and having controlled blood pressure" + }, + { + "type": "tot_ct_ctld_htn", + "description": "PLHIV New in care and having controlled blood pressure" + } + ] + }, + { + "label": "Not well controlled BP(SBP >130 mmHg and DBP >80 mmHg)", + "indicator": [ + { + "type": "nw_unctld_htn_f", + "required": "0", + "description": "Female new in care and having uncontrolled blood pressure" + }, + { + "type": "nw_unctld_htn_m", + "required": "0", + "description": "Male new in care and having uncontrolled blood pressure" + }, + { + "type": "tot_nw_unctld_htn", + "required": "0", + "description": "PLHIV new in care and having controlled blood pressure" + }, + { + "type": "ct_unctld_htn_f", + "description": "Female continuing in care and having uncontrolled blood pressure" + }, + { + "type": "ct_unctld_htn_m", + "description": "Male continuing in care and having uncontrolled blood pressure" + }, + { + "type": "tot_ct_unctld_htn", + "description": "PLHIV continuing in care and having uncontrolled blood pressure" + } + ] + }, + { + "label": "Unknown / Not Established BP(missing either SBP, DBP, or Both)", + "indicator": [ + { + "type": "nw_unk_htn_f", + "required": "1", + "description": "Female new in care and having hypertension but unknown blood pressure" + }, + { + "type": "nw_unk_htn_m", + "required": "1", + "description": "Male new in care and having hypertension but unknown blood pressure" + }, + { + "type": "tot_nw_unk_htn", + "required": "1", + "description": "PLHIV new in care and having hypertension but unknown blood pressure" + }, + { + "type": "ct_unk_htn_f", + "description": "Female continuing in care and having hypertension but unknown blood pressure" + }, + { + "type": "ct_unk_htn_m", + "description": "Male continuing in care and having hypertension but unknown blood pressure" + }, + { + "type": "tot_ct_unk_htn", + "description": "PLHIV continuing in care and having hypertension but unknown blood pressure" + } + ] + }, + { + "label": "Hypertensive", + "indicator": [ + { + "type": "nw_htn_f", + "description": "Female new in care and having hypertension" + }, + { + "type": "nw_htn_m", + "description": "Male new in care and having hypertension" + }, + { + "type": "nw_htn", + "description": "PLHIV new in care and having hypertension" + }, + { + "type": "ct_htn_f", + "description": "Female continuing in care and having hypertension" + }, + { + "type": "ct_htn_m", + "description": "Male continuing in care and having hypertension" + }, + { + "type": "ct_htn", + "description": "PLHIV continuing in care and having hypertension" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_htn", + "description": "PLHIV new in care and are hypertensive" + }, + { + "type": "tot_ct_htn", + "description": "PLHIV continuing in care and are hypertensive" + } + ] + }, + { + "label": "Total Hypertensive", + "indicator": { + "type": "tot_htn", + "description": "PLHIV who are hypertensive" + } + } + ] + }, + { + "sectionTitle": "Diabetes", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Controlled HbA1c(HbA1c <= 7%)", + "indicator": [ + { + "type": "nw_ctld_dm_f", + "required": "0", + "description": "Female new in care and are having controlled Diabetic" + }, + { + "type": "nw_ctld_dm_m", + "required": "0", + "description": "Male new in care and are having controlled Diabetic" + }, + { + "type": "tot_nw_ctld_dm", + "required": "0", + "description": "PLHIV new in care and are having controlled Diabetic" + }, + { + "type": "ct_ctld_dm_f", + "description": "Female continuing in care and are having controlled Diabetic" + }, + { + "type": "ct_ctld_dm_m", + "description": "Male continuing in care and are having controlled Diabetic" + }, + { + "type": "tot_ct_ctld_dm", + "description": "PLHIV continuing in care and are having controlled Diabetic" + } + ] + }, + { + "label": "Uncontrolled HbA1c(HbA1c > 7%)", + "indicator": [ + { + "type": "nw_unctld_dm_f", + "required": "0", + "description": "Female new in care and are having uncontrolled Diabetes" + }, + { + "type": "nw_unctld_dm_m", + "required": "0", + "description": "Male new in care and are having uncontrolled Diabetes" + }, + { + "type": "tot_nw_unctld_dm", + "required": "0", + "description": "PLHIV new in care and are having uncontrolled Diabetes" + }, + { + "type": "ct_unctld_dm_f", + "description": "Female continuing in care and are having uncontrolled Diabetes" + }, + { + "type": "ct_unctld_dm_m", + "description": "Male continuing in care and are having uncontrolled Diabetes" + }, + { + "type": "tot_ct_unctld_dm", + "description": "PLHIV continuing in care and are having uncontrolled Diabetes" + } + ] + }, + { + "label": "Unknown / Not Established HbA1c(missing HbA1c results)", + "indicator": [ + { + "type": "nw_unk_dm_f", + "description": "Female new in care and are having Unknown/Not Established Diabetes" + }, + { + "type": "nw_unk_dm_m", + "description": "Male new in care and are having Unknown/Not Established Diabetes" + }, + { + "type": "tot_nw_unk_dm", + "description": "PLHIV new in care and are having Unknown/Not Established Diabetes" + }, + { + "type": "ct_unk_dm_f", + "description": "Female continuing in care and are having Unknown/Not Established Diabetes" + }, + { + "type": "ct_unk_dm_m", + "description": "Male continuing in care and are having Unknown/Not Established Diabetes" + }, + { + "type": "tot_ct_unk_dm", + "description": "PLHIV continuing in care and are having Unknown/Not Established Diabetes" + } + ] + }, + { + "label": "Diabetic", + "indicator": [ + { + "type": "nw_dm_f", + "description": "Female new in care and are diabetic" + }, + { + "type": "nw_dm_m", + "description": "Male new in care and are diabetic" + }, + { + "type": "nw_dm", + "description": "PLHIV new in care and are diabetic" + }, + { + "type": "ct_dm_f", + "description": "Female continuing in care and are diabetic" + }, + { + "type": "ct_dm_m", + "description": "Male continuing in care and are diabetic" + }, + { + "type": "ct_dm", + "description": "PLHIV continuing in care and are diabetic" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_dm", + "description": "PLHIV new in care and are diabetic" + }, + { + "type": "tot_ct_dm", + "description": "PLHIV continuing in care and are diabetic" + } + ] + }, + { + "label": "Total Diabetic", + "indicator": { + "type": "tot_dm", + "description": "Diabetic PLHIV" + } + } + ] + }, + { + "sectionTitle": "Mental Health Disorder", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Depressive", + "indicator": [ + { + "type": "nw_dp_mh_f", + "description": "Female new in care and have depressive disorder" + }, + { + "type": "nw_dp_mh_m", + "description": "Male new in care and have depressive disorder" + }, + { + "type": "tot_nw_dp_mh", + "description": "PLHIV new in care and have depressive disorder" + }, + { + "type": "ct_dp_mh_f", + "description": "Female continuing in care and have depressive disorder" + }, + { + "type": "ct_dp_mh_m", + "description": "Male continuing in care and have depressive disorder" + }, + { + "type": "tot_ct_dp_mh", + "description": "PLHIV continuing in care and have depressive disorder" + } + ] + }, + { + "label": "Anxiety", + "indicator": [ + { + "type": "nw_anx_mh_f", + "description": "Female new in care and have anxiety disorder" + }, + { + "type": "nw_anx_mh_m", + "description": "Male new in care and have anxiety disorder" + }, + { + "type": "tot_nw_anx_mh", + "description": "PLHIV new in care and have anxiety disorder" + }, + { + "type": "ct_anx_mh_f", + "description": "Female continuing in care and have anxiety disorder" + }, + { + "type": "ct_anx_mh_m", + "description": "Male continuing in care and have anxiety disorder" + }, + { + "type": "tot_ct_anx_mh", + "description": "PLHIV continuing in care and have anxiety disorder" + } + ] + }, + { + "label": "Bipolar and Related Disorder", + "indicator": [ + { + "type": "nw_bip_mh_f", + "description": "Female new in care and have bipolar and related disorder" + }, + { + "type": "nw_bip_mh_m", + "description": "Male new in care and have bipolar and related disorder" + }, + { + "type": "tot_nw_bip_mh", + "description": "PLHIV new in care and have bipolar and related disorder" + }, + { + "type": "ct_bip_mh_f", + "description": "Female continuing in care and have bipolar and related disorder" + }, + { + "type": "ct_bip_mh_m", + "description": "Male continuing in care and have bipolar and related disorder" + }, + { + "type": "tot_ct_bip_mh", + "description": "PLHIV continuing in care and have bipolar and related disorder" + } + ] + }, + { + "label": "Personality Disorder", + "indicator": [ + { + "type": "nw_per_mh_f", + "description": "Female new in care and have personality disorder" + }, + { + "type": "nw_per_mh_m", + "description": "Male new in care and have personality disorder" + }, + { + "type": "tot_nw_per_mh", + "description": "PLHIV new in care and have personality disorder" + }, + { + "type": "ct_per_mh_f", + "description": "Female continuing in care and have personality disorder" + }, + { + "type": "ct_per_mh_m", + "description": "Male continuing in care and have personality disorder" + }, + { + "type": "tot_ct_per_mh", + "description": "PLHIV continuing in care and have personality disorder" + } + ] + }, + { + "label": "Feeding and Eating Disorder", + "indicator": [ + { + "type": "nw_fe_mh_f", + "description": "Female new in care and have feeding and eating disorder" + }, + { + "type": "nw_fe_mh_m", + "description": "Male new in care and have feeding and eating disorder" + }, + { + "type": "tot_nw_fe_mh", + "description": "PLHIV new in care and have feeding and eating disorder" + }, + { + "type": "ct_fe_mh_f", + "description": "Female continuing in care and have feeding and eating disorder" + }, + { + "type": "ct_fe_mh_m", + "description": "Male continuing in care and have feeding and eating disorder" + }, + { + "type": "tot_ct_fe_mh", + "description": "PLHIV continuing in care and have feeding and eating disorder" + } + ] + }, + { + "label": "Obsessive - Compulsive and Related Disorder", + "indicator": [ + { + "type": "nw_obs_mh_f", + "description": "Female new in care and have obsessive and eating disorder" + }, + { + "type": "nw_obs_mh_m", + "description": "Male new in care and have obsessive and eating disorder" + }, + { + "type": "tot_nw_obs_mh", + "description": "PLHIV new in care and have obsessive and eating disorder" + }, + { + "type": "ct_obs_mh_f", + "description": "Female continuing in care and have obsessive and eating disorder" + }, + { + "type": "ct_obs_mh_m", + "description": "Male continuing in care and have obsessive and eating disorder" + }, + { + "type": "tot_ct_obs_mh", + "description": "PLHIV continuing in care and have obsessive and eating disorder" + } + ] + }, + { + "label": "Mentally Ill", + "required": "0", + "indicator": [ + { + "type": "nw_mh_f", + "required": "1", + "description": "Female new in care and have mental health disorder" + }, + { + "type": "nw_mh_m", + "required": "1", + "description": "Male new in care and have mental health disorder" + }, + { + "type": "nw_mh", + "required": "1", + "description": "PLHIV new in care and have mental health disorder" + }, + { + "type": "ct_mh_f", + "required": "1", + "description": "Female continuing in care and have mental health disorder" + }, + { + "type": "ct_mh_m", + "required": "1", + "description": "Male continuing in care and have mental health disorder" + }, + { + "type": "ct_mh", + "required": "1", + "description": "PLHIV continuing in care and have mental health disorder" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_mh", + "description": "PLHIV new in care and have mental health disorder" + }, + { + "type": "tot_ct_mh", + "description": "PLHIV continuing in care and have mental health disorder" + } + ] + }, + { + "label": "Total Mental Health Disorder", + "indicator": { + "type": "tot_mh", + "description": "PLHIV having mental health disorder" + } + } + ] + }, + { + "sectionTitle": "Other Cardiovascular Diseases", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Heart Failure", + "indicator": [ + { + "type": "nw_hf_f", + "description": "Female new in care and have heart failure" + }, + { + "type": "nw_hf_m", + "description": "Male new in care and have heart failure" + }, + { + "type": "tot_nw_hf", + "description": "PLHIV new in care and have heart failure" + }, + { + "type": "ct_hf_f", + "description": "Female continuing in care and have heart failure" + }, + { + "type": "ct_hf_m", + "description": "Male continuing in care and have heart failure" + }, + { + "type": "tot_ct_hf", + "description": "PLHIV continuing in care and have heart failure" + } + ] + }, + { + "label": "Myocardinal Infarction", + "indicator": [ + { + "type": "nw_myo_inf_f", + "description": "Female new in care and have Myocardinal Infarction" + }, + { + "type": "nw_myo_inf_m", + "description": "Male new in care and have Myocardinal Infarction" + }, + { + "type": "tot_nw_myo_inf", + "description": "PLHIV new in care and have Myocardinal Infarction" + }, + { + "type": "ct_myo_inf_f", + "description": "Female continuing in care and have Myocardinal Infarction" + }, + { + "type": "ct_myo_inf_m", + "description": "Male continuing in care and have Myocardinal Infarction" + }, + { + "type": "tot_ct_myo_inft", + "description": "PLHIV continuing in care and have Myocardinal Infarction" + } + ] + }, + { + "label": "General Cardiovascular Disorder ", + "indicator": [ + { + "type": "sub_tot_nw_cvd_f", + "description": "Female new in care and have Cardiovascular Disease" + }, + { + "type": "sub_tot_nw_cvd_m", + "description": "Male new in care and have Cardiovascular Disease" + }, + { + "type": "sub_tot_nw_cvd", + "description": "PLHIV new in care and have Cardiovascular Disease" + }, + { + "type": "sub_tot_ct_cvd_f", + "description": "Female continuing in care and have Cardiovascular Disease" + }, + { + "type": "sub_tot_ct_cvd_m", + "description": "Male continuing in care and have Cardiovascular Disease" + }, + { + "type": "sub_tot_ct_cvd", + "description": "PLHIV continuing in care and have Cardiovascular Disease" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_cvd", + "description": "PLHIV new in care and have Cardiovascular Disease" + }, + { + "type": "tot_ct_cvd", + "description": "PLHIV continuing in care and have Cardiovascular Disease" + } + ] + }, + { + "label": "Total Cardiovascular Disease", + "indicator": { + "type": "tot_cvd", + "description": "PLHIV having Cardiovascular Disease" + } + } + ] + }, + { + "sectionTitle": "Kidney Disease", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "State", + "indicator": ["Chronic", "Acute"] + }, + { + "label": "Status", + "indicator": ["New", "CT", "New", "CT"] + }, + { + "label": "Header", + "indicator": [ + "F", + "M", + "T", + "F", + "M", + "T", + "F", + "M", + "T", + "F", + "M", + "T" + ] + }, + { + "label": "Stage 1", + "indicator": [ + { + "type": "stg_1_nw_chr_f", + "description": "Female new in care and have stage 1 chronic kidney disease" + }, + { + "type": "stg_1_nw_chr_m", + "description": "Male new in care and have stage 1 chronic kidney disease" + }, + { + "type": "tot_stg_1_nw_chr", + "description": "PLHIV new in care and have stage 1 chronic kidney disease" + }, + { + "type": "stg_1_ct_chr_f", + "description": "Female continuing in care and have stage 1 chronic kidney disease" + }, + { + "type": "stg_1_ct_chr_m", + "description": "Male continuing in care and have stage 1 chronic kidney disease" + }, + { + "type": "tot_stg_1_ct_chr", + "description": "PLHIV continuing in care and have stage 1 chronic kidney disease" + }, + { + "type": "stg_1_nw_acu_f", + "required": "0", + "description": "Female new in care and have stage 1 acute kidney disease" + }, + { + "type": "stg_1_nw_acu_m", + "required": "0", + "description": "Male new in care and have stage 1 acute kidney disease" + }, + { + "type": "tot_stg_1_nw_acu", + "required": "0", + "description": "PLHIV new in care and have stage 1 acute kidney disease" + }, + { + "type": "stg_1_ct_acu_f", + "required": "0", + "description": "Female continuing in care and have stage 1 acute kidney disease" + }, + { + "type": "stg_1_ct_acu_m", + "required": "0", + "description": "Male continuing in care and have stage 1 acute kidney disease" + }, + { + "type": "tot_stg_1_ct_acu", + "required": "0", + "description": "PLHIV continuing in care and have stage 1 acute kidney disease" + } + ] + }, + { + "label": "Stage 2", + "indicator": [ + { + "type": "stg_2_nw_chr_f", + "description": "Female new in care and have stage 2 chronic kidney disease" + }, + { + "type": "stg_2_nw_chr_m", + "description": "Male new in care and have stage 2 chronic kidney disease" + }, + { + "type": "tot_stg_2_nw_chr", + "description": "PLHIV new in care and have stage 2 chronic kidney disease" + }, + { + "type": "stg_2_ct_chr_f", + "description": "Female continuing in care and have stage 2 chronic kidney disease" + }, + { + "type": "stg_2_ct_chr_m", + "description": "Male continuing in care and have stage 2 chronic kidney disease" + }, + { + "type": "tot_stg_2_ct_chr", + "description": "PLHIV continuing in care and have stage 2 chronic kidney disease" + }, + { + "type": "stg_2_nw_acu_f", + "required": "0", + "description": "Female new in care and have stage 2 acute kidney disease" + }, + { + "type": "stg_2_nw_acu_m", + "required": "0", + "description": "Male new in care and have stage 2 acute kidney disease" + }, + { + "tupe": "tot_stg_2_nw_acu", + "required": "0", + "description": "PLHIV new in care and have stage 2 acute kidney disease" + }, + { + "type": "stg_2_ct_acu_f", + "required": "0", + "description": "femlae continuing in care and have stage 2 acute kidney disease" + }, + { + "type": "stg_2_ct_acu_m", + "required": "0", + "description": "Male continuing in care and have stage 2 acute kidney disease" + }, + { + "type": "tot_stg_2_ct_acu", + "required": "0", + "description": "PLHIV continuing in care and have stage 2 acute kidney disease" + } + ] + }, + { + "label": "Stage 3", + "indicator": [ + { + "type": "stg_3_nw_chr_f", + "description": "Female new in care and have stage 3 chronic kidney disease" + }, + { + "type": "stg_3_nw_chr_m", + "description": "Male new in care and have stage 3 chronic kidney disease" + }, + { + "type": "tot_stg_3_nw_chr", + "description": "PLHIV new in care and have stage 3 chronic kidney disease" + }, + { + "type": "stg_3_ct_chr_f", + "description": "Female continuing in care and have stage 3 chronic kidney disease" + }, + { + "type": "stg_3_ct_chr_m", + "description": "Male continuing in care and have stage 3 chronic kidney disease" + }, + { + "type": "tot_stg_3_ct_chr", + "description": "PLHIV continuing in care and have stage 3 chronic kidney disease" + }, + { + "type": "stg_3_nw_acu_f", + "required": "0", + "description": "Female new in care and have stage 3 acute kidney disease" + }, + { + "type": "stg_3_nw_acu_m", + "required": "0", + "description": "Male new in care and have stage 3 acute kidney disease" + }, + { + "type": "tot_stg_3_nw_acu", + "required": "0", + "description": "PLHIV new in care and have stage 3 acute kidney disease" + }, + { + "type": "stg_3_ct_acu_f", + "required": "0", + "description": "Female continuing in care and have stage 3 acute kidney disease" + }, + { + "type": "stg_3_ct_acu_m", + "required": "0", + "description": "Male continuing in care and have stage 3 acute kidney disease" + }, + { + "type": "tot_stg_3_ct_acu", + "required": "0", + "description": "PLHIV continuing in care and have stage 3 acute kidney disease" + } + ] + }, + { + "label": "Stage 3a", + "indicator": [ + { + "type": "stg_3a_nw_chr_f", + "description": "Female new in care and have stage 3a chronic kidney disease" + }, + { + "type": "stg_3a_nw_chr_m", + "description": "Male new in care and have stage 3a chronic kidney disease" + }, + { + "type": "tot_stg_3a_nw_chr", + "description": "PLHIV new in care and have stage 3a chronic kidney disease" + }, + { + "type": "stg_3a_ct_chr_f", + "description": "Female continuing in care and have stage 3a chronic kidney disease" + }, + { + "type": "stg_3a_ct_chr_m", + "description": "Male continuing in care and have stage 3a chronic kidney disease" + }, + { + "type": "tot_stg_3a_ct_chr", + "description": "PLHIV continuing in care and have stage 3a chronic kidney disease" + }, + { + "type": "stg_3a_nw_acu_f", + "required": "0", + "description": "Female new in care and have stage 3a acute kidney disease" + }, + { + "type": "stg_3a_nw_acu_m", + "required": "0", + "description": "Male new in care and have stage 3a acute kidney disease" + }, + { + "type": "tot_stg_3a_nw_acu", + "required": "0", + "description": "PLHIV new in care and have stage 3a acute kidney disease" + }, + { + "type": "stg_3a_ct_acu_f", + "required": "0", + "description": "Female continuing in care and have stage 3a acute kidney disease" + }, + { + "type": "stg_3a_ct_acu_m", + "required": "0", + "description": "Male continuing in care and have stage 3a acute kidney disease" + }, + { + "type": "tot_stg_3a_ct_acu", + "required": "0", + "description": "PLHIV continuing in care and have stage 3a acute kidney disease" + } + ] + }, + { + "label": "Stage 3b", + "indicator": [ + { + "type": "stg_3b_nw_chr_f", + "description": "Female new in care and have stage 3b chronic kidney disease" + }, + { + "type": "stg_3b_nw_chr_m", + "description": "Male new in care and have stage 3b chronic kidney disease" + }, + { + "type": "tot_stg_3b_nw_chr", + "description": "PLHIV new in care and have stage 3b chronic kidney disease" + }, + { + "type": "stg_3b_ct_chr_f", + "description": "Female continuing in care and have stage 3b chronic kidney disease" + }, + { + "type": "stg_3b_ct_chr_m", + "description": "Male continuing in care and have stage 3b chronic kidney disease" + }, + { + "type": "tot_stg_3b_ct_chr", + "description": "PLHIV continuing in care and have stage 3b chronic kidney disease" + }, + { + "type": "stg_3b_nw_acu_f", + "required": "0", + "description": "Female new in care and have stage 3b acute kidney disease" + }, + { + "type": "stg_3b_nw_acu_m", + "required": "0", + "description": "Male new in care and have stage 3b acute kidney disease" + }, + { + "type": "tot_stg_3b_nw_acu", + "required": "0", + "description": "PLHIV new in care and have stage 3b acute kidney disease" + }, + { + "type": "stg_3b_ct_acu_f", + "required": "0", + "description": "Female continuing in care and have stage 3b acute kidney disease" + }, + { + "type": "stg_3b_ct_acu_m", + "required": "0", + "description": "Male continuing in care and have stage 3b acute kidney disease" + }, + { + "type": "tot_stg_3b_ct_acu", + "required": "0", + "description": "PLHIV continuing in care and have stage 3b acute kidney disease" + } + ] + }, + { + "label": "Stage 4", + "indicator": [ + { + "type": "stg_4_nw_chr_f", + "description": "Female new in care and have stage 4 chronic kidney disease" + }, + { + "type": "stg_4_nw_chr_m", + "description": "Male new in care and have stage 4 chronic kidney disease" + }, + { + "type": "tot_stg_4_nw_chr", + "description": "PLHIV new in care and have stage 4 chronic kidney disease" + }, + { + "type": "stg_4_ct_chr_f", + "description": "Female continuing in care and have stage 4 chronic kidney disease" + }, + { + "type": "stg_4_ct_chr_m", + "description": "Male continuing in care and have stage 4 chronic kidney disease" + }, + { + "type": "tot_stg_4_ct_chr", + "description": "PLHIV continuing in care and have stage 4 chronic kidney disease" + }, + { + "type": "stg_4_nw_acu_f", + "required": "0", + "description": "Female new in care and have stage 4 acute kidney disease" + }, + { + "type": "stg_4_nw_acu_m", + "required": "0", + "description": "Male new in care and have stage 4 acute kidney disease" + }, + { + "type": "tot_stg_4_nw_acu", + "required": "0", + "description": "PLHIV new in care and have stage 4 acute kidney disease" + }, + { + "type": "stg_4_ct_acu_f", + "required": "0", + "description": "Female continuing in care and have stage 4 acute kidney disease" + }, + { + "type": "stg_4_ct_acu_m", + "required": "0", + "description": "Male continuing in care and have stage 4 acute kidney disease" + }, + { + "type": "tot_stg_4_ct_acu", + "required": "0", + "description": "PLHIV continuing in care and have stage 4 acute kidney disease" + } + ] + }, + { + "label": "Stage 5", + "indicator": [ + { + "type": "stg_5_nw_chr_f", + "description": "Female new in care and have stage 5 chronic kidney disease" + }, + { + "type": "stg_5_nw_chr_m", + "description": "Male new in care and have stage 5 chronic kidney disease" + }, + { + "type": "tot_stg_5_nw_chr", + "description": "PLHIV new in care and have stage 5 chronic kidney disease" + }, + { + "type": "stg_5_ct_chr_f", + "description": "Female continuing in care and have stage 5 chronic kidney disease" + }, + { + "type": "stg_5_ct_chr_m", + "description": "Male continuing in care and have stage 5 chronic kidney disease" + }, + { + "type": "tot_stg_5_ct_chr", + "description": "PLHIV continuing in care and have stage 5 chronic kidney disease" + }, + { + "type": "stg_5_nw_acu_f", + "required": "0", + "description": "Female new in care and have stage 5 acute kidney disease" + }, + { + "type": "stg_5_nw_acu_m", + "required": "0", + "description": "Male new in care and have stage 5 acute kidney disease" + }, + { + "type": "tot_stg_5_nw_acu", + "required": "0", + "description": "PLHIV new in care and have stage 5 acute kidney disease" + }, + { + "type": "stg_5_ct_acu_f", + "required": "0", + "description": "Female continuing in care and have stage 5 acute kidney disease" + }, + { + "type": "stg_5_ct_acu_m", + "required": "0", + "description": "Male continuing in care and have stage 5 acute kidney disease" + }, + { + "type": "tot_stg_5_ct_acu", + "required": "0", + "description": "PLHIV continuing in care and have stage 5 acute kidney disease" + } + ] + }, + { + "label": "Kidney Disease", + "indicator": [ + { + "type": "sub_tot_nw_chr_f", + "description": "Femle new in care and have chronic kidney disease" + }, + { + "type": "sub_tot_nw_chr_m", + "description": "Male new in care and have chronic kidney disease" + }, + { + "type": "sub_tot_nw_chr", + "description": "PLHIV new in care and have chronic kidney disease" + }, + { + "type": "sub_tot_ct_chr_f", + "description": "Female continuing in care and have chronic kidney disease" + }, + { + "type": "sub_tot_ct_chr_m", + "description": "Male continuing in care and have chronic kidney disease" + }, + { + "type": "sub_tot_ct_chr", + "description": "PLHIV continuing in care and have chronic kidney disease" + }, + { + "type": "sub_tot_nw_acu_f", + "description": "Female new in care and have acute kidney disease" + }, + { + "type": "sub_tot_nw_acu_m", + "description": "Male new in care and have acute kidney disease" + }, + { + "type": "sub_tot_nw_acu", + "description": "PLHIV new in care and have acute kidney disease" + }, + { + "type": "sub_tot_ct_acu_f", + "description": "Female continuing in care and have acute kidney disease" + }, + { + "type": "sub_tot_ct_acu_m", + "description": "Male continuing in care and have acute kidney disease" + }, + { + "type": "sub_tot_ct_acu", + "description": "PLHIV continuing in care and have acute kidney disease" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_chr", + "description": "PLHIV new in care and have chronic kidney disease" + }, + { + "type": "tot_ct_chr", + "description": "PLHIV continuing in care and have chronic kidney disease" + }, + { + "type": "tot_nw_acu", + "description": "PLHIV new in care and have acute kidney disease" + }, + { + "type": "tot_ct_acu", + "description": "PLHIV continuing in care and have acute kidney disease" + } + ] + }, + { + "label": "State Sub Total", + "indicator": [ + { + "type": "tot_chr", + "description": "PLHIV and have chronic kidney disease" + }, + { + "type": "tot_acu", + "description": "PLHIV and have acute kidney disease" + } + ] + }, + { + "label": "Grand Total Kidney Disorder", + "indicator": { + "type": "tot_kd", + "description": "PLHIV and have kidney disease" + } + } + ] + }, + { + "sectionTitle": "Neurologic Disease", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Migraine", + "indicator": [ + { + "type": "mg_nw_f", + "description": "Female new in care and have Migraine" + }, + { + "type": "mg_nw_m", + "description": "Male new in care and have Migraine" + }, + { + "type": "tot_mg_nw", + "description": "PLHIV new in care and have Migraine" + }, + { + "type": "mg_ct_f", + "description": "Female continuing in care and have Migraine" + }, + { + "type": "mg_ct_m", + "description": "Male continuing in care and have Migraine" + }, + { + "type": "tot_mg_ct", + "description": "PLHIV continuing in care and have Migraine" + } + ] + }, + { + "label": "Convulsive", + "indicator": [ + { + "type": "cnv_nw_f", + "description": "Female new in care and are Convulsive" + }, + { + "type": "cnv_nw_m", + "description": "Male new in care and are Convulsive" + }, + { + "type": "tot_cnv_nw", + "description": "PLHIV new in care and are Convulsive" + }, + { + "type": "cnv_ct_f", + "description": "Female continuing in care and are Convulsive" + }, + { + "type": "cnv_ct_m", + "description": "Male continuing in care and are Convulsive" + }, + { + "type": "tot_cnv_ct", + "description": "PLHIV continuing in care and are Convulsive" + } + ] + }, + { + "label": "Neurological Disease", + "indicator": [ + { + "type": "sub_tot_nw_neu_f", + "description": "Female new in care and are neurological disorder" + }, + { + "type": "sub_tot_nw_neu_m", + "description": "Male new in care and are neurological disorder" + }, + { + "type": "sub_tot_nw_neu", + "description": "PLHIV new in care and are neurological disorder" + }, + { + "type": "sub_tot_ct_neu_f", + "description": "Female continuing in care and are neurological disorder" + }, + { + "type": "sub_tot_ct_neu_m", + "description": "Male continuing in care and are neurological disorder" + }, + { + "type": "sub_tot_ct_neu", + "description": "PLHIV continuing in care and are neurological disorder" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_neu", + "description": "PLHIV new in care and are neurological disorder" + }, + { + "type": "tot_ct_neu", + "description": "PLHIV continuing in care and are neurological disorder" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_neu", + "description": "PLHIV having neurological disorder" + } + } + ] + }, + { + "sectionTitle": "Rheumatologic Disorders", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Arthritis", + "indicator": [ + { + "type": "ra_nw_f", + "description": "Female new in care and have Arthritis" + }, + { + "type": "ra_nw_m", + "description": "Male new in care and have Arthritis" + }, + { + "type": "tot_ra_nw", + "description": "PLHIV new in care and have Arthritis" + }, + { + "type": "ra_ct_f", + "description": "Female continuing in care and have Arthritis" + }, + { + "type": "ra_ct_m", + "description": "Male continuing in care and have Arthritis" + }, + { + "type": "tot_ra_ct", + "description": "PLHIV continuing in care and have Arthritis" + } + ] + }, + { + "label": "SLE", + "indicator": [ + { + "type": "sle_nw_f", + "description": "Female new in care and have SLE" + }, + { + "type": "sle_nw_m", + "description": "Male new in care and have SLE" + }, + { + "type": "tot_sle_nw", + "description": "PLHIV new in care and have SLE" + }, + { + "type": "sle_ct_f", + "description": "Female continuing in care and have SLE" + }, + { + "type": "sle_ct_m", + "description": "Male continuing in care and have SLE" + }, + { + "type": "tot_sle_ct", + "description": "PLHIV continuing in care and have SLE" + } + ] + }, + { + "label": "Rheumatologic Disorder", + "indicator": [ + { + "type": "sub_tot_nw_rhe_f", + "description": "Female new in care and have rheumatologic disorder" + }, + { + "type": "sub_tot_nw_rhe_m", + "description": "Male new in care and have rheumatologic disorder" + }, + { + "type": "sub_tot_nw_rhe", + "description": "PLHIV new in care and have rheumatologic disorder" + }, + { + "type": "sub_tot_ct_rhe_f", + "description": "Female continuing in care and have rheumatologic disorder" + }, + { + "type": "sub_tot_ct_rhe_m", + "description": "Male continuing in care and have rheumatologic disorder" + }, + { + "type": "sub_tot_ct_rhe", + "description": "PLHIV continuing in care and have rheumatologic disorder" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_rhe", + "description": "PLHIV new in care and have rheumatologic disorder" + }, + { + "type": "tot_ct_rhe", + "description": "PLHIV continuing in care and have rheumatologic disorder" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_rhe", + "description": "PLHIV having rheumatologic disorder" + } + } + ] + }, + { + "sectionTitle": "GI Malignancy", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Oesophageal", + "indicator": [ + { + "type": "oe_nw_f", + "description": "Female new in care and have Oesophageal Malignacies" + }, + { + "type": "oe_nw_m", + "description": "Male new in care and have Oesophageal Malignacies" + }, + { + "type": "tot_oe_nw", + "description": "PLHIV new in care and have Oesophageal Malignacies" + }, + { + "type": "oe_ct_f", + "description": "Female continuing in care and have Oesophageal Malignacies" + }, + { + "type": "oe_ct_m", + "description": "Male continuing in care and have Oesophageal Malignacies" + }, + { + "type": "tot_oe_ct", + "description": "PLHIV continuing in care and have Oesophageal Malignacies" + } + ] + }, + { + "label": "Pancreatic", + "indicator": [ + { + "Type": "pc_nw_f", + "description": "Female new in care and have Pancreatic Malignacies" + }, + { + "type": "pc_nw_m", + "description": "Male new in care and have Pancreatic Malignacies" + }, + { + "type": "tot_pc_nw", + "description": "PLHIV new in care and have Pancreatic Malignacies" + }, + { + "type": "pc_ct_f", + "description": "Female continuing in care and have Pancreatic Malignacies" + }, + { + "type": "pc_ct_m", + "description": "Male continuing in care and have Pancreatic Malignacies" + }, + { + "type": "tot_pc_ct", + "description": "PLHIV continuing in care and have Pancreatic Malignacies" + } + ] + }, + { + "label": "Stomach/Gastric", + "indicator": [ + { + "type": "gs_nw_f", + "description": "Female new in care and have Stomach/Gastric Malignacies" + }, + { + "type": "gs_nw_m", + "description": "Male new in care and have Stomach/Gastric Malignacies" + }, + { + "type": "tot_gs_nw", + "description": "PLHIV new in care and have Stomach/Gastric Malignacies" + }, + { + "type": "gs_ct_f", + "description": "Female continuing in care and have Stomach/Gastric Malignacies" + }, + { + "type": "gs_ct_m", + "description": "Male continuing in care and have Stomach/Gastric Malignacies" + }, + { + "type": "tot_gs_ct", + "description": "PLHIV continuing in care and have Stomach/Gastric Malignacies" + } + ] + }, + { + "label": "Colorectal", + "indicator": [ + { + "type": "col_nw_f", + "description": "Female new in care and have Colorectal Malignacies" + }, + { + "type": "col_nw_m", + "description": "Male new in care and have Colorectal Malignacies" + }, + { + "type": "tot_col_nw", + "description": "PLHIV new in care and have Colorectal Malignacies" + }, + { + "type": "col_ct_f", + "description": "Femla continuing in care and have Colorectal Malignacies" + }, + { + "type": "col_ct_m", + "description": "Male continuing in care and have Colorectal Malignacies" + }, + { + "type": "tot_col_ct", + "description": "PLHIV continuing in care and have Colorectal Malignacies" + } + ] + }, + { + "label": "Sub Total", + "indicator": [ + { + "type": "sub_tot_nw_gi_f", + "description": "Female new in care and have GI Malignacies" + }, + { + "type": "sub_tot_nw_gi_m", + "description": "Male new in care and have GI Malignacies" + }, + { + "type": "sub_tot_nw_gi", + "description": "PLHIV new in care and have GI Malignacies" + }, + { + "type": "sub_tot_ct_gi_f", + "description": "Female continuing in care and have GI Malignacies" + }, + { + "type": "sub_tot_ct_gi_m", + "description": "Male continuing in care and have GI Malignacies" + }, + { + "type": "sub_tot_ct_gi", + "description": "PLHIV continuing in care and have GI Malignacies" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_gi", + "description": "PLHIV new in care and have GI Malignacies" + }, + { + "type": "tot_ct_gi", + "description": "PLHIV continuing in care and have GI Malignacies" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_gi", + "description": "PLHIV having GI Malignacies" + } + } + ] + }, + { + "sectionTitle": "Female Reproductive Malignancy", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Ovarian", + "indicator": [ + { + "type": "ov_nw", + "description": "Female new in care and have Ovarian Malignacies" + }, + { + "type": "ov_ct", + "description": "Female continuing in care and have Ovarian Malignacies" + } + ] + }, + { + "label": "Cervical", + "indicator": [ + { + "type": "cv_nw", + "description": "Female new in care and have Cervical Malignacies" + }, + { + "type": "cv_ct", + "description": "Female continuing in care and have Cervical Malignacies" + } + ] + }, + { + "label": "Endometrial", + "indicator": [ + { + "type": "endo_nw", + "description": "Female new in care and have Endometrial Malignacies" + }, + { + "type": "endo_ct", + "description": "Female continuing in care and have Endometrial Malignacies" + } + ] + }, + { + "label": "Sub Total", + "indicator": [ + { + "type": "tot_f_rep_nw", + "description": "Female new in care and having Reproductive Malignacies" + }, + { + "type": "tot_f_rep_ct", + "description": "Female continuing in care and having Reproductive Malignacies" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_f_rep", + "description": "Female having Reproductive Malignacies" + } + } + ] + }, + { + "sectionTitle": "Male Reproductive Malignancy", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Prostate", + "indicator": [ + { + "type": "pro_nw", + "description": "Male new in care and having Prostate Malignacies" + }, + { + "type": "pro_ct", + "description": "Male continuing in care and having Prostate Malignacies" + } + ] + }, + { + "label": "Testicular", + "indicator": [ + { + "type": "ts_nw", + "description": "Male new in care and having Testicular Malignacies" + }, + { + "type": "ts_ct", + "description": "Male continuing in care and having Testicular Malignacies" + } + ] + }, + { + "label": "Sub Total", + "indicator": [ + { + "type": "tot_m_rep_nw", + "description": "Male new in care and having Reproductive Malignacies" + }, + { + "type": "tot_m_rep_ct", + "description": "Male continuing in care and having Reproductive Malignacies" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_m_rep", + "description": "Male having Reproductive Malignacies" + } + } + ] + }, + { + "sectionTitle": "ENT Malignancy", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Throat", + "indicator": [ + { + "type": "th_nw_f", + "description": "Female new in care and having Throat Malignacies" + }, + { + "type": "th_nw_m", + "description": "Male new in care and having Throat Malignacies" + }, + { + "type": "tot_th_nw", + "description": "PLHIV new in care and having Throat Malignacies" + }, + { + "type": "th_ct_f", + "description": "Female continuing in care and having Throat Malignacies" + }, + { + "type": "th_ct_m", + "description": "Male continuing in care and having Throat Malignacies" + }, + { + "type": "tot_th_ct", + "description": "PLHIV continuing in care and having Throat Malignacies" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_ent", + "description": "PLHIV new in care and having Throat Malignacies" + }, + { + "type": "tot_ct_ent", + "description": "PLHIV continuing in care and having Throat Malignacies" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_ent", + "description": "PLHIV having Throat Malignacies" + } + } + ] + }, + { + "sectionTitle": "Endocrine Malignancy", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Pituitary", + "indicator": [ + { + "type": "pit_nw_f", + "description": "Female new in care and having Pituitary Malignacies" + }, + { + "type": "pit_nw_m", + "description": "Male new in care and having Pituitary Malignacies" + }, + { + "type": "tot_pit_nw", + "description": "PLHIV new in care and having Pituitary Malignacies" + }, + { + "type": "pit_ct_f", + "description": "Female continuing in care and having Pituitary Malignacies" + }, + { + "type": "pit_ct_m", + "description": "Male continuing in care and having Pituitary Malignacies" + }, + { + "type": "tot_pit_ct", + "description": "PLHIV continuing in care and having Pituitary Malignacies" + } + ] + }, + { + "label": "Thyroid", + "indicator": [ + { + "type": "thy_nw_f", + "description": "Female new in care and having Thyroid Malignacies" + }, + { + "type": "thy_nw_m", + "description": "Male new in care and having Thyroid Malignacies" + }, + { + "type": "tot_thy_nw", + "description": "PLHIV new in care and having Thyroid Malignacies" + }, + { + "type": "thy_ct_f", + "description": "Female continuing in care and having Thyroid Malignacies" + }, + { + "type": "thy_ct_m", + "description": "Male continuing in care and having Thyroid Malignacies" + }, + { + "type": "tot_thy_ct", + "description": "PLHIV continuing in care and having Thyroid Malignacies" + } + ] + }, + { + "label": "Adrenal", + "indicator": [ + { + "type": "adr_nw_f", + "description": "Female new in care and having Adrenal Malignacies" + }, + { + "type": "adr_nw_m", + "description": "Male new in care and having Adrenal Malignacies" + }, + { + "type": "tot_adr_nw", + "description": "PLHIV new in care and having Adrenal Malignacies" + }, + { + "type": "adr_ct_f", + "description": "Female continuing in care and having Adrenal Malignacies" + }, + { + "type": "adr_ct_m", + "description": "Male continuing in care and having Adrenal Malignacies" + }, + { + "type": "tot_adr_ct", + "description": "PLHIV continuing in care and having Adrenal Malignacies" + } + ] + }, + { + "label": "Sub Total", + "indicator": [ + { + "type": "sub_tot_nw_endo_f", + "description": "Female new in care and having Endocrine Malignacies" + }, + { + "type": "sub_tot_nw_endo_m", + "description": "Male new in care and having Endocrine Malignacies" + }, + { + "type": "sub_tot_nw_endo", + "description": "PLHIV new in care and having Endocrine Malignacies" + }, + { + "type": "sub_tot_ct_endo_f", + "description": "Female continuing in care and having Endocrine Malignacies" + }, + { + "type": "sub_tot_ct_endo_m", + "description": "Male continuing in care and having Endocrine Malignacies" + }, + { + "type": "sub_tot_ct_endo", + "description": "PLHIV continuing in care and having Endocrine Malignacies" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_endo", + "description": "PLHIV new in care and having Endocrine Malignacies" + }, + { + "type": "tot_ct_endo", + "description": "PLHIV new in care and having Endocrine Malignacies" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_endo", + "description": "PLHIV having Endocrine Malignacies" + } + } + ] + }, + { + "sectionTitle": "Musculoskeletal Malignancy", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Osteosarcoma", + "indicator": [ + { + "type": "ost_nw_f", + "description": "Female new in care and having Osteosarcoma" + }, + { + "type": "ost_nw_m", + "description": "Male new in care and having Osteosarcoma" + }, + { + "type": "tot_ost_nw", + "description": "PLHIV new in care and having Osteosarcoma" + }, + { + "type": "ost_ct_f", + "description": "Female continuing in care and having Osteosarcoma" + }, + { + "type": "ost_ct_m", + "description": "Male continuing in care and having Osteosarcoma" + }, + { + "type": "tot_ost_ct", + "description": "PLHIV continuing in care and having Osteosarcoma" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_musk", + "description": "PLHIV new in care and having Musculoskeletal disorder" + }, + { + "type": "tot_ct_musk", + "description": "PLHIV continuing in care and having Musculoskeletal disorder" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_musk", + "description": "PLHIV having Musculoskeletal disorder" + } + } + ] + }, + { + "sectionTitle": "Haematological Malignancy", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Leukamia", + "indicator": [ + { + "type": "leu_nw_f", + "description": "Female new in care and having leukemia" + }, + { + "type": "leu_nw_m", + "description": "Male new in care and having leukemia" + }, + { + "type": "tot_leu_nw", + "description": "PLHIV new in care and having leukemia" + }, + { + "type": "leu_ct_f", + "description": "Female continuing in care and having leukemia" + }, + { + "type": "leu_ct_m", + "description": "Male continuing in care and having leukemia" + }, + { + "type": "tot_leu_ct", + "description": "PLHIV continuing in care and having leukemia" + } + ] + }, + { + "label": "Lymphoma", + "indicator": [ + { + "type": "lym_nw_f", + "description": "Female new in care and having Lymphoma" + }, + { + "type": "lym_nw_m", + "description": "Male new in care and having Lymphoma" + }, + { + "type": "tot_lym_nw", + "description": "PLHIV new in care and having Lymphoma" + }, + { + "type": "lym_ct_f", + "description": "Female continuing in care and having Lymphoma" + }, + { + "type": "lym_ct_m", + "description": "Male continuing in care and having Lymphoma" + }, + { + "type": "tot_lym_ct", + "description": "PLHIV continuing in care and having Lymphoma" + } + ] + }, + { + "label": "Sub Total", + "indicator": [ + { + "type": "sub_tot_nw_hae_f", + "description": "Female new in care and having Haematological disorder" + }, + { + "type": "sub_tot_nw_hae_m", + "description": "Male new in care and having Haematological disorder" + }, + { + "type": "sub_tot_nw_hae", + "description": "PLHIV new in care and having Haematological disorder" + }, + { + "type": "sub_tot_ct_hae_f", + "description": "Female continuing in care and having Haematological disorder" + }, + { + "type": "sub_tot_ct_hae_m", + "description": "Male continuing in care and having Haematological disorder" + }, + { + "type": "sub_tot_ct_hae", + "description": "PLHIV continuing in care and having Haematological disorder" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_hae", + "description": "PLHIV new in care and having Haematological disorder" + }, + { + "type": "tot_ct_hae", + "description": "PLHIV continuing in care and having Haematological disorder" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_hae", + "description": "PLHIV having Haematological disorder" + } + } + ] + }, + { + "sectionTitle": "Neurological Malignancy", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Gliomas, Glioneuronal and Neuronal Tumors", + "indicator": [ + { + "type": "ggn_nw_f", + "description": "Female new in care and having Gliomas/Glioneuronal/Neuronal Tumors" + }, + { + "type": "ggn_nw_m", + "description": "Male new in care and having Gliomas/Glioneuronal/Neuronal Tumors" + }, + { + "type": "tot_ggn_nw", + "description": "PLHIV new in care and having Gliomas/Glioneuronal/Neuronal Tumors" + }, + { + "type": "ggn_ct_f", + "description": "Female continuing in care and having Gliomas/Glioneuronal/Neuronal Tumors" + }, + { + "type": "ggn_ct_m", + "description": "Male continuing in care and having Gliomas/Glioneuronal/Neuronal Tumors" + }, + { + "type": "tot_ggn_ct", + "description": "PLHIV continuing in care and having Gliomas/Glioneuronal/Neuronal Tumors" + } + ] + }, + { + "label": "Choroid Plexus Tumors", + "indicator": [ + { + "type": "cpt_nw_f", + "description": "Female new in care and having Choroid Plexus Tumors" + }, + { + "type": "cpt_nw_m", + "description": "Male new in care and having Choroid Plexus Tumors" + }, + { + "type": "tot_cpt_nw", + "description": "PLHIV new in care and having Choroid Plexus Tumors" + }, + { + "type": "cpt_ct_f", + "description": "Female continuing in care and having Choroid Plexus Tumors" + }, + { + "type": "cpt_ct_m", + "description": "Male continuing in care and having Choroid Plexus Tumors" + }, + { + "type": "tot_cpt_ct", + "description": "PLHIV continuing in care and having Choroid Plexus Tumors" + } + ] + }, + { + "label": "Embryonal Tumors", + "indicator": [ + { + "type": "emb_nw_f", + "description": "Female new in care and having Embryonal Tumors" + }, + { + "type": "emb_nw_m", + "description": "Male new in care and having Embryonal Tumors" + }, + { + "type": "tot_emb_nw", + "description": "PLHIV new in care and having Embryonal Tumors" + }, + { + "type": "emb_ct_f", + "description": "Female continuing in care and having Embryonal Tumors" + }, + { + "type": "emb_ct_m", + "description": "Male continuing in care and having Embryonal Tumors" + }, + { + "type": "tot_emb_ct", + "description": "PLHIV continuing in care and having Embryonal Tumors" + } + ] + }, + { + "label": "Pineal Tumors", + "indicator": [ + { + "type": "pin_nw_f", + "description": "Female new in care and having Pineal Tumors" + }, + { + "type": "pin_nw_m", + "description": "Male new in care and having Pineal Tumors" + }, + { + "type": "tot_pin_nw", + "description": "PLHIV new in care and having Pineal Tumors" + }, + { + "type": "pin_ct_f", + "description": "Female continuing in care and having Pineal Tumors" + }, + { + "type": "pin_ct_m", + "description": "Male continuing in care and having Pineal Tumors" + }, + { + "type": "tot_pin_ct", + "description": "PLHIV continuing in care and having Pineal Tumors" + } + ] + }, + { + "label": "Meningiomas", + "indicator": [ + { + "type": "men_nw_f", + "description": "Female new in care and having Meningiomas Tumors" + }, + { + "type": "men_nw_m", + "description": "Male new in care and having Meningiomas Tumors" + }, + { + "type": "tot_men_nw", + "description": "PLHIV new in care and having Meningiomas Tumors" + }, + { + "type": "men_ct_f", + "description": "Female continuing in care and having Meningiomas Tumors" + }, + { + "type": "men_ct_m", + "description": "Male continuing in care and having Meningiomas Tumors" + }, + { + "type": "tot_men_ct", + "description": "PLHIV continuing in care and having Meningiomas Tumors" + } + ] + }, + { + "label": "Mesenchymal Tumors", + "indicator": [ + { + "type": "mes_nw_f", + "description": "Female new in care and having Mesenchymal Tumors" + }, + { + "type": "mes_nw_m", + "description": "Male new in care and having Mesenchymal Tumors" + }, + { + "type": "tot_mes_nw", + "description": "PLHIV new in care and having Mesenchymal Tumors" + }, + { + "type": "mes_ct_f", + "description": "Female continuing in care and having Mesenchymal Tumors" + }, + { + "type": "mes_ct_m", + "description": "Male continuing in care and having Mesenchymal Tumors" + }, + { + "type": "tot_mes_ct", + "description": "PLHIV continuing in care and having Mesenchymal Tumors" + } + ] + }, + { + "label": "Melanocytic", + "indicator": [ + { + "type": "mel_nw_f", + "description": "Female new in care and having Melanocytic Malignacies" + }, + { + "type": "mel_nw_m", + "description": "Male new in care and having Melanocytic Malignacies" + }, + { + "type": "tot_mel_nw", + "description": "PLHIV new in care and having Melanocytic Malignacies" + }, + { + "type": "mel_ct_f", + "description": "Female continuing in care and having Melanocytic Malignacies" + }, + { + "type": "mel_ct_m", + "description": "Male continuing in care and having Melanocytic Malignacies" + }, + { + "type": "tot_mel_ct", + "description": "PLHIV continuing in care and having Melanocytic Malignacies" + } + ] + }, + { + "label": "Haematolymphoid", + "indicator": [ + { + "type": "hly_nw_f", + "description": "Female new in care and having Haematolymphoid Malignacies" + }, + { + "type": "hly_nw_m", + "description": "Male new in care and having Haematolymphoid Malignacies" + }, + { + "type": "tot_hly_nw", + "description": "PLHIV new in care and having Haematolymphoid Malignacies" + }, + { + "type": "hly_ct_f", + "description": "Female continuing in care and having Haematolymphoid Malignacies" + }, + { + "type": "hly_ct_m", + "description": "Male continuing in care and having Haematolymphoid Malignacies" + }, + { + "type": "tot_hly_ct", + "description": "PLHIV continuing in care and having Haematolymphoid Malignacies" + } + ] + }, + { + "label": "Germ Cell Tumors", + "indicator": [ + { + "type": "gct_nw_f", + "description": "Female new in care and having Germ Cell Tumors" + }, + { + "type": "gct_nw_m", + "description": "Male new in care and having Germ Cell Tumors" + }, + { + "type": "tot_gct_nw", + "description": "PLHIV new in care and having Germ Cell Tumors" + }, + { + "type": "gct_ct_f", + "description": "Female continuing in care and having Germ Cell Tumors" + }, + { + "type": "gct_ct_m", + "description": "Male continuing in care and having Germ Cell Tumors" + }, + { + "type": "tot_gct_ct", + "description": "PLHIV continuing in care and having Germ Cell Tumors" + } + ] + }, + { + "label": "Sub Total", + "indicator": [ + { + "type": "sub_tot_nw_neu_malig_f", + "description": "Female new in care and having neurological Malignacies" + }, + { + "type": "sub_tot_nw_neu_malig_m", + "description": "Male new in care and having neurological Malignacies" + }, + { + "type": "sub_tot_nw_neu_malig", + "description": "PLHIV new in care and having neurological Malignacies" + }, + { + "type": "sub_tot_ct_neu_malig_f", + "description": "Female continuing in care and having neurological Malignacies" + }, + { + "type": "sub_tot_ct_neu_malig_m", + "description": "Male continuing in care and having neurological Malignacies" + }, + { + "type": "sub_tot_ct_neu_malig", + "description": "PLHIV continuing in care and having neurological Malignacies" + } + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + { + "type": "tot_nw_neu_malig", + "description": "PLHIV new in care and having neurological Malignacies" + }, + { + "type": "tot_ct_neu_malig", + "description": "PLHIV continuing in care and having neurological Malignacies" + } + ] + }, + { + "label": "Total", + "indicator": { + "type": "tot_neu_malig", + "description": "PLHIV having neurological Malignacies" + } + } + ] + } +] diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-patient-list-cols.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-patient-list-cols.json new file mode 100644 index 000000000..ea1290cf7 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-patient-list-cols.json @@ -0,0 +1,103 @@ +{ + "patientListCols": [ + { + "headerName": "CCC Number", + "field": "ccc_number", + "width": 150, + "pinned": true + }, + { + "headerName": "Name", + "field": "person_name", + "width": 250, + "pinned": true + }, + { + "headerName": "NUPI Identifier", + "field": "upi_number", + "width": 150, + "pinned": true + }, + { + "headerName": "Gender", + "field": "gender", + "width": 100 + }, + { + "headerName": "Age", + "field": "age", + "width": 100 + }, + { + "headerName": "Identifiers", + "field": "identifiers", + "width": 250 + }, + { + "headerName": "Phone Number", + "field": "phone_number", + "width": 150 + }, + { + "headerName": "Last Appointment", + "field": "last_appointment", + "width": 250 + }, + { + "headerName": "Latest RTC Date", + "field": "latest_rtc_date", + "width": 100 + }, + { + "headerName": "Latest VL", + "field": "latest_vl", + "width": 100 + }, + { + "headerName": "VL Category", + "field": "vl_category", + "width": 250 + }, + { + "headerName": "Latest VL Date", + "field": "latest_vl_date", + "width": 100 + }, + { + "headerName": "Previous VL", + "field": "previous_vl", + "width": 100 + }, + { + "headerName": "Previous VL Date", + "field": "previous_vl_date", + "width": 100 + }, + { + "headerName": "Covid-19 Screening Date", + "field": "covid_screening_date", + "width": 100 + }, + { + "headerName": "OVCID", + "field": "ovcid_id", + "width": 100 + }, + { + "headerName": "Covid-19 Vaccination Status", + "field": "covid_19_vaccination_status", + "width": 250 + }, + { + "headerName": "Nearest Center", + "field": "nearest_center", + "width": 100 + }, + { + "headerName": "Patient Uuid", + "field": "patient_uuid", + "width": 100, + "hide": true + } + ] +} diff --git a/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report.json b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report.json new file mode 100644 index 000000000..90ab4fbab --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report.json @@ -0,0 +1,27 @@ +{ + "reports": [ + "htnPlhivAggregate", + "dmPlhivAggregate", + "cvdPlhivAggregate", + "kdPlhivAggregate", + + "depPlhivAggregate", + "anxPlhivAggregate", + "bipPlhivAggregate", + "perPlhivAggregate", + "fedPlhivAggregate", + "ocdPlhivAggregate", + "genMDPlhivAggregate", + "stMDPlhivAggregate", + "totMDPlhivAggregate", + + "endoPlhivAggregate", + "entPlhivAggregate", + "frmPlhivAggregate", + "mrmPlhivAggregate", + "haemPlhivAggregate", + "muscPlhivAggregate", + "neuPlhivAggregate", + "rhePlhivAggregate" + ] +} diff --git a/app/routes/plhiv-ncd-v2-report.route.js b/app/routes/plhiv-ncd-v2-report.route.js new file mode 100644 index 000000000..c3142b4e9 --- /dev/null +++ b/app/routes/plhiv-ncd-v2-report.route.js @@ -0,0 +1,102 @@ +const authorizer = require('../../authorization/etl-authorizer'); +const etlHelpers = require('../../etl-helpers'); +const privileges = authorizer.getAllPrivileges(); +const preRequest = require('../../pre-request-processing'); +const { + PLHIVNCDv2SummaryReportService +} = require('../../service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service'); +const routes = [ + { + method: 'GET', + path: '/etl/plhiv-ncd-v2-monthly-report', + config: { + plugins: { + hapiAuthorization: { + role: privileges.canViewClinicDashBoard + } + }, + handler: function (request, reply) { + preRequest.resolveLocationIdsToLocationUuids(request, function () { + let requestParams = Object.assign({}, request.query, request.params); + requestParams.visitState = + requestParams.currentView === 'monthly' ? [0, 1] : [1]; + let reportParams = etlHelpers.getReportParams( + 'plhiv-ncd-v2-monthly-report', + ['startDate', 'endDate', 'locationUuids'], + requestParams + ); + reportParams.requestParams.isAggregated = true; + + let service = new PLHIVNCDv2SummaryReportService( + 'plhiv-ncd-v2-monthly-report', + reportParams.requestParams + ); + service + .generateReport(reportParams.requestParams) + .then((result) => { + reply(result); + }) + .catch((error) => { + reply(error); + }); + }); + }, + description: 'plhiv-ncd summary dataset', + notes: 'plhiv-ncd summary dataset', + tags: ['api'], + validate: { + options: { + allowUnknown: true + }, + params: {} + } + } + }, + { + method: 'GET', + path: '/etl/plhiv-ncd-v2-monthly-report-patient-list', + config: { + plugins: { + hapiAuthorization: { + role: privileges.canViewClinicDashBoard + } + }, + handler: function (request, reply) { + if (request.query.locationUuids) { + preRequest.resolveLocationIdsToLocationUuids(request, function () { + let requestParams = Object.assign( + {}, + request.query, + request.params + ); + requestParams.visitState = + requestParams.currentView === 'monthly' ? [0, 1] : [1]; + let reportParams = etlHelpers.getReportParams( + 'plhiv-ncd-v2-monthly-report', + ['startDate', 'endDate', 'locationUuids'], + requestParams + ); + delete reportParams.requestParams['gender']; + const plhivncdV2ReportService = new PLHIVNCDv2SummaryReportService( + 'plhiv-ncd-v2-monthly-report', + reportParams.requestParams + ); + plhivncdV2ReportService + .generatePatientListReport(reportParams.requestParams) + .then((result) => { + reply(result); + }) + .catch((error) => { + reply(error); + }); + }); + } + }, + description: + 'Get patient list for plhiv-ncd summary report of the location and month provided', + notes: 'Returns patient list of plhiv-ncd summary indicators', + tags: ['api'] + } + } +]; +exports.routes = (server) => server.route(routes); diff --git a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js new file mode 100644 index 000000000..d5f228bdc --- /dev/null +++ b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js @@ -0,0 +1,125 @@ +import ReportProcessorHelpersService from '../../app/reporting-framework/report-processor-helpers.service.js'; +import { MultiDatasetPatientlistReport } from '../../app/reporting-framework/multi-dataset-patientlist.report.js'; + +const _ = require('lodash'); +const Moment = require('moment'); + +const plhivncdV2ReportSections = require('../../app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json'); +const plhivncdV2ReportPatientListCols = require('../../app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-patient-list-cols.json'); + +const etlHelpers = require('../../etl-helpers.js'); + +export class PLHIVNCDv2SummaryReportService extends MultiDatasetPatientlistReport { + constructor(reportName, params) { + super(reportName, params); + params.hivMonthlyDatasetSource = 'etl.hiv_monthly_report_dataset_frozen'; + } + + generateReport(additionalParams) { + const that = this; + return new Promise((resolve, reject) => { + that + .getSourceTables() + .then((sourceTables) => { + that.params.hivMonthlyDatasetSource = + sourceTables.hivMonthlyDatasetSource; + super.generateReport(additionalParams).then((results) => { + if (additionalParams && additionalParams.type === 'patient-list') { + resolve(results); + } else { + let finalResult = []; + const reportProcessorHelpersService = new ReportProcessorHelpersService(); + for (let result of results) { + if ( + result.report && + result.report.reportSchemas && + result.report.reportSchemas.main && + result.report.reportSchemas.main.transFormDirectives + .joinColumn + ) { + finalResult = reportProcessorHelpersService.joinDataSets( + that.params[ + result.report.reportSchemas.main.transFormDirectives + .joinColumnParam + ] || + result.report.reportSchemas.main.transFormDirectives + .joinColumn, + finalResult, + result.results.results.results + ); + } + } + + resolve({ + queriesAndSchemas: results, + result: finalResult, + sectionDefinitions: plhivncdV2ReportSections, + indicatorDefinitions: [] + }); + } + }); + }) + .catch((error) => { + reject(error); + }); + }); + } + getSourceTables() { + const self = this; + return new Promise((resolve, reject) => { + let query = 'select * from etl.moh_731_last_release_month'; + let runner = self.getSqlRunner(); + + runner + .executeQuery(query) + .then((results) => { + const lastReleasedMonth = results[0]['last_released_month']; + let sourceTables = { + hivMonthlyDatasetSource: this.determineSourceTable( + self.params.endingMonth, + lastReleasedMonth + ) + }; + + resolve(sourceTables); + }) + .catch((error) => { + reject(error); + }); + }); + } + determineSourceTable(month, lastReleasedMonth) { + // set default source table to frozen table + let sourceTable = 'etl.hiv_monthly_report_dataset_frozen'; + if (Moment(lastReleasedMonth).isSameOrAfter(Moment(month))) { + sourceTable = 'etl.hiv_monthly_report_dataset_frozen'; + } else { + sourceTable = 'etl.hiv_monthly_report_dataset_v1_2'; + } + return sourceTable; + } + + generatePatientListReport(reportParams) { + const indicators = reportParams.requestIndicators.split(',') || []; + let self = this; + return new Promise((resolve, reject) => { + super + .generatePatientListReport(indicators) + .then((results) => { + let result = results.result; + results['results'] = { + results: result + }; + results['patientListCols'] = plhivncdV2ReportPatientListCols; + delete results['result']; + _.each(results.results.results, (row) => { + row.cur_meds = etlHelpers.getARVNames(row.cur_meds); + }); + resolve(results); + }) + .catch((err) => { + reject(err); + }); + }); + } +}