From 14ebd728bfe36b8614d0ccf1c5a760ad41335c6f Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 6 Nov 2023 09:13:28 +0300 Subject: [PATCH 01/40] POC-544-v2: Enhanced PLHIV-NCD Comorbidity Monthly report --- .../plhiv-ncd-v2-report-indicators.json | 584 ++++++++++++++++++ ...plhiv-ncd-v2-report-patient-list-cols.json | 103 +++ app/routes/plhiv-ncd-v2-report.route.js | 98 +++ .../plhiv-ncd-v2-summary.service.js | 126 ++++ 4 files changed, 911 insertions(+) create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-patient-list-cols.json create mode 100644 app/routes/plhiv-ncd-v2-report.route.js create mode 100644 service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js 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..f873cd35e --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json @@ -0,0 +1,584 @@ +[ + { + "sectionTitle": "", + "indicators": [ + { + "label": "Location", + "indicator": "location" + } + ] + }, + { + "sectionTitle": "Hypertensive", + "indicators": [ + { + "label": "Contolled", + "indicator": [ + "nw_ctld_htn_f", + "nw_ctld_htn_m", + "tot_nw_ctld_htn", + "ct_ctld_htn_f", + "ct_ctld_htn_m", + "tot_ct_ctld_htn" + ] + }, + { + "label": "Uncontrolled", + "indicator": [ + "nw_unctld_htn_f", + "nw_unctld_htn_m", + "tot_nw_unctld_htn", + "ct_unctld_htn_f", + "ct_unctld_htn_m", + "tot_ct_unctld_htn" + ] + }, + { + "label": "Unknown / Not Established", + "indicator": [ + "nw_unk_htn_f", + "nw_unk_htn_m", + "tot_nw_unk_htn", + "ct_unk_htn_f", + "ct_unk_htn_m", + "tot_ct_unk_htn" + ] + }, + { + "label": "Sub Total", + "indicator": ["nw_htn_m", "nw_htn_f", "nw_htn", "ct_htn_m", "ct_htn_f", "ct_htn"] + }, + { + "label": "tot", + "indicator": ["tot_died", "placeholder", "tot_died"] + } + ] + }, + { + "sectionTitle": "Diabetic", + "indicators": [ + { + "label": "Contolled", + "indicator": [ + "nw_ctld_dm_f", + "nw_ctld_dm_m", + "tot_nw_ctld_dm", + "ct_ctld_dm_f", + "ct_ctld_dm_m", + "tot_ct_ctld_dm" + ] + }, + { + "label": "Uncontrolled", + "indicator": [ + "nw_unctld_dm_f", + "nw_unctld_dm_m", + "tot_nw_unctld_dm", + "ct_unctld_dm_f", + "ct_unctld_dm_m", + "tot_ct_unctld_dm" + ] + }, + { + "label": "Unknown / Not Established", + "indicator": [ + "nw_unk_dm_f", + "nw_unk_dm_m", + "tot_nw_unk_dm", + "ct_unk_dm_f", + "ct_unk_dm_m", + "tot_ct_unk_dm" + ] + }, + { + "label": "Sub Total", + "indicator": ["nw_dm_m", "nw_dm_f", "nw_dm", "ct_dm_m", "ct_dm_f", "ct_dm"] + }, + { + "label": "tot", + "indicator": ["tot_died", "placeholder", "tot_died"] + } + ] + }, + { + "sectionTitle": "Kidney Disease", + "indicators": [ + { + "label": "Stage 1", + "indicator": [ + "stg_1_nw_chro_m", + "stg_1_nw_chro_f", + "tot_stg_1_nw_chro", + "stg_1_ct_chro_m", + "stg_1_ct_chro_f", + "tot_stg_1_ct_chro", + "stg_1_nw_act_m", + "stg_1_nw_act_f", + "tot_stg_1_nw_act", + "stg_1_ct_act_m", + "stg_1_ct_act_f", + "tot_stg_1_ct_act" + ] + }, + { + "label": "Stage 2", + "indicator": [ + "stg_2_nw_chro_m", + "stg_2_nw_chro_f", + "tot_stg_2_nw_chro", + "stg_2_ct_chro_m", + "stg_2_ct_chro_f", + "tot_stg_2_ct_chro", + "stg_2_nw_act_m", + "stg_2_nw_act_f", + "tot_stg_2_nw_act", + "stg_2_ct_act_m", + "stg_2_ct_act_f", + "tot_stg_2_ct_act" + ] + }, + { + "label": "Stage 3", + "indicator": [ + "stg_3_nw_chro_m", + "stg_3_nw_chro_f", + "tot_stg_3_nw_chro", + "stg_3_ct_chro_m", + "stg_3_ct_chro_f", + "tot_stg_3_ct_chro", + "stg_3_nw_act_m", + "stg_3_nw_act_f", + "tot_stg_3_nw_act", + "stg_3_ct_act_m", + "stg_3_ct_act_f", + "tot_stg_3_ct_act" + ] + }, + { + "label": "Stage 4", + "indicator": [ + "stg_4_nw_chro_m", + "stg_4_nw_chro_f", + "tot_stg_4_nw_chro", + "stg_4_ct_chro_m", + "stg_4_ct_chro_f", + "tot_stg_4_ct_chro", + "stg_4_nw_act_m", + "stg_4_nw_act_f", + "tot_stg_4_nw_act", + "stg_4_ct_act_m", + "stg_4_ct_act_f", + "tot_stg_4_ct_act" + ] + }, + { + "label": "Stage 5", + "indicator": [ + "stg_5_nw_chro_m", + "stg_5_nw_chro_f", + "tot_stg_5_nw_chro", + "stg_5_ct_chro_m", + "stg_5_ct_chro_f", + "tot_stg_5_ct_chro", + "stg_5_nw_act_m", + "stg_5_nw_act_f", + "tot_stg_5_nw_act", + "stg_5_ct_act_m", + "stg_5_ct_act_f", + "tot_stg_5_ct_act" + ] + } + ] + }, + { + "sectionTitle": "Cardiovascular Disease (other than hypertension)", + "indicators": [ + { + "label": "<1 year", + "indicator": [ + "f_iit_6_plus_less_1_year", + "m_iit_6_plus_less_1_year", + "iit_6_plus_less_1_year" + ] + }, + { + "label": "1 - 4 years", + "indicator": [ + "f_iit_6_plus_one_four_year", + "m_iit_6_plus_one_four_year", + "iit_6_plus_one_four_year" + ] + }, + { + "label": "5 - 9 years", + "indicator": [ + "f_iit_6_plus_5_9_year", + "m_iit_6_plus_5_9_year", + "iit_6_plus_5_9_year" + ] + }, + { + "label": "10 - 14 years", + "indicator": [ + "f_iit_6_plus_10_14_year", + "m_iit_6_plus_10_14_year", + "iit_6_plus_10_14_year" + ] + }, + { + "label": "15 - 19 years", + "indicator": [ + "f_iit_6_plus_15_19_year", + "m_iit_6_plus_15_19_year", + "iit_6_plus_15_19_year" + ] + }, + { + "label": "20 - 24 years", + "indicator": [ + "f_iit_6_plus_20_24_year", + "m_iit_6_plus_20_24_year", + "iit_6_plus_20_24_year" + ] + }, + { + "label": "25 - 29 years", + "indicator": [ + "f_iit_6_plus_25_29_year", + "m_iit_6_plus_25_29_year", + "iit_6_plus_25_29_year" + ] + }, + { + "label": "30 - 34 years", + "indicator": [ + "f_iit_6_plus_30_34_year", + "m_iit_6_plus_30_34_year", + "iit_6_plus_30_34_year" + ] + }, + { + "label": "35 - 39 years", + "indicator": [ + "f_iit_6_plus_35_39_year", + "m_iit_6_plus_35_39_year", + "iit_6_plus_35_39_year" + ] + }, + { + "label": "40 - 44 years", + "indicator": [ + "f_iit_6_plus_40_44_year", + "m_iit_6_plus_40_44_year", + "iit_6_plus_40_44_year" + ] + }, + { + "label": "45 - 49 years", + "indicator": [ + "f_iit_6_plus_45_49_year", + "m_iit_6_plus_45_49_year", + "iit_6_plus_45_49_year" + ] + }, + { + "label": "50 - 54 years", + "indicator": [ + "f_iit_6_plus_50_54_year", + "m_iit_6_plus_50_54_year", + "iit_6_plus_50_54_year" + ] + }, + { + "label": "55 - 59 years", + "indicator": [ + "f_iit_6_plus_55_59_year", + "m_iit_6_plus_55_59_year", + "iit_6_plus_55_59_year" + ] + }, + { + "label": "60 - 64 years", + "indicator": [ + "f_iit_6_plus_60_64_year", + "m_iit_6_plus_60_64_year", + "iit_6_plus_60_64_year" + ] + }, + { + "label": "65+ years", + "indicator": [ + "f_iit_6_plus_above_65_year", + "m_iit_6_plus_above_65_year", + "iit_6_plus_above_65_year" + ] + }, + { + "label": "Sub tot", + "indicator": ["f_iit_6_plus", "m_iit_6_plus"] + }, + { + "label": "tot", + "indicator": ["tot_iit_6_plus", "placeholder", "tot_iit_6_plus"] + } + ] + }, + { + "sectionTitle": "Transferred Out", + "indicators": [ + { + "label": "<1 year", + "indicator": [ + "f_to_less_1_year", + "m_to_less_1_year", + "to_less_1_year" + ] + }, + { + "label": "1 - 4 years", + "indicator": ["f_to_1_4_year", "m_to_1_4_year", "to_1_4_year"] + }, + { + "label": "5 - 9 years", + "indicator": ["f_to_5_9_year", "m_to_5_9_year", "to_5_9_year"] + }, + { + "label": "10 - 14 years", + "indicator": [ + "f_to_10_14_year", + "m_to_10_14_year", + "to_10_14_year" + ] + }, + { + "label": "15 - 19 years", + "indicator": [ + "f_to_15_19_year", + "m_to_15_19_year", + "to_15_19_year" + ] + }, + { + "label": "20 - 24 years", + "indicator": [ + "f_to_20_24_year", + "m_to_20_24_year", + "to_20_24_year" + ] + }, + { + "label": "25 - 29 years", + "indicator": [ + "f_to_25_29_year", + "m_to_25_29_year", + "to_25_29_year" + ] + }, + { + "label": "30 - 34 years", + "indicator": [ + "f_to_30_34_year", + "m_to_30_34_year", + "to_30_34_year" + ] + }, + { + "label": "35 - 39 years", + "indicator": [ + "f_to_35_39_year", + "m_to_35_39_year", + "to_35_39_year" + ] + }, + { + "label": "40 - 44 years", + "indicator": [ + "f_to_40_44_year", + "m_to_40_44_year", + "to_40_44_year" + ] + }, + { + "label": "45 - 49 years", + "indicator": [ + "f_to_45_49_year", + "m_to_45_49_year", + "to_45_49_year" + ] + }, + { + "label": "50 - 54 years", + "indicator": [ + "f_to_50_54_year", + "m_to_50_54_year", + "to_50_54_year" + ] + }, + { + "label": "55 - 59 years", + "indicator": [ + "f_to_55_59_year", + "m_to_55_59_year", + "to_55_59_year" + ] + }, + { + "label": "60 - 64 years", + "indicator": [ + "f_to_60_64_year", + "m_to_60_64_year", + "to_60_64_year" + ] + }, + { + "label": "65+ years", + "indicator": [ + "f_to_above_65_year", + "m_to_above_65_year", + "to_above_65_year" + ] + }, + { + "label": "Sub tot", + "indicator": ["f_to", "m_to"] + }, + { + "label": "tot", + "indicator": ["tot_to", "placeholder", "tot_to"] + } + ] + }, + { + "sectionTitle": "Refused (Stopped) Treatment", + "indicators": [ + { + "label": "<1 year", + "indicator": [ + "f_rst_less_1_year", + "m_rst_less_1_year", + "rst_less_1_year" + ] + }, + { + "label": "1 - 4 years", + "indicator": [ + "f_rst_1_4_year", + "m_rst_1_4_year", + "rst_1_4_year" + ] + }, + { + "label": "5 - 9 years", + "indicator": [ + "f_rst_5_9_year", + "m_rst_5_9_year", + "rst_5_9_year" + ] + }, + { + "label": "10 - 14 years", + "indicator": [ + "f_rst_10_14_year", + "m_rst_10_14_year", + "rst_10_14_year" + ] + }, + { + "label": "15 - 19 years", + "indicator": [ + "f_rst_15_19_year", + "m_rst_15_19_year", + "rst_15_19_year" + ] + }, + { + "label": "20 - 24 years", + "indicator": [ + "f_rst_20_24_year", + "m_rst_20_24_year", + "rst_20_24_year" + ] + }, + { + "label": "25 - 29 years", + "indicator": [ + "f_rst_25_29_year", + "m_rst_25_29_year", + "rst_25_29_year" + ] + }, + { + "label": "30 - 34 years", + "indicator": [ + "f_rst_30_34_year", + "m_rst_30_34_year", + "rst_30_34_year" + ] + }, + { + "label": "35 - 39 years", + "indicator": [ + "f_rst_35_39_year", + "m_rst_35_39_year", + "rst_35_39_year" + ] + }, + { + "label": "40 - 44 years", + "indicator": [ + "f_rst_40_44_year", + "m_rst_40_44_year", + "rst_40_44_year" + ] + }, + { + "label": "45 - 49 years", + "indicator": [ + "f_rst_45_49_year", + "m_rst_45_49_year", + "rst_45_49_year" + ] + }, + { + "label": "50 - 54 years", + "indicator": [ + "f_rst_50_54_year", + "m_rst_50_54_year", + "rst_50_54_year" + ] + }, + { + "label": "55 - 59 years", + "indicator": [ + "f_rst_55_59_year", + "m_rst_55_59_year", + "rst_55_59_year" + ] + }, + { + "label": "60 - 64 years", + "indicator": [ + "f_rst_60_64_year", + "m_rst_60_64_year", + "rst_60_64_year" + ] + }, + { + "label": "65+ years", + "indicator": [ + "f_rst_above_65_year", + "m_rst_above_65_year", + "rst_above_65_year" + ] + }, + { + "label": "Sub tot", + "indicator": ["f_rst", "m_rst"] + }, + { + "label": "tot", + "indicator": ["tot_rst", "placeholder", "tot_rst"] + } + ] + } +] 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/routes/plhiv-ncd-v2-report.route.js b/app/routes/plhiv-ncd-v2-report.route.js new file mode 100644 index 000000000..64cd08f9b --- /dev/null +++ b/app/routes/plhiv-ncd-v2-report.route.js @@ -0,0 +1,98 @@ +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-summary', + config: { + plugins: { + hapiAuthorization: { + role: privileges.canViewClinicDashBoard + } + }, + handler: function (request, reply) { + preRequest.resolveLocationIdsToLocationUuids(request, function () { + let requestParams = Object.assign({}, request.query, request.params); + let reportParams = etlHelpers.getReportParams( + 'plhiv-ncd-v2-summary-report', + ['endDate', 'locationUuids'], + requestParams + ); + reportParams.requestParams.isAggregated = true; + + let service = new PLHIVNCDv2SummaryReportService( + 'plhiv-ncd-v2-summary-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-summary-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 + ); + let reportParams = etlHelpers.getReportParams( + 'plhiv-ncd-v2-summary-report', + ['endDate', 'locationUuids'], + requestParams + ); + delete reportParams.requestParams['gender']; + const plhivncdV2ReportService = new PLHIVNCDv2SummaryReportService( + 'plhiv-ncd-v2-summary-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..4ed2f798c --- /dev/null +++ b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js @@ -0,0 +1,126 @@ +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) => { + console.log("source-table: ", 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); + }); + }); + } +} From 4b040cf9da6f6a0c635a60d295d5876c2428e99f Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 7 Nov 2023 16:54:46 +0300 Subject: [PATCH 02/40] POC-544-v2: Added all the needed indicators in the config --- .../plhiv-ncd-v2-report-indicators.json | 579 +++++++++--------- 1 file changed, 277 insertions(+), 302 deletions(-) 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 index f873cd35e..5297b0b96 100644 --- 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 @@ -14,43 +14,36 @@ { "label": "Contolled", "indicator": [ - "nw_ctld_htn_f", - "nw_ctld_htn_m", - "tot_nw_ctld_htn", - "ct_ctld_htn_f", - "ct_ctld_htn_m", - "tot_ct_ctld_htn" + "nw_ctld_htn_f","nw_ctld_htn_m","tot_nw_ctld_htn", + "ct_ctld_htn_f","ct_ctld_htn_m","tot_ct_ctld_htn" ] }, { "label": "Uncontrolled", "indicator": [ - "nw_unctld_htn_f", - "nw_unctld_htn_m", - "tot_nw_unctld_htn", - "ct_unctld_htn_f", - "ct_unctld_htn_m", - "tot_ct_unctld_htn" + "nw_unctld_htn_f","nw_unctld_htn_m","tot_nw_unctld_htn", + "ct_unctld_htn_f","ct_unctld_htn_m","tot_ct_unctld_htn" ] }, { "label": "Unknown / Not Established", "indicator": [ - "nw_unk_htn_f", - "nw_unk_htn_m", - "tot_nw_unk_htn", - "ct_unk_htn_f", - "ct_unk_htn_m", - "tot_ct_unk_htn" + "nw_unk_htn_f","nw_unk_htn_m","tot_nw_unk_htn", + "ct_unk_htn_f","ct_unk_htn_m","tot_ct_unk_htn" ] }, { "label": "Sub Total", - "indicator": ["nw_htn_m", "nw_htn_f", "nw_htn", "ct_htn_m", "ct_htn_f", "ct_htn"] + "indicator": [ + "nw_htn_m", "nw_htn_f", "nw_htn", + "ct_htn_m", "ct_htn_f", "ct_htn" + ] }, { - "label": "tot", - "indicator": ["tot_died", "placeholder", "tot_died"] + "label": "Total", + "indicator": [ + "tot_htn" + ] } ] }, @@ -60,43 +53,36 @@ { "label": "Contolled", "indicator": [ - "nw_ctld_dm_f", - "nw_ctld_dm_m", - "tot_nw_ctld_dm", - "ct_ctld_dm_f", - "ct_ctld_dm_m", - "tot_ct_ctld_dm" + "nw_ctld_dm_f","nw_ctld_dm_m","tot_nw_ctld_dm", + "ct_ctld_dm_f","ct_ctld_dm_m","tot_ct_ctld_dm" ] }, { "label": "Uncontrolled", "indicator": [ - "nw_unctld_dm_f", - "nw_unctld_dm_m", - "tot_nw_unctld_dm", - "ct_unctld_dm_f", - "ct_unctld_dm_m", - "tot_ct_unctld_dm" + "nw_unctld_dm_f","nw_unctld_dm_m","tot_nw_unctld_dm", + "ct_unctld_dm_f","ct_unctld_dm_m","tot_ct_unctld_dm" ] }, { "label": "Unknown / Not Established", "indicator": [ - "nw_unk_dm_f", - "nw_unk_dm_m", - "tot_nw_unk_dm", - "ct_unk_dm_f", - "ct_unk_dm_m", - "tot_ct_unk_dm" + "nw_unk_dm_f","nw_unk_dm_m","tot_nw_unk_dm", + "ct_unk_dm_f","ct_unk_dm_m","tot_ct_unk_dm" ] }, { "label": "Sub Total", - "indicator": ["nw_dm_m", "nw_dm_f", "nw_dm", "ct_dm_m", "ct_dm_f", "ct_dm"] + "indicator": [ + "nw_dm_m", "nw_dm_f", "nw_dm", + "ct_dm_m", "ct_dm_f", "ct_dm" + ] }, { - "label": "tot", - "indicator": ["tot_died", "placeholder", "tot_died"] + "label": "Tot", + "indicator": [ + "tot_dm" + ] } ] }, @@ -106,478 +92,467 @@ { "label": "Stage 1", "indicator": [ - "stg_1_nw_chro_m", - "stg_1_nw_chro_f", - "tot_stg_1_nw_chro", - "stg_1_ct_chro_m", - "stg_1_ct_chro_f", - "tot_stg_1_ct_chro", - "stg_1_nw_act_m", - "stg_1_nw_act_f", - "tot_stg_1_nw_act", - "stg_1_ct_act_m", - "stg_1_ct_act_f", - "tot_stg_1_ct_act" + "stg_1_nw_chr_m","stg_1_nw_chr_f","tot_stg_1_nw_chr", + "stg_1_ct_chr_m","stg_1_ct_chr_f","tot_stg_1_ct_chr", + "stg_1_nw_acu_m","stg_1_nw_acu_f","tot_stg_1_nw_acu", + "stg_1_ct_acu_m","stg_1_ct_acu_f","tot_stg_1_ct_acu" ] }, { "label": "Stage 2", "indicator": [ - "stg_2_nw_chro_m", - "stg_2_nw_chro_f", - "tot_stg_2_nw_chro", - "stg_2_ct_chro_m", - "stg_2_ct_chro_f", - "tot_stg_2_ct_chro", - "stg_2_nw_act_m", - "stg_2_nw_act_f", - "tot_stg_2_nw_act", - "stg_2_ct_act_m", - "stg_2_ct_act_f", - "tot_stg_2_ct_act" + "stg_2_nw_chr_m","stg_2_nw_chr_f","tot_stg_2_nw_chr", + "stg_2_ct_chr_m","stg_2_ct_chr_f","tot_stg_2_ct_chr", + "stg_2_nw_acu_m","stg_2_nw_acu_f","tot_stg_2_nw_acu", + "stg_2_ct_acu_m","stg_2_ct_acu_f","tot_stg_2_ct_acu" ] }, { "label": "Stage 3", "indicator": [ - "stg_3_nw_chro_m", - "stg_3_nw_chro_f", - "tot_stg_3_nw_chro", - "stg_3_ct_chro_m", - "stg_3_ct_chro_f", - "tot_stg_3_ct_chro", - "stg_3_nw_act_m", - "stg_3_nw_act_f", - "tot_stg_3_nw_act", - "stg_3_ct_act_m", - "stg_3_ct_act_f", - "tot_stg_3_ct_act" + "stg_3_nw_chr_m","stg_3_nw_chr_f","tot_stg_3_nw_chr", + "stg_3_ct_chr_m","stg_3_ct_chr_f","tot_stg_3_ct_chr", + "stg_3_nw_acu_m","stg_3_nw_acu_f","tot_stg_3_nw_acu", + "stg_3_ct_acu_m","stg_3_ct_acu_f","tot_stg_3_ct_acu" ] }, { "label": "Stage 4", "indicator": [ - "stg_4_nw_chro_m", - "stg_4_nw_chro_f", - "tot_stg_4_nw_chro", - "stg_4_ct_chro_m", - "stg_4_ct_chro_f", - "tot_stg_4_ct_chro", - "stg_4_nw_act_m", - "stg_4_nw_act_f", - "tot_stg_4_nw_act", - "stg_4_ct_act_m", - "stg_4_ct_act_f", - "tot_stg_4_ct_act" + "stg_4_nw_chr_m","stg_4_nw_chr_f","tot_stg_4_nw_chr", + "stg_4_ct_chr_m","stg_4_ct_chr_f","tot_stg_4_ct_chr", + "stg_4_nw_acu_m","stg_4_nw_acu_f","tot_stg_4_nw_acu", + "stg_4_ct_acu_m","stg_4_ct_acu_f","tot_stg_4_ct_acu" ] }, { "label": "Stage 5", "indicator": [ - "stg_5_nw_chro_m", - "stg_5_nw_chro_f", - "tot_stg_5_nw_chro", - "stg_5_ct_chro_m", - "stg_5_ct_chro_f", - "tot_stg_5_ct_chro", - "stg_5_nw_act_m", - "stg_5_nw_act_f", - "tot_stg_5_nw_act", - "stg_5_ct_act_m", - "stg_5_ct_act_f", - "tot_stg_5_ct_act" + "stg_5_nw_chr_m","stg_5_nw_chr_f","tot_stg_5_nw_chr", + "stg_5_ct_chr_m","stg_5_ct_chr_f","tot_stg_5_ct_chr", + "stg_5_nw_acu_m","stg_5_nw_acu_f","tot_stg_5_nw_acu", + "stg_5_ct_acu_m","stg_5_ct_acu_f","tot_stg_5_ct_acu" + ] + }, + { + "label": "Sub Sub Total", + "indicator": [ + "sub_tot_nw_chr_m", "sub_tot_nw_chr_f", "sub_tot_nw_chr", + "sub_tot_ct_chr_m", "sub_tot_ct_chr_f", "sub_tot_ct_chr", + "sub_tot_nw_acu_m", "sub_tot_nw_acu_f", "sub_tot_nw_acu", + "sub_tot_ct_acu_m", "sub_tot_ct_acu_f", "sub_tot_ct_acu" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_chr", "sub_tot_acu" + ] + }, + { + "label": "Total", + "indicator": [ + "tot_kd" ] } ] }, { - "sectionTitle": "Cardiovascular Disease (other than hypertension)", + "sectionTitle": "Cardiovascular Disease (other than Hypertension)", "indicators": [ { - "label": "<1 year", + "label": "Heart Failure", "indicator": [ - "f_iit_6_plus_less_1_year", - "m_iit_6_plus_less_1_year", - "iit_6_plus_less_1_year" + "hf_nw_m", "hf_nw_f", "tot_hf_nw", + "hf_ct_m", "hf_ct_f", "tot_hf_ct" ] }, { - "label": "1 - 4 years", + "label": "Myocardinal Infarction", "indicator": [ - "f_iit_6_plus_one_four_year", - "m_iit_6_plus_one_four_year", - "iit_6_plus_one_four_year" + "myo_inf_nw_m", "myo_inf_nw_f", "tot_myo_inf_nw", + "myo_inf_ct_m", "myo_inf_ct_f", "tot_myo_inf_ct" ] }, { - "label": "5 - 9 years", + "label": "Sub Total", "indicator": [ - "f_iit_6_plus_5_9_year", - "m_iit_6_plus_5_9_year", - "iit_6_plus_5_9_year" + "sub_tot_nw_cvd_m", "sub_tot_nw_cvd_f", "sub_tot_nw_cvd", + "sub_tot_ct_cvd_m", "sub_tot_ct_cvd_f", "sub_tot_ct_cvd" ] }, { - "label": "10 - 14 years", + "label": "Total", "indicator": [ - "f_iit_6_plus_10_14_year", - "m_iit_6_plus_10_14_year", - "iit_6_plus_10_14_year" + "tot_cvd" ] - }, + } + ] + }, + { + "sectionTitle": "Neurologic Disease", + "indicators": [ { - "label": "15 - 19 years", + "label": "Migraine", "indicator": [ - "f_iit_6_plus_15_19_year", - "m_iit_6_plus_15_19_year", - "iit_6_plus_15_19_year" + "mg_nw_m", "mg_nw_f", "tot_mg_nw", + "mg_ct_m", "mg_ct_f", "tot_mg_ct" ] }, { - "label": "20 - 24 years", + "label": "Convulsive", "indicator": [ - "f_iit_6_plus_20_24_year", - "m_iit_6_plus_20_24_year", - "iit_6_plus_20_24_year" + "cnv_nw_m", "cnv_nw_f", "tot_cnv_nw", + "cnv_ct_m", "cnv_ct_f", "tot_cnv_ct" ] }, { - "label": "25 - 29 years", + "label": "Sub Total", "indicator": [ - "f_iit_6_plus_25_29_year", - "m_iit_6_plus_25_29_year", - "iit_6_plus_25_29_year" + "sub_tot_nw_cnv_m", "sub_tot_nw_cnv_f", "sub_tot_nw_cnv", + "sub_tot_ct_cnv_m", "sub_tot_ct_cnv_f", "sub_tot_ct_cnv" ] }, { - "label": "30 - 34 years", + "label": "Total", "indicator": [ - "f_iit_6_plus_30_34_year", - "m_iit_6_plus_30_34_year", - "iit_6_plus_30_34_year" + "tot_cnv" ] - }, + } + ] + }, + { + "sectionTitle": "Rheumatologic", + "indicators": [ { - "label": "35 - 39 years", + "label": "Arthritis", "indicator": [ - "f_iit_6_plus_35_39_year", - "m_iit_6_plus_35_39_year", - "iit_6_plus_35_39_year" + "ra_nw_m", "ra_nw_f", "tot_ra_nw", + "ra_ct_m", "ra_ct_f", "tot_ra_ct" ] }, { - "label": "40 - 44 years", + "label": "SLE", "indicator": [ - "f_iit_6_plus_40_44_year", - "m_iit_6_plus_40_44_year", - "iit_6_plus_40_44_year" + "sle_nw_m", "sle_nw_f", "tot_sle_nw", + "sle_ct_m", "sle_ct_f", "tot_sle_ct" ] }, { - "label": "45 - 49 years", + "label": "Sub Total", "indicator": [ - "f_iit_6_plus_45_49_year", - "m_iit_6_plus_45_49_year", - "iit_6_plus_45_49_year" + "sub_tot_nw_rhe_m", "sub_tot_nw_rhe_f", "sub_tot_nw_rhe", + "sub_tot_ct_rhe_m", "sub_tot_ct_rhe_f", "sub_tot_ct_rhe" ] }, { - "label": "50 - 54 years", + "label": "Total", "indicator": [ - "f_iit_6_plus_50_54_year", - "m_iit_6_plus_50_54_year", - "iit_6_plus_50_54_year" + "tot_rhe" + ] + } + ] + }, + { + "sectionTitle": "Oncology/Malignacies", + "indicators": [ + ] + }, + { + "sectionTitle": "GI Malignacies", + "indicators": [ + { + "label": "Oesophageal", + "indicator": [ + "oe_nw_m", "oe_nw_f", "tot_oe_nw", + "oe_ct_m", "oe_ct_f", "tot_oe_ct" ] }, { - "label": "55 - 59 years", + "label": "Pancreatic", "indicator": [ - "f_iit_6_plus_55_59_year", - "m_iit_6_plus_55_59_year", - "iit_6_plus_55_59_year" + "pc_nw_m", "pc_nw_f", "tot_pc_nw", + "pc_ct_m", "pc_ct_f", "tot_pc_ct" ] }, { - "label": "60 - 64 years", + "label": "Stomach/Gastric", "indicator": [ - "f_iit_6_plus_60_64_year", - "m_iit_6_plus_60_64_year", - "iit_6_plus_60_64_year" + "gs_nw_m", "gs_nw_f", "tot_gs_nw", + "gs_ct_m", "gs_ct_f", "tot_gs_ct" ] }, { - "label": "65+ years", + "label": "Colorectal", "indicator": [ - "f_iit_6_plus_above_65_year", - "m_iit_6_plus_above_65_year", - "iit_6_plus_above_65_year" + "col_nw_m", "col_nw_f", "tot_col_nw", + "col_ct_m", "col_ct_f", "tot_col_ct" ] }, { - "label": "Sub tot", - "indicator": ["f_iit_6_plus", "m_iit_6_plus"] + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_gi_m", "sub_tot_nw_gi_f", "sub_tot_nw_gi", + "sub_tot_ct_gi_m", "sub_tot_ct_gi_f", "sub_tot_ct_gi" + ] }, { - "label": "tot", - "indicator": ["tot_iit_6_plus", "placeholder", "tot_iit_6_plus"] + "label": "Total", + "indicator": [ + "tot_gi" + ] } ] }, { - "sectionTitle": "Transferred Out", + "sectionTitle": "Female Reproductive", "indicators": [ { - "label": "<1 year", + "label": "Ovarian", "indicator": [ - "f_to_less_1_year", - "m_to_less_1_year", - "to_less_1_year" + "ov_nw", "ov_ct" ] }, { - "label": "1 - 4 years", - "indicator": ["f_to_1_4_year", "m_to_1_4_year", "to_1_4_year"] - }, - { - "label": "5 - 9 years", - "indicator": ["f_to_5_9_year", "m_to_5_9_year", "to_5_9_year"] + "label": "Cervical", + "indicator": [ + "cv_nw", "cv_ct" + ] }, { - "label": "10 - 14 years", + "label": "Endometrial", "indicator": [ - "f_to_10_14_year", - "m_to_10_14_year", - "to_10_14_year" + "endo_nw", "endo_ct" ] }, { - "label": "15 - 19 years", + "label": "Sub Total", "indicator": [ - "f_to_15_19_year", - "m_to_15_19_year", - "to_15_19_year" + "tot_f_rep_nw", "tot_f_rep_ct" ] }, { - "label": "20 - 24 years", + "label": "Total", "indicator": [ - "f_to_20_24_year", - "m_to_20_24_year", - "to_20_24_year" + "tot_f_rep" ] - }, + } + ] + }, + { + "sectionTitle": "Male Reproductive", + "indicators": [ { - "label": "25 - 29 years", + "label": "Prostate", "indicator": [ - "f_to_25_29_year", - "m_to_25_29_year", - "to_25_29_year" + "pro_nw", "pro_ct" ] }, { - "label": "30 - 34 years", + "label": "Testicular", "indicator": [ - "f_to_30_34_year", - "m_to_30_34_year", - "to_30_34_year" + "ts_nw", "ts_ct" ] }, { - "label": "35 - 39 years", + "label": "Sub Total", "indicator": [ - "f_to_35_39_year", - "m_to_35_39_year", - "to_35_39_year" + "tot_m_rep_nw", "tot_m_rep_ct" ] }, { - "label": "40 - 44 years", + "label": "Total", "indicator": [ - "f_to_40_44_year", - "m_to_40_44_year", - "to_40_44_year" + "tot_m_rep" ] - }, + } + ] + }, + { + "sectionTitle": "ENT Malignancies", + "indicators": [ { - "label": "45 - 49 years", + "label": "Throat", "indicator": [ - "f_to_45_49_year", - "m_to_45_49_year", - "to_45_49_year" + "th_nw_m", "th_nw_f", "tot_th_nw", + "th_ct_m", "th_ct_f", "tot_th_ct" ] }, { - "label": "50 - 54 years", + "label": "Total", "indicator": [ - "f_to_50_54_year", - "m_to_50_54_year", - "to_50_54_year" + "tot_ent" ] - }, + } + ] + }, + { + "sectionTitle": "Endocrine", + "indicators": [ { - "label": "55 - 59 years", + "label": "Pituitary", "indicator": [ - "f_to_55_59_year", - "m_to_55_59_year", - "to_55_59_year" + "pit_nw_m", "pit_nw_f", "tot_pit_nw", + "pit_ct_m", "pit_ct_f", "tot_pit_ct" ] }, { - "label": "60 - 64 years", + "label": "Thyroid", "indicator": [ - "f_to_60_64_year", - "m_to_60_64_year", - "to_60_64_year" + "thy_nw_m", "thy_nw_f", "tot_thy_nw", + "thy_ct_m", "thy_ct_f", "tot_thy_ct" ] }, { - "label": "65+ years", + "label": "Adrenal", "indicator": [ - "f_to_above_65_year", - "m_to_above_65_year", - "to_above_65_year" + "adr_nw_m", "adr_nw_f", "tot_adr_nw", + "adr_ct_m", "adr_ct_f", "tot_adr_ct" ] }, { - "label": "Sub tot", - "indicator": ["f_to", "m_to"] + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_endo_m", "sub_tot_nw_endo_f", "sub_tot_nw_endo", + "sub_tot_ct_endo_m", "sub_tot_ct_endo_f", "sub_tot_ct_endo" + ] }, { - "label": "tot", - "indicator": ["tot_to", "placeholder", "tot_to"] + "label": "Total", + "indicator": [ + "tot_endo" + ] } ] }, { - "sectionTitle": "Refused (Stopped) Treatment", + "sectionTitle": "Musculoskeletal", "indicators": [ { - "label": "<1 year", + "label": "Osteosarcoma", "indicator": [ - "f_rst_less_1_year", - "m_rst_less_1_year", - "rst_less_1_year" + "ost_nw_m", "ost_nw_f", "tot_ost_nw", + "ost_ct_m", "ost_ct_f", "tot_ost_ct" ] }, { - "label": "1 - 4 years", + "label": "Total", "indicator": [ - "f_rst_1_4_year", - "m_rst_1_4_year", - "rst_1_4_year" + "tot_musk" ] - }, + } + ] + }, + { + "sectionTitle": "Haematological", + "indicators": [ { - "label": "5 - 9 years", + "label": "Leukamia", "indicator": [ - "f_rst_5_9_year", - "m_rst_5_9_year", - "rst_5_9_year" + "leu_nw_m", "leu_nw_f", "tot_leu_nw", + "leu_ct_m", "leu_ct_f", "tot_leu_ct" ] }, { - "label": "10 - 14 years", + "label": "Lymphoma", "indicator": [ - "f_rst_10_14_year", - "m_rst_10_14_year", - "rst_10_14_year" + "lym_nw_m", "lym_nw_f", "tot_lym_nw", + "lym_ct_m", "lym_ct_f", "tot_lym_ct" ] }, { - "label": "15 - 19 years", + "label": "Sub Total", "indicator": [ - "f_rst_15_19_year", - "m_rst_15_19_year", - "rst_15_19_year" + "sub_tot_nw_hae_m", "sub_tot_nw_hae_f", "sub_tot_nw_hae", + "sub_tot_ct_hae_m", "sub_tot_ct_hae_f", "sub_tot_ct_hae" ] }, { - "label": "20 - 24 years", + "label": "Total", "indicator": [ - "f_rst_20_24_year", - "m_rst_20_24_year", - "rst_20_24_year" + "tot_hae" ] - }, + } + ] + }, + { + "sectionTitle": "Neurological", + "indicators": [ { - "label": "25 - 29 years", + "label": "Gliomas, Glioneuronal and Neuronal Tumors", "indicator": [ - "f_rst_25_29_year", - "m_rst_25_29_year", - "rst_25_29_year" + "ggn_nw_m", "ggn_nw_f", "tot_ggn_nw", + "ggn_ct_m", "ggn_ct_f", "tot_ggn_ct" ] }, { - "label": "30 - 34 years", + "label": "Choroid Plexus Tumors", "indicator": [ - "f_rst_30_34_year", - "m_rst_30_34_year", - "rst_30_34_year" + "cpt_nw_m", "cpt_nw_f", "tot_cpt_nw", + "cpt_ct_m", "cpt_ct_f", "tot_cpt_ct" ] }, { - "label": "35 - 39 years", + "label": "Embryonal Tumors", "indicator": [ - "f_rst_35_39_year", - "m_rst_35_39_year", - "rst_35_39_year" + "emb_nw_m", "emb_nw_f", "tot_emb_nw", + "emb_ct_m", "emb_ct_f", "tot_emb_ct" ] }, { - "label": "40 - 44 years", + "label": "Pineal Tumors", "indicator": [ - "f_rst_40_44_year", - "m_rst_40_44_year", - "rst_40_44_year" + "pin_nw_m", "pin_nw_f", "tot_pin_nw", + "pin_ct_m", "pin_ct_f", "tot_pin_ct" ] }, { - "label": "45 - 49 years", + "label": "Meningiomas", "indicator": [ - "f_rst_45_49_year", - "m_rst_45_49_year", - "rst_45_49_year" + "men_nw_m", "men_nw_f", "tot_men_nw", + "men_ct_m", "men_ct_f", "tot_men_ct" ] }, { - "label": "50 - 54 years", + "label": "Mesenchymal Tumors", "indicator": [ - "f_rst_50_54_year", - "m_rst_50_54_year", - "rst_50_54_year" + "mes_nw_m", "mes_nw_f", "tot_mes_nw", + "mes_ct_m", "mes_ct_f", "tot_mes_ct" ] }, { - "label": "55 - 59 years", + "label": "Melanocytic", "indicator": [ - "f_rst_55_59_year", - "m_rst_55_59_year", - "rst_55_59_year" + "mel_nw_m", "mel_nw_f", "tot_mel_nw", + "mel_ct_m", "mel_ct_f", "tot_mel_ct" ] }, { - "label": "60 - 64 years", + "label": "Haematolymphoid", "indicator": [ - "f_rst_60_64_year", - "m_rst_60_64_year", - "rst_60_64_year" + "hly_nw_m", "hly_nw_f", "tot_hly_nw", + "hly_ct_m", "hly_ct_f", "tot_hly_ct" ] }, { - "label": "65+ years", + "label": "Germ Cell Tumors", "indicator": [ - "f_rst_above_65_year", - "m_rst_above_65_year", - "rst_above_65_year" + "gct_nw_m", "gct_nw_f", "tot_gct_nw", + "gct_ct_m", "gct_ct_f", "tot_gct_ct" ] }, { - "label": "Sub tot", - "indicator": ["f_rst", "m_rst"] + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_neu_m", "sub_tot_nw_neu_f", "sub_tot_nw_neu", + "sub_tot_ct_neu_m", "sub_tot_ct_neu_f", "sub_tot_ct_neu" + ] }, { - "label": "tot", - "indicator": ["tot_rst", "placeholder", "tot_rst"] + "label": "Total", + "indicator": [ + "tot_neu" + ] } ] } From 054f22b1f3f11eeb9d6b4815012bd74c30b3745a Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 13 Nov 2023 11:47:29 +0300 Subject: [PATCH 03/40] POC-544-v2: Enhanced PLHIV NCD Report end points --- .../plhiv-ncd-v2-report-indicators.json | 712 +++++++++++++----- .../plhiv-ncd-v2-summary.service.js | 399 +++++++++- 2 files changed, 899 insertions(+), 212 deletions(-) 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 index 5297b0b96..f0a4c2d3a 100644 --- 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 @@ -1,558 +1,898 @@ [ { - "sectionTitle": "", + "sectionTitle": "Hypertensive", "indicators": [ { "label": "Location", "indicator": "location" - } - ] - }, - { - "sectionTitle": "Hypertensive", - "indicators": [ + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Contolled", "indicator": [ - "nw_ctld_htn_f","nw_ctld_htn_m","tot_nw_ctld_htn", - "ct_ctld_htn_f","ct_ctld_htn_m","tot_ct_ctld_htn" + "nw_ctld_htn_f", + "nw_ctld_htn_m", + "tot_nw_ctld_htn", + "ct_ctld_htn_f", + "ct_ctld_htn_m", + "tot_ct_ctld_htn" ] }, { "label": "Uncontrolled", "indicator": [ - "nw_unctld_htn_f","nw_unctld_htn_m","tot_nw_unctld_htn", - "ct_unctld_htn_f","ct_unctld_htn_m","tot_ct_unctld_htn" + "nw_unctld_htn_f", + "nw_unctld_htn_m", + "tot_nw_unctld_htn", + "ct_unctld_htn_f", + "ct_unctld_htn_m", + "tot_ct_unctld_htn" ] }, { "label": "Unknown / Not Established", "indicator": [ - "nw_unk_htn_f","nw_unk_htn_m","tot_nw_unk_htn", - "ct_unk_htn_f","ct_unk_htn_m","tot_ct_unk_htn" + "nw_unk_htn_f", + "nw_unk_htn_m", + "tot_nw_unk_htn", + "ct_unk_htn_f", + "ct_unk_htn_m", + "tot_ct_unk_htn" ] }, { "label": "Sub Total", "indicator": [ - "nw_htn_m", "nw_htn_f", "nw_htn", - "ct_htn_m", "ct_htn_f", "ct_htn" + "nw_htn_m", + "nw_htn_f", + "nw_htn", + "ct_htn_m", + "ct_htn_f", + "ct_htn" ] }, { "label": "Total", - "indicator": [ - "tot_htn" - ] + "indicator": "tot_htn" } ] }, { "sectionTitle": "Diabetic", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Contolled", "indicator": [ - "nw_ctld_dm_f","nw_ctld_dm_m","tot_nw_ctld_dm", - "ct_ctld_dm_f","ct_ctld_dm_m","tot_ct_ctld_dm" + "nw_ctld_dm_f", + "nw_ctld_dm_m", + "tot_nw_ctld_dm", + "ct_ctld_dm_f", + "ct_ctld_dm_m", + "tot_ct_ctld_dm" ] }, { "label": "Uncontrolled", "indicator": [ - "nw_unctld_dm_f","nw_unctld_dm_m","tot_nw_unctld_dm", - "ct_unctld_dm_f","ct_unctld_dm_m","tot_ct_unctld_dm" + "nw_unctld_dm_f", + "nw_unctld_dm_m", + "tot_nw_unctld_dm", + "ct_unctld_dm_f", + "ct_unctld_dm_m", + "tot_ct_unctld_dm" ] }, { "label": "Unknown / Not Established", "indicator": [ - "nw_unk_dm_f","nw_unk_dm_m","tot_nw_unk_dm", - "ct_unk_dm_f","ct_unk_dm_m","tot_ct_unk_dm" + "nw_unk_dm_f", + "nw_unk_dm_m", + "tot_nw_unk_dm", + "ct_unk_dm_f", + "ct_unk_dm_m", + "tot_ct_unk_dm" ] }, { "label": "Sub Total", "indicator": [ - "nw_dm_m", "nw_dm_f", "nw_dm", - "ct_dm_m", "ct_dm_f", "ct_dm" + "nw_dm_m", + "nw_dm_f", + "nw_dm", + "ct_dm_m", + "ct_dm_f", + "ct_dm" ] }, { - "label": "Tot", - "indicator": [ - "tot_dm" - ] + "label": "Total", + "indicator": "tot_dm" } ] }, { "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": [ - "stg_1_nw_chr_m","stg_1_nw_chr_f","tot_stg_1_nw_chr", - "stg_1_ct_chr_m","stg_1_ct_chr_f","tot_stg_1_ct_chr", - "stg_1_nw_acu_m","stg_1_nw_acu_f","tot_stg_1_nw_acu", - "stg_1_ct_acu_m","stg_1_ct_acu_f","tot_stg_1_ct_acu" + "stg_1_nw_chr_m", + "stg_1_nw_chr_f", + "tot_stg_1_nw_chr", + "stg_1_ct_chr_m", + "stg_1_ct_chr_f", + "tot_stg_1_ct_chr", + "stg_1_nw_acu_m", + "stg_1_nw_acu_f", + "tot_stg_1_nw_acu", + "stg_1_ct_acu_m", + "stg_1_ct_acu_f", + "tot_stg_1_ct_acu" ] }, { "label": "Stage 2", "indicator": [ - "stg_2_nw_chr_m","stg_2_nw_chr_f","tot_stg_2_nw_chr", - "stg_2_ct_chr_m","stg_2_ct_chr_f","tot_stg_2_ct_chr", - "stg_2_nw_acu_m","stg_2_nw_acu_f","tot_stg_2_nw_acu", - "stg_2_ct_acu_m","stg_2_ct_acu_f","tot_stg_2_ct_acu" + "stg_2_nw_chr_m", + "stg_2_nw_chr_f", + "tot_stg_2_nw_chr", + "stg_2_ct_chr_m", + "stg_2_ct_chr_f", + "tot_stg_2_ct_chr", + "stg_2_nw_acu_m", + "stg_2_nw_acu_f", + "tot_stg_2_nw_acu", + "stg_2_ct_acu_m", + "stg_2_ct_acu_f", + "tot_stg_2_ct_acu" ] }, { "label": "Stage 3", "indicator": [ - "stg_3_nw_chr_m","stg_3_nw_chr_f","tot_stg_3_nw_chr", - "stg_3_ct_chr_m","stg_3_ct_chr_f","tot_stg_3_ct_chr", - "stg_3_nw_acu_m","stg_3_nw_acu_f","tot_stg_3_nw_acu", - "stg_3_ct_acu_m","stg_3_ct_acu_f","tot_stg_3_ct_acu" + "stg_3_nw_chr_m", + "stg_3_nw_chr_f", + "tot_stg_3_nw_chr", + "stg_3_ct_chr_m", + "stg_3_ct_chr_f", + "tot_stg_3_ct_chr", + "stg_3_nw_acu_m", + "stg_3_nw_acu_f", + "tot_stg_3_nw_acu", + "stg_3_ct_acu_m", + "stg_3_ct_acu_f", + "tot_stg_3_ct_acu" ] }, { "label": "Stage 4", "indicator": [ - "stg_4_nw_chr_m","stg_4_nw_chr_f","tot_stg_4_nw_chr", - "stg_4_ct_chr_m","stg_4_ct_chr_f","tot_stg_4_ct_chr", - "stg_4_nw_acu_m","stg_4_nw_acu_f","tot_stg_4_nw_acu", - "stg_4_ct_acu_m","stg_4_ct_acu_f","tot_stg_4_ct_acu" + "stg_4_nw_chr_m", + "stg_4_nw_chr_f", + "tot_stg_4_nw_chr", + "stg_4_ct_chr_m", + "stg_4_ct_chr_f", + "tot_stg_4_ct_chr", + "stg_4_nw_acu_m", + "stg_4_nw_acu_f", + "tot_stg_4_nw_acu", + "stg_4_ct_acu_m", + "stg_4_ct_acu_f", + "tot_stg_4_ct_acu" ] }, { "label": "Stage 5", "indicator": [ - "stg_5_nw_chr_m","stg_5_nw_chr_f","tot_stg_5_nw_chr", - "stg_5_ct_chr_m","stg_5_ct_chr_f","tot_stg_5_ct_chr", - "stg_5_nw_acu_m","stg_5_nw_acu_f","tot_stg_5_nw_acu", - "stg_5_ct_acu_m","stg_5_ct_acu_f","tot_stg_5_ct_acu" + "stg_5_nw_chr_m", + "stg_5_nw_chr_f", + "tot_stg_5_nw_chr", + "stg_5_ct_chr_m", + "stg_5_ct_chr_f", + "tot_stg_5_ct_chr", + "stg_5_nw_acu_m", + "stg_5_nw_acu_f", + "tot_stg_5_nw_acu", + "stg_5_ct_acu_m", + "stg_5_ct_acu_f", + "tot_stg_5_ct_acu" ] }, { - "label": "Sub Sub Total", + "label": "Sub Total", "indicator": [ - "sub_tot_nw_chr_m", "sub_tot_nw_chr_f", "sub_tot_nw_chr", - "sub_tot_ct_chr_m", "sub_tot_ct_chr_f", "sub_tot_ct_chr", - "sub_tot_nw_acu_m", "sub_tot_nw_acu_f", "sub_tot_nw_acu", - "sub_tot_ct_acu_m", "sub_tot_ct_acu_f", "sub_tot_ct_acu" + "sub_tot_nw_chr_m", + "sub_tot_nw_chr_f", + "sub_tot_nw_chr", + "sub_tot_ct_chr_m", + "sub_tot_ct_chr_f", + "sub_tot_ct_chr", + "sub_tot_nw_acu_m", + "sub_tot_nw_acu_f", + "sub_tot_nw_acu", + "sub_tot_ct_acu_m", + "sub_tot_ct_acu_f", + "sub_tot_ct_acu" ] }, { - "label": "Sub Total", + "label": "Status Sub Total", "indicator": [ - "sub_tot_chr", "sub_tot_acu" + "sub_tot_nw_chr", + "sub_tot_ct_chr", + "sub_tot_nw_acu", + "sub_tot_ct_acu" ] }, { - "label": "Total", - "indicator": [ - "tot_kd" - ] + "label": "State Sub Total", + "indicator": ["sub_tot_chr", "sub_tot_acu"] + }, + { + "label": "Grand Total", + "indicator": "tot_kd" } ] }, { "sectionTitle": "Cardiovascular Disease (other than Hypertension)", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Heart Failure", "indicator": [ - "hf_nw_m", "hf_nw_f", "tot_hf_nw", - "hf_ct_m", "hf_ct_f", "tot_hf_ct" + "hf_nw_m", + "hf_nw_f", + "tot_hf_nw", + "hf_ct_m", + "hf_ct_f", + "tot_hf_ct" ] }, { "label": "Myocardinal Infarction", "indicator": [ - "myo_inf_nw_m", "myo_inf_nw_f", "tot_myo_inf_nw", - "myo_inf_ct_m", "myo_inf_ct_f", "tot_myo_inf_ct" + "myo_inf_nw_m", + "myo_inf_nw_f", + "tot_myo_inf_nw", + "myo_inf_ct_m", + "myo_inf_ct_f", + "tot_myo_inf_ct" ] }, { "label": "Sub Total", "indicator": [ - "sub_tot_nw_cvd_m", "sub_tot_nw_cvd_f", "sub_tot_nw_cvd", - "sub_tot_ct_cvd_m", "sub_tot_ct_cvd_f", "sub_tot_ct_cvd" + "sub_tot_nw_cvd_m", + "sub_tot_nw_cvd_f", + "sub_tot_nw_cvd", + "sub_tot_ct_cvd_m", + "sub_tot_ct_cvd_f", + "sub_tot_ct_cvd" ] }, { "label": "Total", - "indicator": [ - "tot_cvd" - ] + "indicator": "tot_cvd" } ] }, { "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": [ - "mg_nw_m", "mg_nw_f", "tot_mg_nw", - "mg_ct_m", "mg_ct_f", "tot_mg_ct" + "mg_nw_m", + "mg_nw_f", + "tot_mg_nw", + "mg_ct_m", + "mg_ct_f", + "tot_mg_ct" ] }, { "label": "Convulsive", "indicator": [ - "cnv_nw_m", "cnv_nw_f", "tot_cnv_nw", - "cnv_ct_m", "cnv_ct_f", "tot_cnv_ct" + "cnv_nw_m", + "cnv_nw_f", + "tot_cnv_nw", + "cnv_ct_m", + "cnv_ct_f", + "tot_cnv_ct" ] }, { "label": "Sub Total", "indicator": [ - "sub_tot_nw_cnv_m", "sub_tot_nw_cnv_f", "sub_tot_nw_cnv", - "sub_tot_ct_cnv_m", "sub_tot_ct_cnv_f", "sub_tot_ct_cnv" + "sub_tot_nw_cnv_m", + "sub_tot_nw_cnv_f", + "sub_tot_nw_cnv", + "sub_tot_ct_cnv_m", + "sub_tot_ct_cnv_f", + "sub_tot_ct_cnv" ] }, { "label": "Total", - "indicator": [ - "tot_cnv" - ] + "indicator": "tot_cnv" } ] }, { "sectionTitle": "Rheumatologic", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Arthritis", "indicator": [ - "ra_nw_m", "ra_nw_f", "tot_ra_nw", - "ra_ct_m", "ra_ct_f", "tot_ra_ct" + "ra_nw_m", + "ra_nw_f", + "tot_ra_nw", + "ra_ct_m", + "ra_ct_f", + "tot_ra_ct" ] }, { "label": "SLE", "indicator": [ - "sle_nw_m", "sle_nw_f", "tot_sle_nw", - "sle_ct_m", "sle_ct_f", "tot_sle_ct" + "sle_nw_m", + "sle_nw_f", + "tot_sle_nw", + "sle_ct_m", + "sle_ct_f", + "tot_sle_ct" ] }, { "label": "Sub Total", "indicator": [ - "sub_tot_nw_rhe_m", "sub_tot_nw_rhe_f", "sub_tot_nw_rhe", - "sub_tot_ct_rhe_m", "sub_tot_ct_rhe_f", "sub_tot_ct_rhe" + "sub_tot_nw_rhe_m", + "sub_tot_nw_rhe_f", + "sub_tot_nw_rhe", + "sub_tot_ct_rhe_m", + "sub_tot_ct_rhe_f", + "sub_tot_ct_rhe" ] }, { "label": "Total", - "indicator": [ - "tot_rhe" - ] + "indicator": "tot_rhe" } ] }, - { - "sectionTitle": "Oncology/Malignacies", - "indicators": [ - ] - }, { "sectionTitle": "GI Malignacies", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Oesophageal", "indicator": [ - "oe_nw_m", "oe_nw_f", "tot_oe_nw", - "oe_ct_m", "oe_ct_f", "tot_oe_ct" + "oe_nw_m", + "oe_nw_f", + "tot_oe_nw", + "oe_ct_m", + "oe_ct_f", + "tot_oe_ct" ] }, { "label": "Pancreatic", "indicator": [ - "pc_nw_m", "pc_nw_f", "tot_pc_nw", - "pc_ct_m", "pc_ct_f", "tot_pc_ct" + "pc_nw_m", + "pc_nw_f", + "tot_pc_nw", + "pc_ct_m", + "pc_ct_f", + "tot_pc_ct" ] }, { "label": "Stomach/Gastric", "indicator": [ - "gs_nw_m", "gs_nw_f", "tot_gs_nw", - "gs_ct_m", "gs_ct_f", "tot_gs_ct" + "gs_nw_m", + "gs_nw_f", + "tot_gs_nw", + "gs_ct_m", + "gs_ct_f", + "tot_gs_ct" ] }, { "label": "Colorectal", "indicator": [ - "col_nw_m", "col_nw_f", "tot_col_nw", - "col_ct_m", "col_ct_f", "tot_col_ct" + "col_nw_m", + "col_nw_f", + "tot_col_nw", + "col_ct_m", + "col_ct_f", + "tot_col_ct" ] }, { "label": "Sub Total", "indicator": [ - "sub_tot_nw_gi_m", "sub_tot_nw_gi_f", "sub_tot_nw_gi", - "sub_tot_ct_gi_m", "sub_tot_ct_gi_f", "sub_tot_ct_gi" + "sub_tot_nw_gi_m", + "sub_tot_nw_gi_f", + "sub_tot_nw_gi", + "sub_tot_ct_gi_m", + "sub_tot_ct_gi_f", + "sub_tot_ct_gi" ] }, { "label": "Total", - "indicator": [ - "tot_gi" - ] + "indicator": "tot_gi" } ] }, { "sectionTitle": "Female Reproductive", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, { "label": "Ovarian", - "indicator": [ - "ov_nw", "ov_ct" - ] + "indicator": ["ov_nw", "ov_ct"] }, { "label": "Cervical", - "indicator": [ - "cv_nw", "cv_ct" - ] + "indicator": ["cv_nw", "cv_ct"] }, { "label": "Endometrial", - "indicator": [ - "endo_nw", "endo_ct" - ] + "indicator": ["endo_nw", "endo_ct"] }, { "label": "Sub Total", - "indicator": [ - "tot_f_rep_nw", "tot_f_rep_ct" - ] + "indicator": ["tot_f_rep_nw", "tot_f_rep_ct"] }, { "label": "Total", - "indicator": [ - "tot_f_rep" - ] + "indicator": "tot_f_rep" } ] }, { "sectionTitle": "Male Reproductive", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, { "label": "Prostate", - "indicator": [ - "pro_nw", "pro_ct" - ] + "indicator": ["pro_nw", "pro_ct"] }, { "label": "Testicular", - "indicator": [ - "ts_nw", "ts_ct" - ] + "indicator": ["ts_nw", "ts_ct"] }, { "label": "Sub Total", - "indicator": [ - "tot_m_rep_nw", "tot_m_rep_ct" - ] + "indicator": ["tot_m_rep_nw", "tot_m_rep_ct"] }, { "label": "Total", - "indicator": [ - "tot_m_rep" - ] + "indicator": "tot_m_rep" } ] }, { "sectionTitle": "ENT Malignancies", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Throat", "indicator": [ - "th_nw_m", "th_nw_f", "tot_th_nw", - "th_ct_m", "th_ct_f", "tot_th_ct" + "th_nw_m", + "th_nw_f", + "tot_th_nw", + "th_ct_m", + "th_ct_f", + "tot_th_ct" ] }, { "label": "Total", - "indicator": [ - "tot_ent" - ] + "indicator": "tot_ent" } ] }, { "sectionTitle": "Endocrine", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Pituitary", "indicator": [ - "pit_nw_m", "pit_nw_f", "tot_pit_nw", - "pit_ct_m", "pit_ct_f", "tot_pit_ct" + "pit_nw_m", + "pit_nw_f", + "tot_pit_nw", + "pit_ct_m", + "pit_ct_f", + "tot_pit_ct" ] }, { "label": "Thyroid", "indicator": [ - "thy_nw_m", "thy_nw_f", "tot_thy_nw", - "thy_ct_m", "thy_ct_f", "tot_thy_ct" + "thy_nw_m", + "thy_nw_f", + "tot_thy_nw", + "thy_ct_m", + "thy_ct_f", + "tot_thy_ct" ] }, { "label": "Adrenal", "indicator": [ - "adr_nw_m", "adr_nw_f", "tot_adr_nw", - "adr_ct_m", "adr_ct_f", "tot_adr_ct" + "adr_nw_m", + "adr_nw_f", + "tot_adr_nw", + "adr_ct_m", + "adr_ct_f", + "tot_adr_ct" ] }, { "label": "Sub Total", "indicator": [ - "sub_tot_nw_endo_m", "sub_tot_nw_endo_f", "sub_tot_nw_endo", - "sub_tot_ct_endo_m", "sub_tot_ct_endo_f", "sub_tot_ct_endo" + "sub_tot_nw_endo_m", + "sub_tot_nw_endo_f", + "sub_tot_nw_endo", + "sub_tot_ct_endo_m", + "sub_tot_ct_endo_f", + "sub_tot_ct_endo" ] }, { "label": "Total", - "indicator": [ - "tot_endo" - ] + "indicator": "tot_endo" } ] }, { "sectionTitle": "Musculoskeletal", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Osteosarcoma", "indicator": [ - "ost_nw_m", "ost_nw_f", "tot_ost_nw", - "ost_ct_m", "ost_ct_f", "tot_ost_ct" + "ost_nw_m", + "ost_nw_f", + "tot_ost_nw", + "ost_ct_m", + "ost_ct_f", + "tot_ost_ct" ] }, { "label": "Total", - "indicator": [ - "tot_musk" - ] + "indicator": "tot_musk" } ] }, { "sectionTitle": "Haematological", "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, { "label": "Leukamia", "indicator": [ - "leu_nw_m", "leu_nw_f", "tot_leu_nw", - "leu_ct_m", "leu_ct_f", "tot_leu_ct" + "leu_nw_m", + "leu_nw_f", + "tot_leu_nw", + "leu_ct_m", + "leu_ct_f", + "tot_leu_ct" ] }, { "label": "Lymphoma", "indicator": [ - "lym_nw_m", "lym_nw_f", "tot_lym_nw", - "lym_ct_m", "lym_ct_f", "tot_lym_ct" + "lym_nw_m", + "lym_nw_f", + "tot_lym_nw", + "lym_ct_m", + "lym_ct_f", + "tot_lym_ct" ] }, { "label": "Sub Total", "indicator": [ - "sub_tot_nw_hae_m", "sub_tot_nw_hae_f", "sub_tot_nw_hae", - "sub_tot_ct_hae_m", "sub_tot_ct_hae_f", "sub_tot_ct_hae" + "sub_tot_nw_hae_m", + "sub_tot_nw_hae_f", + "sub_tot_nw_hae", + "sub_tot_ct_hae_m", + "sub_tot_ct_hae_f", + "sub_tot_ct_hae" ] }, { "label": "Total", - "indicator": [ - "tot_hae" - ] + "indicator": "tot_hae" } ] }, { "sectionTitle": "Neurological", "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": [ - "ggn_nw_m", "ggn_nw_f", "tot_ggn_nw", - "ggn_ct_m", "ggn_ct_f", "tot_ggn_ct" + "ggn_nw_m", + "ggn_nw_f", + "tot_ggn_nw", + "ggn_ct_m", + "ggn_ct_f", + "tot_ggn_ct" ] }, { "label": "Choroid Plexus Tumors", "indicator": [ - "cpt_nw_m", "cpt_nw_f", "tot_cpt_nw", - "cpt_ct_m", "cpt_ct_f", "tot_cpt_ct" + "cpt_nw_m", + "cpt_nw_f", + "tot_cpt_nw", + "cpt_ct_m", + "cpt_ct_f", + "tot_cpt_ct" ] }, { "label": "Embryonal Tumors", "indicator": [ - "emb_nw_m", "emb_nw_f", "tot_emb_nw", - "emb_ct_m", "emb_ct_f", "tot_emb_ct" + "emb_nw_m", + "emb_nw_f", + "tot_emb_nw", + "emb_ct_m", + "emb_ct_f", + "tot_emb_ct" ] }, { "label": "Pineal Tumors", "indicator": [ - "pin_nw_m", "pin_nw_f", "tot_pin_nw", - "pin_ct_m", "pin_ct_f", "tot_pin_ct" + "pin_nw_m", + "pin_nw_f", + "tot_pin_nw", + "pin_ct_m", + "pin_ct_f", + "tot_pin_ct" ] }, { "label": "Meningiomas", "indicator": [ - "men_nw_m", "men_nw_f", "tot_men_nw", - "men_ct_m", "men_ct_f", "tot_men_ct" + "men_nw_m", + "men_nw_f", + "tot_men_nw", + "men_ct_m", + "men_ct_f", + "tot_men_ct" ] }, { "label": "Mesenchymal Tumors", "indicator": [ - "mes_nw_m", "mes_nw_f", "tot_mes_nw", - "mes_ct_m", "mes_ct_f", "tot_mes_ct" + "mes_nw_m", + "mes_nw_f", + "tot_mes_nw", + "mes_ct_m", + "mes_ct_f", + "tot_mes_ct" ] }, { "label": "Melanocytic", "indicator": [ - "mel_nw_m", "mel_nw_f", "tot_mel_nw", - "mel_ct_m", "mel_ct_f", "tot_mel_ct" + "mel_nw_m", + "mel_nw_f", + "tot_mel_nw", + "mel_ct_m", + "mel_ct_f", + "tot_mel_ct" ] }, { "label": "Haematolymphoid", "indicator": [ - "hly_nw_m", "hly_nw_f", "tot_hly_nw", - "hly_ct_m", "hly_ct_f", "tot_hly_ct" + "hly_nw_m", + "hly_nw_f", + "tot_hly_nw", + "hly_ct_m", + "hly_ct_f", + "tot_hly_ct" ] }, { "label": "Germ Cell Tumors", "indicator": [ - "gct_nw_m", "gct_nw_f", "tot_gct_nw", - "gct_ct_m", "gct_ct_f", "tot_gct_ct" + "gct_nw_m", + "gct_nw_f", + "tot_gct_nw", + "gct_ct_m", + "gct_ct_f", + "tot_gct_ct" ] }, { "label": "Sub Total", "indicator": [ - "sub_tot_nw_neu_m", "sub_tot_nw_neu_f", "sub_tot_nw_neu", - "sub_tot_ct_neu_m", "sub_tot_ct_neu_f", "sub_tot_ct_neu" + "sub_tot_nw_neu_m", + "sub_tot_nw_neu_f", + "sub_tot_nw_neu", + "sub_tot_ct_neu_m", + "sub_tot_ct_neu_f", + "sub_tot_ct_neu" ] }, { "label": "Total", - "indicator": [ - "tot_neu" - ] + "indicator": "tot_neu" } ] } diff --git a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js index 4ed2f798c..e52ab2c5b 100644 --- a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js +++ b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js @@ -24,41 +24,388 @@ export class PLHIVNCDv2SummaryReportService extends MultiDatasetPatientlistRepor console.log("source-table: ", sourceTables) that.params.hivMonthlyDatasetSource = sourceTables.hivMonthlyDatasetSource; - super.generateReport(additionalParams).then((results) => { + // 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 - ); - } - } + // 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: [] + // }); + //test resolve({ - queriesAndSchemas: results, - result: finalResult, + queriesAndSchemas: [], + result: [ + { + "join_location": 1, + "location_uuid": "08feae7c-1352-11df-a1f1-0026b9348838", + "mfl_code": 15204, + "county": "Uasin Gishu", + "facility": "Moi Teaching Refferal Hospital", + "location_id": 1, + "location": "MTRH Module 1", + "nw_ctld_htn_m": 1, + "tot_nw_ctld_htn": 2, + "ct_ctld_htn_f": 10, + "ct_ctld_htn_m": 10, + "tot_ct_ctld_htn": 5, + "nw_unctld_htn_f": 4, + "nw_unctld_htn_m": 10, + "tot_nw_unctld_htn": 8, + "ct_unctld_htn_f": 5, + "ct_unctld_htn_m": 0, + "tot_ct_unctld_htn": 1, + "nw_unk_htn_f": 6, + "nw_unk_htn_m": 0, + "tot_nw_unk_htn": 2, + "ct_unk_htn_f": 5, + "ct_unk_htn_m": 3, + "tot_ct_unk_htn": 3, + "nw_htn_m": 5, + "nw_htn_f": 3, + "nw_htn": 9, + "ct_htn_m": 5, + "ct_htn_f": 7, + "ct_htn": 3, + "tot_htn": 10, + "nw_ctld_dm_f": 2, + "nw_ctld_dm_m": 1, + "tot_nw_ctld_dm": 0, + "ct_ctld_dm_f": 8, + "ct_ctld_dm_m": 6, + "tot_ct_ctld_dm": 2, + "nw_unctld_dm_f": 2, + "nw_unctld_dm_m": 10, + "tot_nw_unctld_dm": 6, + "ct_unctld_dm_f": 5, + "ct_unctld_dm_m": 2, + "tot_ct_unctld_dm": 5, + "nw_unk_dm_f": 0, + "nw_unk_dm_m": 4, + "tot_nw_unk_dm": 10, + "ct_unk_dm_f": 7, + "ct_unk_dm_m": 1, + "tot_ct_unk_dm": 5, + "nw_dm_m": 6, + "nw_dm_f": 8, + "nw_dm": 10, + "ct_dm_m": 4, + "ct_dm_f": 5, + "ct_dm": 6, + "tot_dm": 9, + "stg_1_nw_chr_m": 5, + "stg_1_nw_chr_f": 3, + "tot_stg_1_nw_chr": 3, + "stg_1_ct_chr_m": 9, + "stg_1_ct_chr_f": 6, + "tot_stg_1_ct_chr": 9, + "stg_1_nw_acu_m": 3, + "stg_1_nw_acu_f": 9, + "tot_stg_1_nw_acu": 3, + "stg_1_ct_acu_m": 7, + "stg_1_ct_acu_f": 3, + "tot_stg_1_ct_acu": 2, + "stg_2_nw_chr_m": 9, + "stg_2_nw_chr_f": 1, + "tot_stg_2_nw_chr": 10, + "stg_2_ct_chr_m": 3, + "stg_2_ct_chr_f": 9, + "tot_stg_2_ct_chr": 5, + "stg_2_nw_acu_m": 8, + "stg_2_nw_acu_f": 9, + "tot_stg_2_nw_acu": 2, + "stg_2_ct_acu_m": 3, + "stg_2_ct_acu_f": 0, + "tot_stg_2_ct_acu": 2, + "stg_3_nw_chr_m": 10, + "stg_3_nw_chr_f": 10, + "tot_stg_3_nw_chr": 7, + "stg_3_ct_chr_m": 2, + "stg_3_ct_chr_f": 5, + "tot_stg_3_ct_chr": 6, + "stg_3_nw_acu_m": 8, + "stg_3_nw_acu_f": 4, + "tot_stg_3_nw_acu": 2, + "stg_3_ct_acu_m": 0, + "stg_3_ct_acu_f": 3, + "tot_stg_3_ct_acu": 1, + "stg_4_nw_chr_m": 3, + "stg_4_nw_chr_f": 10, + "tot_stg_4_nw_chr": 10, + "stg_4_ct_chr_m": 2, + "stg_4_ct_chr_f": 9, + "tot_stg_4_ct_chr": 1, + "stg_4_nw_acu_m": 1, + "stg_4_nw_acu_f": 4, + "tot_stg_4_nw_acu": 8, + "stg_4_ct_acu_m": 7, + "stg_4_ct_acu_f": 2, + "tot_stg_4_ct_acu": 7, + "stg_5_nw_chr_m": 5, + "stg_5_nw_chr_f": 4, + "tot_stg_5_nw_chr": 9, + "stg_5_ct_chr_m": 8, + "stg_5_ct_chr_f": 8, + "tot_stg_5_ct_chr": 4, + "stg_5_nw_acu_m": 10, + "stg_5_nw_acu_f": 10, + "tot_stg_5_nw_acu": 4, + "stg_5_ct_acu_m": 6, + "stg_5_ct_acu_f": 2, + "tot_stg_5_ct_acu": 8, + "sub_tot_chr": 1, + "sub_tot_acu": 0, + "hf_nw_m": 9, + "hf_nw_f": 6, + "tot_hf_nw": 2, + "hf_ct_m": 7, + "hf_ct_f": 8, + "tot_hf_ct": 6, + "myo_inf_nw_m": 2, + "myo_inf_nw_f": 4, + "tot_myo_inf_nw": 4, + "myo_inf_ct_m": 5, + "myo_inf_ct_f": 3, + "tot_myo_inf_ct": 9, + "sub_tot_ct_cvd_m": 4, + "sub_tot_ct_cvd_f": 7, + "sub_tot_ct_cvd": 1, + "tot_cvd": 5, + "mg_nw_m": 7, + "mg_nw_f": 5, + "tot_mg_nw": 5, + "mg_ct_m": 3, + "mg_ct_f": 4, + "tot_mg_ct": 9, + "cnv_nw_m": 5, + "cnv_nw_f": 7, + "tot_cnv_nw": 10, + "cnv_ct_m": 5, + "cnv_ct_f": 7, + "tot_cnv_ct": 10, + "sub_tot_nw_cnv_m": 9, + "sub_tot_nw_cnv_f": 4, + "sub_tot_nw_cnv": 6, + "sub_tot_ct_cnv_m": 9, + "sub_tot_ct_cnv_f": 7, + "sub_tot_ct_cnv": 1, + "tot_cnv": 1, + "ra_nw_m": 10, + "ra_nw_f": 1, + "tot_ra_nw": 4, + "ra_ct_m": 8, + "ra_ct_f": 9, + "tot_ra_ct": 0, + "sle_nw_m": 9, + "sle_nw_f": 5, + "tot_sle_nw": 2, + "sle_ct_m": 2, + "sle_ct_f": 6, + "tot_sle_ct": 8, + "sub_tot_nw_rhe_m": 8, + "sub_tot_nw_rhe_f": 7, + "sub_tot_nw_rhe": 10, + "sub_tot_ct_rhe_m": 3, + "sub_tot_ct_rhe_f": 10, + "sub_tot_ct_rhe": 2, + "tot_rhe": 9, + "oe_nw_m": 8, + "oe_nw_f": 4, + "tot_oe_nw": 7, + "oe_ct_m": 3, + "oe_ct_f": 6, + "tot_oe_ct": 8, + "pc_nw_m": 9, + "pc_nw_f": 3, + "tot_pc_nw": 6, + "pc_ct_m": 5, + "pc_ct_f": 8, + "tot_pc_ct": 3, + "gs_nw_m": 2, + "gs_nw_f": 6, + "tot_gs_nw": 10, + "gs_ct_m": 1, + "gs_ct_f": 3, + "tot_gs_ct": 5, + "col_nw_m": 9, + "col_nw_f": 1, + "tot_col_nw": 6, + "col_ct_m": 9, + "col_ct_f": 10, + "tot_col_ct": 0, + "sub_tot_nw_gi_m": 1, + "sub_tot_nw_gi_f": 5, + "sub_tot_nw_gi": 10, + "sub_tot_ct_gi_m": 8, + "sub_tot_ct_gi_f": 10, + "sub_tot_ct_gi": 9, + "tot_gi": 10, + "ov_nw": 3, + "ov_ct": 10, + "cv_nw": 6, + "cv_ct": 1, + "endo_nw": 6, + "endo_ct": 5, + "tot_f_rep_nw": 10, + "tot_f_rep_ct": 7, + "tot_f_rep": 0, + "pro_nw": 4, + "pro_ct": 1, + "ts_nw": 0, + "ts_ct": 2, + "tot_m_rep_nw": 4, + "tot_m_rep_ct": 5, + "tot_m_rep": 9, + "th_nw_m": 9, + "th_nw_f": 6, + "tot_th_nw": 1, + "th_ct_m": 5, + "th_ct_f": 6, + "tot_th_ct": 1, + "pit_nw_m": 10, + "pit_nw_f": 10, + "tot_pit_nw": 10, + "pit_ct_m": 1, + "pit_ct_f": 8, + "tot_pit_ct": 7, + "thy_nw_m": 3, + "thy_nw_f": 7, + "tot_thy_nw": 9, + "thy_ct_m": 2, + "thy_ct_f": 6, + "tot_thy_ct": 10, + "adr_nw_m": 5, + "adr_nw_f": 4, + "tot_adr_nw": 6, + "adr_ct_m": 0, + "adr_ct_f": 5, + "tot_adr_ct": 1, + "sub_tot_nw_endo_m": 3, + "sub_tot_nw_endo_f": 10, + "sub_tot_nw_endo": 8, + "sub_tot_ct_endo_m": 7, + "sub_tot_ct_endo_f": 8, + "sub_tot_ct_endo": 3, + "tot_endo": 5, + "ost_nw_m": 5, + "ost_nw_f": 9, + "tot_ost_nw": 5, + "ost_ct_m": 9, + "ost_ct_f": 6, + "tot_ost_ct": 10, + "tot_musk": 1, + "leu_nw_m": 6, + "leu_nw_f": 10, + "tot_leu_nw": 10, + "leu_ct_m": 9, + "leu_ct_f": 9, + "tot_leu_ct": 2, + "lym_nw_m": 3, + "lym_nw_f": 3, + "tot_lym_nw": 6, + "lym_ct_m": 3, + "lym_ct_f": 0, + "tot_lym_ct": 5, + "sub_tot_nw_hae_m": 5, + "sub_tot_nw_hae_f": 4, + "sub_tot_nw_hae": 9, + "sub_tot_ct_hae_m": 7, + "sub_tot_ct_hae_f": 6, + "sub_tot_ct_hae": 10, + "tot_hae": 3, + "ggn_nw_m": 1, + "ggn_nw_f": 10, + "tot_ggn_nw": 8, + "ggn_ct_m": 4, + "ggn_ct_f": 5, + "tot_ggn_ct": 6, + "cpt_nw_m": 0, + "cpt_nw_f": 10, + "tot_cpt_nw": 1, + "cpt_ct_m": 8, + "cpt_ct_f": 3, + "tot_cpt_ct": 0, + "emb_nw_m": 1, + "emb_nw_f": 3, + "tot_emb_nw": 4, + "emb_ct_m": 4, + "emb_ct_f": 3, + "tot_emb_ct": 5, + "pin_nw_m": 3, + "pin_nw_f": 9, + "tot_pin_nw": 10, + "pin_ct_m": 5, + "pin_ct_f": 3, + "tot_pin_ct": 6, + "men_nw_m": 7, + "men_nw_f": 9, + "tot_men_nw": 10, + "men_ct_m": 6, + "men_ct_f": 5, + "tot_men_ct": 4, + "mes_nw_m": 2, + "mes_nw_f": 5, + "tot_mes_nw": 6, + "mes_ct_m": 3, + "mes_ct_f": 6, + "tot_mes_ct": 4, + "mel_nw_m": 0, + "mel_nw_f": 5, + "tot_mel_nw": 8, + "mel_ct_m": 2, + "mel_ct_f": 1, + "tot_mel_ct": 0, + "hly_nw_m": 8, + "hly_nw_f": 3, + "tot_hly_nw": 0, + "hly_ct_m": 9, + "hly_ct_f": 5, + "tot_hly_ct": 4, + "gct_nw_m": 7, + "gct_nw_f": 8, + "tot_gct_nw": 4, + "gct_ct_m": 1, + "gct_ct_f": 8, + "tot_gct_ct": 10, + "sub_tot_nw_neu_m": 1, + "sub_tot_nw_neu_f": 2, + "sub_tot_nw_neu": 9, + "sub_tot_ct_neu_m": 8, + "sub_tot_ct_neu_f": 3, + "sub_tot_ct_neu": 2, + "tot_neu": 2 + } + ], sectionDefinitions: plhivncdV2ReportSections, indicatorDefinitions: [] }); } - }); + // }); }) .catch((error) => { reject(error); From 4a46162cafa97258dd1e8179150af2f4934beae3 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Thu, 16 Nov 2023 10:19:17 +0300 Subject: [PATCH 04/40] POC-544-v2: update service --- .../plhiv-ncd-v2-summary.service.js | 689 +++++++++++++++++- 1 file changed, 683 insertions(+), 6 deletions(-) diff --git a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js index e52ab2c5b..3539bb1f6 100644 --- a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js +++ b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js @@ -21,7 +21,6 @@ export class PLHIVNCDv2SummaryReportService extends MultiDatasetPatientlistRepor that .getSourceTables() .then((sourceTables) => { - console.log("source-table: ", sourceTables) that.params.hivMonthlyDatasetSource = sourceTables.hivMonthlyDatasetSource; // super.generateReport(additionalParams).then((results) => { @@ -62,13 +61,691 @@ export class PLHIVNCDv2SummaryReportService extends MultiDatasetPatientlistRepor queriesAndSchemas: [], result: [ { - "join_location": 1, - "location_uuid": "08feae7c-1352-11df-a1f1-0026b9348838", - "mfl_code": 15204, + "join_location": 45, + "location_uuid": "08feae7c-1352-11df-a1f1-0026b0000000", + "mfl_code": 22222, "county": "Uasin Gishu", - "facility": "Moi Teaching Refferal Hospital", + "facility": "Kapseret", "location_id": 1, - "location": "MTRH Module 1", + "location": "Kapseret", + "nw_ctld_htn_m": 1, + "tot_nw_ctld_htn": 2, + "ct_ctld_htn_f": 10, + "ct_ctld_htn_m": 10, + "tot_ct_ctld_htn": 5, + "nw_unctld_htn_f": 4, + "nw_unctld_htn_m": 10, + "tot_nw_unctld_htn": 8, + "ct_unctld_htn_f": 5, + "ct_unctld_htn_m": 0, + "tot_ct_unctld_htn": 1, + "nw_unk_htn_f": 6, + "nw_unk_htn_m": 0, + "tot_nw_unk_htn": 2, + "ct_unk_htn_f": 5, + "ct_unk_htn_m": 3, + "tot_ct_unk_htn": 3, + "nw_htn_m": 5, + "nw_htn_f": 3, + "nw_htn": 9, + "ct_htn_m": 5, + "ct_htn_f": 7, + "ct_htn": 3, + "tot_htn": 10, + "nw_ctld_dm_f": 2, + "nw_ctld_dm_m": 1, + "tot_nw_ctld_dm": 0, + "ct_ctld_dm_f": 8, + "ct_ctld_dm_m": 6, + "tot_ct_ctld_dm": 2, + "nw_unctld_dm_f": 2, + "nw_unctld_dm_m": 10, + "tot_nw_unctld_dm": 6, + "ct_unctld_dm_f": 5, + "ct_unctld_dm_m": 2, + "tot_ct_unctld_dm": 5, + "nw_unk_dm_f": 0, + "nw_unk_dm_m": 4, + "tot_nw_unk_dm": 10, + "ct_unk_dm_f": 7, + "ct_unk_dm_m": 1, + "tot_ct_unk_dm": 5, + "nw_dm_m": 6, + "nw_dm_f": 8, + "nw_dm": 10, + "ct_dm_m": 4, + "ct_dm_f": 5, + "ct_dm": 6, + "tot_dm": 9, + "stg_1_nw_chr_m": 5, + "stg_1_nw_chr_f": 3, + "tot_stg_1_nw_chr": 3, + "stg_1_ct_chr_m": 9, + "stg_1_ct_chr_f": 6, + "tot_stg_1_ct_chr": 9, + "stg_1_nw_acu_m": 3, + "stg_1_nw_acu_f": 9, + "tot_stg_1_nw_acu": 3, + "stg_1_ct_acu_m": 7, + "stg_1_ct_acu_f": 3, + "tot_stg_1_ct_acu": 2, + "stg_2_nw_chr_m": 9, + "stg_2_nw_chr_f": 1, + "tot_stg_2_nw_chr": 10, + "stg_2_ct_chr_m": 3, + "stg_2_ct_chr_f": 9, + "tot_stg_2_ct_chr": 5, + "stg_2_nw_acu_m": 8, + "stg_2_nw_acu_f": 9, + "tot_stg_2_nw_acu": 2, + "stg_2_ct_acu_m": 3, + "stg_2_ct_acu_f": 0, + "tot_stg_2_ct_acu": 2, + "stg_3_nw_chr_m": 10, + "stg_3_nw_chr_f": 10, + "tot_stg_3_nw_chr": 7, + "stg_3_ct_chr_m": 2, + "stg_3_ct_chr_f": 5, + "tot_stg_3_ct_chr": 6, + "stg_3_nw_acu_m": 8, + "stg_3_nw_acu_f": 4, + "tot_stg_3_nw_acu": 2, + "stg_3_ct_acu_m": 0, + "stg_3_ct_acu_f": 3, + "tot_stg_3_ct_acu": 1, + "stg_4_nw_chr_m": 3, + "stg_4_nw_chr_f": 10, + "tot_stg_4_nw_chr": 10, + "stg_4_ct_chr_m": 2, + "stg_4_ct_chr_f": 9, + "tot_stg_4_ct_chr": 1, + "stg_4_nw_acu_m": 1, + "stg_4_nw_acu_f": 4, + "tot_stg_4_nw_acu": 8, + "stg_4_ct_acu_m": 7, + "stg_4_ct_acu_f": 2, + "tot_stg_4_ct_acu": 7, + "stg_5_nw_chr_m": 5, + "stg_5_nw_chr_f": 4, + "tot_stg_5_nw_chr": 9, + "stg_5_ct_chr_m": 8, + "stg_5_ct_chr_f": 8, + "tot_stg_5_ct_chr": 4, + "stg_5_nw_acu_m": 10, + "stg_5_nw_acu_f": 10, + "tot_stg_5_nw_acu": 4, + "stg_5_ct_acu_m": 6, + "stg_5_ct_acu_f": 2, + "tot_stg_5_ct_acu": 8, + "sub_tot_chr": 1, + "sub_tot_acu": 0, + "hf_nw_m": 9, + "hf_nw_f": 6, + "tot_hf_nw": 2, + "hf_ct_m": 7, + "hf_ct_f": 8, + "tot_hf_ct": 6, + "myo_inf_nw_m": 2, + "myo_inf_nw_f": 4, + "tot_myo_inf_nw": 4, + "myo_inf_ct_m": 5, + "myo_inf_ct_f": 3, + "tot_myo_inf_ct": 9, + "sub_tot_ct_cvd_m": 4, + "sub_tot_ct_cvd_f": 7, + "sub_tot_ct_cvd": 1, + "tot_cvd": 5, + "mg_nw_m": 7, + "mg_nw_f": 5, + "tot_mg_nw": 5, + "mg_ct_m": 3, + "mg_ct_f": 4, + "tot_mg_ct": 9, + "cnv_nw_m": 5, + "cnv_nw_f": 7, + "tot_cnv_nw": 10, + "cnv_ct_m": 5, + "cnv_ct_f": 7, + "tot_cnv_ct": 10, + "sub_tot_nw_cnv_m": 9, + "sub_tot_nw_cnv_f": 4, + "sub_tot_nw_cnv": 6, + "sub_tot_ct_cnv_m": 9, + "sub_tot_ct_cnv_f": 7, + "sub_tot_ct_cnv": 1, + "tot_cnv": 1, + "ra_nw_m": 10, + "ra_nw_f": 1, + "tot_ra_nw": 4, + "ra_ct_m": 8, + "ra_ct_f": 9, + "tot_ra_ct": 0, + "sle_nw_m": 9, + "sle_nw_f": 5, + "tot_sle_nw": 2, + "sle_ct_m": 2, + "sle_ct_f": 6, + "tot_sle_ct": 8, + "sub_tot_nw_rhe_m": 8, + "sub_tot_nw_rhe_f": 7, + "sub_tot_nw_rhe": 10, + "sub_tot_ct_rhe_m": 3, + "sub_tot_ct_rhe_f": 10, + "sub_tot_ct_rhe": 2, + "tot_rhe": 9, + "oe_nw_m": 8, + "oe_nw_f": 4, + "tot_oe_nw": 7, + "oe_ct_m": 3, + "oe_ct_f": 6, + "tot_oe_ct": 8, + "pc_nw_m": 9, + "pc_nw_f": 3, + "tot_pc_nw": 6, + "pc_ct_m": 5, + "pc_ct_f": 8, + "tot_pc_ct": 3, + "gs_nw_m": 2, + "gs_nw_f": 6, + "tot_gs_nw": 10, + "gs_ct_m": 1, + "gs_ct_f": 3, + "tot_gs_ct": 5, + "col_nw_m": 9, + "col_nw_f": 1, + "tot_col_nw": 6, + "col_ct_m": 9, + "col_ct_f": 10, + "tot_col_ct": 0, + "sub_tot_nw_gi_m": 1, + "sub_tot_nw_gi_f": 5, + "sub_tot_nw_gi": 10, + "sub_tot_ct_gi_m": 8, + "sub_tot_ct_gi_f": 10, + "sub_tot_ct_gi": 9, + "tot_gi": 10, + "ov_nw": 3, + "ov_ct": 10, + "cv_nw": 6, + "cv_ct": 1, + "endo_nw": 6, + "endo_ct": 5, + "tot_f_rep_nw": 10, + "tot_f_rep_ct": 7, + "tot_f_rep": 0, + "pro_nw": 4, + "pro_ct": 1, + "ts_nw": 0, + "ts_ct": 2, + "tot_m_rep_nw": 4, + "tot_m_rep_ct": 5, + "tot_m_rep": 9, + "th_nw_m": 9, + "th_nw_f": 6, + "tot_th_nw": 1, + "th_ct_m": 5, + "th_ct_f": 6, + "tot_th_ct": 1, + "pit_nw_m": 10, + "pit_nw_f": 10, + "tot_pit_nw": 10, + "pit_ct_m": 1, + "pit_ct_f": 8, + "tot_pit_ct": 7, + "thy_nw_m": 3, + "thy_nw_f": 7, + "tot_thy_nw": 9, + "thy_ct_m": 2, + "thy_ct_f": 6, + "tot_thy_ct": 10, + "adr_nw_m": 5, + "adr_nw_f": 4, + "tot_adr_nw": 6, + "adr_ct_m": 0, + "adr_ct_f": 5, + "tot_adr_ct": 1, + "sub_tot_nw_endo_m": 3, + "sub_tot_nw_endo_f": 10, + "sub_tot_nw_endo": 8, + "sub_tot_ct_endo_m": 7, + "sub_tot_ct_endo_f": 8, + "sub_tot_ct_endo": 3, + "tot_endo": 5, + "ost_nw_m": 5, + "ost_nw_f": 9, + "tot_ost_nw": 5, + "ost_ct_m": 9, + "ost_ct_f": 6, + "tot_ost_ct": 10, + "tot_musk": 1, + "leu_nw_m": 6, + "leu_nw_f": 10, + "tot_leu_nw": 10, + "leu_ct_m": 9, + "leu_ct_f": 9, + "tot_leu_ct": 2, + "lym_nw_m": 3, + "lym_nw_f": 3, + "tot_lym_nw": 6, + "lym_ct_m": 3, + "lym_ct_f": 0, + "tot_lym_ct": 5, + "sub_tot_nw_hae_m": 5, + "sub_tot_nw_hae_f": 4, + "sub_tot_nw_hae": 9, + "sub_tot_ct_hae_m": 7, + "sub_tot_ct_hae_f": 6, + "sub_tot_ct_hae": 10, + "tot_hae": 3, + "ggn_nw_m": 1, + "ggn_nw_f": 10, + "tot_ggn_nw": 8, + "ggn_ct_m": 4, + "ggn_ct_f": 5, + "tot_ggn_ct": 6, + "cpt_nw_m": 0, + "cpt_nw_f": 10, + "tot_cpt_nw": 1, + "cpt_ct_m": 8, + "cpt_ct_f": 3, + "tot_cpt_ct": 0, + "emb_nw_m": 1, + "emb_nw_f": 3, + "tot_emb_nw": 4, + "emb_ct_m": 4, + "emb_ct_f": 3, + "tot_emb_ct": 5, + "pin_nw_m": 3, + "pin_nw_f": 9, + "tot_pin_nw": 10, + "pin_ct_m": 5, + "pin_ct_f": 3, + "tot_pin_ct": 6, + "men_nw_m": 7, + "men_nw_f": 9, + "tot_men_nw": 10, + "men_ct_m": 6, + "men_ct_f": 5, + "tot_men_ct": 4, + "mes_nw_m": 2, + "mes_nw_f": 5, + "tot_mes_nw": 6, + "mes_ct_m": 3, + "mes_ct_f": 6, + "tot_mes_ct": 4, + "mel_nw_m": 0, + "mel_nw_f": 5, + "tot_mel_nw": 8, + "mel_ct_m": 2, + "mel_ct_f": 1, + "tot_mel_ct": 0, + "hly_nw_m": 8, + "hly_nw_f": 3, + "tot_hly_nw": 0, + "hly_ct_m": 9, + "hly_ct_f": 5, + "tot_hly_ct": 4, + "gct_nw_m": 7, + "gct_nw_f": 8, + "tot_gct_nw": 4, + "gct_ct_m": 1, + "gct_ct_f": 8, + "tot_gct_ct": 10, + "sub_tot_nw_neu_m": 1, + "sub_tot_nw_neu_f": 2, + "sub_tot_nw_neu": 9, + "sub_tot_ct_neu_m": 8, + "sub_tot_ct_neu_f": 3, + "sub_tot_ct_neu": 2, + "tot_neu": 2 + }, + { + "join_location": 1, + "location_uuid": "08feae7c-1352-11df-a1f1-0026b9348838", + "mfl_code": 15204, + "county": "Uasin Gishu", + "facility": "Moi Teaching Refferal Hospital", + "location_id": 1, + "location": "MTRH Module 1", + "nw_ctld_htn_m": 1, + "tot_nw_ctld_htn": 2, + "ct_ctld_htn_f": 10, + "ct_ctld_htn_m": 10, + "tot_ct_ctld_htn": 5, + "nw_unctld_htn_f": 4, + "nw_unctld_htn_m": 10, + "tot_nw_unctld_htn": 8, + "ct_unctld_htn_f": 5, + "ct_unctld_htn_m": 0, + "tot_ct_unctld_htn": 1, + "nw_unk_htn_f": 6, + "nw_unk_htn_m": 0, + "tot_nw_unk_htn": 2, + "ct_unk_htn_f": 5, + "ct_unk_htn_m": 3, + "tot_ct_unk_htn": 3, + "nw_htn_m": 5, + "nw_htn_f": 3, + "nw_htn": 9, + "ct_htn_m": 5, + "ct_htn_f": 7, + "ct_htn": 3, + "tot_htn": 10, + "nw_ctld_dm_f": 2, + "nw_ctld_dm_m": 1, + "tot_nw_ctld_dm": 0, + "ct_ctld_dm_f": 8, + "ct_ctld_dm_m": 6, + "tot_ct_ctld_dm": 2, + "nw_unctld_dm_f": 2, + "nw_unctld_dm_m": 10, + "tot_nw_unctld_dm": 6, + "ct_unctld_dm_f": 5, + "ct_unctld_dm_m": 2, + "tot_ct_unctld_dm": 5, + "nw_unk_dm_f": 0, + "nw_unk_dm_m": 4, + "tot_nw_unk_dm": 10, + "ct_unk_dm_f": 7, + "ct_unk_dm_m": 1, + "tot_ct_unk_dm": 5, + "nw_dm_m": 6, + "nw_dm_f": 8, + "nw_dm": 10, + "ct_dm_m": 4, + "ct_dm_f": 5, + "ct_dm": 6, + "tot_dm": 9, + "stg_1_nw_chr_m": 5, + "stg_1_nw_chr_f": 3, + "tot_stg_1_nw_chr": 3, + "stg_1_ct_chr_m": 9, + "stg_1_ct_chr_f": 6, + "tot_stg_1_ct_chr": 9, + "stg_1_nw_acu_m": 3, + "stg_1_nw_acu_f": 9, + "tot_stg_1_nw_acu": 3, + "stg_1_ct_acu_m": 7, + "stg_1_ct_acu_f": 3, + "tot_stg_1_ct_acu": 2, + "stg_2_nw_chr_m": 9, + "stg_2_nw_chr_f": 1, + "tot_stg_2_nw_chr": 10, + "stg_2_ct_chr_m": 3, + "stg_2_ct_chr_f": 9, + "tot_stg_2_ct_chr": 5, + "stg_2_nw_acu_m": 8, + "stg_2_nw_acu_f": 9, + "tot_stg_2_nw_acu": 2, + "stg_2_ct_acu_m": 3, + "stg_2_ct_acu_f": 0, + "tot_stg_2_ct_acu": 2, + "stg_3_nw_chr_m": 10, + "stg_3_nw_chr_f": 10, + "tot_stg_3_nw_chr": 7, + "stg_3_ct_chr_m": 2, + "stg_3_ct_chr_f": 5, + "tot_stg_3_ct_chr": 6, + "stg_3_nw_acu_m": 8, + "stg_3_nw_acu_f": 4, + "tot_stg_3_nw_acu": 2, + "stg_3_ct_acu_m": 0, + "stg_3_ct_acu_f": 3, + "tot_stg_3_ct_acu": 1, + "stg_4_nw_chr_m": 3, + "stg_4_nw_chr_f": 10, + "tot_stg_4_nw_chr": 10, + "stg_4_ct_chr_m": 2, + "stg_4_ct_chr_f": 9, + "tot_stg_4_ct_chr": 1, + "stg_4_nw_acu_m": 1, + "stg_4_nw_acu_f": 4, + "tot_stg_4_nw_acu": 8, + "stg_4_ct_acu_m": 7, + "stg_4_ct_acu_f": 2, + "tot_stg_4_ct_acu": 7, + "stg_5_nw_chr_m": 5, + "stg_5_nw_chr_f": 4, + "tot_stg_5_nw_chr": 9, + "stg_5_ct_chr_m": 8, + "stg_5_ct_chr_f": 8, + "tot_stg_5_ct_chr": 4, + "stg_5_nw_acu_m": 10, + "stg_5_nw_acu_f": 10, + "tot_stg_5_nw_acu": 4, + "stg_5_ct_acu_m": 6, + "stg_5_ct_acu_f": 2, + "tot_stg_5_ct_acu": 8, + "sub_tot_chr": 1, + "sub_tot_acu": 0, + "hf_nw_m": 9, + "hf_nw_f": 6, + "tot_hf_nw": 2, + "hf_ct_m": 7, + "hf_ct_f": 8, + "tot_hf_ct": 6, + "myo_inf_nw_m": 2, + "myo_inf_nw_f": 4, + "tot_myo_inf_nw": 4, + "myo_inf_ct_m": 5, + "myo_inf_ct_f": 3, + "tot_myo_inf_ct": 9, + "sub_tot_ct_cvd_m": 4, + "sub_tot_ct_cvd_f": 7, + "sub_tot_ct_cvd": 1, + "tot_cvd": 5, + "mg_nw_m": 7, + "mg_nw_f": 5, + "tot_mg_nw": 5, + "mg_ct_m": 3, + "mg_ct_f": 4, + "tot_mg_ct": 9, + "cnv_nw_m": 5, + "cnv_nw_f": 7, + "tot_cnv_nw": 10, + "cnv_ct_m": 5, + "cnv_ct_f": 7, + "tot_cnv_ct": 10, + "sub_tot_nw_cnv_m": 9, + "sub_tot_nw_cnv_f": 4, + "sub_tot_nw_cnv": 6, + "sub_tot_ct_cnv_m": 9, + "sub_tot_ct_cnv_f": 7, + "sub_tot_ct_cnv": 1, + "tot_cnv": 1, + "ra_nw_m": 10, + "ra_nw_f": 1, + "tot_ra_nw": 4, + "ra_ct_m": 8, + "ra_ct_f": 9, + "tot_ra_ct": 0, + "sle_nw_m": 9, + "sle_nw_f": 5, + "tot_sle_nw": 2, + "sle_ct_m": 2, + "sle_ct_f": 6, + "tot_sle_ct": 8, + "sub_tot_nw_rhe_m": 8, + "sub_tot_nw_rhe_f": 7, + "sub_tot_nw_rhe": 10, + "sub_tot_ct_rhe_m": 3, + "sub_tot_ct_rhe_f": 10, + "sub_tot_ct_rhe": 2, + "tot_rhe": 9, + "oe_nw_m": 8, + "oe_nw_f": 4, + "tot_oe_nw": 7, + "oe_ct_m": 3, + "oe_ct_f": 6, + "tot_oe_ct": 8, + "pc_nw_m": 9, + "pc_nw_f": 3, + "tot_pc_nw": 6, + "pc_ct_m": 5, + "pc_ct_f": 8, + "tot_pc_ct": 3, + "gs_nw_m": 2, + "gs_nw_f": 6, + "tot_gs_nw": 10, + "gs_ct_m": 1, + "gs_ct_f": 3, + "tot_gs_ct": 5, + "col_nw_m": 9, + "col_nw_f": 1, + "tot_col_nw": 6, + "col_ct_m": 9, + "col_ct_f": 10, + "tot_col_ct": 0, + "sub_tot_nw_gi_m": 1, + "sub_tot_nw_gi_f": 5, + "sub_tot_nw_gi": 10, + "sub_tot_ct_gi_m": 8, + "sub_tot_ct_gi_f": 10, + "sub_tot_ct_gi": 9, + "tot_gi": 10, + "ov_nw": 3, + "ov_ct": 10, + "cv_nw": 6, + "cv_ct": 1, + "endo_nw": 6, + "endo_ct": 5, + "tot_f_rep_nw": 10, + "tot_f_rep_ct": 7, + "tot_f_rep": 0, + "pro_nw": 4, + "pro_ct": 1, + "ts_nw": 0, + "ts_ct": 2, + "tot_m_rep_nw": 4, + "tot_m_rep_ct": 5, + "tot_m_rep": 9, + "th_nw_m": 9, + "th_nw_f": 6, + "tot_th_nw": 1, + "th_ct_m": 5, + "th_ct_f": 6, + "tot_th_ct": 1, + "pit_nw_m": 10, + "pit_nw_f": 10, + "tot_pit_nw": 10, + "pit_ct_m": 1, + "pit_ct_f": 8, + "tot_pit_ct": 7, + "thy_nw_m": 3, + "thy_nw_f": 7, + "tot_thy_nw": 9, + "thy_ct_m": 2, + "thy_ct_f": 6, + "tot_thy_ct": 10, + "adr_nw_m": 5, + "adr_nw_f": 4, + "tot_adr_nw": 6, + "adr_ct_m": 0, + "adr_ct_f": 5, + "tot_adr_ct": 1, + "sub_tot_nw_endo_m": 3, + "sub_tot_nw_endo_f": 10, + "sub_tot_nw_endo": 8, + "sub_tot_ct_endo_m": 7, + "sub_tot_ct_endo_f": 8, + "sub_tot_ct_endo": 3, + "tot_endo": 5, + "ost_nw_m": 5, + "ost_nw_f": 9, + "tot_ost_nw": 5, + "ost_ct_m": 9, + "ost_ct_f": 6, + "tot_ost_ct": 10, + "tot_musk": 1, + "leu_nw_m": 6, + "leu_nw_f": 10, + "tot_leu_nw": 10, + "leu_ct_m": 9, + "leu_ct_f": 9, + "tot_leu_ct": 2, + "lym_nw_m": 3, + "lym_nw_f": 3, + "tot_lym_nw": 6, + "lym_ct_m": 3, + "lym_ct_f": 0, + "tot_lym_ct": 5, + "sub_tot_nw_hae_m": 5, + "sub_tot_nw_hae_f": 4, + "sub_tot_nw_hae": 9, + "sub_tot_ct_hae_m": 7, + "sub_tot_ct_hae_f": 6, + "sub_tot_ct_hae": 10, + "tot_hae": 3, + "ggn_nw_m": 1, + "ggn_nw_f": 10, + "tot_ggn_nw": 8, + "ggn_ct_m": 4, + "ggn_ct_f": 5, + "tot_ggn_ct": 6, + "cpt_nw_m": 0, + "cpt_nw_f": 10, + "tot_cpt_nw": 1, + "cpt_ct_m": 8, + "cpt_ct_f": 3, + "tot_cpt_ct": 0, + "emb_nw_m": 1, + "emb_nw_f": 3, + "tot_emb_nw": 4, + "emb_ct_m": 4, + "emb_ct_f": 3, + "tot_emb_ct": 5, + "pin_nw_m": 3, + "pin_nw_f": 9, + "tot_pin_nw": 10, + "pin_ct_m": 5, + "pin_ct_f": 3, + "tot_pin_ct": 6, + "men_nw_m": 7, + "men_nw_f": 9, + "tot_men_nw": 10, + "men_ct_m": 6, + "men_ct_f": 5, + "tot_men_ct": 4, + "mes_nw_m": 2, + "mes_nw_f": 5, + "tot_mes_nw": 6, + "mes_ct_m": 3, + "mes_ct_f": 6, + "tot_mes_ct": 4, + "mel_nw_m": 0, + "mel_nw_f": 5, + "tot_mel_nw": 8, + "mel_ct_m": 2, + "mel_ct_f": 1, + "tot_mel_ct": 0, + "hly_nw_m": 8, + "hly_nw_f": 3, + "tot_hly_nw": 0, + "hly_ct_m": 9, + "hly_ct_f": 5, + "tot_hly_ct": 4, + "gct_nw_m": 7, + "gct_nw_f": 8, + "tot_gct_nw": 4, + "gct_ct_m": 1, + "gct_ct_f": 8, + "tot_gct_ct": 10, + "sub_tot_nw_neu_m": 1, + "sub_tot_nw_neu_f": 2, + "sub_tot_nw_neu": 9, + "sub_tot_ct_neu_m": 8, + "sub_tot_ct_neu_f": 3, + "sub_tot_ct_neu": 2, + "tot_neu": 2 + }, + { + "join_location": 1, + "location_uuid": "08feae7c-1352-11df-a1f1-0026b9348837", + "mfl_code": 11111, + "county": "Busia", + "facility": "Busia", + "location_id": 2, + "location": "Busia", "nw_ctld_htn_m": 1, "tot_nw_ctld_htn": 2, "ct_ctld_htn_f": 10, From 2021b89c7da5cfcaaa5515f0c66b0e243be5ba48 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 6 Nov 2023 09:13:28 +0300 Subject: [PATCH 05/40] POC-544-v2: Enhanced PLHIV-NCD Comorbidity Monthly report POC-544-v2: Added all the needed indicators in the config POC-544-v2: Enhanced PLHIV NCD Report end points POC-544-v2: update service POC-544-v2: updated indicator schema --- .../plhiv-ncd-v2-report-indicators.json | 943 ++++++++++++++ ...plhiv-ncd-v2-report-patient-list-cols.json | 103 ++ app/routes/plhiv-ncd-v2-report.route.js | 98 ++ .../plhiv-ncd-v2-summary.service.js | 1150 +++++++++++++++++ 4 files changed, 2294 insertions(+) create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-patient-list-cols.json create mode 100644 app/routes/plhiv-ncd-v2-report.route.js create mode 100644 service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js 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..b07ac3615 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json @@ -0,0 +1,943 @@ +[ + { + "sectionTitle": "Hypertensive", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Contolled", + "indicator": [ + "nw_ctld_htn_f", + "nw_ctld_htn_m", + "tot_nw_ctld_htn", + "ct_ctld_htn_f", + "ct_ctld_htn_m", + "tot_ct_ctld_htn" + ] + }, + { + "label": "Uncontrolled", + "indicator": [ + "nw_unctld_htn_f", + "nw_unctld_htn_m", + "tot_nw_unctld_htn", + "ct_unctld_htn_f", + "ct_unctld_htn_m", + "tot_ct_unctld_htn" + ] + }, + { + "label": "Unknown / Not Established", + "indicator": [ + "nw_unk_htn_f", + "nw_unk_htn_m", + "tot_nw_unk_htn", + "ct_unk_htn_f", + "ct_unk_htn_m", + "tot_ct_unk_htn" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "nw_htn_m", + "nw_htn_f", + "nw_htn", + "ct_htn_m", + "ct_htn_f", + "ct_htn" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_htn", "tot_ct_htn"] + }, + { + "label": "Total", + "indicator": "tot_htn" + } + ] + }, + { + "sectionTitle": "Diabetic", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Contolled", + "indicator": [ + "nw_ctld_dm_f", + "nw_ctld_dm_m", + "tot_nw_ctld_dm", + "ct_ctld_dm_f", + "ct_ctld_dm_m", + "tot_ct_ctld_dm" + ] + }, + { + "label": "Uncontrolled", + "indicator": [ + "nw_unctld_dm_f", + "nw_unctld_dm_m", + "tot_nw_unctld_dm", + "ct_unctld_dm_f", + "ct_unctld_dm_m", + "tot_ct_unctld_dm" + ] + }, + { + "label": "Unknown / Not Established", + "indicator": [ + "nw_unk_dm_f", + "nw_unk_dm_m", + "tot_nw_unk_dm", + "ct_unk_dm_f", + "ct_unk_dm_m", + "tot_ct_unk_dm" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "nw_dm_m", + "nw_dm_f", + "nw_dm", + "ct_dm_m", + "ct_dm_f", + "ct_dm" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_dm", "tot_ct_dm"] + }, + { + "label": "Total", + "indicator": "tot_dm" + } + ] + }, + { + "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": [ + "stg_1_nw_chr_m", + "stg_1_nw_chr_f", + "tot_stg_1_nw_chr", + "stg_1_ct_chr_m", + "stg_1_ct_chr_f", + "tot_stg_1_ct_chr", + "stg_1_nw_acu_m", + "stg_1_nw_acu_f", + "tot_stg_1_nw_acu", + "stg_1_ct_acu_m", + "stg_1_ct_acu_f", + "tot_stg_1_ct_acu" + ] + }, + { + "label": "Stage 2", + "indicator": [ + "stg_2_nw_chr_m", + "stg_2_nw_chr_f", + "tot_stg_2_nw_chr", + "stg_2_ct_chr_m", + "stg_2_ct_chr_f", + "tot_stg_2_ct_chr", + "stg_2_nw_acu_m", + "stg_2_nw_acu_f", + "tot_stg_2_nw_acu", + "stg_2_ct_acu_m", + "stg_2_ct_acu_f", + "tot_stg_2_ct_acu" + ] + }, + { + "label": "Stage 3", + "indicator": [ + "stg_3_nw_chr_m", + "stg_3_nw_chr_f", + "tot_stg_3_nw_chr", + "stg_3_ct_chr_m", + "stg_3_ct_chr_f", + "tot_stg_3_ct_chr", + "stg_3_nw_acu_m", + "stg_3_nw_acu_f", + "tot_stg_3_nw_acu", + "stg_3_ct_acu_m", + "stg_3_ct_acu_f", + "tot_stg_3_ct_acu" + ] + }, + { + "label": "Stage 4", + "indicator": [ + "stg_4_nw_chr_m", + "stg_4_nw_chr_f", + "tot_stg_4_nw_chr", + "stg_4_ct_chr_m", + "stg_4_ct_chr_f", + "tot_stg_4_ct_chr", + "stg_4_nw_acu_m", + "stg_4_nw_acu_f", + "tot_stg_4_nw_acu", + "stg_4_ct_acu_m", + "stg_4_ct_acu_f", + "tot_stg_4_ct_acu" + ] + }, + { + "label": "Stage 5", + "indicator": [ + "stg_5_nw_chr_m", + "stg_5_nw_chr_f", + "tot_stg_5_nw_chr", + "stg_5_ct_chr_m", + "stg_5_ct_chr_f", + "tot_stg_5_ct_chr", + "stg_5_nw_acu_m", + "stg_5_nw_acu_f", + "tot_stg_5_nw_acu", + "stg_5_ct_acu_m", + "stg_5_ct_acu_f", + "tot_stg_5_ct_acu" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_chr_m", + "sub_tot_nw_chr_f", + "sub_tot_nw_chr", + "sub_tot_ct_chr_m", + "sub_tot_ct_chr_f", + "sub_tot_ct_chr", + "sub_tot_nw_acu_m", + "sub_tot_nw_acu_f", + "sub_tot_nw_acu", + "sub_tot_ct_acu_m", + "sub_tot_ct_acu_f", + "sub_tot_ct_acu" + ] + }, + { + "label": "Status Sub Total", + "indicator": [ + "sub_tot_nw_chr", + "sub_tot_ct_chr", + "sub_tot_nw_acu", + "sub_tot_ct_acu" + ] + }, + { + "label": "State Sub Total", + "indicator": ["sub_tot_chr", "sub_tot_acu"] + }, + { + "label": "Grand Total", + "indicator": "tot_kd" + } + ] + }, + { + "sectionTitle": "Cardiovascular Disease (other than Hypertension)", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Heart Failure", + "indicator": [ + "hf_nw_m", + "hf_nw_f", + "tot_hf_nw", + "hf_ct_m", + "hf_ct_f", + "tot_hf_ct" + ] + }, + { + "label": "Myocardinal Infarction", + "indicator": [ + "myo_inf_nw_m", + "myo_inf_nw_f", + "tot_myo_inf_nw", + "myo_inf_ct_m", + "myo_inf_ct_f", + "tot_myo_inf_ct" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_cvd_m", + "sub_tot_nw_cvd_f", + "sub_tot_nw_cvd", + "sub_tot_ct_cvd_m", + "sub_tot_ct_cvd_f", + "sub_tot_ct_cvd" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_cvd", "tot_ct_cvd"] + }, + { + "label": "Total", + "indicator": "tot_cvd" + } + ] + }, + { + "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": [ + "mg_nw_m", + "mg_nw_f", + "tot_mg_nw", + "mg_ct_m", + "mg_ct_f", + "tot_mg_ct" + ] + }, + { + "label": "Convulsive", + "indicator": [ + "cnv_nw_m", + "cnv_nw_f", + "tot_cnv_nw", + "cnv_ct_m", + "cnv_ct_f", + "tot_cnv_ct" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_cnv_m", + "sub_tot_nw_cnv_f", + "sub_tot_nw_cnv", + "sub_tot_ct_cnv_m", + "sub_tot_ct_cnv_f", + "sub_tot_ct_cnv" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_cnv", "tot_ct_cnv"] + }, + { + "label": "Total", + "indicator": "tot_cnv" + } + ] + }, + { + "sectionTitle": "Rheumatologic", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Arthritis", + "indicator": [ + "ra_nw_m", + "ra_nw_f", + "tot_ra_nw", + "ra_ct_m", + "ra_ct_f", + "tot_ra_ct" + ] + }, + { + "label": "SLE", + "indicator": [ + "sle_nw_m", + "sle_nw_f", + "tot_sle_nw", + "sle_ct_m", + "sle_ct_f", + "tot_sle_ct" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_rhe_m", + "sub_tot_nw_rhe_f", + "sub_tot_nw_rhe", + "sub_tot_ct_rhe_m", + "sub_tot_ct_rhe_f", + "sub_tot_ct_rhe" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_rhe", "tot_ct_rhe"] + }, + { + "label": "Total", + "indicator": "tot_rhe" + } + ] + }, + { + "sectionTitle": "GI Malignacies", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Oesophageal", + "indicator": [ + "oe_nw_m", + "oe_nw_f", + "tot_oe_nw", + "oe_ct_m", + "oe_ct_f", + "tot_oe_ct" + ] + }, + { + "label": "Pancreatic", + "indicator": [ + "pc_nw_m", + "pc_nw_f", + "tot_pc_nw", + "pc_ct_m", + "pc_ct_f", + "tot_pc_ct" + ] + }, + { + "label": "Stomach/Gastric", + "indicator": [ + "gs_nw_m", + "gs_nw_f", + "tot_gs_nw", + "gs_ct_m", + "gs_ct_f", + "tot_gs_ct" + ] + }, + { + "label": "Colorectal", + "indicator": [ + "col_nw_m", + "col_nw_f", + "tot_col_nw", + "col_ct_m", + "col_ct_f", + "tot_col_ct" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_gi_m", + "sub_tot_nw_gi_f", + "sub_tot_nw_gi", + "sub_tot_ct_gi_m", + "sub_tot_ct_gi_f", + "sub_tot_ct_gi" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_gi", "tot_ct_gi"] + }, + { + "label": "Total", + "indicator": "tot_gi" + } + ] + }, + { + "sectionTitle": "Female Reproductive", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Ovarian", + "indicator": ["ov_nw", "ov_ct"] + }, + { + "label": "Cervical", + "indicator": ["cv_nw", "cv_ct"] + }, + { + "label": "Endometrial", + "indicator": ["endo_nw", "endo_ct"] + }, + { + "label": "Sub Total", + "indicator": ["tot_f_rep_nw", "tot_f_rep_ct"] + }, + { + "label": "Total", + "indicator": "tot_f_rep" + } + ] + }, + { + "sectionTitle": "Male Reproductive", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Prostate", + "indicator": ["pro_nw", "pro_ct"] + }, + { + "label": "Testicular", + "indicator": ["ts_nw", "ts_ct"] + }, + { + "label": "Sub Total", + "indicator": ["tot_m_rep_nw", "tot_m_rep_ct"] + }, + { + "label": "Total", + "indicator": "tot_m_rep" + } + ] + }, + { + "sectionTitle": "ENT Malignancies", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Throat", + "indicator": [ + "th_nw_m", + "th_nw_f", + "tot_th_nw", + "th_ct_m", + "th_ct_f", + "tot_th_ct" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_ent", "tot_ct_ent"] + }, + { + "label": "Total", + "indicator": "tot_ent" + } + ] + }, + { + "sectionTitle": "Endocrine", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Pituitary", + "indicator": [ + "pit_nw_m", + "pit_nw_f", + "tot_pit_nw", + "pit_ct_m", + "pit_ct_f", + "tot_pit_ct" + ] + }, + { + "label": "Thyroid", + "indicator": [ + "thy_nw_m", + "thy_nw_f", + "tot_thy_nw", + "thy_ct_m", + "thy_ct_f", + "tot_thy_ct" + ] + }, + { + "label": "Adrenal", + "indicator": [ + "adr_nw_m", + "adr_nw_f", + "tot_adr_nw", + "adr_ct_m", + "adr_ct_f", + "tot_adr_ct" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_endo_m", + "sub_tot_nw_endo_f", + "sub_tot_nw_endo", + "sub_tot_ct_endo_m", + "sub_tot_ct_endo_f", + "sub_tot_ct_endo" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_endo", "tot_ct_endo"] + }, + { + "label": "Total", + "indicator": "tot_endo" + } + ] + }, + { + "sectionTitle": "Musculoskeletal", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Osteosarcoma", + "indicator": [ + "ost_nw_m", + "ost_nw_f", + "tot_ost_nw", + "ost_ct_m", + "ost_ct_f", + "tot_ost_ct" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_musk", "tot_ct_musk"] + }, + { + "label": "Total", + "indicator": "tot_musk" + } + ] + }, + { + "sectionTitle": "Haematological", + "indicators": [ + { + "label": "Location", + "indicator": "location" + }, + { + "label": "Status", + "indicator": ["New", "CT"] + }, + { + "label": "Header", + "indicator": ["F", "M", "T", "F", "M", "T"] + }, + { + "label": "Leukamia", + "indicator": [ + "leu_nw_m", + "leu_nw_f", + "tot_leu_nw", + "leu_ct_m", + "leu_ct_f", + "tot_leu_ct" + ] + }, + { + "label": "Lymphoma", + "indicator": [ + "lym_nw_m", + "lym_nw_f", + "tot_lym_nw", + "lym_ct_m", + "lym_ct_f", + "tot_lym_ct" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_hae_m", + "sub_tot_nw_hae_f", + "sub_tot_nw_hae", + "sub_tot_ct_hae_m", + "sub_tot_ct_hae_f", + "sub_tot_ct_hae" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_hae", "tot_ct_hae"] + }, + { + "label": "Total", + "indicator": "tot_hae" + } + ] + }, + { + "sectionTitle": "Neurological", + "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": [ + "ggn_nw_m", + "ggn_nw_f", + "tot_ggn_nw", + "ggn_ct_m", + "ggn_ct_f", + "tot_ggn_ct" + ] + }, + { + "label": "Choroid Plexus Tumors", + "indicator": [ + "cpt_nw_m", + "cpt_nw_f", + "tot_cpt_nw", + "cpt_ct_m", + "cpt_ct_f", + "tot_cpt_ct" + ] + }, + { + "label": "Embryonal Tumors", + "indicator": [ + "emb_nw_m", + "emb_nw_f", + "tot_emb_nw", + "emb_ct_m", + "emb_ct_f", + "tot_emb_ct" + ] + }, + { + "label": "Pineal Tumors", + "indicator": [ + "pin_nw_m", + "pin_nw_f", + "tot_pin_nw", + "pin_ct_m", + "pin_ct_f", + "tot_pin_ct" + ] + }, + { + "label": "Meningiomas", + "indicator": [ + "men_nw_m", + "men_nw_f", + "tot_men_nw", + "men_ct_m", + "men_ct_f", + "tot_men_ct" + ] + }, + { + "label": "Mesenchymal Tumors", + "indicator": [ + "mes_nw_m", + "mes_nw_f", + "tot_mes_nw", + "mes_ct_m", + "mes_ct_f", + "tot_mes_ct" + ] + }, + { + "label": "Melanocytic", + "indicator": [ + "mel_nw_m", + "mel_nw_f", + "tot_mel_nw", + "mel_ct_m", + "mel_ct_f", + "tot_mel_ct" + ] + }, + { + "label": "Haematolymphoid", + "indicator": [ + "hly_nw_m", + "hly_nw_f", + "tot_hly_nw", + "hly_ct_m", + "hly_ct_f", + "tot_hly_ct" + ] + }, + { + "label": "Germ Cell Tumors", + "indicator": [ + "gct_nw_m", + "gct_nw_f", + "tot_gct_nw", + "gct_ct_m", + "gct_ct_f", + "tot_gct_ct" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "sub_tot_nw_neu_m", + "sub_tot_nw_neu_f", + "sub_tot_nw_neu", + "sub_tot_ct_neu_m", + "sub_tot_ct_neu_f", + "sub_tot_ct_neu" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_neu", "tot_ct_neu"] + }, + { + "label": "Total", + "indicator": "tot_neu" + } + ] + } +] 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/routes/plhiv-ncd-v2-report.route.js b/app/routes/plhiv-ncd-v2-report.route.js new file mode 100644 index 000000000..64cd08f9b --- /dev/null +++ b/app/routes/plhiv-ncd-v2-report.route.js @@ -0,0 +1,98 @@ +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-summary', + config: { + plugins: { + hapiAuthorization: { + role: privileges.canViewClinicDashBoard + } + }, + handler: function (request, reply) { + preRequest.resolveLocationIdsToLocationUuids(request, function () { + let requestParams = Object.assign({}, request.query, request.params); + let reportParams = etlHelpers.getReportParams( + 'plhiv-ncd-v2-summary-report', + ['endDate', 'locationUuids'], + requestParams + ); + reportParams.requestParams.isAggregated = true; + + let service = new PLHIVNCDv2SummaryReportService( + 'plhiv-ncd-v2-summary-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-summary-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 + ); + let reportParams = etlHelpers.getReportParams( + 'plhiv-ncd-v2-summary-report', + ['endDate', 'locationUuids'], + requestParams + ); + delete reportParams.requestParams['gender']; + const plhivncdV2ReportService = new PLHIVNCDv2SummaryReportService( + 'plhiv-ncd-v2-summary-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..3539bb1f6 --- /dev/null +++ b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js @@ -0,0 +1,1150 @@ +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: [] + // }); + //test + resolve({ + queriesAndSchemas: [], + result: [ + { + "join_location": 45, + "location_uuid": "08feae7c-1352-11df-a1f1-0026b0000000", + "mfl_code": 22222, + "county": "Uasin Gishu", + "facility": "Kapseret", + "location_id": 1, + "location": "Kapseret", + "nw_ctld_htn_m": 1, + "tot_nw_ctld_htn": 2, + "ct_ctld_htn_f": 10, + "ct_ctld_htn_m": 10, + "tot_ct_ctld_htn": 5, + "nw_unctld_htn_f": 4, + "nw_unctld_htn_m": 10, + "tot_nw_unctld_htn": 8, + "ct_unctld_htn_f": 5, + "ct_unctld_htn_m": 0, + "tot_ct_unctld_htn": 1, + "nw_unk_htn_f": 6, + "nw_unk_htn_m": 0, + "tot_nw_unk_htn": 2, + "ct_unk_htn_f": 5, + "ct_unk_htn_m": 3, + "tot_ct_unk_htn": 3, + "nw_htn_m": 5, + "nw_htn_f": 3, + "nw_htn": 9, + "ct_htn_m": 5, + "ct_htn_f": 7, + "ct_htn": 3, + "tot_htn": 10, + "nw_ctld_dm_f": 2, + "nw_ctld_dm_m": 1, + "tot_nw_ctld_dm": 0, + "ct_ctld_dm_f": 8, + "ct_ctld_dm_m": 6, + "tot_ct_ctld_dm": 2, + "nw_unctld_dm_f": 2, + "nw_unctld_dm_m": 10, + "tot_nw_unctld_dm": 6, + "ct_unctld_dm_f": 5, + "ct_unctld_dm_m": 2, + "tot_ct_unctld_dm": 5, + "nw_unk_dm_f": 0, + "nw_unk_dm_m": 4, + "tot_nw_unk_dm": 10, + "ct_unk_dm_f": 7, + "ct_unk_dm_m": 1, + "tot_ct_unk_dm": 5, + "nw_dm_m": 6, + "nw_dm_f": 8, + "nw_dm": 10, + "ct_dm_m": 4, + "ct_dm_f": 5, + "ct_dm": 6, + "tot_dm": 9, + "stg_1_nw_chr_m": 5, + "stg_1_nw_chr_f": 3, + "tot_stg_1_nw_chr": 3, + "stg_1_ct_chr_m": 9, + "stg_1_ct_chr_f": 6, + "tot_stg_1_ct_chr": 9, + "stg_1_nw_acu_m": 3, + "stg_1_nw_acu_f": 9, + "tot_stg_1_nw_acu": 3, + "stg_1_ct_acu_m": 7, + "stg_1_ct_acu_f": 3, + "tot_stg_1_ct_acu": 2, + "stg_2_nw_chr_m": 9, + "stg_2_nw_chr_f": 1, + "tot_stg_2_nw_chr": 10, + "stg_2_ct_chr_m": 3, + "stg_2_ct_chr_f": 9, + "tot_stg_2_ct_chr": 5, + "stg_2_nw_acu_m": 8, + "stg_2_nw_acu_f": 9, + "tot_stg_2_nw_acu": 2, + "stg_2_ct_acu_m": 3, + "stg_2_ct_acu_f": 0, + "tot_stg_2_ct_acu": 2, + "stg_3_nw_chr_m": 10, + "stg_3_nw_chr_f": 10, + "tot_stg_3_nw_chr": 7, + "stg_3_ct_chr_m": 2, + "stg_3_ct_chr_f": 5, + "tot_stg_3_ct_chr": 6, + "stg_3_nw_acu_m": 8, + "stg_3_nw_acu_f": 4, + "tot_stg_3_nw_acu": 2, + "stg_3_ct_acu_m": 0, + "stg_3_ct_acu_f": 3, + "tot_stg_3_ct_acu": 1, + "stg_4_nw_chr_m": 3, + "stg_4_nw_chr_f": 10, + "tot_stg_4_nw_chr": 10, + "stg_4_ct_chr_m": 2, + "stg_4_ct_chr_f": 9, + "tot_stg_4_ct_chr": 1, + "stg_4_nw_acu_m": 1, + "stg_4_nw_acu_f": 4, + "tot_stg_4_nw_acu": 8, + "stg_4_ct_acu_m": 7, + "stg_4_ct_acu_f": 2, + "tot_stg_4_ct_acu": 7, + "stg_5_nw_chr_m": 5, + "stg_5_nw_chr_f": 4, + "tot_stg_5_nw_chr": 9, + "stg_5_ct_chr_m": 8, + "stg_5_ct_chr_f": 8, + "tot_stg_5_ct_chr": 4, + "stg_5_nw_acu_m": 10, + "stg_5_nw_acu_f": 10, + "tot_stg_5_nw_acu": 4, + "stg_5_ct_acu_m": 6, + "stg_5_ct_acu_f": 2, + "tot_stg_5_ct_acu": 8, + "sub_tot_chr": 1, + "sub_tot_acu": 0, + "hf_nw_m": 9, + "hf_nw_f": 6, + "tot_hf_nw": 2, + "hf_ct_m": 7, + "hf_ct_f": 8, + "tot_hf_ct": 6, + "myo_inf_nw_m": 2, + "myo_inf_nw_f": 4, + "tot_myo_inf_nw": 4, + "myo_inf_ct_m": 5, + "myo_inf_ct_f": 3, + "tot_myo_inf_ct": 9, + "sub_tot_ct_cvd_m": 4, + "sub_tot_ct_cvd_f": 7, + "sub_tot_ct_cvd": 1, + "tot_cvd": 5, + "mg_nw_m": 7, + "mg_nw_f": 5, + "tot_mg_nw": 5, + "mg_ct_m": 3, + "mg_ct_f": 4, + "tot_mg_ct": 9, + "cnv_nw_m": 5, + "cnv_nw_f": 7, + "tot_cnv_nw": 10, + "cnv_ct_m": 5, + "cnv_ct_f": 7, + "tot_cnv_ct": 10, + "sub_tot_nw_cnv_m": 9, + "sub_tot_nw_cnv_f": 4, + "sub_tot_nw_cnv": 6, + "sub_tot_ct_cnv_m": 9, + "sub_tot_ct_cnv_f": 7, + "sub_tot_ct_cnv": 1, + "tot_cnv": 1, + "ra_nw_m": 10, + "ra_nw_f": 1, + "tot_ra_nw": 4, + "ra_ct_m": 8, + "ra_ct_f": 9, + "tot_ra_ct": 0, + "sle_nw_m": 9, + "sle_nw_f": 5, + "tot_sle_nw": 2, + "sle_ct_m": 2, + "sle_ct_f": 6, + "tot_sle_ct": 8, + "sub_tot_nw_rhe_m": 8, + "sub_tot_nw_rhe_f": 7, + "sub_tot_nw_rhe": 10, + "sub_tot_ct_rhe_m": 3, + "sub_tot_ct_rhe_f": 10, + "sub_tot_ct_rhe": 2, + "tot_rhe": 9, + "oe_nw_m": 8, + "oe_nw_f": 4, + "tot_oe_nw": 7, + "oe_ct_m": 3, + "oe_ct_f": 6, + "tot_oe_ct": 8, + "pc_nw_m": 9, + "pc_nw_f": 3, + "tot_pc_nw": 6, + "pc_ct_m": 5, + "pc_ct_f": 8, + "tot_pc_ct": 3, + "gs_nw_m": 2, + "gs_nw_f": 6, + "tot_gs_nw": 10, + "gs_ct_m": 1, + "gs_ct_f": 3, + "tot_gs_ct": 5, + "col_nw_m": 9, + "col_nw_f": 1, + "tot_col_nw": 6, + "col_ct_m": 9, + "col_ct_f": 10, + "tot_col_ct": 0, + "sub_tot_nw_gi_m": 1, + "sub_tot_nw_gi_f": 5, + "sub_tot_nw_gi": 10, + "sub_tot_ct_gi_m": 8, + "sub_tot_ct_gi_f": 10, + "sub_tot_ct_gi": 9, + "tot_gi": 10, + "ov_nw": 3, + "ov_ct": 10, + "cv_nw": 6, + "cv_ct": 1, + "endo_nw": 6, + "endo_ct": 5, + "tot_f_rep_nw": 10, + "tot_f_rep_ct": 7, + "tot_f_rep": 0, + "pro_nw": 4, + "pro_ct": 1, + "ts_nw": 0, + "ts_ct": 2, + "tot_m_rep_nw": 4, + "tot_m_rep_ct": 5, + "tot_m_rep": 9, + "th_nw_m": 9, + "th_nw_f": 6, + "tot_th_nw": 1, + "th_ct_m": 5, + "th_ct_f": 6, + "tot_th_ct": 1, + "pit_nw_m": 10, + "pit_nw_f": 10, + "tot_pit_nw": 10, + "pit_ct_m": 1, + "pit_ct_f": 8, + "tot_pit_ct": 7, + "thy_nw_m": 3, + "thy_nw_f": 7, + "tot_thy_nw": 9, + "thy_ct_m": 2, + "thy_ct_f": 6, + "tot_thy_ct": 10, + "adr_nw_m": 5, + "adr_nw_f": 4, + "tot_adr_nw": 6, + "adr_ct_m": 0, + "adr_ct_f": 5, + "tot_adr_ct": 1, + "sub_tot_nw_endo_m": 3, + "sub_tot_nw_endo_f": 10, + "sub_tot_nw_endo": 8, + "sub_tot_ct_endo_m": 7, + "sub_tot_ct_endo_f": 8, + "sub_tot_ct_endo": 3, + "tot_endo": 5, + "ost_nw_m": 5, + "ost_nw_f": 9, + "tot_ost_nw": 5, + "ost_ct_m": 9, + "ost_ct_f": 6, + "tot_ost_ct": 10, + "tot_musk": 1, + "leu_nw_m": 6, + "leu_nw_f": 10, + "tot_leu_nw": 10, + "leu_ct_m": 9, + "leu_ct_f": 9, + "tot_leu_ct": 2, + "lym_nw_m": 3, + "lym_nw_f": 3, + "tot_lym_nw": 6, + "lym_ct_m": 3, + "lym_ct_f": 0, + "tot_lym_ct": 5, + "sub_tot_nw_hae_m": 5, + "sub_tot_nw_hae_f": 4, + "sub_tot_nw_hae": 9, + "sub_tot_ct_hae_m": 7, + "sub_tot_ct_hae_f": 6, + "sub_tot_ct_hae": 10, + "tot_hae": 3, + "ggn_nw_m": 1, + "ggn_nw_f": 10, + "tot_ggn_nw": 8, + "ggn_ct_m": 4, + "ggn_ct_f": 5, + "tot_ggn_ct": 6, + "cpt_nw_m": 0, + "cpt_nw_f": 10, + "tot_cpt_nw": 1, + "cpt_ct_m": 8, + "cpt_ct_f": 3, + "tot_cpt_ct": 0, + "emb_nw_m": 1, + "emb_nw_f": 3, + "tot_emb_nw": 4, + "emb_ct_m": 4, + "emb_ct_f": 3, + "tot_emb_ct": 5, + "pin_nw_m": 3, + "pin_nw_f": 9, + "tot_pin_nw": 10, + "pin_ct_m": 5, + "pin_ct_f": 3, + "tot_pin_ct": 6, + "men_nw_m": 7, + "men_nw_f": 9, + "tot_men_nw": 10, + "men_ct_m": 6, + "men_ct_f": 5, + "tot_men_ct": 4, + "mes_nw_m": 2, + "mes_nw_f": 5, + "tot_mes_nw": 6, + "mes_ct_m": 3, + "mes_ct_f": 6, + "tot_mes_ct": 4, + "mel_nw_m": 0, + "mel_nw_f": 5, + "tot_mel_nw": 8, + "mel_ct_m": 2, + "mel_ct_f": 1, + "tot_mel_ct": 0, + "hly_nw_m": 8, + "hly_nw_f": 3, + "tot_hly_nw": 0, + "hly_ct_m": 9, + "hly_ct_f": 5, + "tot_hly_ct": 4, + "gct_nw_m": 7, + "gct_nw_f": 8, + "tot_gct_nw": 4, + "gct_ct_m": 1, + "gct_ct_f": 8, + "tot_gct_ct": 10, + "sub_tot_nw_neu_m": 1, + "sub_tot_nw_neu_f": 2, + "sub_tot_nw_neu": 9, + "sub_tot_ct_neu_m": 8, + "sub_tot_ct_neu_f": 3, + "sub_tot_ct_neu": 2, + "tot_neu": 2 + }, + { + "join_location": 1, + "location_uuid": "08feae7c-1352-11df-a1f1-0026b9348838", + "mfl_code": 15204, + "county": "Uasin Gishu", + "facility": "Moi Teaching Refferal Hospital", + "location_id": 1, + "location": "MTRH Module 1", + "nw_ctld_htn_m": 1, + "tot_nw_ctld_htn": 2, + "ct_ctld_htn_f": 10, + "ct_ctld_htn_m": 10, + "tot_ct_ctld_htn": 5, + "nw_unctld_htn_f": 4, + "nw_unctld_htn_m": 10, + "tot_nw_unctld_htn": 8, + "ct_unctld_htn_f": 5, + "ct_unctld_htn_m": 0, + "tot_ct_unctld_htn": 1, + "nw_unk_htn_f": 6, + "nw_unk_htn_m": 0, + "tot_nw_unk_htn": 2, + "ct_unk_htn_f": 5, + "ct_unk_htn_m": 3, + "tot_ct_unk_htn": 3, + "nw_htn_m": 5, + "nw_htn_f": 3, + "nw_htn": 9, + "ct_htn_m": 5, + "ct_htn_f": 7, + "ct_htn": 3, + "tot_htn": 10, + "nw_ctld_dm_f": 2, + "nw_ctld_dm_m": 1, + "tot_nw_ctld_dm": 0, + "ct_ctld_dm_f": 8, + "ct_ctld_dm_m": 6, + "tot_ct_ctld_dm": 2, + "nw_unctld_dm_f": 2, + "nw_unctld_dm_m": 10, + "tot_nw_unctld_dm": 6, + "ct_unctld_dm_f": 5, + "ct_unctld_dm_m": 2, + "tot_ct_unctld_dm": 5, + "nw_unk_dm_f": 0, + "nw_unk_dm_m": 4, + "tot_nw_unk_dm": 10, + "ct_unk_dm_f": 7, + "ct_unk_dm_m": 1, + "tot_ct_unk_dm": 5, + "nw_dm_m": 6, + "nw_dm_f": 8, + "nw_dm": 10, + "ct_dm_m": 4, + "ct_dm_f": 5, + "ct_dm": 6, + "tot_dm": 9, + "stg_1_nw_chr_m": 5, + "stg_1_nw_chr_f": 3, + "tot_stg_1_nw_chr": 3, + "stg_1_ct_chr_m": 9, + "stg_1_ct_chr_f": 6, + "tot_stg_1_ct_chr": 9, + "stg_1_nw_acu_m": 3, + "stg_1_nw_acu_f": 9, + "tot_stg_1_nw_acu": 3, + "stg_1_ct_acu_m": 7, + "stg_1_ct_acu_f": 3, + "tot_stg_1_ct_acu": 2, + "stg_2_nw_chr_m": 9, + "stg_2_nw_chr_f": 1, + "tot_stg_2_nw_chr": 10, + "stg_2_ct_chr_m": 3, + "stg_2_ct_chr_f": 9, + "tot_stg_2_ct_chr": 5, + "stg_2_nw_acu_m": 8, + "stg_2_nw_acu_f": 9, + "tot_stg_2_nw_acu": 2, + "stg_2_ct_acu_m": 3, + "stg_2_ct_acu_f": 0, + "tot_stg_2_ct_acu": 2, + "stg_3_nw_chr_m": 10, + "stg_3_nw_chr_f": 10, + "tot_stg_3_nw_chr": 7, + "stg_3_ct_chr_m": 2, + "stg_3_ct_chr_f": 5, + "tot_stg_3_ct_chr": 6, + "stg_3_nw_acu_m": 8, + "stg_3_nw_acu_f": 4, + "tot_stg_3_nw_acu": 2, + "stg_3_ct_acu_m": 0, + "stg_3_ct_acu_f": 3, + "tot_stg_3_ct_acu": 1, + "stg_4_nw_chr_m": 3, + "stg_4_nw_chr_f": 10, + "tot_stg_4_nw_chr": 10, + "stg_4_ct_chr_m": 2, + "stg_4_ct_chr_f": 9, + "tot_stg_4_ct_chr": 1, + "stg_4_nw_acu_m": 1, + "stg_4_nw_acu_f": 4, + "tot_stg_4_nw_acu": 8, + "stg_4_ct_acu_m": 7, + "stg_4_ct_acu_f": 2, + "tot_stg_4_ct_acu": 7, + "stg_5_nw_chr_m": 5, + "stg_5_nw_chr_f": 4, + "tot_stg_5_nw_chr": 9, + "stg_5_ct_chr_m": 8, + "stg_5_ct_chr_f": 8, + "tot_stg_5_ct_chr": 4, + "stg_5_nw_acu_m": 10, + "stg_5_nw_acu_f": 10, + "tot_stg_5_nw_acu": 4, + "stg_5_ct_acu_m": 6, + "stg_5_ct_acu_f": 2, + "tot_stg_5_ct_acu": 8, + "sub_tot_chr": 1, + "sub_tot_acu": 0, + "hf_nw_m": 9, + "hf_nw_f": 6, + "tot_hf_nw": 2, + "hf_ct_m": 7, + "hf_ct_f": 8, + "tot_hf_ct": 6, + "myo_inf_nw_m": 2, + "myo_inf_nw_f": 4, + "tot_myo_inf_nw": 4, + "myo_inf_ct_m": 5, + "myo_inf_ct_f": 3, + "tot_myo_inf_ct": 9, + "sub_tot_ct_cvd_m": 4, + "sub_tot_ct_cvd_f": 7, + "sub_tot_ct_cvd": 1, + "tot_cvd": 5, + "mg_nw_m": 7, + "mg_nw_f": 5, + "tot_mg_nw": 5, + "mg_ct_m": 3, + "mg_ct_f": 4, + "tot_mg_ct": 9, + "cnv_nw_m": 5, + "cnv_nw_f": 7, + "tot_cnv_nw": 10, + "cnv_ct_m": 5, + "cnv_ct_f": 7, + "tot_cnv_ct": 10, + "sub_tot_nw_cnv_m": 9, + "sub_tot_nw_cnv_f": 4, + "sub_tot_nw_cnv": 6, + "sub_tot_ct_cnv_m": 9, + "sub_tot_ct_cnv_f": 7, + "sub_tot_ct_cnv": 1, + "tot_cnv": 1, + "ra_nw_m": 10, + "ra_nw_f": 1, + "tot_ra_nw": 4, + "ra_ct_m": 8, + "ra_ct_f": 9, + "tot_ra_ct": 0, + "sle_nw_m": 9, + "sle_nw_f": 5, + "tot_sle_nw": 2, + "sle_ct_m": 2, + "sle_ct_f": 6, + "tot_sle_ct": 8, + "sub_tot_nw_rhe_m": 8, + "sub_tot_nw_rhe_f": 7, + "sub_tot_nw_rhe": 10, + "sub_tot_ct_rhe_m": 3, + "sub_tot_ct_rhe_f": 10, + "sub_tot_ct_rhe": 2, + "tot_rhe": 9, + "oe_nw_m": 8, + "oe_nw_f": 4, + "tot_oe_nw": 7, + "oe_ct_m": 3, + "oe_ct_f": 6, + "tot_oe_ct": 8, + "pc_nw_m": 9, + "pc_nw_f": 3, + "tot_pc_nw": 6, + "pc_ct_m": 5, + "pc_ct_f": 8, + "tot_pc_ct": 3, + "gs_nw_m": 2, + "gs_nw_f": 6, + "tot_gs_nw": 10, + "gs_ct_m": 1, + "gs_ct_f": 3, + "tot_gs_ct": 5, + "col_nw_m": 9, + "col_nw_f": 1, + "tot_col_nw": 6, + "col_ct_m": 9, + "col_ct_f": 10, + "tot_col_ct": 0, + "sub_tot_nw_gi_m": 1, + "sub_tot_nw_gi_f": 5, + "sub_tot_nw_gi": 10, + "sub_tot_ct_gi_m": 8, + "sub_tot_ct_gi_f": 10, + "sub_tot_ct_gi": 9, + "tot_gi": 10, + "ov_nw": 3, + "ov_ct": 10, + "cv_nw": 6, + "cv_ct": 1, + "endo_nw": 6, + "endo_ct": 5, + "tot_f_rep_nw": 10, + "tot_f_rep_ct": 7, + "tot_f_rep": 0, + "pro_nw": 4, + "pro_ct": 1, + "ts_nw": 0, + "ts_ct": 2, + "tot_m_rep_nw": 4, + "tot_m_rep_ct": 5, + "tot_m_rep": 9, + "th_nw_m": 9, + "th_nw_f": 6, + "tot_th_nw": 1, + "th_ct_m": 5, + "th_ct_f": 6, + "tot_th_ct": 1, + "pit_nw_m": 10, + "pit_nw_f": 10, + "tot_pit_nw": 10, + "pit_ct_m": 1, + "pit_ct_f": 8, + "tot_pit_ct": 7, + "thy_nw_m": 3, + "thy_nw_f": 7, + "tot_thy_nw": 9, + "thy_ct_m": 2, + "thy_ct_f": 6, + "tot_thy_ct": 10, + "adr_nw_m": 5, + "adr_nw_f": 4, + "tot_adr_nw": 6, + "adr_ct_m": 0, + "adr_ct_f": 5, + "tot_adr_ct": 1, + "sub_tot_nw_endo_m": 3, + "sub_tot_nw_endo_f": 10, + "sub_tot_nw_endo": 8, + "sub_tot_ct_endo_m": 7, + "sub_tot_ct_endo_f": 8, + "sub_tot_ct_endo": 3, + "tot_endo": 5, + "ost_nw_m": 5, + "ost_nw_f": 9, + "tot_ost_nw": 5, + "ost_ct_m": 9, + "ost_ct_f": 6, + "tot_ost_ct": 10, + "tot_musk": 1, + "leu_nw_m": 6, + "leu_nw_f": 10, + "tot_leu_nw": 10, + "leu_ct_m": 9, + "leu_ct_f": 9, + "tot_leu_ct": 2, + "lym_nw_m": 3, + "lym_nw_f": 3, + "tot_lym_nw": 6, + "lym_ct_m": 3, + "lym_ct_f": 0, + "tot_lym_ct": 5, + "sub_tot_nw_hae_m": 5, + "sub_tot_nw_hae_f": 4, + "sub_tot_nw_hae": 9, + "sub_tot_ct_hae_m": 7, + "sub_tot_ct_hae_f": 6, + "sub_tot_ct_hae": 10, + "tot_hae": 3, + "ggn_nw_m": 1, + "ggn_nw_f": 10, + "tot_ggn_nw": 8, + "ggn_ct_m": 4, + "ggn_ct_f": 5, + "tot_ggn_ct": 6, + "cpt_nw_m": 0, + "cpt_nw_f": 10, + "tot_cpt_nw": 1, + "cpt_ct_m": 8, + "cpt_ct_f": 3, + "tot_cpt_ct": 0, + "emb_nw_m": 1, + "emb_nw_f": 3, + "tot_emb_nw": 4, + "emb_ct_m": 4, + "emb_ct_f": 3, + "tot_emb_ct": 5, + "pin_nw_m": 3, + "pin_nw_f": 9, + "tot_pin_nw": 10, + "pin_ct_m": 5, + "pin_ct_f": 3, + "tot_pin_ct": 6, + "men_nw_m": 7, + "men_nw_f": 9, + "tot_men_nw": 10, + "men_ct_m": 6, + "men_ct_f": 5, + "tot_men_ct": 4, + "mes_nw_m": 2, + "mes_nw_f": 5, + "tot_mes_nw": 6, + "mes_ct_m": 3, + "mes_ct_f": 6, + "tot_mes_ct": 4, + "mel_nw_m": 0, + "mel_nw_f": 5, + "tot_mel_nw": 8, + "mel_ct_m": 2, + "mel_ct_f": 1, + "tot_mel_ct": 0, + "hly_nw_m": 8, + "hly_nw_f": 3, + "tot_hly_nw": 0, + "hly_ct_m": 9, + "hly_ct_f": 5, + "tot_hly_ct": 4, + "gct_nw_m": 7, + "gct_nw_f": 8, + "tot_gct_nw": 4, + "gct_ct_m": 1, + "gct_ct_f": 8, + "tot_gct_ct": 10, + "sub_tot_nw_neu_m": 1, + "sub_tot_nw_neu_f": 2, + "sub_tot_nw_neu": 9, + "sub_tot_ct_neu_m": 8, + "sub_tot_ct_neu_f": 3, + "sub_tot_ct_neu": 2, + "tot_neu": 2 + }, + { + "join_location": 1, + "location_uuid": "08feae7c-1352-11df-a1f1-0026b9348837", + "mfl_code": 11111, + "county": "Busia", + "facility": "Busia", + "location_id": 2, + "location": "Busia", + "nw_ctld_htn_m": 1, + "tot_nw_ctld_htn": 2, + "ct_ctld_htn_f": 10, + "ct_ctld_htn_m": 10, + "tot_ct_ctld_htn": 5, + "nw_unctld_htn_f": 4, + "nw_unctld_htn_m": 10, + "tot_nw_unctld_htn": 8, + "ct_unctld_htn_f": 5, + "ct_unctld_htn_m": 0, + "tot_ct_unctld_htn": 1, + "nw_unk_htn_f": 6, + "nw_unk_htn_m": 0, + "tot_nw_unk_htn": 2, + "ct_unk_htn_f": 5, + "ct_unk_htn_m": 3, + "tot_ct_unk_htn": 3, + "nw_htn_m": 5, + "nw_htn_f": 3, + "nw_htn": 9, + "ct_htn_m": 5, + "ct_htn_f": 7, + "ct_htn": 3, + "tot_htn": 10, + "nw_ctld_dm_f": 2, + "nw_ctld_dm_m": 1, + "tot_nw_ctld_dm": 0, + "ct_ctld_dm_f": 8, + "ct_ctld_dm_m": 6, + "tot_ct_ctld_dm": 2, + "nw_unctld_dm_f": 2, + "nw_unctld_dm_m": 10, + "tot_nw_unctld_dm": 6, + "ct_unctld_dm_f": 5, + "ct_unctld_dm_m": 2, + "tot_ct_unctld_dm": 5, + "nw_unk_dm_f": 0, + "nw_unk_dm_m": 4, + "tot_nw_unk_dm": 10, + "ct_unk_dm_f": 7, + "ct_unk_dm_m": 1, + "tot_ct_unk_dm": 5, + "nw_dm_m": 6, + "nw_dm_f": 8, + "nw_dm": 10, + "ct_dm_m": 4, + "ct_dm_f": 5, + "ct_dm": 6, + "tot_dm": 9, + "stg_1_nw_chr_m": 5, + "stg_1_nw_chr_f": 3, + "tot_stg_1_nw_chr": 3, + "stg_1_ct_chr_m": 9, + "stg_1_ct_chr_f": 6, + "tot_stg_1_ct_chr": 9, + "stg_1_nw_acu_m": 3, + "stg_1_nw_acu_f": 9, + "tot_stg_1_nw_acu": 3, + "stg_1_ct_acu_m": 7, + "stg_1_ct_acu_f": 3, + "tot_stg_1_ct_acu": 2, + "stg_2_nw_chr_m": 9, + "stg_2_nw_chr_f": 1, + "tot_stg_2_nw_chr": 10, + "stg_2_ct_chr_m": 3, + "stg_2_ct_chr_f": 9, + "tot_stg_2_ct_chr": 5, + "stg_2_nw_acu_m": 8, + "stg_2_nw_acu_f": 9, + "tot_stg_2_nw_acu": 2, + "stg_2_ct_acu_m": 3, + "stg_2_ct_acu_f": 0, + "tot_stg_2_ct_acu": 2, + "stg_3_nw_chr_m": 10, + "stg_3_nw_chr_f": 10, + "tot_stg_3_nw_chr": 7, + "stg_3_ct_chr_m": 2, + "stg_3_ct_chr_f": 5, + "tot_stg_3_ct_chr": 6, + "stg_3_nw_acu_m": 8, + "stg_3_nw_acu_f": 4, + "tot_stg_3_nw_acu": 2, + "stg_3_ct_acu_m": 0, + "stg_3_ct_acu_f": 3, + "tot_stg_3_ct_acu": 1, + "stg_4_nw_chr_m": 3, + "stg_4_nw_chr_f": 10, + "tot_stg_4_nw_chr": 10, + "stg_4_ct_chr_m": 2, + "stg_4_ct_chr_f": 9, + "tot_stg_4_ct_chr": 1, + "stg_4_nw_acu_m": 1, + "stg_4_nw_acu_f": 4, + "tot_stg_4_nw_acu": 8, + "stg_4_ct_acu_m": 7, + "stg_4_ct_acu_f": 2, + "tot_stg_4_ct_acu": 7, + "stg_5_nw_chr_m": 5, + "stg_5_nw_chr_f": 4, + "tot_stg_5_nw_chr": 9, + "stg_5_ct_chr_m": 8, + "stg_5_ct_chr_f": 8, + "tot_stg_5_ct_chr": 4, + "stg_5_nw_acu_m": 10, + "stg_5_nw_acu_f": 10, + "tot_stg_5_nw_acu": 4, + "stg_5_ct_acu_m": 6, + "stg_5_ct_acu_f": 2, + "tot_stg_5_ct_acu": 8, + "sub_tot_chr": 1, + "sub_tot_acu": 0, + "hf_nw_m": 9, + "hf_nw_f": 6, + "tot_hf_nw": 2, + "hf_ct_m": 7, + "hf_ct_f": 8, + "tot_hf_ct": 6, + "myo_inf_nw_m": 2, + "myo_inf_nw_f": 4, + "tot_myo_inf_nw": 4, + "myo_inf_ct_m": 5, + "myo_inf_ct_f": 3, + "tot_myo_inf_ct": 9, + "sub_tot_ct_cvd_m": 4, + "sub_tot_ct_cvd_f": 7, + "sub_tot_ct_cvd": 1, + "tot_cvd": 5, + "mg_nw_m": 7, + "mg_nw_f": 5, + "tot_mg_nw": 5, + "mg_ct_m": 3, + "mg_ct_f": 4, + "tot_mg_ct": 9, + "cnv_nw_m": 5, + "cnv_nw_f": 7, + "tot_cnv_nw": 10, + "cnv_ct_m": 5, + "cnv_ct_f": 7, + "tot_cnv_ct": 10, + "sub_tot_nw_cnv_m": 9, + "sub_tot_nw_cnv_f": 4, + "sub_tot_nw_cnv": 6, + "sub_tot_ct_cnv_m": 9, + "sub_tot_ct_cnv_f": 7, + "sub_tot_ct_cnv": 1, + "tot_cnv": 1, + "ra_nw_m": 10, + "ra_nw_f": 1, + "tot_ra_nw": 4, + "ra_ct_m": 8, + "ra_ct_f": 9, + "tot_ra_ct": 0, + "sle_nw_m": 9, + "sle_nw_f": 5, + "tot_sle_nw": 2, + "sle_ct_m": 2, + "sle_ct_f": 6, + "tot_sle_ct": 8, + "sub_tot_nw_rhe_m": 8, + "sub_tot_nw_rhe_f": 7, + "sub_tot_nw_rhe": 10, + "sub_tot_ct_rhe_m": 3, + "sub_tot_ct_rhe_f": 10, + "sub_tot_ct_rhe": 2, + "tot_rhe": 9, + "oe_nw_m": 8, + "oe_nw_f": 4, + "tot_oe_nw": 7, + "oe_ct_m": 3, + "oe_ct_f": 6, + "tot_oe_ct": 8, + "pc_nw_m": 9, + "pc_nw_f": 3, + "tot_pc_nw": 6, + "pc_ct_m": 5, + "pc_ct_f": 8, + "tot_pc_ct": 3, + "gs_nw_m": 2, + "gs_nw_f": 6, + "tot_gs_nw": 10, + "gs_ct_m": 1, + "gs_ct_f": 3, + "tot_gs_ct": 5, + "col_nw_m": 9, + "col_nw_f": 1, + "tot_col_nw": 6, + "col_ct_m": 9, + "col_ct_f": 10, + "tot_col_ct": 0, + "sub_tot_nw_gi_m": 1, + "sub_tot_nw_gi_f": 5, + "sub_tot_nw_gi": 10, + "sub_tot_ct_gi_m": 8, + "sub_tot_ct_gi_f": 10, + "sub_tot_ct_gi": 9, + "tot_gi": 10, + "ov_nw": 3, + "ov_ct": 10, + "cv_nw": 6, + "cv_ct": 1, + "endo_nw": 6, + "endo_ct": 5, + "tot_f_rep_nw": 10, + "tot_f_rep_ct": 7, + "tot_f_rep": 0, + "pro_nw": 4, + "pro_ct": 1, + "ts_nw": 0, + "ts_ct": 2, + "tot_m_rep_nw": 4, + "tot_m_rep_ct": 5, + "tot_m_rep": 9, + "th_nw_m": 9, + "th_nw_f": 6, + "tot_th_nw": 1, + "th_ct_m": 5, + "th_ct_f": 6, + "tot_th_ct": 1, + "pit_nw_m": 10, + "pit_nw_f": 10, + "tot_pit_nw": 10, + "pit_ct_m": 1, + "pit_ct_f": 8, + "tot_pit_ct": 7, + "thy_nw_m": 3, + "thy_nw_f": 7, + "tot_thy_nw": 9, + "thy_ct_m": 2, + "thy_ct_f": 6, + "tot_thy_ct": 10, + "adr_nw_m": 5, + "adr_nw_f": 4, + "tot_adr_nw": 6, + "adr_ct_m": 0, + "adr_ct_f": 5, + "tot_adr_ct": 1, + "sub_tot_nw_endo_m": 3, + "sub_tot_nw_endo_f": 10, + "sub_tot_nw_endo": 8, + "sub_tot_ct_endo_m": 7, + "sub_tot_ct_endo_f": 8, + "sub_tot_ct_endo": 3, + "tot_endo": 5, + "ost_nw_m": 5, + "ost_nw_f": 9, + "tot_ost_nw": 5, + "ost_ct_m": 9, + "ost_ct_f": 6, + "tot_ost_ct": 10, + "tot_musk": 1, + "leu_nw_m": 6, + "leu_nw_f": 10, + "tot_leu_nw": 10, + "leu_ct_m": 9, + "leu_ct_f": 9, + "tot_leu_ct": 2, + "lym_nw_m": 3, + "lym_nw_f": 3, + "tot_lym_nw": 6, + "lym_ct_m": 3, + "lym_ct_f": 0, + "tot_lym_ct": 5, + "sub_tot_nw_hae_m": 5, + "sub_tot_nw_hae_f": 4, + "sub_tot_nw_hae": 9, + "sub_tot_ct_hae_m": 7, + "sub_tot_ct_hae_f": 6, + "sub_tot_ct_hae": 10, + "tot_hae": 3, + "ggn_nw_m": 1, + "ggn_nw_f": 10, + "tot_ggn_nw": 8, + "ggn_ct_m": 4, + "ggn_ct_f": 5, + "tot_ggn_ct": 6, + "cpt_nw_m": 0, + "cpt_nw_f": 10, + "tot_cpt_nw": 1, + "cpt_ct_m": 8, + "cpt_ct_f": 3, + "tot_cpt_ct": 0, + "emb_nw_m": 1, + "emb_nw_f": 3, + "tot_emb_nw": 4, + "emb_ct_m": 4, + "emb_ct_f": 3, + "tot_emb_ct": 5, + "pin_nw_m": 3, + "pin_nw_f": 9, + "tot_pin_nw": 10, + "pin_ct_m": 5, + "pin_ct_f": 3, + "tot_pin_ct": 6, + "men_nw_m": 7, + "men_nw_f": 9, + "tot_men_nw": 10, + "men_ct_m": 6, + "men_ct_f": 5, + "tot_men_ct": 4, + "mes_nw_m": 2, + "mes_nw_f": 5, + "tot_mes_nw": 6, + "mes_ct_m": 3, + "mes_ct_f": 6, + "tot_mes_ct": 4, + "mel_nw_m": 0, + "mel_nw_f": 5, + "tot_mel_nw": 8, + "mel_ct_m": 2, + "mel_ct_f": 1, + "tot_mel_ct": 0, + "hly_nw_m": 8, + "hly_nw_f": 3, + "tot_hly_nw": 0, + "hly_ct_m": 9, + "hly_ct_f": 5, + "tot_hly_ct": 4, + "gct_nw_m": 7, + "gct_nw_f": 8, + "tot_gct_nw": 4, + "gct_ct_m": 1, + "gct_ct_f": 8, + "tot_gct_ct": 10, + "sub_tot_nw_neu_m": 1, + "sub_tot_nw_neu_f": 2, + "sub_tot_nw_neu": 9, + "sub_tot_ct_neu_m": 8, + "sub_tot_ct_neu_f": 3, + "sub_tot_ct_neu": 2, + "tot_neu": 2 + } + ], + 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); + }); + }); + } +} From f41e2b63e3d42640bbfdc27d9f3e7d90d335aa59 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Sun, 19 Nov 2023 18:17:41 +0300 Subject: [PATCH 06/40] POC-544-v2: added all the report listings POC-544-v2: added htn schema and ability to have e2e result POC-544-v3: set end point to function POC-544-v2: added dm report and done cleanup POC-544-v2: enlisted all the reports --- app/reporting-framework/base-mysql.report.js | 43 + .../cardiovascular-disease/cvd-aggregate.json | 239 ++++ .../cardiovascular-disease/cvd-base.json | 282 +++++ .../diabetic/dm-aggregate.json | 204 ++++ .../disaggregations/diabetic/dm-base.json | 328 +++++ .../hypertensive/htn-aggregate.json | 204 ++++ .../hypertensive/htn-base.json | 328 +++++ .../kidney-disease/kd-aggregate.json | 701 +++++++++++ .../kidney-disease/kd-base.json | 740 +++++++++++ .../plhiv-ncd-v2-report-indicators.json | 126 +- .../plhiv-ncd-v2-report.json | 17 + app/routes/plhiv-ncd-v2-report.route.js | 12 +- .../plhiv-ncd-v2-summary.service.js | 1077 +---------------- 13 files changed, 3232 insertions(+), 1069 deletions(-) create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report.json diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index 6961f2216..833a80ade 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -384,6 +384,20 @@ 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 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 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 +1809,35 @@ 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 'cvdPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(cvd_plhiv_aggregate), + cvdPlhivBase: this.cloneJsonSchema(cvd_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..1f36a3f86 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/cardiovascular-disease/cvd-aggregate.json @@ -0,0 +1,239 @@ +{ + "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..5444ac39d --- /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.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd" + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "hmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "hmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "hmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "hmrd.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": "hmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "hmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "l.name" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "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": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_cvd_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + } + + , + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_cvd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.endDate = ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" + } + ] + }, + "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/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..942c82c74 --- /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.nw_ctld_dm_f)" + }, + { + "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..a445ed2bf --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/diabetic/dm-base.json @@ -0,0 +1,328 @@ +{ + "name": "dmPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd" + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "hmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "hmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "hmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "hmrd.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": "hmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "hmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "l.name" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "derived_column", + "alias": "nw_ctld_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmrd.gender = 'F',1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_ctld_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_ctld_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "derived_column", + "alias": "ct_ctld_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_ctld_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_ctld_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_unctld_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_unctld_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_unctld_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_unctld_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_unctld_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_unctld_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_unk_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_unk_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_unk_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_unk_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_unk_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_unk_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmrd.gender = 'F',1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_dm_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_dm_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmrd.gender = 'F',1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_dm", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmrd.gender = 'F',1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.endDate = ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" + } + ] + }, + "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/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..dfc9089d4 --- /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.nw_ctld_htn_f)" + }, + { + "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": "sum(b.nw_unctld_htn_f)" + }, + { + "type": "simple_column", + "alias": "nw_unctld_htn_m", + "column": "sum(b.nw_unctld_htn_m)" + }, + { + "type": "simple_column", + "alias": "tot_nw_unctld_htn", + "column": "sum(b.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_m", + "column": "sum(b.nw_htn_m)" + }, + { + "type": "simple_column", + "alias": "nw_htn_f", + "column": "sum(b.nw_htn_f)" + }, + { + "type": "simple_column", + "alias": "nw_htn", + "column": "sum(b.nw_htn)" + }, + { + "type": "simple_column", + "alias": "ct_htn_m", + "column": "sum(b.ct_htn_m)" + }, + { + "type": "simple_column", + "alias": "ct_htn_f", + "column": "sum(b.ct_htn_f)" + }, + { + "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..245809d13 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/hypertensive/htn-base.json @@ -0,0 +1,328 @@ +{ + "name": "htnPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd" + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "hmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "hmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "hmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "hmrd.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": "hmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "hmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "l.name" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "derived_column", + "alias": "nw_ctld_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmrd.gender = 'F',1, 0)" + } + }, + { + "type": "derived_column", + "alias": "nw_ctld_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_ctld_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "1" + } + }, + { + "type": "derived_column", + "alias": "ct_ctld_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_ctld_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_ctld_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_unctld_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_unctld_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_unctld_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_unctld_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_unctld_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_unctld_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_unk_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_unk_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_unk_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_unk_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_unk_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_unk_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "nw_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmrd.gender = 'F',1, 0)" + } + }, + { + "type": "derived_column", + "alias": "ct_htn_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_htn_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "ct_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_nw_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmrd.gender = 'F',1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_ct_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_htn", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmrd.gender = 'F',1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.endDate = ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" + } + ] + }, + "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/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..bf41ec24e --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-aggregate.json @@ -0,0 +1,701 @@ +{ + "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": "sum(b.stg_1_nw_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_1_nw_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_1_nw_acu)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_1_ct_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_1_ct_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(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": "sum(b.stg_2_nw_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_2_nw_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_2_nw_acu)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_2_ct_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_2_ct_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(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": "sum(b.stg_3_nw_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3_nw_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_3_nw_acu)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3_ct_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_3_ct_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_3_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": "sum(b.stg_4_nw_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_4_nw_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_4_nw_acu)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_4_ct_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_4_ct_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(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": "sum(b.stg_5_nw_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_5_nw_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.tot_stg_5_nw_acu)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_5_ct_acu_m)" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.stg_5_ct_acu_f)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(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": "sub_tot_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_tot_chr)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "sum(b.sub_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..83869a420 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/kidney-disease/kd-base.json @@ -0,0 +1,740 @@ +{ + "name": "kdPlhivBase", + "version": "1.0", + "tag": "", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd" + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "hmrd.person_id = fi.patient_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "hmrd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "per", + "join": { + "type": "INNER", + "joinCondition": "hmrd.person_id = per.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "hmrd.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": "hmrd.age" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "hmrd.location_id" + }, + { + "type": "simple_column", + "alias": "location", + "column": "l.name" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "derived_column", + "alias": "stg_1_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_1_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_1_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_1_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_2_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_2_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_2_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "2" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_3_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_3_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_4_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_4_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_4_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_5_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "stg_5_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_5_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "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": "sub_tot_nw_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_chr", + "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", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + }, + { + "type": "derived_column", + "alias": "tot_kd", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "0" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.endDate = ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["hmrd.person_id"], + "excludeParam": "excludeParam" + } +} 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 index b07ac3615..1a1354641 100644 --- 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 @@ -137,6 +137,108 @@ } ] }, + { + "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": [ + "nw_dp_mh_f", + "nw_dp_mh_m", + "tot_nw_dp_mh", + "ct_dp_mh_f", + "ct_dp_mh_m", + "tot_ct_dp_mh" + ] + }, + { + "label": "Anxiety", + "indicator": [ + "nw_anx_mh_f", + "nw_anx_mh_m", + "tot_nw_anx_mh", + "ct_anx_mh_f", + "ct_anx_mh_m", + "tot_ct_anx_mh" + ] + }, + { + "label": "Bipolar and Related Disorder", + "indicator": [ + "nw_bip_mh_f", + "nw_bip_mh_m", + "tot_nw_bip_mh", + "ct_bip_mh_f", + "ct_bip_mh_m", + "tot_ct_bip_mh" + ] + }, + { + "label": "Personality Disorder", + "indicator": [ + "nw_per_mh_f", + "nw_per_mh_m", + "tot_nw_per_mh", + "ct_per_mh_f", + "ct_per_mh_m", + "tot_ct_per_mh" + ] + }, + { + "label": "Feeding and Eating Disorder", + "indicator": [ + "nw_fe_mh_f", + "nw_fe_mh_m", + "tot_nw_fe_mh", + "ct_fe_mh_f", + "ct_fe_mh_m", + "tot_ct_fe_mh" + ] + }, + { + "label": "Obsessive - Compulsive and Related Disorder", + "indicator": [ + "nw_obs_mh_f", + "nw_obs_mh_m", + "tot_nw_obs_mh", + "ct_obs_mh_f", + "ct_obs_mh_m", + "tot_ct_obs_mh" + ] + }, + { + "label": "Sub Total", + "indicator": [ + "nw_mh_m", + "nw_mh_f", + "nw_mh", + "ct_mh_m", + "ct_mh_f", + "ct_mh" + ] + }, + { + "label": "Status Sub Total", + "indicator": ["tot_nw_mh", "tot_ct_mh"] + }, + { + "label": "Total", + "indicator": "tot_mh" + } + ] + }, { "sectionTitle": "Kidney Disease", "indicators": [ @@ -308,23 +410,23 @@ { "label": "Heart Failure", "indicator": [ - "hf_nw_m", - "hf_nw_f", - "tot_hf_nw", - "hf_ct_m", - "hf_ct_f", - "tot_hf_ct" + "nw_hf_m", + "nw_hf_f", + "tot_nw_hf", + "ct_hf_m", + "ct_hf_f", + "tot_ct_hf" ] }, { "label": "Myocardinal Infarction", "indicator": [ - "myo_inf_nw_m", - "myo_inf_nw_f", - "tot_myo_inf_nw", - "myo_inf_ct_m", - "myo_inf_ct_f", - "tot_myo_inf_ct" + "nw_myo_inf_m", + "nw_myo_inf_f", + "tot_nw_myo_inf", + "ct_myo_inf_m", + "ct_myo_inf_f", + "tot_ct_myo_inft" ] }, { 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..d43da2463 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/plhiv-ncd-v2-report.json @@ -0,0 +1,17 @@ +{ + "reports": [ + "htnPlhivAggregate", + "dmPlhivAggregate", + "cvdPlhivAggregate", + "kdPlhivAggregate", + "mhPlhivAggregate", + "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 index 64cd08f9b..cbceaa5ff 100644 --- a/app/routes/plhiv-ncd-v2-report.route.js +++ b/app/routes/plhiv-ncd-v2-report.route.js @@ -8,7 +8,7 @@ const { const routes = [ { method: 'GET', - path: '/etl/plhiv-ncd-v2-summary', + path: '/etl/plhiv-ncd-v2-monthly-report', config: { plugins: { hapiAuthorization: { @@ -19,14 +19,14 @@ const routes = [ preRequest.resolveLocationIdsToLocationUuids(request, function () { let requestParams = Object.assign({}, request.query, request.params); let reportParams = etlHelpers.getReportParams( - 'plhiv-ncd-v2-summary-report', + 'plhiv-ncd-v2-monthly-report', ['endDate', 'locationUuids'], requestParams ); reportParams.requestParams.isAggregated = true; let service = new PLHIVNCDv2SummaryReportService( - 'plhiv-ncd-v2-summary-report', + 'plhiv-ncd-v2-monthly-report', reportParams.requestParams ); service @@ -52,7 +52,7 @@ const routes = [ }, { method: 'GET', - path: '/etl/plhiv-ncd-v2-summary-patient-list', + path: '/etl/plhiv-ncd-v2-monthly-report-patient-list', config: { plugins: { hapiAuthorization: { @@ -68,13 +68,13 @@ const routes = [ request.params ); let reportParams = etlHelpers.getReportParams( - 'plhiv-ncd-v2-summary-report', + 'plhiv-ncd-v2-monthly-report', ['endDate', 'locationUuids'], requestParams ); delete reportParams.requestParams['gender']; const plhivncdV2ReportService = new PLHIVNCDv2SummaryReportService( - 'plhiv-ncd-v2-summary-report', + 'plhiv-ncd-v2-monthly-report', reportParams.requestParams ); plhivncdV2ReportService diff --git a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js index 3539bb1f6..d5f228bdc 100644 --- a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js +++ b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js @@ -23,1066 +23,41 @@ export class PLHIVNCDv2SummaryReportService extends MultiDatasetPatientlistRepor .then((sourceTables) => { that.params.hivMonthlyDatasetSource = sourceTables.hivMonthlyDatasetSource; - // super.generateReport(additionalParams).then((results) => { + 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 - // ); - // } - // } + 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: [] - // }); - //test resolve({ - queriesAndSchemas: [], - result: [ - { - "join_location": 45, - "location_uuid": "08feae7c-1352-11df-a1f1-0026b0000000", - "mfl_code": 22222, - "county": "Uasin Gishu", - "facility": "Kapseret", - "location_id": 1, - "location": "Kapseret", - "nw_ctld_htn_m": 1, - "tot_nw_ctld_htn": 2, - "ct_ctld_htn_f": 10, - "ct_ctld_htn_m": 10, - "tot_ct_ctld_htn": 5, - "nw_unctld_htn_f": 4, - "nw_unctld_htn_m": 10, - "tot_nw_unctld_htn": 8, - "ct_unctld_htn_f": 5, - "ct_unctld_htn_m": 0, - "tot_ct_unctld_htn": 1, - "nw_unk_htn_f": 6, - "nw_unk_htn_m": 0, - "tot_nw_unk_htn": 2, - "ct_unk_htn_f": 5, - "ct_unk_htn_m": 3, - "tot_ct_unk_htn": 3, - "nw_htn_m": 5, - "nw_htn_f": 3, - "nw_htn": 9, - "ct_htn_m": 5, - "ct_htn_f": 7, - "ct_htn": 3, - "tot_htn": 10, - "nw_ctld_dm_f": 2, - "nw_ctld_dm_m": 1, - "tot_nw_ctld_dm": 0, - "ct_ctld_dm_f": 8, - "ct_ctld_dm_m": 6, - "tot_ct_ctld_dm": 2, - "nw_unctld_dm_f": 2, - "nw_unctld_dm_m": 10, - "tot_nw_unctld_dm": 6, - "ct_unctld_dm_f": 5, - "ct_unctld_dm_m": 2, - "tot_ct_unctld_dm": 5, - "nw_unk_dm_f": 0, - "nw_unk_dm_m": 4, - "tot_nw_unk_dm": 10, - "ct_unk_dm_f": 7, - "ct_unk_dm_m": 1, - "tot_ct_unk_dm": 5, - "nw_dm_m": 6, - "nw_dm_f": 8, - "nw_dm": 10, - "ct_dm_m": 4, - "ct_dm_f": 5, - "ct_dm": 6, - "tot_dm": 9, - "stg_1_nw_chr_m": 5, - "stg_1_nw_chr_f": 3, - "tot_stg_1_nw_chr": 3, - "stg_1_ct_chr_m": 9, - "stg_1_ct_chr_f": 6, - "tot_stg_1_ct_chr": 9, - "stg_1_nw_acu_m": 3, - "stg_1_nw_acu_f": 9, - "tot_stg_1_nw_acu": 3, - "stg_1_ct_acu_m": 7, - "stg_1_ct_acu_f": 3, - "tot_stg_1_ct_acu": 2, - "stg_2_nw_chr_m": 9, - "stg_2_nw_chr_f": 1, - "tot_stg_2_nw_chr": 10, - "stg_2_ct_chr_m": 3, - "stg_2_ct_chr_f": 9, - "tot_stg_2_ct_chr": 5, - "stg_2_nw_acu_m": 8, - "stg_2_nw_acu_f": 9, - "tot_stg_2_nw_acu": 2, - "stg_2_ct_acu_m": 3, - "stg_2_ct_acu_f": 0, - "tot_stg_2_ct_acu": 2, - "stg_3_nw_chr_m": 10, - "stg_3_nw_chr_f": 10, - "tot_stg_3_nw_chr": 7, - "stg_3_ct_chr_m": 2, - "stg_3_ct_chr_f": 5, - "tot_stg_3_ct_chr": 6, - "stg_3_nw_acu_m": 8, - "stg_3_nw_acu_f": 4, - "tot_stg_3_nw_acu": 2, - "stg_3_ct_acu_m": 0, - "stg_3_ct_acu_f": 3, - "tot_stg_3_ct_acu": 1, - "stg_4_nw_chr_m": 3, - "stg_4_nw_chr_f": 10, - "tot_stg_4_nw_chr": 10, - "stg_4_ct_chr_m": 2, - "stg_4_ct_chr_f": 9, - "tot_stg_4_ct_chr": 1, - "stg_4_nw_acu_m": 1, - "stg_4_nw_acu_f": 4, - "tot_stg_4_nw_acu": 8, - "stg_4_ct_acu_m": 7, - "stg_4_ct_acu_f": 2, - "tot_stg_4_ct_acu": 7, - "stg_5_nw_chr_m": 5, - "stg_5_nw_chr_f": 4, - "tot_stg_5_nw_chr": 9, - "stg_5_ct_chr_m": 8, - "stg_5_ct_chr_f": 8, - "tot_stg_5_ct_chr": 4, - "stg_5_nw_acu_m": 10, - "stg_5_nw_acu_f": 10, - "tot_stg_5_nw_acu": 4, - "stg_5_ct_acu_m": 6, - "stg_5_ct_acu_f": 2, - "tot_stg_5_ct_acu": 8, - "sub_tot_chr": 1, - "sub_tot_acu": 0, - "hf_nw_m": 9, - "hf_nw_f": 6, - "tot_hf_nw": 2, - "hf_ct_m": 7, - "hf_ct_f": 8, - "tot_hf_ct": 6, - "myo_inf_nw_m": 2, - "myo_inf_nw_f": 4, - "tot_myo_inf_nw": 4, - "myo_inf_ct_m": 5, - "myo_inf_ct_f": 3, - "tot_myo_inf_ct": 9, - "sub_tot_ct_cvd_m": 4, - "sub_tot_ct_cvd_f": 7, - "sub_tot_ct_cvd": 1, - "tot_cvd": 5, - "mg_nw_m": 7, - "mg_nw_f": 5, - "tot_mg_nw": 5, - "mg_ct_m": 3, - "mg_ct_f": 4, - "tot_mg_ct": 9, - "cnv_nw_m": 5, - "cnv_nw_f": 7, - "tot_cnv_nw": 10, - "cnv_ct_m": 5, - "cnv_ct_f": 7, - "tot_cnv_ct": 10, - "sub_tot_nw_cnv_m": 9, - "sub_tot_nw_cnv_f": 4, - "sub_tot_nw_cnv": 6, - "sub_tot_ct_cnv_m": 9, - "sub_tot_ct_cnv_f": 7, - "sub_tot_ct_cnv": 1, - "tot_cnv": 1, - "ra_nw_m": 10, - "ra_nw_f": 1, - "tot_ra_nw": 4, - "ra_ct_m": 8, - "ra_ct_f": 9, - "tot_ra_ct": 0, - "sle_nw_m": 9, - "sle_nw_f": 5, - "tot_sle_nw": 2, - "sle_ct_m": 2, - "sle_ct_f": 6, - "tot_sle_ct": 8, - "sub_tot_nw_rhe_m": 8, - "sub_tot_nw_rhe_f": 7, - "sub_tot_nw_rhe": 10, - "sub_tot_ct_rhe_m": 3, - "sub_tot_ct_rhe_f": 10, - "sub_tot_ct_rhe": 2, - "tot_rhe": 9, - "oe_nw_m": 8, - "oe_nw_f": 4, - "tot_oe_nw": 7, - "oe_ct_m": 3, - "oe_ct_f": 6, - "tot_oe_ct": 8, - "pc_nw_m": 9, - "pc_nw_f": 3, - "tot_pc_nw": 6, - "pc_ct_m": 5, - "pc_ct_f": 8, - "tot_pc_ct": 3, - "gs_nw_m": 2, - "gs_nw_f": 6, - "tot_gs_nw": 10, - "gs_ct_m": 1, - "gs_ct_f": 3, - "tot_gs_ct": 5, - "col_nw_m": 9, - "col_nw_f": 1, - "tot_col_nw": 6, - "col_ct_m": 9, - "col_ct_f": 10, - "tot_col_ct": 0, - "sub_tot_nw_gi_m": 1, - "sub_tot_nw_gi_f": 5, - "sub_tot_nw_gi": 10, - "sub_tot_ct_gi_m": 8, - "sub_tot_ct_gi_f": 10, - "sub_tot_ct_gi": 9, - "tot_gi": 10, - "ov_nw": 3, - "ov_ct": 10, - "cv_nw": 6, - "cv_ct": 1, - "endo_nw": 6, - "endo_ct": 5, - "tot_f_rep_nw": 10, - "tot_f_rep_ct": 7, - "tot_f_rep": 0, - "pro_nw": 4, - "pro_ct": 1, - "ts_nw": 0, - "ts_ct": 2, - "tot_m_rep_nw": 4, - "tot_m_rep_ct": 5, - "tot_m_rep": 9, - "th_nw_m": 9, - "th_nw_f": 6, - "tot_th_nw": 1, - "th_ct_m": 5, - "th_ct_f": 6, - "tot_th_ct": 1, - "pit_nw_m": 10, - "pit_nw_f": 10, - "tot_pit_nw": 10, - "pit_ct_m": 1, - "pit_ct_f": 8, - "tot_pit_ct": 7, - "thy_nw_m": 3, - "thy_nw_f": 7, - "tot_thy_nw": 9, - "thy_ct_m": 2, - "thy_ct_f": 6, - "tot_thy_ct": 10, - "adr_nw_m": 5, - "adr_nw_f": 4, - "tot_adr_nw": 6, - "adr_ct_m": 0, - "adr_ct_f": 5, - "tot_adr_ct": 1, - "sub_tot_nw_endo_m": 3, - "sub_tot_nw_endo_f": 10, - "sub_tot_nw_endo": 8, - "sub_tot_ct_endo_m": 7, - "sub_tot_ct_endo_f": 8, - "sub_tot_ct_endo": 3, - "tot_endo": 5, - "ost_nw_m": 5, - "ost_nw_f": 9, - "tot_ost_nw": 5, - "ost_ct_m": 9, - "ost_ct_f": 6, - "tot_ost_ct": 10, - "tot_musk": 1, - "leu_nw_m": 6, - "leu_nw_f": 10, - "tot_leu_nw": 10, - "leu_ct_m": 9, - "leu_ct_f": 9, - "tot_leu_ct": 2, - "lym_nw_m": 3, - "lym_nw_f": 3, - "tot_lym_nw": 6, - "lym_ct_m": 3, - "lym_ct_f": 0, - "tot_lym_ct": 5, - "sub_tot_nw_hae_m": 5, - "sub_tot_nw_hae_f": 4, - "sub_tot_nw_hae": 9, - "sub_tot_ct_hae_m": 7, - "sub_tot_ct_hae_f": 6, - "sub_tot_ct_hae": 10, - "tot_hae": 3, - "ggn_nw_m": 1, - "ggn_nw_f": 10, - "tot_ggn_nw": 8, - "ggn_ct_m": 4, - "ggn_ct_f": 5, - "tot_ggn_ct": 6, - "cpt_nw_m": 0, - "cpt_nw_f": 10, - "tot_cpt_nw": 1, - "cpt_ct_m": 8, - "cpt_ct_f": 3, - "tot_cpt_ct": 0, - "emb_nw_m": 1, - "emb_nw_f": 3, - "tot_emb_nw": 4, - "emb_ct_m": 4, - "emb_ct_f": 3, - "tot_emb_ct": 5, - "pin_nw_m": 3, - "pin_nw_f": 9, - "tot_pin_nw": 10, - "pin_ct_m": 5, - "pin_ct_f": 3, - "tot_pin_ct": 6, - "men_nw_m": 7, - "men_nw_f": 9, - "tot_men_nw": 10, - "men_ct_m": 6, - "men_ct_f": 5, - "tot_men_ct": 4, - "mes_nw_m": 2, - "mes_nw_f": 5, - "tot_mes_nw": 6, - "mes_ct_m": 3, - "mes_ct_f": 6, - "tot_mes_ct": 4, - "mel_nw_m": 0, - "mel_nw_f": 5, - "tot_mel_nw": 8, - "mel_ct_m": 2, - "mel_ct_f": 1, - "tot_mel_ct": 0, - "hly_nw_m": 8, - "hly_nw_f": 3, - "tot_hly_nw": 0, - "hly_ct_m": 9, - "hly_ct_f": 5, - "tot_hly_ct": 4, - "gct_nw_m": 7, - "gct_nw_f": 8, - "tot_gct_nw": 4, - "gct_ct_m": 1, - "gct_ct_f": 8, - "tot_gct_ct": 10, - "sub_tot_nw_neu_m": 1, - "sub_tot_nw_neu_f": 2, - "sub_tot_nw_neu": 9, - "sub_tot_ct_neu_m": 8, - "sub_tot_ct_neu_f": 3, - "sub_tot_ct_neu": 2, - "tot_neu": 2 - }, - { - "join_location": 1, - "location_uuid": "08feae7c-1352-11df-a1f1-0026b9348838", - "mfl_code": 15204, - "county": "Uasin Gishu", - "facility": "Moi Teaching Refferal Hospital", - "location_id": 1, - "location": "MTRH Module 1", - "nw_ctld_htn_m": 1, - "tot_nw_ctld_htn": 2, - "ct_ctld_htn_f": 10, - "ct_ctld_htn_m": 10, - "tot_ct_ctld_htn": 5, - "nw_unctld_htn_f": 4, - "nw_unctld_htn_m": 10, - "tot_nw_unctld_htn": 8, - "ct_unctld_htn_f": 5, - "ct_unctld_htn_m": 0, - "tot_ct_unctld_htn": 1, - "nw_unk_htn_f": 6, - "nw_unk_htn_m": 0, - "tot_nw_unk_htn": 2, - "ct_unk_htn_f": 5, - "ct_unk_htn_m": 3, - "tot_ct_unk_htn": 3, - "nw_htn_m": 5, - "nw_htn_f": 3, - "nw_htn": 9, - "ct_htn_m": 5, - "ct_htn_f": 7, - "ct_htn": 3, - "tot_htn": 10, - "nw_ctld_dm_f": 2, - "nw_ctld_dm_m": 1, - "tot_nw_ctld_dm": 0, - "ct_ctld_dm_f": 8, - "ct_ctld_dm_m": 6, - "tot_ct_ctld_dm": 2, - "nw_unctld_dm_f": 2, - "nw_unctld_dm_m": 10, - "tot_nw_unctld_dm": 6, - "ct_unctld_dm_f": 5, - "ct_unctld_dm_m": 2, - "tot_ct_unctld_dm": 5, - "nw_unk_dm_f": 0, - "nw_unk_dm_m": 4, - "tot_nw_unk_dm": 10, - "ct_unk_dm_f": 7, - "ct_unk_dm_m": 1, - "tot_ct_unk_dm": 5, - "nw_dm_m": 6, - "nw_dm_f": 8, - "nw_dm": 10, - "ct_dm_m": 4, - "ct_dm_f": 5, - "ct_dm": 6, - "tot_dm": 9, - "stg_1_nw_chr_m": 5, - "stg_1_nw_chr_f": 3, - "tot_stg_1_nw_chr": 3, - "stg_1_ct_chr_m": 9, - "stg_1_ct_chr_f": 6, - "tot_stg_1_ct_chr": 9, - "stg_1_nw_acu_m": 3, - "stg_1_nw_acu_f": 9, - "tot_stg_1_nw_acu": 3, - "stg_1_ct_acu_m": 7, - "stg_1_ct_acu_f": 3, - "tot_stg_1_ct_acu": 2, - "stg_2_nw_chr_m": 9, - "stg_2_nw_chr_f": 1, - "tot_stg_2_nw_chr": 10, - "stg_2_ct_chr_m": 3, - "stg_2_ct_chr_f": 9, - "tot_stg_2_ct_chr": 5, - "stg_2_nw_acu_m": 8, - "stg_2_nw_acu_f": 9, - "tot_stg_2_nw_acu": 2, - "stg_2_ct_acu_m": 3, - "stg_2_ct_acu_f": 0, - "tot_stg_2_ct_acu": 2, - "stg_3_nw_chr_m": 10, - "stg_3_nw_chr_f": 10, - "tot_stg_3_nw_chr": 7, - "stg_3_ct_chr_m": 2, - "stg_3_ct_chr_f": 5, - "tot_stg_3_ct_chr": 6, - "stg_3_nw_acu_m": 8, - "stg_3_nw_acu_f": 4, - "tot_stg_3_nw_acu": 2, - "stg_3_ct_acu_m": 0, - "stg_3_ct_acu_f": 3, - "tot_stg_3_ct_acu": 1, - "stg_4_nw_chr_m": 3, - "stg_4_nw_chr_f": 10, - "tot_stg_4_nw_chr": 10, - "stg_4_ct_chr_m": 2, - "stg_4_ct_chr_f": 9, - "tot_stg_4_ct_chr": 1, - "stg_4_nw_acu_m": 1, - "stg_4_nw_acu_f": 4, - "tot_stg_4_nw_acu": 8, - "stg_4_ct_acu_m": 7, - "stg_4_ct_acu_f": 2, - "tot_stg_4_ct_acu": 7, - "stg_5_nw_chr_m": 5, - "stg_5_nw_chr_f": 4, - "tot_stg_5_nw_chr": 9, - "stg_5_ct_chr_m": 8, - "stg_5_ct_chr_f": 8, - "tot_stg_5_ct_chr": 4, - "stg_5_nw_acu_m": 10, - "stg_5_nw_acu_f": 10, - "tot_stg_5_nw_acu": 4, - "stg_5_ct_acu_m": 6, - "stg_5_ct_acu_f": 2, - "tot_stg_5_ct_acu": 8, - "sub_tot_chr": 1, - "sub_tot_acu": 0, - "hf_nw_m": 9, - "hf_nw_f": 6, - "tot_hf_nw": 2, - "hf_ct_m": 7, - "hf_ct_f": 8, - "tot_hf_ct": 6, - "myo_inf_nw_m": 2, - "myo_inf_nw_f": 4, - "tot_myo_inf_nw": 4, - "myo_inf_ct_m": 5, - "myo_inf_ct_f": 3, - "tot_myo_inf_ct": 9, - "sub_tot_ct_cvd_m": 4, - "sub_tot_ct_cvd_f": 7, - "sub_tot_ct_cvd": 1, - "tot_cvd": 5, - "mg_nw_m": 7, - "mg_nw_f": 5, - "tot_mg_nw": 5, - "mg_ct_m": 3, - "mg_ct_f": 4, - "tot_mg_ct": 9, - "cnv_nw_m": 5, - "cnv_nw_f": 7, - "tot_cnv_nw": 10, - "cnv_ct_m": 5, - "cnv_ct_f": 7, - "tot_cnv_ct": 10, - "sub_tot_nw_cnv_m": 9, - "sub_tot_nw_cnv_f": 4, - "sub_tot_nw_cnv": 6, - "sub_tot_ct_cnv_m": 9, - "sub_tot_ct_cnv_f": 7, - "sub_tot_ct_cnv": 1, - "tot_cnv": 1, - "ra_nw_m": 10, - "ra_nw_f": 1, - "tot_ra_nw": 4, - "ra_ct_m": 8, - "ra_ct_f": 9, - "tot_ra_ct": 0, - "sle_nw_m": 9, - "sle_nw_f": 5, - "tot_sle_nw": 2, - "sle_ct_m": 2, - "sle_ct_f": 6, - "tot_sle_ct": 8, - "sub_tot_nw_rhe_m": 8, - "sub_tot_nw_rhe_f": 7, - "sub_tot_nw_rhe": 10, - "sub_tot_ct_rhe_m": 3, - "sub_tot_ct_rhe_f": 10, - "sub_tot_ct_rhe": 2, - "tot_rhe": 9, - "oe_nw_m": 8, - "oe_nw_f": 4, - "tot_oe_nw": 7, - "oe_ct_m": 3, - "oe_ct_f": 6, - "tot_oe_ct": 8, - "pc_nw_m": 9, - "pc_nw_f": 3, - "tot_pc_nw": 6, - "pc_ct_m": 5, - "pc_ct_f": 8, - "tot_pc_ct": 3, - "gs_nw_m": 2, - "gs_nw_f": 6, - "tot_gs_nw": 10, - "gs_ct_m": 1, - "gs_ct_f": 3, - "tot_gs_ct": 5, - "col_nw_m": 9, - "col_nw_f": 1, - "tot_col_nw": 6, - "col_ct_m": 9, - "col_ct_f": 10, - "tot_col_ct": 0, - "sub_tot_nw_gi_m": 1, - "sub_tot_nw_gi_f": 5, - "sub_tot_nw_gi": 10, - "sub_tot_ct_gi_m": 8, - "sub_tot_ct_gi_f": 10, - "sub_tot_ct_gi": 9, - "tot_gi": 10, - "ov_nw": 3, - "ov_ct": 10, - "cv_nw": 6, - "cv_ct": 1, - "endo_nw": 6, - "endo_ct": 5, - "tot_f_rep_nw": 10, - "tot_f_rep_ct": 7, - "tot_f_rep": 0, - "pro_nw": 4, - "pro_ct": 1, - "ts_nw": 0, - "ts_ct": 2, - "tot_m_rep_nw": 4, - "tot_m_rep_ct": 5, - "tot_m_rep": 9, - "th_nw_m": 9, - "th_nw_f": 6, - "tot_th_nw": 1, - "th_ct_m": 5, - "th_ct_f": 6, - "tot_th_ct": 1, - "pit_nw_m": 10, - "pit_nw_f": 10, - "tot_pit_nw": 10, - "pit_ct_m": 1, - "pit_ct_f": 8, - "tot_pit_ct": 7, - "thy_nw_m": 3, - "thy_nw_f": 7, - "tot_thy_nw": 9, - "thy_ct_m": 2, - "thy_ct_f": 6, - "tot_thy_ct": 10, - "adr_nw_m": 5, - "adr_nw_f": 4, - "tot_adr_nw": 6, - "adr_ct_m": 0, - "adr_ct_f": 5, - "tot_adr_ct": 1, - "sub_tot_nw_endo_m": 3, - "sub_tot_nw_endo_f": 10, - "sub_tot_nw_endo": 8, - "sub_tot_ct_endo_m": 7, - "sub_tot_ct_endo_f": 8, - "sub_tot_ct_endo": 3, - "tot_endo": 5, - "ost_nw_m": 5, - "ost_nw_f": 9, - "tot_ost_nw": 5, - "ost_ct_m": 9, - "ost_ct_f": 6, - "tot_ost_ct": 10, - "tot_musk": 1, - "leu_nw_m": 6, - "leu_nw_f": 10, - "tot_leu_nw": 10, - "leu_ct_m": 9, - "leu_ct_f": 9, - "tot_leu_ct": 2, - "lym_nw_m": 3, - "lym_nw_f": 3, - "tot_lym_nw": 6, - "lym_ct_m": 3, - "lym_ct_f": 0, - "tot_lym_ct": 5, - "sub_tot_nw_hae_m": 5, - "sub_tot_nw_hae_f": 4, - "sub_tot_nw_hae": 9, - "sub_tot_ct_hae_m": 7, - "sub_tot_ct_hae_f": 6, - "sub_tot_ct_hae": 10, - "tot_hae": 3, - "ggn_nw_m": 1, - "ggn_nw_f": 10, - "tot_ggn_nw": 8, - "ggn_ct_m": 4, - "ggn_ct_f": 5, - "tot_ggn_ct": 6, - "cpt_nw_m": 0, - "cpt_nw_f": 10, - "tot_cpt_nw": 1, - "cpt_ct_m": 8, - "cpt_ct_f": 3, - "tot_cpt_ct": 0, - "emb_nw_m": 1, - "emb_nw_f": 3, - "tot_emb_nw": 4, - "emb_ct_m": 4, - "emb_ct_f": 3, - "tot_emb_ct": 5, - "pin_nw_m": 3, - "pin_nw_f": 9, - "tot_pin_nw": 10, - "pin_ct_m": 5, - "pin_ct_f": 3, - "tot_pin_ct": 6, - "men_nw_m": 7, - "men_nw_f": 9, - "tot_men_nw": 10, - "men_ct_m": 6, - "men_ct_f": 5, - "tot_men_ct": 4, - "mes_nw_m": 2, - "mes_nw_f": 5, - "tot_mes_nw": 6, - "mes_ct_m": 3, - "mes_ct_f": 6, - "tot_mes_ct": 4, - "mel_nw_m": 0, - "mel_nw_f": 5, - "tot_mel_nw": 8, - "mel_ct_m": 2, - "mel_ct_f": 1, - "tot_mel_ct": 0, - "hly_nw_m": 8, - "hly_nw_f": 3, - "tot_hly_nw": 0, - "hly_ct_m": 9, - "hly_ct_f": 5, - "tot_hly_ct": 4, - "gct_nw_m": 7, - "gct_nw_f": 8, - "tot_gct_nw": 4, - "gct_ct_m": 1, - "gct_ct_f": 8, - "tot_gct_ct": 10, - "sub_tot_nw_neu_m": 1, - "sub_tot_nw_neu_f": 2, - "sub_tot_nw_neu": 9, - "sub_tot_ct_neu_m": 8, - "sub_tot_ct_neu_f": 3, - "sub_tot_ct_neu": 2, - "tot_neu": 2 - }, - { - "join_location": 1, - "location_uuid": "08feae7c-1352-11df-a1f1-0026b9348837", - "mfl_code": 11111, - "county": "Busia", - "facility": "Busia", - "location_id": 2, - "location": "Busia", - "nw_ctld_htn_m": 1, - "tot_nw_ctld_htn": 2, - "ct_ctld_htn_f": 10, - "ct_ctld_htn_m": 10, - "tot_ct_ctld_htn": 5, - "nw_unctld_htn_f": 4, - "nw_unctld_htn_m": 10, - "tot_nw_unctld_htn": 8, - "ct_unctld_htn_f": 5, - "ct_unctld_htn_m": 0, - "tot_ct_unctld_htn": 1, - "nw_unk_htn_f": 6, - "nw_unk_htn_m": 0, - "tot_nw_unk_htn": 2, - "ct_unk_htn_f": 5, - "ct_unk_htn_m": 3, - "tot_ct_unk_htn": 3, - "nw_htn_m": 5, - "nw_htn_f": 3, - "nw_htn": 9, - "ct_htn_m": 5, - "ct_htn_f": 7, - "ct_htn": 3, - "tot_htn": 10, - "nw_ctld_dm_f": 2, - "nw_ctld_dm_m": 1, - "tot_nw_ctld_dm": 0, - "ct_ctld_dm_f": 8, - "ct_ctld_dm_m": 6, - "tot_ct_ctld_dm": 2, - "nw_unctld_dm_f": 2, - "nw_unctld_dm_m": 10, - "tot_nw_unctld_dm": 6, - "ct_unctld_dm_f": 5, - "ct_unctld_dm_m": 2, - "tot_ct_unctld_dm": 5, - "nw_unk_dm_f": 0, - "nw_unk_dm_m": 4, - "tot_nw_unk_dm": 10, - "ct_unk_dm_f": 7, - "ct_unk_dm_m": 1, - "tot_ct_unk_dm": 5, - "nw_dm_m": 6, - "nw_dm_f": 8, - "nw_dm": 10, - "ct_dm_m": 4, - "ct_dm_f": 5, - "ct_dm": 6, - "tot_dm": 9, - "stg_1_nw_chr_m": 5, - "stg_1_nw_chr_f": 3, - "tot_stg_1_nw_chr": 3, - "stg_1_ct_chr_m": 9, - "stg_1_ct_chr_f": 6, - "tot_stg_1_ct_chr": 9, - "stg_1_nw_acu_m": 3, - "stg_1_nw_acu_f": 9, - "tot_stg_1_nw_acu": 3, - "stg_1_ct_acu_m": 7, - "stg_1_ct_acu_f": 3, - "tot_stg_1_ct_acu": 2, - "stg_2_nw_chr_m": 9, - "stg_2_nw_chr_f": 1, - "tot_stg_2_nw_chr": 10, - "stg_2_ct_chr_m": 3, - "stg_2_ct_chr_f": 9, - "tot_stg_2_ct_chr": 5, - "stg_2_nw_acu_m": 8, - "stg_2_nw_acu_f": 9, - "tot_stg_2_nw_acu": 2, - "stg_2_ct_acu_m": 3, - "stg_2_ct_acu_f": 0, - "tot_stg_2_ct_acu": 2, - "stg_3_nw_chr_m": 10, - "stg_3_nw_chr_f": 10, - "tot_stg_3_nw_chr": 7, - "stg_3_ct_chr_m": 2, - "stg_3_ct_chr_f": 5, - "tot_stg_3_ct_chr": 6, - "stg_3_nw_acu_m": 8, - "stg_3_nw_acu_f": 4, - "tot_stg_3_nw_acu": 2, - "stg_3_ct_acu_m": 0, - "stg_3_ct_acu_f": 3, - "tot_stg_3_ct_acu": 1, - "stg_4_nw_chr_m": 3, - "stg_4_nw_chr_f": 10, - "tot_stg_4_nw_chr": 10, - "stg_4_ct_chr_m": 2, - "stg_4_ct_chr_f": 9, - "tot_stg_4_ct_chr": 1, - "stg_4_nw_acu_m": 1, - "stg_4_nw_acu_f": 4, - "tot_stg_4_nw_acu": 8, - "stg_4_ct_acu_m": 7, - "stg_4_ct_acu_f": 2, - "tot_stg_4_ct_acu": 7, - "stg_5_nw_chr_m": 5, - "stg_5_nw_chr_f": 4, - "tot_stg_5_nw_chr": 9, - "stg_5_ct_chr_m": 8, - "stg_5_ct_chr_f": 8, - "tot_stg_5_ct_chr": 4, - "stg_5_nw_acu_m": 10, - "stg_5_nw_acu_f": 10, - "tot_stg_5_nw_acu": 4, - "stg_5_ct_acu_m": 6, - "stg_5_ct_acu_f": 2, - "tot_stg_5_ct_acu": 8, - "sub_tot_chr": 1, - "sub_tot_acu": 0, - "hf_nw_m": 9, - "hf_nw_f": 6, - "tot_hf_nw": 2, - "hf_ct_m": 7, - "hf_ct_f": 8, - "tot_hf_ct": 6, - "myo_inf_nw_m": 2, - "myo_inf_nw_f": 4, - "tot_myo_inf_nw": 4, - "myo_inf_ct_m": 5, - "myo_inf_ct_f": 3, - "tot_myo_inf_ct": 9, - "sub_tot_ct_cvd_m": 4, - "sub_tot_ct_cvd_f": 7, - "sub_tot_ct_cvd": 1, - "tot_cvd": 5, - "mg_nw_m": 7, - "mg_nw_f": 5, - "tot_mg_nw": 5, - "mg_ct_m": 3, - "mg_ct_f": 4, - "tot_mg_ct": 9, - "cnv_nw_m": 5, - "cnv_nw_f": 7, - "tot_cnv_nw": 10, - "cnv_ct_m": 5, - "cnv_ct_f": 7, - "tot_cnv_ct": 10, - "sub_tot_nw_cnv_m": 9, - "sub_tot_nw_cnv_f": 4, - "sub_tot_nw_cnv": 6, - "sub_tot_ct_cnv_m": 9, - "sub_tot_ct_cnv_f": 7, - "sub_tot_ct_cnv": 1, - "tot_cnv": 1, - "ra_nw_m": 10, - "ra_nw_f": 1, - "tot_ra_nw": 4, - "ra_ct_m": 8, - "ra_ct_f": 9, - "tot_ra_ct": 0, - "sle_nw_m": 9, - "sle_nw_f": 5, - "tot_sle_nw": 2, - "sle_ct_m": 2, - "sle_ct_f": 6, - "tot_sle_ct": 8, - "sub_tot_nw_rhe_m": 8, - "sub_tot_nw_rhe_f": 7, - "sub_tot_nw_rhe": 10, - "sub_tot_ct_rhe_m": 3, - "sub_tot_ct_rhe_f": 10, - "sub_tot_ct_rhe": 2, - "tot_rhe": 9, - "oe_nw_m": 8, - "oe_nw_f": 4, - "tot_oe_nw": 7, - "oe_ct_m": 3, - "oe_ct_f": 6, - "tot_oe_ct": 8, - "pc_nw_m": 9, - "pc_nw_f": 3, - "tot_pc_nw": 6, - "pc_ct_m": 5, - "pc_ct_f": 8, - "tot_pc_ct": 3, - "gs_nw_m": 2, - "gs_nw_f": 6, - "tot_gs_nw": 10, - "gs_ct_m": 1, - "gs_ct_f": 3, - "tot_gs_ct": 5, - "col_nw_m": 9, - "col_nw_f": 1, - "tot_col_nw": 6, - "col_ct_m": 9, - "col_ct_f": 10, - "tot_col_ct": 0, - "sub_tot_nw_gi_m": 1, - "sub_tot_nw_gi_f": 5, - "sub_tot_nw_gi": 10, - "sub_tot_ct_gi_m": 8, - "sub_tot_ct_gi_f": 10, - "sub_tot_ct_gi": 9, - "tot_gi": 10, - "ov_nw": 3, - "ov_ct": 10, - "cv_nw": 6, - "cv_ct": 1, - "endo_nw": 6, - "endo_ct": 5, - "tot_f_rep_nw": 10, - "tot_f_rep_ct": 7, - "tot_f_rep": 0, - "pro_nw": 4, - "pro_ct": 1, - "ts_nw": 0, - "ts_ct": 2, - "tot_m_rep_nw": 4, - "tot_m_rep_ct": 5, - "tot_m_rep": 9, - "th_nw_m": 9, - "th_nw_f": 6, - "tot_th_nw": 1, - "th_ct_m": 5, - "th_ct_f": 6, - "tot_th_ct": 1, - "pit_nw_m": 10, - "pit_nw_f": 10, - "tot_pit_nw": 10, - "pit_ct_m": 1, - "pit_ct_f": 8, - "tot_pit_ct": 7, - "thy_nw_m": 3, - "thy_nw_f": 7, - "tot_thy_nw": 9, - "thy_ct_m": 2, - "thy_ct_f": 6, - "tot_thy_ct": 10, - "adr_nw_m": 5, - "adr_nw_f": 4, - "tot_adr_nw": 6, - "adr_ct_m": 0, - "adr_ct_f": 5, - "tot_adr_ct": 1, - "sub_tot_nw_endo_m": 3, - "sub_tot_nw_endo_f": 10, - "sub_tot_nw_endo": 8, - "sub_tot_ct_endo_m": 7, - "sub_tot_ct_endo_f": 8, - "sub_tot_ct_endo": 3, - "tot_endo": 5, - "ost_nw_m": 5, - "ost_nw_f": 9, - "tot_ost_nw": 5, - "ost_ct_m": 9, - "ost_ct_f": 6, - "tot_ost_ct": 10, - "tot_musk": 1, - "leu_nw_m": 6, - "leu_nw_f": 10, - "tot_leu_nw": 10, - "leu_ct_m": 9, - "leu_ct_f": 9, - "tot_leu_ct": 2, - "lym_nw_m": 3, - "lym_nw_f": 3, - "tot_lym_nw": 6, - "lym_ct_m": 3, - "lym_ct_f": 0, - "tot_lym_ct": 5, - "sub_tot_nw_hae_m": 5, - "sub_tot_nw_hae_f": 4, - "sub_tot_nw_hae": 9, - "sub_tot_ct_hae_m": 7, - "sub_tot_ct_hae_f": 6, - "sub_tot_ct_hae": 10, - "tot_hae": 3, - "ggn_nw_m": 1, - "ggn_nw_f": 10, - "tot_ggn_nw": 8, - "ggn_ct_m": 4, - "ggn_ct_f": 5, - "tot_ggn_ct": 6, - "cpt_nw_m": 0, - "cpt_nw_f": 10, - "tot_cpt_nw": 1, - "cpt_ct_m": 8, - "cpt_ct_f": 3, - "tot_cpt_ct": 0, - "emb_nw_m": 1, - "emb_nw_f": 3, - "tot_emb_nw": 4, - "emb_ct_m": 4, - "emb_ct_f": 3, - "tot_emb_ct": 5, - "pin_nw_m": 3, - "pin_nw_f": 9, - "tot_pin_nw": 10, - "pin_ct_m": 5, - "pin_ct_f": 3, - "tot_pin_ct": 6, - "men_nw_m": 7, - "men_nw_f": 9, - "tot_men_nw": 10, - "men_ct_m": 6, - "men_ct_f": 5, - "tot_men_ct": 4, - "mes_nw_m": 2, - "mes_nw_f": 5, - "tot_mes_nw": 6, - "mes_ct_m": 3, - "mes_ct_f": 6, - "tot_mes_ct": 4, - "mel_nw_m": 0, - "mel_nw_f": 5, - "tot_mel_nw": 8, - "mel_ct_m": 2, - "mel_ct_f": 1, - "tot_mel_ct": 0, - "hly_nw_m": 8, - "hly_nw_f": 3, - "tot_hly_nw": 0, - "hly_ct_m": 9, - "hly_ct_f": 5, - "tot_hly_ct": 4, - "gct_nw_m": 7, - "gct_nw_f": 8, - "tot_gct_nw": 4, - "gct_ct_m": 1, - "gct_ct_f": 8, - "tot_gct_ct": 10, - "sub_tot_nw_neu_m": 1, - "sub_tot_nw_neu_f": 2, - "sub_tot_nw_neu": 9, - "sub_tot_ct_neu_m": 8, - "sub_tot_ct_neu_f": 3, - "sub_tot_ct_neu": 2, - "tot_neu": 2 - } - ], + queriesAndSchemas: results, + result: finalResult, sectionDefinitions: plhivncdV2ReportSections, indicatorDefinitions: [] }); } - // }); + }); }) .catch((error) => { reject(error); From 0307ab160a8ed72792cb48af3e0aa2168f355d90 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Sat, 16 Dec 2023 12:04:02 +0300 Subject: [PATCH 07/40] POC-544-v2: Renamed HTN-DM status report fields --- .../plhiv-ncd-v2-report-indicators.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 index 1a1354641..8baac1291 100644 --- 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 @@ -15,7 +15,7 @@ "indicator": ["F", "M", "T", "F", "M", "T"] }, { - "label": "Contolled", + "label": "Controlled (SBP <130 mmHg and DBP <80 mmHg)", "indicator": [ "nw_ctld_htn_f", "nw_ctld_htn_m", @@ -26,7 +26,7 @@ ] }, { - "label": "Uncontrolled", + "label": "Not well controlled", "indicator": [ "nw_unctld_htn_f", "nw_unctld_htn_m", @@ -63,7 +63,7 @@ "indicator": ["tot_nw_htn", "tot_ct_htn"] }, { - "label": "Total", + "label": "Total HTN", "indicator": "tot_htn" } ] @@ -84,7 +84,7 @@ "indicator": ["F", "M", "T", "F", "M", "T"] }, { - "label": "Contolled", + "label": "Controlled (HbA1c 7% - 8%)", "indicator": [ "nw_ctld_dm_f", "nw_ctld_dm_m", @@ -132,7 +132,7 @@ "indicator": ["tot_nw_dm", "tot_ct_dm"] }, { - "label": "Total", + "label": "Total DM", "indicator": "tot_dm" } ] @@ -234,7 +234,7 @@ "indicator": ["tot_nw_mh", "tot_ct_mh"] }, { - "label": "Total", + "label": "Total MHD", "indicator": "tot_mh" } ] @@ -387,7 +387,7 @@ "indicator": ["sub_tot_chr", "sub_tot_acu"] }, { - "label": "Grand Total", + "label": "Grand Total KD", "indicator": "tot_kd" } ] @@ -445,7 +445,7 @@ "indicator": ["tot_nw_cvd", "tot_ct_cvd"] }, { - "label": "Total", + "label": "Total CVD", "indicator": "tot_cvd" } ] From c330cd045446393472bb3aa45625b5c068bb7c15 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 19 Dec 2023 15:20:48 +0300 Subject: [PATCH 08/40] POC-544-v2: updated indicators --- .../plhiv-ncd-v2-report-indicators.json | 52 +++++++++++++++---- 1 file changed, 43 insertions(+), 9 deletions(-) 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 index 8baac1291..622a75b98 100644 --- 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 @@ -50,11 +50,11 @@ { "label": "Sub Total", "indicator": [ - "nw_htn_m", "nw_htn_f", + "nw_htn_m", "nw_htn", - "ct_htn_m", "ct_htn_f", + "ct_htn_m", "ct_htn" ] }, @@ -119,11 +119,11 @@ { "label": "Sub Total", "indicator": [ - "nw_dm_m", "nw_dm_f", + "nw_dm_m", "nw_dm", - "ct_dm_m", "ct_dm_f", + "ct_dm_m", "ct_dm" ] }, @@ -322,6 +322,40 @@ "tot_stg_3_ct_acu" ] }, + { + "label": "Stage 3a", + "indicator": [ + "stg_3a_nw_chr_m", + "stg_3a_nw_chr_f", + "tot_stg_3a_nw_chr", + "stg_3a_ct_chr_m", + "stg_3a_ct_chr_f", + "tot_stg_3a_ct_chr", + "stg_3a_nw_acu_m", + "stg_3a_nw_acu_f", + "tot_stg_3a_nw_acu", + "stg_3a_ct_acu_m", + "stg_3a_ct_acu_f", + "tot_stg_3a_ct_acu" + ] + }, + { + "label": "Stage 3b", + "indicator": [ + "stg_3b_nw_chr_m", + "stg_3b_nw_chr_f", + "tot_stg_3b_nw_chr", + "stg_3b_ct_chr_m", + "stg_3b_ct_chr_f", + "tot_stg_3b_ct_chr", + "stg_3b_nw_acu_m", + "stg_3b_nw_acu_f", + "tot_stg_3b_nw_acu", + "stg_3b_ct_acu_m", + "stg_3b_ct_acu_f", + "tot_stg_3b_ct_acu" + ] + }, { "label": "Stage 4", "indicator": [ @@ -376,15 +410,15 @@ { "label": "Status Sub Total", "indicator": [ - "sub_tot_nw_chr", - "sub_tot_ct_chr", - "sub_tot_nw_acu", - "sub_tot_ct_acu" + "tot_nw_chr", + "tot_ct_chr", + "tot_nw_acu", + "tot_ct_acu" ] }, { "label": "State Sub Total", - "indicator": ["sub_tot_chr", "sub_tot_acu"] + "indicator": ["tot_chr", "tot_acu"] }, { "label": "Grand Total KD", From 6c114e7833c6a9dd9a65969f7b57159e1c6d5eaf Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 19 Dec 2023 15:22:46 +0300 Subject: [PATCH 09/40] POC-544-v2: Added kidney disease base and aggregate queries --- .../kidney-disease/kd-aggregate.json | 260 ++++++++++-- .../kidney-disease/kd-base.json | 385 +++++++++++++----- 2 files changed, 514 insertions(+), 131 deletions(-) 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 index bf41ec24e..c6bbd294a 100644 --- 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 @@ -93,7 +93,7 @@ "alias": "stg_1_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_1_nw_acu_m)" + "expression": "b.stg_1_nw_acu_m" } }, { @@ -101,7 +101,7 @@ "alias": "stg_1_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_1_nw_acu_f)" + "expression": "b.stg_1_nw_acu_f" } }, { @@ -109,7 +109,7 @@ "alias": "tot_stg_1_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_1_nw_acu)" + "expression": "b.tot_stg_1_nw_acu" } }, { @@ -117,7 +117,7 @@ "alias": "stg_1_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_1_ct_acu_m)" + "expression": "b.stg_1_ct_acu_m" } }, { @@ -125,7 +125,7 @@ "alias": "stg_1_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_1_ct_acu_f)" + "expression": "b.stg_1_ct_acu_f" } }, { @@ -133,7 +133,7 @@ "alias": "tot_stg_1_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_1_ct_acu)" + "expression": "b.tot_stg_1_ct_acu" } }, { @@ -189,7 +189,7 @@ "alias": "stg_2_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_2_nw_acu_m)" + "expression": "b.stg_2_nw_acu_m" } }, { @@ -197,7 +197,7 @@ "alias": "stg_2_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_2_nw_acu_f)" + "expression": "b.stg_2_nw_acu_f" } }, { @@ -205,7 +205,7 @@ "alias": "tot_stg_2_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_2_nw_acu)" + "expression": "b.tot_stg_2_nw_acu" } }, { @@ -213,7 +213,7 @@ "alias": "stg_2_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_2_ct_acu_m)" + "expression": "b.stg_2_ct_acu_m" } }, { @@ -221,7 +221,7 @@ "alias": "stg_2_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_2_ct_acu_f)" + "expression": "b.stg_2_ct_acu_f" } }, { @@ -229,7 +229,7 @@ "alias": "tot_stg_2_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_2_ct_acu)" + "expression": "b.tot_stg_2_ct_acu" } }, { @@ -285,7 +285,7 @@ "alias": "stg_3_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_3_nw_acu_m)" + "expression": "b.stg_3_nw_acu_m" } }, { @@ -293,7 +293,7 @@ "alias": "stg_3_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_3_nw_acu_f)" + "expression": "b.stg_3_nw_acu_f" } }, { @@ -301,7 +301,7 @@ "alias": "tot_stg_3_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_3_nw_acu)" + "expression": "b.tot_stg_3_nw_acu" } }, { @@ -309,7 +309,7 @@ "alias": "stg_3_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_3_ct_acu_m)" + "expression": "b.stg_3_ct_acu_m" } }, { @@ -317,7 +317,7 @@ "alias": "stg_3_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_3_ct_acu_f)" + "expression": "b.stg_3_ct_acu_f" } }, { @@ -325,7 +325,199 @@ "alias": "tot_stg_3_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_3_ct_acu)" + "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" } }, { @@ -381,7 +573,7 @@ "alias": "stg_4_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_4_nw_acu_m)" + "expression": "b.stg_4_nw_acu_m" } }, { @@ -389,7 +581,7 @@ "alias": "stg_4_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_4_nw_acu_f)" + "expression": "b.stg_4_nw_acu_f" } }, { @@ -397,7 +589,7 @@ "alias": "tot_stg_4_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_4_nw_acu)" + "expression": "b.tot_stg_4_nw_acu" } }, { @@ -405,7 +597,7 @@ "alias": "stg_4_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_4_ct_acu_m)" + "expression": "b.stg_4_ct_acu_m" } }, { @@ -413,7 +605,7 @@ "alias": "stg_4_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_4_ct_acu_f)" + "expression": "b.stg_4_ct_acu_f" } }, { @@ -421,7 +613,7 @@ "alias": "tot_stg_4_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_4_ct_acu)" + "expression": "b.tot_stg_4_ct_acu" } }, { @@ -477,7 +669,7 @@ "alias": "stg_5_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_5_nw_acu_m)" + "expression": "b.stg_5_nw_acu_m" } }, { @@ -485,7 +677,7 @@ "alias": "stg_5_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_5_nw_acu_f)" + "expression": "b.stg_5_nw_acu_f" } }, { @@ -493,7 +685,7 @@ "alias": "tot_stg_5_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_5_nw_acu)" + "expression": "b.tot_stg_5_nw_acu" } }, { @@ -501,7 +693,7 @@ "alias": "stg_5_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_5_ct_acu_m)" + "expression": "b.stg_5_ct_acu_m" } }, { @@ -509,7 +701,7 @@ "alias": "stg_5_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_5_ct_acu_f)" + "expression": "b.stg_5_ct_acu_f" } }, { @@ -517,7 +709,7 @@ "alias": "tot_stg_5_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_5_ct_acu)" + "expression": "b.tot_stg_5_ct_acu" } }, { @@ -650,18 +842,18 @@ }, { "type": "derived_column", - "alias": "sub_tot_chr", + "alias": "tot_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.sub_tot_chr)" + "expression": "sum(b.tot_chr)" } }, { "type": "derived_column", - "alias": "sub_tot_acu", + "alias": "tot_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.sub_tot_acu)" + "expression": "sum(b.tot_acu)" } }, { 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 index 83869a420..61d15a7d9 100644 --- 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 @@ -5,16 +5,24 @@ "description": "", "uses": [], "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, { "table": "etl.hiv_monthly_report_dataset_v1_2", - "alias": "hmrd" + "alias": "hmrd", + "join": { + "type": "LEFT", + "joinCondition": "hmrd.person_id = nmrd.person_id AND nmrd.endDate = hmrd.endDate AND nmrd.location_id = hmrd.location_id" + } }, { "table": "etl.flat_patient_identifiers_v1", "alias": "fi", "join": { "type": "LEFT", - "joinCondition": "hmrd.person_id = fi.patient_id" + "joinCondition": "nmrd.person_id = fi.patient_id" } }, { @@ -22,7 +30,7 @@ "alias": "l", "join": { "type": "INNER", - "joinCondition": "hmrd.location_id = l.location_id" + "joinCondition": "nmrd.location_id = l.location_id" } }, { @@ -30,7 +38,7 @@ "alias": "per", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = per.person_id" + "joinCondition": "nmrd.person_id = per.person_id" } } ], @@ -38,12 +46,12 @@ { "type": "simple_column", "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.location_uuid" }, { "type": "simple_column", "alias": "person_id", - "column": "hmrd.person_id" + "column": "nmrd.person_id" }, { "type": "simple_column", @@ -63,29 +71,24 @@ { "type": "simple_column", "alias": "age", - "column": "hmrd.age" + "column": "nmrd.age" }, { "type": "simple_column", "alias": "location_id", - "column": "hmrd.location_id" + "column": "nmrd.location_id" }, { "type": "simple_column", "alias": "location", - "column": "l.name" - }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.clinic" }, { "type": "derived_column", "alias": "stg_1_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -93,7 +96,7 @@ "alias": "stg_1_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -101,7 +104,7 @@ "alias": "tot_stg_1_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -109,7 +112,7 @@ "alias": "stg_1_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -117,7 +120,7 @@ "alias": "stg_1_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -125,7 +128,7 @@ "alias": "tot_stg_1_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -133,7 +136,7 @@ "alias": "stg_1_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -141,7 +144,7 @@ "alias": "stg_1_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -149,7 +152,7 @@ "alias": "tot_stg_1_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -157,7 +160,7 @@ "alias": "stg_1_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -165,7 +168,7 @@ "alias": "stg_1_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -173,7 +176,7 @@ "alias": "tot_stg_1_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -181,7 +184,7 @@ "alias": "stg_2_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -189,7 +192,7 @@ "alias": "stg_2_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -197,7 +200,7 @@ "alias": "tot_stg_2_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -205,7 +208,7 @@ "alias": "stg_2_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -213,7 +216,7 @@ "alias": "stg_2_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -221,7 +224,7 @@ "alias": "tot_stg_2_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -229,7 +232,7 @@ "alias": "stg_2_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -237,7 +240,7 @@ "alias": "stg_2_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -245,7 +248,7 @@ "alias": "tot_stg_2_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -253,7 +256,7 @@ "alias": "stg_2_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -261,7 +264,7 @@ "alias": "stg_2_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -269,7 +272,7 @@ "alias": "tot_stg_2_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -277,7 +280,7 @@ "alias": "stg_3_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -285,7 +288,7 @@ "alias": "stg_3_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -293,7 +296,7 @@ "alias": "tot_stg_3_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "2" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -301,7 +304,7 @@ "alias": "stg_3_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -309,7 +312,7 @@ "alias": "stg_3_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -317,7 +320,7 @@ "alias": "tot_stg_3_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -325,7 +328,7 @@ "alias": "stg_3_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -333,7 +336,7 @@ "alias": "stg_3_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -341,7 +344,7 @@ "alias": "tot_stg_3_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -349,7 +352,7 @@ "alias": "stg_3_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -357,7 +360,7 @@ "alias": "stg_3_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -365,7 +368,199 @@ "alias": "tot_stg_3_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 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 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 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 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 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 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 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 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 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 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 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 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" } }, { @@ -373,7 +568,7 @@ "alias": "stg_4_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -381,7 +576,7 @@ "alias": "stg_4_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -389,7 +584,7 @@ "alias": "tot_stg_4_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -397,7 +592,7 @@ "alias": "stg_4_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -405,7 +600,7 @@ "alias": "stg_4_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -413,7 +608,7 @@ "alias": "tot_stg_4_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -421,7 +616,7 @@ "alias": "stg_4_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -429,7 +624,7 @@ "alias": "stg_4_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -437,7 +632,7 @@ "alias": "tot_stg_4_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -445,7 +640,7 @@ "alias": "stg_4_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -453,7 +648,7 @@ "alias": "stg_4_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -461,7 +656,7 @@ "alias": "tot_stg_4_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -469,7 +664,7 @@ "alias": "stg_5_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -477,7 +672,7 @@ "alias": "stg_5_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -485,7 +680,7 @@ "alias": "tot_stg_5_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -493,7 +688,7 @@ "alias": "stg_5_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -501,7 +696,7 @@ "alias": "stg_5_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -509,7 +704,7 @@ "alias": "tot_stg_5_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -517,7 +712,7 @@ "alias": "stg_5_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -525,7 +720,7 @@ "alias": "stg_5_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -533,7 +728,7 @@ "alias": "tot_stg_5_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -541,7 +736,7 @@ "alias": "stg_5_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -549,7 +744,7 @@ "alias": "stg_5_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -557,7 +752,7 @@ "alias": "tot_stg_5_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -565,7 +760,7 @@ "alias": "sub_tot_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -573,7 +768,7 @@ "alias": "sub_tot_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -581,7 +776,7 @@ "alias": "sub_tot_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -589,7 +784,7 @@ "alias": "sub_tot_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -597,7 +792,7 @@ "alias": "sub_tot_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -605,7 +800,7 @@ "alias": "sub_tot_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -658,23 +853,23 @@ }, { "type": "derived_column", - "alias": "sub_tot_nw_chr", + "alias": "tot_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { "type": "derived_column", - "alias": "sub_tot_ct_chr", + "alias": "tot_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { "type": "derived_column", - "alias": "sub_tot_nw_acu", + "alias": "tot_nw_acu", "expressionType": "simple_expression", "expressionOptions": { "expression": "0" @@ -682,7 +877,7 @@ }, { "type": "derived_column", - "alias": "sub_tot_ct_acu", + "alias": "tot_ct_acu", "expressionType": "simple_expression", "expressionOptions": { "expression": "0" @@ -690,15 +885,15 @@ }, { "type": "derived_column", - "alias": "sub_tot_chr", + "alias": "tot_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1, 1, 0)" } }, { "type": "derived_column", - "alias": "sub_tot_acu", + "alias": "tot_acu", "expressionType": "simple_expression", "expressionOptions": { "expression": "0" @@ -709,7 +904,7 @@ "alias": "tot_kd", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.has_kd = 1, 1, 0)" } } ], @@ -718,23 +913,19 @@ "conditions": [ { "filterType": "tableColumns", - "conditionExpression": "hmrd.location_id in ?", + "conditionExpression": "nmrd.location_id in ?", "parameterName": "locations" }, { "filterType": "tableColumns", - "conditionExpression": "hmrd.endDate = ?", + "conditionExpression": "nmrd.endDate = ?", "parameterName": "endDate" - }, - { - "filterType": "tableColumns", - "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" } ] }, "groupBy": { "groupParam": "groupByParam", - "columns": ["hmrd.person_id"], + "columns": ["nmrd.person_id, nmrd.has_kd, nmrd.is_ckd"], "excludeParam": "excludeParam" } } From 414ba5bcdf9bca3ce10c97408040319652054b31 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 19 Dec 2023 15:23:26 +0300 Subject: [PATCH 10/40] POC-544-v2: Added HTN base and aggregate queries --- .../hypertensive/htn-aggregate.json | 22 ++-- .../hypertensive/htn-base.json | 102 +++++++++--------- 2 files changed, 59 insertions(+), 65 deletions(-) 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 index dfc9089d4..1bf7d1f6a 100644 --- 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 @@ -43,17 +43,17 @@ { "type": "simple_column", "alias": "nw_ctld_htn_f", - "column": "sum(b.nw_ctld_htn_f)" + "column": "nw_ctld_htn_f" }, { "type": "simple_column", "alias": "nw_ctld_htn_m", - "column": "sum(b.nw_ctld_htn_m)" + "column": "nw_ctld_htn_m" }, { "type": "simple_column", "alias": "tot_nw_ctld_htn", - "column": "sum(b.nw_ctld_htn_f)" + "column": "tot_nw_ctld_htn" }, { "type": "simple_column", @@ -73,17 +73,17 @@ { "type": "simple_column", "alias": "nw_unctld_htn_f", - "column": "sum(b.nw_unctld_htn_f)" + "column": "nw_unctld_htn_f" }, { "type": "simple_column", "alias": "nw_unctld_htn_m", - "column": "sum(b.nw_unctld_htn_m)" + "column": "nw_unctld_htn_m" }, { "type": "simple_column", "alias": "tot_nw_unctld_htn", - "column": "sum(b.tot_nw_unctld_htn)" + "column": "tot_nw_unctld_htn" }, { "type": "simple_column", @@ -103,17 +103,17 @@ { "type": "simple_column", "alias": "nw_unk_htn_f", - "column": "sum(b.nw_unk_htn_f)" + "column": "nw_unk_htn_f" }, { "type": "simple_column", "alias": "nw_unk_htn_m", - "column": "sum(b.nw_unk_htn_m)" + "column": "nw_unk_htn_m" }, { "type": "simple_column", "alias": "tot_nw_unk_htn", - "column": "sum(b.tot_nw_unk_htn)" + "column": "tot_nw_unk_htn" }, { "type": "simple_column", @@ -133,12 +133,12 @@ { "type": "simple_column", "alias": "nw_htn_m", - "column": "sum(b.nw_htn_m)" + "column": "sum(nw_htn_m)" }, { "type": "simple_column", "alias": "nw_htn_f", - "column": "sum(b.nw_htn_f)" + "column": "sum(nw_htn_f)" }, { "type": "simple_column", 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 index 245809d13..1775a5954 100644 --- 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 @@ -6,15 +6,23 @@ "uses": [], "sources": [ { - "table": "etl.hiv_monthly_report_dataset_v1_2", - "alias": "hmrd" + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_frozen", + "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": "hmrd.person_id = fi.patient_id" + "joinCondition": "nmrd.person_id = fi.patient_id" } }, { @@ -22,7 +30,7 @@ "alias": "l", "join": { "type": "INNER", - "joinCondition": "hmrd.location_id = l.location_id" + "joinCondition": "nmrd.location_id = l.location_id" } }, { @@ -30,7 +38,7 @@ "alias": "per", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = per.person_id" + "joinCondition": "nmrd.person_id = per.person_id" } } ], @@ -38,12 +46,12 @@ { "type": "simple_column", "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.location_uuid" }, { "type": "simple_column", "alias": "person_id", - "column": "hmrd.person_id" + "column": "nmrd.person_id" }, { "type": "simple_column", @@ -63,29 +71,24 @@ { "type": "simple_column", "alias": "age", - "column": "hmrd.age" + "column": "nmrd.age" }, { "type": "simple_column", "alias": "location_id", - "column": "hmrd.location_id" + "column": "nmrd.location_id" }, { "type": "simple_column", "alias": "location", - "column": "l.name" - }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.clinic" }, { "type": "derived_column", "alias": "nw_ctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "-1" } }, { @@ -93,7 +96,7 @@ "alias": "nw_ctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -101,7 +104,7 @@ "alias": "tot_nw_ctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "1" + "expression": "-1" } }, { @@ -109,7 +112,7 @@ "alias": "ct_ctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.htn_state = 1 AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -117,7 +120,7 @@ "alias": "ct_ctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -125,7 +128,7 @@ "alias": "tot_ct_ctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -133,7 +136,7 @@ "alias": "nw_unctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -141,7 +144,7 @@ "alias": "nw_unctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -149,7 +152,7 @@ "alias": "tot_nw_unctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -157,7 +160,7 @@ "alias": "ct_unctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -165,7 +168,7 @@ "alias": "ct_unctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -173,7 +176,7 @@ "alias": "tot_ct_unctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -181,7 +184,7 @@ "alias": "nw_unk_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -189,7 +192,7 @@ "alias": "nw_unk_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -197,7 +200,7 @@ "alias": "tot_nw_unk_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -205,7 +208,7 @@ "alias": "ct_unk_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -213,7 +216,7 @@ "alias": "ct_unk_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -221,7 +224,7 @@ "alias": "tot_ct_unk_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -229,7 +232,7 @@ "alias": "nw_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -237,7 +240,7 @@ "alias": "nw_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -245,7 +248,7 @@ "alias": "nw_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -253,7 +256,7 @@ "alias": "ct_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -261,7 +264,7 @@ "alias": "ct_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -269,7 +272,7 @@ "alias": "ct_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -277,7 +280,7 @@ "alias": "tot_nw_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1),1, 0)" } }, { @@ -285,7 +288,7 @@ "alias": "tot_ct_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -293,7 +296,7 @@ "alias": "tot_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1),1, 0)" } } ], @@ -302,27 +305,18 @@ "conditions": [ { "filterType": "tableColumns", - "conditionExpression": "hmrd.location_id in ?", + "conditionExpression": "nmrd.location_id in ?", "parameterName": "locations" }, { "filterType": "tableColumns", - "conditionExpression": "hmrd.endDate = ?", + "conditionExpression": "nmrd.endDate = ?", "parameterName": "endDate" - }, - { - "filterType": "tableColumns", - "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" } ] }, "groupBy": { "groupParam": "groupByParam", - "columns": ["hmrd.person_id"], - "excludeParam": "excludeParam" - }, - "paging": { - "offSetParam": "offSetParam", - "limitParam": "limitParam" + "columns": ["person_id,htn_state"] } } From fdc34a1a0349e0310e9d31567985ec1356e74606 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 19 Dec 2023 15:24:52 +0300 Subject: [PATCH 11/40] POC-544-v2: Added diabetes base and aggregate queries --- .../diabetic/dm-aggregate.json | 18 ++-- .../disaggregations/diabetic/dm-base.json | 93 +++++++++---------- 2 files changed, 55 insertions(+), 56 deletions(-) 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 index 942c82c74..dfb30a7b7 100644 --- 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 @@ -43,17 +43,17 @@ { "type": "simple_column", "alias": "nw_ctld_dm_f", - "column": "sum(b.nw_ctld_dm_f)" + "column": "b.nw_ctld_dm_f" }, { "type": "simple_column", "alias": "nw_ctld_dm_m", - "column": "sum(b.nw_ctld_dm_m)" + "column": "b.nw_ctld_dm_m" }, { "type": "simple_column", "alias": "tot_nw_ctld_dm", - "column": "sum(b.nw_ctld_dm_f)" + "column": "b.tot_nw_ctld_dm" }, { "type": "simple_column", @@ -73,17 +73,17 @@ { "type": "simple_column", "alias": "nw_unctld_dm_f", - "column": "sum(b.nw_unctld_dm_f)" + "column": "b.nw_unctld_dm_f" }, { "type": "simple_column", "alias": "nw_unctld_dm_m", - "column": "sum(b.nw_unctld_dm_m)" + "column": "b.nw_unctld_dm_m" }, { "type": "simple_column", "alias": "tot_nw_unctld_dm", - "column": "sum(b.tot_nw_unctld_dm)" + "column": "b.tot_nw_unctld_dm" }, { "type": "simple_column", @@ -103,17 +103,17 @@ { "type": "simple_column", "alias": "nw_unk_dm_f", - "column": "sum(b.nw_unk_dm_f)" + "column": "b.nw_unk_dm_f" }, { "type": "simple_column", "alias": "nw_unk_dm_m", - "column": "sum(b.nw_unk_dm_m)" + "column": "b.nw_unk_dm_m" }, { "type": "simple_column", "alias": "tot_nw_unk_dm", - "column": "sum(b.tot_nw_unk_dm)" + "column": "b.tot_nw_unk_dm" }, { "type": "simple_column", 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 index a445ed2bf..3cd1aeec0 100644 --- 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 @@ -5,16 +5,24 @@ "description": "", "uses": [], "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, { "table": "etl.hiv_monthly_report_dataset_v1_2", - "alias": "hmrd" + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "hmrd.person_id = nmrd.person_id AND hmrd.endDate = nmrd.endDate AND hmrd.status = 'active'" + } }, { "table": "etl.flat_patient_identifiers_v1", "alias": "fi", "join": { "type": "LEFT", - "joinCondition": "hmrd.person_id = fi.patient_id" + "joinCondition": "nmrd.person_id = fi.patient_id" } }, { @@ -22,7 +30,7 @@ "alias": "l", "join": { "type": "INNER", - "joinCondition": "hmrd.location_id = l.location_id" + "joinCondition": "nmrd.location_id = l.location_id" } }, { @@ -30,7 +38,7 @@ "alias": "per", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = per.person_id" + "joinCondition": "nmrd.person_id = per.person_id" } } ], @@ -38,12 +46,12 @@ { "type": "simple_column", "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.location_uuid" }, { "type": "simple_column", "alias": "person_id", - "column": "hmrd.person_id" + "column": "nmrd.person_id" }, { "type": "simple_column", @@ -63,29 +71,24 @@ { "type": "simple_column", "alias": "age", - "column": "hmrd.age" + "column": "nmrd.age" }, { "type": "simple_column", "alias": "location_id", - "column": "hmrd.location_id" + "column": "nmrd.location_id" }, { "type": "simple_column", "alias": "location", - "column": "l.name" - }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.clinic" }, { "type": "derived_column", "alias": "nw_ctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "-1" } }, { @@ -93,7 +96,7 @@ "alias": "nw_ctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -101,7 +104,7 @@ "alias": "tot_nw_ctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "1" + "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -109,7 +112,7 @@ "alias": "ct_ctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -117,7 +120,7 @@ "alias": "ct_ctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -125,7 +128,7 @@ "alias": "tot_ct_ctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -133,7 +136,7 @@ "alias": "nw_unctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -141,7 +144,7 @@ "alias": "nw_unctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -149,7 +152,7 @@ "alias": "tot_nw_unctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -157,7 +160,7 @@ "alias": "ct_unctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -165,7 +168,7 @@ "alias": "ct_unctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -173,7 +176,7 @@ "alias": "tot_ct_unctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -181,7 +184,7 @@ "alias": "nw_unk_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -189,7 +192,7 @@ "alias": "nw_unk_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -197,7 +200,7 @@ "alias": "tot_nw_unk_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -205,7 +208,7 @@ "alias": "ct_unk_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -213,7 +216,7 @@ "alias": "ct_unk_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -221,7 +224,7 @@ "alias": "tot_ct_unk_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -229,7 +232,7 @@ "alias": "nw_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -237,7 +240,7 @@ "alias": "nw_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -245,7 +248,7 @@ "alias": "nw_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1),1, 0)" } }, { @@ -253,7 +256,7 @@ "alias": "ct_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" } }, { @@ -261,7 +264,7 @@ "alias": "ct_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" } }, { @@ -269,7 +272,7 @@ "alias": "ct_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" } }, { @@ -277,7 +280,7 @@ "alias": "tot_nw_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1),1, 0)" } }, { @@ -285,7 +288,7 @@ "alias": "tot_ct_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" } }, { @@ -293,7 +296,7 @@ "alias": "tot_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_diabetic = 1),1, 0)" } } ], @@ -302,17 +305,13 @@ "conditions": [ { "filterType": "tableColumns", - "conditionExpression": "hmrd.location_id in ?", + "conditionExpression": "nmrd.location_id in ?", "parameterName": "locations" }, { "filterType": "tableColumns", - "conditionExpression": "hmrd.endDate = ?", + "conditionExpression": "nmrd.endDate = ?", "parameterName": "endDate" - }, - { - "filterType": "tableColumns", - "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" } ] }, From 87a3b66562404ac817767c2b6e3812d37a9aa184 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Sat, 16 Dec 2023 12:04:02 +0300 Subject: [PATCH 12/40] POC-544-v2: added HTN, DM, and KD schema POC-544-v2: Renamed HTN-DM status report fields POC-544-v2: updated indicators POC-544-v2: Added kidney disease base and aggregate queries POC-544-v2: Added HTN base and aggregate queries POC-544-v2: Added diabetes base and aggregate queries --- .../diabetic/dm-aggregate.json | 18 +- .../disaggregations/diabetic/dm-base.json | 93 +++-- .../hypertensive/htn-aggregate.json | 22 +- .../hypertensive/htn-base.json | 102 +++-- .../kidney-disease/kd-aggregate.json | 260 ++++++++++-- .../kidney-disease/kd-base.json | 385 +++++++++++++----- .../plhiv-ncd-v2-report-indicators.json | 68 +++- 7 files changed, 679 insertions(+), 269 deletions(-) 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 index 942c82c74..dfb30a7b7 100644 --- 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 @@ -43,17 +43,17 @@ { "type": "simple_column", "alias": "nw_ctld_dm_f", - "column": "sum(b.nw_ctld_dm_f)" + "column": "b.nw_ctld_dm_f" }, { "type": "simple_column", "alias": "nw_ctld_dm_m", - "column": "sum(b.nw_ctld_dm_m)" + "column": "b.nw_ctld_dm_m" }, { "type": "simple_column", "alias": "tot_nw_ctld_dm", - "column": "sum(b.nw_ctld_dm_f)" + "column": "b.tot_nw_ctld_dm" }, { "type": "simple_column", @@ -73,17 +73,17 @@ { "type": "simple_column", "alias": "nw_unctld_dm_f", - "column": "sum(b.nw_unctld_dm_f)" + "column": "b.nw_unctld_dm_f" }, { "type": "simple_column", "alias": "nw_unctld_dm_m", - "column": "sum(b.nw_unctld_dm_m)" + "column": "b.nw_unctld_dm_m" }, { "type": "simple_column", "alias": "tot_nw_unctld_dm", - "column": "sum(b.tot_nw_unctld_dm)" + "column": "b.tot_nw_unctld_dm" }, { "type": "simple_column", @@ -103,17 +103,17 @@ { "type": "simple_column", "alias": "nw_unk_dm_f", - "column": "sum(b.nw_unk_dm_f)" + "column": "b.nw_unk_dm_f" }, { "type": "simple_column", "alias": "nw_unk_dm_m", - "column": "sum(b.nw_unk_dm_m)" + "column": "b.nw_unk_dm_m" }, { "type": "simple_column", "alias": "tot_nw_unk_dm", - "column": "sum(b.tot_nw_unk_dm)" + "column": "b.tot_nw_unk_dm" }, { "type": "simple_column", 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 index a445ed2bf..3cd1aeec0 100644 --- 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 @@ -5,16 +5,24 @@ "description": "", "uses": [], "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, { "table": "etl.hiv_monthly_report_dataset_v1_2", - "alias": "hmrd" + "alias": "hmrd", + "join": { + "type": "INNER", + "joinCondition": "hmrd.person_id = nmrd.person_id AND hmrd.endDate = nmrd.endDate AND hmrd.status = 'active'" + } }, { "table": "etl.flat_patient_identifiers_v1", "alias": "fi", "join": { "type": "LEFT", - "joinCondition": "hmrd.person_id = fi.patient_id" + "joinCondition": "nmrd.person_id = fi.patient_id" } }, { @@ -22,7 +30,7 @@ "alias": "l", "join": { "type": "INNER", - "joinCondition": "hmrd.location_id = l.location_id" + "joinCondition": "nmrd.location_id = l.location_id" } }, { @@ -30,7 +38,7 @@ "alias": "per", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = per.person_id" + "joinCondition": "nmrd.person_id = per.person_id" } } ], @@ -38,12 +46,12 @@ { "type": "simple_column", "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.location_uuid" }, { "type": "simple_column", "alias": "person_id", - "column": "hmrd.person_id" + "column": "nmrd.person_id" }, { "type": "simple_column", @@ -63,29 +71,24 @@ { "type": "simple_column", "alias": "age", - "column": "hmrd.age" + "column": "nmrd.age" }, { "type": "simple_column", "alias": "location_id", - "column": "hmrd.location_id" + "column": "nmrd.location_id" }, { "type": "simple_column", "alias": "location", - "column": "l.name" - }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.clinic" }, { "type": "derived_column", "alias": "nw_ctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "-1" } }, { @@ -93,7 +96,7 @@ "alias": "nw_ctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -101,7 +104,7 @@ "alias": "tot_nw_ctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "1" + "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -109,7 +112,7 @@ "alias": "ct_ctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -117,7 +120,7 @@ "alias": "ct_ctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -125,7 +128,7 @@ "alias": "tot_ct_ctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -133,7 +136,7 @@ "alias": "nw_unctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -141,7 +144,7 @@ "alias": "nw_unctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -149,7 +152,7 @@ "alias": "tot_nw_unctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -157,7 +160,7 @@ "alias": "ct_unctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -165,7 +168,7 @@ "alias": "ct_unctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -173,7 +176,7 @@ "alias": "tot_ct_unctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -181,7 +184,7 @@ "alias": "nw_unk_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -189,7 +192,7 @@ "alias": "nw_unk_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -197,7 +200,7 @@ "alias": "tot_nw_unk_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -205,7 +208,7 @@ "alias": "ct_unk_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -213,7 +216,7 @@ "alias": "ct_unk_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -221,7 +224,7 @@ "alias": "tot_ct_unk_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" } }, { @@ -229,7 +232,7 @@ "alias": "nw_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -237,7 +240,7 @@ "alias": "nw_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -245,7 +248,7 @@ "alias": "nw_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1),1, 0)" } }, { @@ -253,7 +256,7 @@ "alias": "ct_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" } }, { @@ -261,7 +264,7 @@ "alias": "ct_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" } }, { @@ -269,7 +272,7 @@ "alias": "ct_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" } }, { @@ -277,7 +280,7 @@ "alias": "tot_nw_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1),1, 0)" } }, { @@ -285,7 +288,7 @@ "alias": "tot_ct_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" } }, { @@ -293,7 +296,7 @@ "alias": "tot_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_diabetic = 1),1, 0)" } } ], @@ -302,17 +305,13 @@ "conditions": [ { "filterType": "tableColumns", - "conditionExpression": "hmrd.location_id in ?", + "conditionExpression": "nmrd.location_id in ?", "parameterName": "locations" }, { "filterType": "tableColumns", - "conditionExpression": "hmrd.endDate = ?", + "conditionExpression": "nmrd.endDate = ?", "parameterName": "endDate" - }, - { - "filterType": "tableColumns", - "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" } ] }, 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 index dfc9089d4..1bf7d1f6a 100644 --- 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 @@ -43,17 +43,17 @@ { "type": "simple_column", "alias": "nw_ctld_htn_f", - "column": "sum(b.nw_ctld_htn_f)" + "column": "nw_ctld_htn_f" }, { "type": "simple_column", "alias": "nw_ctld_htn_m", - "column": "sum(b.nw_ctld_htn_m)" + "column": "nw_ctld_htn_m" }, { "type": "simple_column", "alias": "tot_nw_ctld_htn", - "column": "sum(b.nw_ctld_htn_f)" + "column": "tot_nw_ctld_htn" }, { "type": "simple_column", @@ -73,17 +73,17 @@ { "type": "simple_column", "alias": "nw_unctld_htn_f", - "column": "sum(b.nw_unctld_htn_f)" + "column": "nw_unctld_htn_f" }, { "type": "simple_column", "alias": "nw_unctld_htn_m", - "column": "sum(b.nw_unctld_htn_m)" + "column": "nw_unctld_htn_m" }, { "type": "simple_column", "alias": "tot_nw_unctld_htn", - "column": "sum(b.tot_nw_unctld_htn)" + "column": "tot_nw_unctld_htn" }, { "type": "simple_column", @@ -103,17 +103,17 @@ { "type": "simple_column", "alias": "nw_unk_htn_f", - "column": "sum(b.nw_unk_htn_f)" + "column": "nw_unk_htn_f" }, { "type": "simple_column", "alias": "nw_unk_htn_m", - "column": "sum(b.nw_unk_htn_m)" + "column": "nw_unk_htn_m" }, { "type": "simple_column", "alias": "tot_nw_unk_htn", - "column": "sum(b.tot_nw_unk_htn)" + "column": "tot_nw_unk_htn" }, { "type": "simple_column", @@ -133,12 +133,12 @@ { "type": "simple_column", "alias": "nw_htn_m", - "column": "sum(b.nw_htn_m)" + "column": "sum(nw_htn_m)" }, { "type": "simple_column", "alias": "nw_htn_f", - "column": "sum(b.nw_htn_f)" + "column": "sum(nw_htn_f)" }, { "type": "simple_column", 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 index 245809d13..1775a5954 100644 --- 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 @@ -6,15 +6,23 @@ "uses": [], "sources": [ { - "table": "etl.hiv_monthly_report_dataset_v1_2", - "alias": "hmrd" + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, + { + "table": "etl.hiv_monthly_report_dataset_frozen", + "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": "hmrd.person_id = fi.patient_id" + "joinCondition": "nmrd.person_id = fi.patient_id" } }, { @@ -22,7 +30,7 @@ "alias": "l", "join": { "type": "INNER", - "joinCondition": "hmrd.location_id = l.location_id" + "joinCondition": "nmrd.location_id = l.location_id" } }, { @@ -30,7 +38,7 @@ "alias": "per", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = per.person_id" + "joinCondition": "nmrd.person_id = per.person_id" } } ], @@ -38,12 +46,12 @@ { "type": "simple_column", "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.location_uuid" }, { "type": "simple_column", "alias": "person_id", - "column": "hmrd.person_id" + "column": "nmrd.person_id" }, { "type": "simple_column", @@ -63,29 +71,24 @@ { "type": "simple_column", "alias": "age", - "column": "hmrd.age" + "column": "nmrd.age" }, { "type": "simple_column", "alias": "location_id", - "column": "hmrd.location_id" + "column": "nmrd.location_id" }, { "type": "simple_column", "alias": "location", - "column": "l.name" - }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.clinic" }, { "type": "derived_column", "alias": "nw_ctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "-1" } }, { @@ -93,7 +96,7 @@ "alias": "nw_ctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -101,7 +104,7 @@ "alias": "tot_nw_ctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "1" + "expression": "-1" } }, { @@ -109,7 +112,7 @@ "alias": "ct_ctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.htn_state = 1 AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -117,7 +120,7 @@ "alias": "ct_ctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -125,7 +128,7 @@ "alias": "tot_ct_ctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -133,7 +136,7 @@ "alias": "nw_unctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -141,7 +144,7 @@ "alias": "nw_unctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -149,7 +152,7 @@ "alias": "tot_nw_unctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -157,7 +160,7 @@ "alias": "ct_unctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -165,7 +168,7 @@ "alias": "ct_unctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -173,7 +176,7 @@ "alias": "tot_ct_unctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 2 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -181,7 +184,7 @@ "alias": "nw_unk_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -189,7 +192,7 @@ "alias": "nw_unk_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -197,7 +200,7 @@ "alias": "tot_nw_unk_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -205,7 +208,7 @@ "alias": "ct_unk_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -213,7 +216,7 @@ "alias": "ct_unk_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -221,7 +224,7 @@ "alias": "tot_ct_unk_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -229,7 +232,7 @@ "alias": "nw_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -237,7 +240,7 @@ "alias": "nw_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -245,7 +248,7 @@ "alias": "nw_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -253,7 +256,7 @@ "alias": "ct_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -261,7 +264,7 @@ "alias": "ct_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -269,7 +272,7 @@ "alias": "ct_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -277,7 +280,7 @@ "alias": "tot_nw_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.started_art_this_month = 1),1, 0)" } }, { @@ -285,7 +288,7 @@ "alias": "tot_ct_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -293,7 +296,7 @@ "alias": "tot_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(hmrd.gender = 'F',1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1),1, 0)" } } ], @@ -302,27 +305,18 @@ "conditions": [ { "filterType": "tableColumns", - "conditionExpression": "hmrd.location_id in ?", + "conditionExpression": "nmrd.location_id in ?", "parameterName": "locations" }, { "filterType": "tableColumns", - "conditionExpression": "hmrd.endDate = ?", + "conditionExpression": "nmrd.endDate = ?", "parameterName": "endDate" - }, - { - "filterType": "tableColumns", - "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" } ] }, "groupBy": { "groupParam": "groupByParam", - "columns": ["hmrd.person_id"], - "excludeParam": "excludeParam" - }, - "paging": { - "offSetParam": "offSetParam", - "limitParam": "limitParam" + "columns": ["person_id,htn_state"] } } 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 index bf41ec24e..c6bbd294a 100644 --- 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 @@ -93,7 +93,7 @@ "alias": "stg_1_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_1_nw_acu_m)" + "expression": "b.stg_1_nw_acu_m" } }, { @@ -101,7 +101,7 @@ "alias": "stg_1_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_1_nw_acu_f)" + "expression": "b.stg_1_nw_acu_f" } }, { @@ -109,7 +109,7 @@ "alias": "tot_stg_1_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_1_nw_acu)" + "expression": "b.tot_stg_1_nw_acu" } }, { @@ -117,7 +117,7 @@ "alias": "stg_1_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_1_ct_acu_m)" + "expression": "b.stg_1_ct_acu_m" } }, { @@ -125,7 +125,7 @@ "alias": "stg_1_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_1_ct_acu_f)" + "expression": "b.stg_1_ct_acu_f" } }, { @@ -133,7 +133,7 @@ "alias": "tot_stg_1_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_1_ct_acu)" + "expression": "b.tot_stg_1_ct_acu" } }, { @@ -189,7 +189,7 @@ "alias": "stg_2_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_2_nw_acu_m)" + "expression": "b.stg_2_nw_acu_m" } }, { @@ -197,7 +197,7 @@ "alias": "stg_2_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_2_nw_acu_f)" + "expression": "b.stg_2_nw_acu_f" } }, { @@ -205,7 +205,7 @@ "alias": "tot_stg_2_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_2_nw_acu)" + "expression": "b.tot_stg_2_nw_acu" } }, { @@ -213,7 +213,7 @@ "alias": "stg_2_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_2_ct_acu_m)" + "expression": "b.stg_2_ct_acu_m" } }, { @@ -221,7 +221,7 @@ "alias": "stg_2_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_2_ct_acu_f)" + "expression": "b.stg_2_ct_acu_f" } }, { @@ -229,7 +229,7 @@ "alias": "tot_stg_2_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_2_ct_acu)" + "expression": "b.tot_stg_2_ct_acu" } }, { @@ -285,7 +285,7 @@ "alias": "stg_3_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_3_nw_acu_m)" + "expression": "b.stg_3_nw_acu_m" } }, { @@ -293,7 +293,7 @@ "alias": "stg_3_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_3_nw_acu_f)" + "expression": "b.stg_3_nw_acu_f" } }, { @@ -301,7 +301,7 @@ "alias": "tot_stg_3_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_3_nw_acu)" + "expression": "b.tot_stg_3_nw_acu" } }, { @@ -309,7 +309,7 @@ "alias": "stg_3_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_3_ct_acu_m)" + "expression": "b.stg_3_ct_acu_m" } }, { @@ -317,7 +317,7 @@ "alias": "stg_3_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_3_ct_acu_f)" + "expression": "b.stg_3_ct_acu_f" } }, { @@ -325,7 +325,199 @@ "alias": "tot_stg_3_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_3_ct_acu)" + "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" } }, { @@ -381,7 +573,7 @@ "alias": "stg_4_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_4_nw_acu_m)" + "expression": "b.stg_4_nw_acu_m" } }, { @@ -389,7 +581,7 @@ "alias": "stg_4_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_4_nw_acu_f)" + "expression": "b.stg_4_nw_acu_f" } }, { @@ -397,7 +589,7 @@ "alias": "tot_stg_4_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_4_nw_acu)" + "expression": "b.tot_stg_4_nw_acu" } }, { @@ -405,7 +597,7 @@ "alias": "stg_4_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_4_ct_acu_m)" + "expression": "b.stg_4_ct_acu_m" } }, { @@ -413,7 +605,7 @@ "alias": "stg_4_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_4_ct_acu_f)" + "expression": "b.stg_4_ct_acu_f" } }, { @@ -421,7 +613,7 @@ "alias": "tot_stg_4_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_4_ct_acu)" + "expression": "b.tot_stg_4_ct_acu" } }, { @@ -477,7 +669,7 @@ "alias": "stg_5_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_5_nw_acu_m)" + "expression": "b.stg_5_nw_acu_m" } }, { @@ -485,7 +677,7 @@ "alias": "stg_5_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_5_nw_acu_f)" + "expression": "b.stg_5_nw_acu_f" } }, { @@ -493,7 +685,7 @@ "alias": "tot_stg_5_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_5_nw_acu)" + "expression": "b.tot_stg_5_nw_acu" } }, { @@ -501,7 +693,7 @@ "alias": "stg_5_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_5_ct_acu_m)" + "expression": "b.stg_5_ct_acu_m" } }, { @@ -509,7 +701,7 @@ "alias": "stg_5_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.stg_5_ct_acu_f)" + "expression": "b.stg_5_ct_acu_f" } }, { @@ -517,7 +709,7 @@ "alias": "tot_stg_5_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.tot_stg_5_ct_acu)" + "expression": "b.tot_stg_5_ct_acu" } }, { @@ -650,18 +842,18 @@ }, { "type": "derived_column", - "alias": "sub_tot_chr", + "alias": "tot_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.sub_tot_chr)" + "expression": "sum(b.tot_chr)" } }, { "type": "derived_column", - "alias": "sub_tot_acu", + "alias": "tot_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "sum(b.sub_tot_acu)" + "expression": "sum(b.tot_acu)" } }, { 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 index 83869a420..61d15a7d9 100644 --- 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 @@ -5,16 +5,24 @@ "description": "", "uses": [], "sources": [ + { + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" + }, { "table": "etl.hiv_monthly_report_dataset_v1_2", - "alias": "hmrd" + "alias": "hmrd", + "join": { + "type": "LEFT", + "joinCondition": "hmrd.person_id = nmrd.person_id AND nmrd.endDate = hmrd.endDate AND nmrd.location_id = hmrd.location_id" + } }, { "table": "etl.flat_patient_identifiers_v1", "alias": "fi", "join": { "type": "LEFT", - "joinCondition": "hmrd.person_id = fi.patient_id" + "joinCondition": "nmrd.person_id = fi.patient_id" } }, { @@ -22,7 +30,7 @@ "alias": "l", "join": { "type": "INNER", - "joinCondition": "hmrd.location_id = l.location_id" + "joinCondition": "nmrd.location_id = l.location_id" } }, { @@ -30,7 +38,7 @@ "alias": "per", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = per.person_id" + "joinCondition": "nmrd.person_id = per.person_id" } } ], @@ -38,12 +46,12 @@ { "type": "simple_column", "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.location_uuid" }, { "type": "simple_column", "alias": "person_id", - "column": "hmrd.person_id" + "column": "nmrd.person_id" }, { "type": "simple_column", @@ -63,29 +71,24 @@ { "type": "simple_column", "alias": "age", - "column": "hmrd.age" + "column": "nmrd.age" }, { "type": "simple_column", "alias": "location_id", - "column": "hmrd.location_id" + "column": "nmrd.location_id" }, { "type": "simple_column", "alias": "location", - "column": "l.name" - }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.clinic" }, { "type": "derived_column", "alias": "stg_1_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -93,7 +96,7 @@ "alias": "stg_1_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -101,7 +104,7 @@ "alias": "tot_stg_1_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -109,7 +112,7 @@ "alias": "stg_1_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -117,7 +120,7 @@ "alias": "stg_1_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -125,7 +128,7 @@ "alias": "tot_stg_1_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -133,7 +136,7 @@ "alias": "stg_1_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -141,7 +144,7 @@ "alias": "stg_1_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -149,7 +152,7 @@ "alias": "tot_stg_1_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -157,7 +160,7 @@ "alias": "stg_1_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -165,7 +168,7 @@ "alias": "stg_1_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -173,7 +176,7 @@ "alias": "tot_stg_1_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -181,7 +184,7 @@ "alias": "stg_2_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -189,7 +192,7 @@ "alias": "stg_2_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -197,7 +200,7 @@ "alias": "tot_stg_2_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -205,7 +208,7 @@ "alias": "stg_2_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -213,7 +216,7 @@ "alias": "stg_2_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -221,7 +224,7 @@ "alias": "tot_stg_2_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -229,7 +232,7 @@ "alias": "stg_2_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -237,7 +240,7 @@ "alias": "stg_2_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -245,7 +248,7 @@ "alias": "tot_stg_2_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -253,7 +256,7 @@ "alias": "stg_2_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -261,7 +264,7 @@ "alias": "stg_2_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -269,7 +272,7 @@ "alias": "tot_stg_2_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -277,7 +280,7 @@ "alias": "stg_3_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -285,7 +288,7 @@ "alias": "stg_3_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -293,7 +296,7 @@ "alias": "tot_stg_3_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "2" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -301,7 +304,7 @@ "alias": "stg_3_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -309,7 +312,7 @@ "alias": "stg_3_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -317,7 +320,7 @@ "alias": "tot_stg_3_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -325,7 +328,7 @@ "alias": "stg_3_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -333,7 +336,7 @@ "alias": "stg_3_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -341,7 +344,7 @@ "alias": "tot_stg_3_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -349,7 +352,7 @@ "alias": "stg_3_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -357,7 +360,7 @@ "alias": "stg_3_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -365,7 +368,199 @@ "alias": "tot_stg_3_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 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 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 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 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 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 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3a_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3a_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_chr_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 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 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 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 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 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 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_ct_chr", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_nw_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_nw_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_acu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "stg_3b_ct_acu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" + } + }, + { + "type": "derived_column", + "alias": "tot_stg_3b_ct_acu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "-1" } }, { @@ -373,7 +568,7 @@ "alias": "stg_4_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -381,7 +576,7 @@ "alias": "stg_4_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -389,7 +584,7 @@ "alias": "tot_stg_4_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -397,7 +592,7 @@ "alias": "stg_4_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -405,7 +600,7 @@ "alias": "stg_4_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -413,7 +608,7 @@ "alias": "tot_stg_4_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -421,7 +616,7 @@ "alias": "stg_4_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -429,7 +624,7 @@ "alias": "stg_4_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -437,7 +632,7 @@ "alias": "tot_stg_4_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -445,7 +640,7 @@ "alias": "stg_4_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -453,7 +648,7 @@ "alias": "stg_4_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -461,7 +656,7 @@ "alias": "tot_stg_4_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -469,7 +664,7 @@ "alias": "stg_5_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -477,7 +672,7 @@ "alias": "stg_5_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -485,7 +680,7 @@ "alias": "tot_stg_5_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -493,7 +688,7 @@ "alias": "stg_5_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -501,7 +696,7 @@ "alias": "stg_5_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -509,7 +704,7 @@ "alias": "tot_stg_5_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -517,7 +712,7 @@ "alias": "stg_5_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -525,7 +720,7 @@ "alias": "stg_5_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -533,7 +728,7 @@ "alias": "tot_stg_5_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -541,7 +736,7 @@ "alias": "stg_5_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -549,7 +744,7 @@ "alias": "stg_5_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -557,7 +752,7 @@ "alias": "tot_stg_5_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "-1" } }, { @@ -565,7 +760,7 @@ "alias": "sub_tot_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -573,7 +768,7 @@ "alias": "sub_tot_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -581,7 +776,7 @@ "alias": "sub_tot_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -589,7 +784,7 @@ "alias": "sub_tot_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -597,7 +792,7 @@ "alias": "sub_tot_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -605,7 +800,7 @@ "alias": "sub_tot_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { @@ -658,23 +853,23 @@ }, { "type": "derived_column", - "alias": "sub_tot_nw_chr", + "alias": "tot_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { "type": "derived_column", - "alias": "sub_tot_ct_chr", + "alias": "tot_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" } }, { "type": "derived_column", - "alias": "sub_tot_nw_acu", + "alias": "tot_nw_acu", "expressionType": "simple_expression", "expressionOptions": { "expression": "0" @@ -682,7 +877,7 @@ }, { "type": "derived_column", - "alias": "sub_tot_ct_acu", + "alias": "tot_ct_acu", "expressionType": "simple_expression", "expressionOptions": { "expression": "0" @@ -690,15 +885,15 @@ }, { "type": "derived_column", - "alias": "sub_tot_chr", + "alias": "tot_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.is_ckd = 1, 1, 0)" } }, { "type": "derived_column", - "alias": "sub_tot_acu", + "alias": "tot_acu", "expressionType": "simple_expression", "expressionOptions": { "expression": "0" @@ -709,7 +904,7 @@ "alias": "tot_kd", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(nmrd.has_kd = 1, 1, 0)" } } ], @@ -718,23 +913,19 @@ "conditions": [ { "filterType": "tableColumns", - "conditionExpression": "hmrd.location_id in ?", + "conditionExpression": "nmrd.location_id in ?", "parameterName": "locations" }, { "filterType": "tableColumns", - "conditionExpression": "hmrd.endDate = ?", + "conditionExpression": "nmrd.endDate = ?", "parameterName": "endDate" - }, - { - "filterType": "tableColumns", - "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" } ] }, "groupBy": { "groupParam": "groupByParam", - "columns": ["hmrd.person_id"], + "columns": ["nmrd.person_id, nmrd.has_kd, nmrd.is_ckd"], "excludeParam": "excludeParam" } } 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 index 1a1354641..622a75b98 100644 --- 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 @@ -15,7 +15,7 @@ "indicator": ["F", "M", "T", "F", "M", "T"] }, { - "label": "Contolled", + "label": "Controlled (SBP <130 mmHg and DBP <80 mmHg)", "indicator": [ "nw_ctld_htn_f", "nw_ctld_htn_m", @@ -26,7 +26,7 @@ ] }, { - "label": "Uncontrolled", + "label": "Not well controlled", "indicator": [ "nw_unctld_htn_f", "nw_unctld_htn_m", @@ -50,11 +50,11 @@ { "label": "Sub Total", "indicator": [ - "nw_htn_m", "nw_htn_f", + "nw_htn_m", "nw_htn", - "ct_htn_m", "ct_htn_f", + "ct_htn_m", "ct_htn" ] }, @@ -63,7 +63,7 @@ "indicator": ["tot_nw_htn", "tot_ct_htn"] }, { - "label": "Total", + "label": "Total HTN", "indicator": "tot_htn" } ] @@ -84,7 +84,7 @@ "indicator": ["F", "M", "T", "F", "M", "T"] }, { - "label": "Contolled", + "label": "Controlled (HbA1c 7% - 8%)", "indicator": [ "nw_ctld_dm_f", "nw_ctld_dm_m", @@ -119,11 +119,11 @@ { "label": "Sub Total", "indicator": [ - "nw_dm_m", "nw_dm_f", + "nw_dm_m", "nw_dm", - "ct_dm_m", "ct_dm_f", + "ct_dm_m", "ct_dm" ] }, @@ -132,7 +132,7 @@ "indicator": ["tot_nw_dm", "tot_ct_dm"] }, { - "label": "Total", + "label": "Total DM", "indicator": "tot_dm" } ] @@ -234,7 +234,7 @@ "indicator": ["tot_nw_mh", "tot_ct_mh"] }, { - "label": "Total", + "label": "Total MHD", "indicator": "tot_mh" } ] @@ -322,6 +322,40 @@ "tot_stg_3_ct_acu" ] }, + { + "label": "Stage 3a", + "indicator": [ + "stg_3a_nw_chr_m", + "stg_3a_nw_chr_f", + "tot_stg_3a_nw_chr", + "stg_3a_ct_chr_m", + "stg_3a_ct_chr_f", + "tot_stg_3a_ct_chr", + "stg_3a_nw_acu_m", + "stg_3a_nw_acu_f", + "tot_stg_3a_nw_acu", + "stg_3a_ct_acu_m", + "stg_3a_ct_acu_f", + "tot_stg_3a_ct_acu" + ] + }, + { + "label": "Stage 3b", + "indicator": [ + "stg_3b_nw_chr_m", + "stg_3b_nw_chr_f", + "tot_stg_3b_nw_chr", + "stg_3b_ct_chr_m", + "stg_3b_ct_chr_f", + "tot_stg_3b_ct_chr", + "stg_3b_nw_acu_m", + "stg_3b_nw_acu_f", + "tot_stg_3b_nw_acu", + "stg_3b_ct_acu_m", + "stg_3b_ct_acu_f", + "tot_stg_3b_ct_acu" + ] + }, { "label": "Stage 4", "indicator": [ @@ -376,18 +410,18 @@ { "label": "Status Sub Total", "indicator": [ - "sub_tot_nw_chr", - "sub_tot_ct_chr", - "sub_tot_nw_acu", - "sub_tot_ct_acu" + "tot_nw_chr", + "tot_ct_chr", + "tot_nw_acu", + "tot_ct_acu" ] }, { "label": "State Sub Total", - "indicator": ["sub_tot_chr", "sub_tot_acu"] + "indicator": ["tot_chr", "tot_acu"] }, { - "label": "Grand Total", + "label": "Grand Total KD", "indicator": "tot_kd" } ] @@ -445,7 +479,7 @@ "indicator": ["tot_nw_cvd", "tot_ct_cvd"] }, { - "label": "Total", + "label": "Total CVD", "indicator": "tot_cvd" } ] From 6c6cb71231627dcd10cb823db333bc891f141ead Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 19 Dec 2023 22:51:04 +0300 Subject: [PATCH 13/40] POC-544-v2: added mental health disorder query schema --- .../mental-health-disorder/mh-aggregate.json | 295 +++++++++++ .../mental-health-disorder/mh-base.json | 471 ++++++++++++++++++ 2 files changed, 766 insertions(+) create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-base.json 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..5e4217336 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-aggregate.json @@ -0,0 +1,295 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..aa68d9bbd --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/mh-base.json @@ -0,0 +1,471 @@ +{ + "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": "hmrd.person_id = nmrd.person_id AND hmrd.endDate = nmrd.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_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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 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), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "tot_mh", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_mhd = 1 and (hmrd.started_art_this_month = 1 OR hmrd.on_art_this_month = 1)), 1, 0)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate = ?", + "parameterName": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["hmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } +} From 5a6da8eeb6865a08d996e0bdbb6a014c34b9e89a Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 19 Dec 2023 22:52:10 +0300 Subject: [PATCH 14/40] POC-544-v2: added enhancement for data display --- app/reporting-framework/base-mysql.report.js | 9 +++++++++ .../disaggregations/diabetic/dm-base.json | 2 +- .../disaggregations/hypertensive/htn-aggregate.json | 6 +++--- .../disaggregations/hypertensive/htn-base.json | 2 +- .../disaggregations/kidney-disease/kd-base.json | 2 +- .../plhiv-ncd-v2-report-indicators.json | 4 ++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index 833a80ade..dcda229c3 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -393,6 +393,9 @@ import * as htn_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disagg 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 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'; @@ -1826,6 +1829,12 @@ export class BaseMysqlReport { dmPlhivBase: this.cloneJsonSchema(dm_plhiv_base) }); break; + case 'mhPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(mh_plhiv_aggregate), + mhPlhivBase: this.cloneJsonSchema(mh_plhiv_base) + }); + break; case 'cvdPlhivAggregate': resolve({ main: this.cloneJsonSchema(cvd_plhiv_aggregate), 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 index 3cd1aeec0..55735d85c 100644 --- 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 @@ -296,7 +296,7 @@ "alias": "tot_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_diabetic = 1),1, 0)" + "expression": "IF((nmrd.is_diabetic = 1 AND (hmrd.started_art_this_month = 1 OR hmrd.on_art_this_month = 1)),1, 0)" } } ], 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 index 1bf7d1f6a..bdf6fbba7 100644 --- 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 @@ -43,17 +43,17 @@ { "type": "simple_column", "alias": "nw_ctld_htn_f", - "column": "nw_ctld_htn_f" + "column": "b.nw_ctld_htn_f" }, { "type": "simple_column", "alias": "nw_ctld_htn_m", - "column": "nw_ctld_htn_m" + "column": "b.nw_ctld_htn_m" }, { "type": "simple_column", "alias": "tot_nw_ctld_htn", - "column": "tot_nw_ctld_htn" + "column": "b.tot_nw_ctld_htn" }, { "type": "simple_column", 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 index 1775a5954..77eb01360 100644 --- 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 @@ -296,7 +296,7 @@ "alias": "tot_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_hypertensive = 1),1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1 AND (hmrd.started_art_this_month = 1 OR hmrd.on_art_this_month = 1)),1, 0)" } } ], 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 index 61d15a7d9..1c46e5b6f 100644 --- 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 @@ -392,7 +392,7 @@ "alias": "tot_stg_3a_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { 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 index 622a75b98..924b82dd9 100644 --- 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 @@ -221,11 +221,11 @@ { "label": "Sub Total", "indicator": [ - "nw_mh_m", "nw_mh_f", + "nw_mh_m", "nw_mh", - "ct_mh_m", "ct_mh_f", + "ct_mh_m", "ct_mh" ] }, From 1b7255d370db3de2fecddd63bb9f5e8ce239a7fd Mon Sep 17 00:00:00 2001 From: henrykorir Date: Thu, 21 Dec 2023 08:02:54 +0300 Subject: [PATCH 15/40] POC-544-v2: Update NCD report to reflect neurological disorders POC-544-v2: Modified the DM report aggregation POC-544-v2: Modified the HTN base report logic POC-544-v2: Modified indicators to map correctly POC-544-v2: Added neurological report schema POC-544-v2: Added Neurological Report --- app/reporting-framework/base-mysql.report.js | 9 + .../disaggregations/diabetic/dm-base.json | 2 +- .../hypertensive/htn-base.json | 4 +- .../neurological-disease/neuro-aggregate.json | 175 +++++++++++ .../neurological-disease/neuro-base.json | 280 ++++++++++++++++++ .../plhiv-ncd-v2-report-indicators.json | 18 +- 6 files changed, 476 insertions(+), 12 deletions(-) create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-base.json diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index dcda229c3..ceb1fd846 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -399,6 +399,9 @@ import * as mh_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggr 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 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 { @@ -1841,6 +1844,12 @@ export class BaseMysqlReport { cvdPlhivBase: this.cloneJsonSchema(cvd_plhiv_base) }); break; + case 'neuPlhivAggregate': + resolve({ + main: this.cloneJsonSchema(neu_plhiv_aggregate), + neuPlhivBase: this.cloneJsonSchema(neu_plhiv_base) + }); + break; case 'kdPlhivAggregate': resolve({ main: this.cloneJsonSchema(kd_plhiv_aggregate), 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 index 55735d85c..3cd1aeec0 100644 --- 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 @@ -296,7 +296,7 @@ "alias": "tot_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_diabetic = 1 AND (hmrd.started_art_this_month = 1 OR hmrd.on_art_this_month = 1)),1, 0)" + "expression": "IF((nmrd.is_diabetic = 1),1, 0)" } } ], 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 index 77eb01360..ace19c050 100644 --- 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 @@ -224,7 +224,7 @@ "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) ,1, 0)" + "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1) ,1, 0)" } }, { @@ -296,7 +296,7 @@ "alias": "tot_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_hypertensive = 1 AND (hmrd.started_art_this_month = 1 OR hmrd.on_art_this_month = 1)),1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1 ),1, 0)" } } ], 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..611868220 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-aggregate.json @@ -0,0 +1,175 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..a0d731518 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/neurological-disease/neuro-base.json @@ -0,0 +1,280 @@ +{ + "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": "hmrd.person_id = nmrd.person_id AND hmrd.endDate = nmrd.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), 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), 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), 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), 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), 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), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_nw_neu_m", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'M' AND (nmrd.has_migraine = 1 OR nmrd.has_convulsive_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_migraine = 1 OR nmrd.has_convulsive_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_convulsive_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_migraine = 1 OR nmrd.has_convulsive_disorder = 1) AND hmrd.on_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_neu_f", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.gender = 'F' AND (nmrd.has_migraine = 1 OR nmrd.has_convulsive_disorder = 1) AND hmrd.on_art_this_month = 1), 1, 0)" + } + }, + { + "type": "derived_column", + "alias": "sub_tot_ct_neu", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF((nmrd.has_convulsive_disorder = 1 AND hmrd.on_art_this_month = 1), 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), 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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["hmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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 index 924b82dd9..ebfd4b045 100644 --- 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 @@ -524,21 +524,21 @@ { "label": "Sub Total", "indicator": [ - "sub_tot_nw_cnv_m", - "sub_tot_nw_cnv_f", - "sub_tot_nw_cnv", - "sub_tot_ct_cnv_m", - "sub_tot_ct_cnv_f", - "sub_tot_ct_cnv" + "sub_tot_nw_neu_m", + "sub_tot_nw_neu_f", + "sub_tot_nw_neu", + "sub_tot_ct_neu_m", + "sub_tot_ct_neu_f", + "sub_tot_ct_neu" ] }, { "label": "Status Sub Total", - "indicator": ["tot_nw_cnv", "tot_ct_cnv"] + "indicator": ["tot_nw_neu", "tot_ct_neu"] }, { - "label": "Total", - "indicator": "tot_cnv" + "label": "Total Neurological Disorder", + "indicator": "tot_neu" } ] }, From decb7960e373cf42c44360735939a0475e734f4b Mon Sep 17 00:00:00 2001 From: henrykorir Date: Thu, 21 Dec 2023 10:21:01 +0300 Subject: [PATCH 16/40] POC-544-v2: Updated the query logic and updated indicators POC-544-v2: PLHIV NCD Endpoint POC-544-v2: Updated the indicator to indicate that its value is not applicable POC-544-v2: Minor fixes on indicators and DM logic POC-544-v2: Updated indicators and the rheumatological malignancies report POC-544-v2: Enhanced ncd endpoints POC-544-v2: Added rheumatologic disorders POC-544-v2: Fixed missing base entries POC-544-v2: Added type and indicator descriptions POC-544-v2: Fixed indicator and field mismatches POC-544-v2: Fixed a bug affecting display POC-544-v2: Provided a more descriptive diabetic state POC-544-v2: Updated the indicators to indicate an indicator is not required POC-544-v2: Renamed confusing indicators POC-544-v2: Fixed query logic and updated indicator field Fixed issues in the query schemas and indicator POC-544-v2: Explicitly identified clients as either new or continuing treatment POC-544-v2: Updated indicators to have better descriptions --- app/reporting-framework/base-mysql.report.js | 9 + .../cardiovascular-disease/cvd-base.json | 65 +- .../diabetic/dm-aggregate.json | 18 +- .../disaggregations/diabetic/dm-base.json | 48 +- .../hypertensive/htn-aggregate.json | 28 +- .../hypertensive/htn-base.json | 52 +- .../kidney-disease/kd-base.json | 170 +- .../mental-health-disorder/mh-base.json | 52 +- .../neurological-disease/neuro-base.json | 28 +- .../rheumatologic-disease/rheu-aggregate.json | 238 ++ .../rheumatologic-disease/rheu-base.json | 280 ++ .../plhiv-ncd-v2-report-indicators.json | 2352 +++++++++++++---- 12 files changed, 2652 insertions(+), 688 deletions(-) create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-base.json diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index ceb1fd846..331eb3f8e 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -402,6 +402,9 @@ import * as cvd_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disagg 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 { @@ -1850,6 +1853,12 @@ export class BaseMysqlReport { 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), 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 index 5444ac39d..2f52e4c9a 100644 --- 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 @@ -6,23 +6,23 @@ "uses": [], "sources": [ { - "table": "etl.hiv_monthly_report_dataset_v1_2", - "alias": "hmrd" + "table": "etl.ncd_monthly_report_dataset", + "alias": "nmrd" }, { - "table": "etl.flat_patient_identifiers_v1", - "alias": "fi", + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "hmrd", "join": { - "type": "LEFT", - "joinCondition": "hmrd.person_id = fi.patient_id" + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" } }, { - "table": "amrs.location", - "alias": "l", + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", "join": { - "type": "INNER", - "joinCondition": "hmrd.location_id = l.location_id" + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" } }, { @@ -30,7 +30,7 @@ "alias": "per", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = per.person_id" + "joinCondition": "nmrd.person_id = per.person_id" } } ], @@ -38,12 +38,12 @@ { "type": "simple_column", "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.location_uuid" }, { "type": "simple_column", "alias": "person_id", - "column": "hmrd.person_id" + "column": "nmrd.person_id" }, { "type": "simple_column", @@ -63,22 +63,17 @@ { "type": "simple_column", "alias": "age", - "column": "hmrd.age" + "column": "nmrd.age" }, { "type": "simple_column", "alias": "location_id", - "column": "hmrd.location_id" + "column": "nmrd.location_id" }, { "type": "simple_column", "alias": "location", - "column": "l.name" - }, - { - "type": "simple_column", - "alias": "location_uuid", - "column": "l.uuid" + "column": "nmrd.clinic" }, { "type": "derived_column", @@ -181,7 +176,7 @@ "alias": "sub_tot_nw_cvd_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_cvd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -189,7 +184,7 @@ "alias": "sub_tot_nw_cvd_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_cvd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -197,7 +192,7 @@ "alias": "sub_tot_nw_cvd", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF(((nmrd.gender = 'F' OR nmrd.gender = 'M') AND nmrd.has_cvd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } } @@ -207,7 +202,7 @@ "alias": "sub_tot_ct_cvd_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "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)" } }, { @@ -215,7 +210,7 @@ "alias": "sub_tot_ct_cvd_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "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)" } }, { @@ -223,7 +218,7 @@ "alias": "sub_tot_ct_cvd", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "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)" } }, { @@ -231,7 +226,7 @@ "alias": "tot_nw_cvd", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.has_cvd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -239,7 +234,7 @@ "alias": "tot_ct_cvd", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.has_cvd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -247,7 +242,7 @@ "alias": "tot_cvd", "expressionType": "simple_expression", "expressionOptions": { - "expression": "0" + "expression": "IF((nmrd.has_cvd = 1), 1, 0)" } } ], @@ -256,23 +251,19 @@ "conditions": [ { "filterType": "tableColumns", - "conditionExpression": "hmrd.location_id in ?", + "conditionExpression": "nmrd.location_id in ?", "parameterName": "locations" }, { "filterType": "tableColumns", - "conditionExpression": "hmrd.endDate = ?", + "conditionExpression": "nmrd.endDate = ?", "parameterName": "endDate" - }, - { - "filterType": "tableColumns", - "conditionExpression": "hmrd.status = 'active' AND hmrd.on_art_this_month = 1" } ] }, "groupBy": { "groupParam": "groupByParam", - "columns": ["hmrd.person_id"], + "columns": ["nmrd.person_id"], "excludeParam": "excludeParam" }, "paging": { 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 index dfb30a7b7..a0a147f3e 100644 --- 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 @@ -43,17 +43,17 @@ { "type": "simple_column", "alias": "nw_ctld_dm_f", - "column": "b.nw_ctld_dm_f" + "column": "sum(b.nw_ctld_dm_f)" }, { "type": "simple_column", "alias": "nw_ctld_dm_m", - "column": "b.nw_ctld_dm_m" + "column": "sum(b.nw_ctld_dm_m)" }, { "type": "simple_column", "alias": "tot_nw_ctld_dm", - "column": "b.tot_nw_ctld_dm" + "column": "sum(b.tot_nw_ctld_dm)" }, { "type": "simple_column", @@ -73,17 +73,17 @@ { "type": "simple_column", "alias": "nw_unctld_dm_f", - "column": "b.nw_unctld_dm_f" + "column": "sum(b.nw_unctld_dm_f)" }, { "type": "simple_column", "alias": "nw_unctld_dm_m", - "column": "b.nw_unctld_dm_m" + "column": "sum(b.nw_unctld_dm_m)" }, { "type": "simple_column", "alias": "tot_nw_unctld_dm", - "column": "b.tot_nw_unctld_dm" + "column": "sum(b.tot_nw_unctld_dm)" }, { "type": "simple_column", @@ -103,17 +103,17 @@ { "type": "simple_column", "alias": "nw_unk_dm_f", - "column": "b.nw_unk_dm_f" + "column": "sum(b.nw_unk_dm_f)" }, { "type": "simple_column", "alias": "nw_unk_dm_m", - "column": "b.nw_unk_dm_m" + "column": "sum(b.nw_unk_dm_m)" }, { "type": "simple_column", "alias": "tot_nw_unk_dm", - "column": "b.tot_nw_unk_dm" + "column": "sum(b.tot_nw_unk_dm)" }, { "type": "simple_column", 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 index 3cd1aeec0..1a91d6dcb 100644 --- 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 @@ -88,7 +88,7 @@ "alias": "nw_ctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -96,7 +96,7 @@ "alias": "nw_ctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -104,7 +104,7 @@ "alias": "tot_nw_ctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -112,7 +112,7 @@ "alias": "ct_ctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -120,7 +120,7 @@ "alias": "ct_ctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -128,7 +128,7 @@ "alias": "tot_ct_ctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 1 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -136,7 +136,7 @@ "alias": "nw_unctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -144,7 +144,7 @@ "alias": "nw_unctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -152,7 +152,7 @@ "alias": "tot_nw_unctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -160,7 +160,7 @@ "alias": "ct_unctld_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -168,7 +168,7 @@ "alias": "ct_unctld_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -176,7 +176,7 @@ "alias": "tot_ct_unctld_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 2 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -184,7 +184,7 @@ "alias": "nw_unk_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -192,7 +192,7 @@ "alias": "nw_unk_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -200,7 +200,7 @@ "alias": "tot_nw_unk_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "IF((nmrd.is_diabetic = 1 AND dm_state = 3 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -208,7 +208,7 @@ "alias": "ct_unk_dm_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -216,7 +216,7 @@ "alias": "ct_unk_dm_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -224,7 +224,7 @@ "alias": "tot_ct_unk_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_diabetic = 1 AND nmrd.dm_state = 3 AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -248,7 +248,7 @@ "alias": "nw_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1),1, 0)" + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.started_art_this_month = 1),1, 0)" } }, { @@ -256,7 +256,7 @@ "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),1, 0)" + "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)" } }, { @@ -264,7 +264,7 @@ "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),1, 0)" + "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)" } }, { @@ -272,7 +272,7 @@ "alias": "ct_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0),1, 0)" } }, { @@ -288,7 +288,7 @@ "alias": "tot_ct_dm", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1),1, 0)" + "expression": "IF((nmrd.is_diabetic = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0),1, 0)" } }, { @@ -317,7 +317,7 @@ }, "groupBy": { "groupParam": "groupByParam", - "columns": ["hmrd.person_id"], + "columns": ["nmrd.person_id"], "excludeParam": "excludeParam" }, "paging": { 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 index bdf6fbba7..402e07695 100644 --- 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 @@ -43,17 +43,17 @@ { "type": "simple_column", "alias": "nw_ctld_htn_f", - "column": "b.nw_ctld_htn_f" + "column": "sum(b.nw_ctld_htn_f)" }, { "type": "simple_column", "alias": "nw_ctld_htn_m", - "column": "b.nw_ctld_htn_m" + "column": "sum(b.nw_ctld_htn_m)" }, { "type": "simple_column", "alias": "tot_nw_ctld_htn", - "column": "b.tot_nw_ctld_htn" + "column": "sum(b.tot_nw_ctld_htn)" }, { "type": "simple_column", @@ -103,17 +103,17 @@ { "type": "simple_column", "alias": "nw_unk_htn_f", - "column": "nw_unk_htn_f" + "column": "sum(b.nw_unk_htn_f)" }, { "type": "simple_column", "alias": "nw_unk_htn_m", - "column": "nw_unk_htn_m" + "column": "sum(b.nw_unk_htn_m)" }, { "type": "simple_column", "alias": "tot_nw_unk_htn", - "column": "tot_nw_unk_htn" + "column": "sum(b.tot_nw_unk_htn)" }, { "type": "simple_column", @@ -132,13 +132,13 @@ }, { "type": "simple_column", - "alias": "nw_htn_m", - "column": "sum(nw_htn_m)" + "alias": "nw_htn_f", + "column": "sum(nw_htn_f)" }, { "type": "simple_column", - "alias": "nw_htn_f", - "column": "sum(nw_htn_f)" + "alias": "nw_htn_m", + "column": "sum(nw_htn_m)" }, { "type": "simple_column", @@ -147,13 +147,13 @@ }, { "type": "simple_column", - "alias": "ct_htn_m", - "column": "sum(b.ct_htn_m)" + "alias": "ct_htn_f", + "column": "sum(b.ct_htn_f)" }, { "type": "simple_column", - "alias": "ct_htn_f", - "column": "sum(b.ct_htn_f)" + "alias": "ct_htn_m", + "column": "sum(b.ct_htn_m)" }, { "type": "simple_column", 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 index ace19c050..7aaf2791f 100644 --- 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 @@ -10,11 +10,11 @@ "alias": "nmrd" }, { - "table": "etl.hiv_monthly_report_dataset_frozen", + "table": "etl.hiv_monthly_report_dataset_v1_2", "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" } }, { @@ -88,7 +88,7 @@ "alias": "nw_ctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -96,7 +96,7 @@ "alias": "nw_ctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -104,7 +104,7 @@ "alias": "tot_nw_ctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -112,7 +112,7 @@ "alias": "ct_ctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.htn_state = 1 AND nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" + "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)" } }, { @@ -120,7 +120,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -128,7 +128,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -136,7 +136,7 @@ "alias": "nw_unctld_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -144,7 +144,7 @@ "alias": "nw_unctld_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -152,7 +152,7 @@ "alias": "tot_nw_unctld_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -160,7 +160,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -168,7 +168,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -176,7 +176,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -184,7 +184,7 @@ "alias": "nw_unk_htn_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -192,7 +192,7 @@ "alias": "nw_unk_htn_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -200,7 +200,7 @@ "alias": "tot_nw_unk_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "IF((nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.started_art_this_month = 1) ,1, 0)" } }, { @@ -208,7 +208,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -216,7 +216,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -224,7 +224,7 @@ "alias": "tot_ct_unk_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_hypertensive = 1 AND nmrd.htn_state = 3 AND hmrd.on_art_this_month = 1) ,1, 0)" + "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)" } }, { @@ -256,7 +256,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -264,7 +264,7 @@ "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) ,1, 0)" + "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)" } }, { @@ -272,7 +272,7 @@ "alias": "ct_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" } }, { @@ -288,7 +288,7 @@ "alias": "tot_ct_htn", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1) ,1, 0)" + "expression": "IF((nmrd.is_hypertensive = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0) ,1, 0)" } }, { @@ -312,11 +312,11 @@ "filterType": "tableColumns", "conditionExpression": "nmrd.endDate = ?", "parameterName": "endDate" - } + } ] }, "groupBy": { "groupParam": "groupByParam", - "columns": ["person_id,htn_state"] + "columns": ["nmrd.person_id, nmrd.is_hypertensive,nmrd.htn_state"] } } 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 index 1c46e5b6f..8deb90f4d 100644 --- 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 @@ -13,8 +13,8 @@ "table": "etl.hiv_monthly_report_dataset_v1_2", "alias": "hmrd", "join": { - "type": "LEFT", - "joinCondition": "hmrd.person_id = nmrd.person_id AND nmrd.endDate = hmrd.endDate AND nmrd.location_id = hmrd.location_id" + "type": "INNER", + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" } }, { @@ -112,7 +112,7 @@ "alias": "stg_1_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -120,7 +120,7 @@ "alias": "stg_1_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -128,7 +128,7 @@ "alias": "tot_stg_1_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -136,7 +136,7 @@ "alias": "stg_1_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -144,7 +144,7 @@ "alias": "stg_1_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -152,7 +152,7 @@ "alias": "tot_stg_1_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -160,7 +160,7 @@ "alias": "stg_1_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -168,7 +168,7 @@ "alias": "stg_1_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -176,7 +176,7 @@ "alias": "tot_stg_1_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -208,7 +208,7 @@ "alias": "stg_2_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -216,7 +216,7 @@ "alias": "stg_2_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -224,7 +224,7 @@ "alias": "tot_stg_2_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -232,7 +232,7 @@ "alias": "stg_2_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -240,7 +240,7 @@ "alias": "stg_2_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -248,7 +248,7 @@ "alias": "tot_stg_2_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -256,7 +256,7 @@ "alias": "stg_2_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -264,7 +264,7 @@ "alias": "stg_2_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -272,7 +272,7 @@ "alias": "tot_stg_2_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -304,7 +304,7 @@ "alias": "stg_3_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -312,7 +312,7 @@ "alias": "stg_3_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -320,7 +320,7 @@ "alias": "tot_stg_3_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -328,7 +328,7 @@ "alias": "stg_3_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -336,7 +336,7 @@ "alias": "stg_3_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -344,7 +344,7 @@ "alias": "tot_stg_3_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -352,7 +352,7 @@ "alias": "stg_3_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -360,7 +360,7 @@ "alias": "stg_3_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -368,7 +368,7 @@ "alias": "tot_stg_3_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -392,7 +392,7 @@ "alias": "tot_stg_3a_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' OR nmrd.gender = 'F') AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -400,7 +400,7 @@ "alias": "stg_3a_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -408,7 +408,7 @@ "alias": "stg_3a_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -416,7 +416,7 @@ "alias": "tot_stg_3a_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" } }, { @@ -424,7 +424,7 @@ "alias": "stg_3a_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -432,7 +432,7 @@ "alias": "stg_3a_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -440,7 +440,7 @@ "alias": "tot_stg_3a_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -448,7 +448,7 @@ "alias": "stg_3a_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -456,7 +456,7 @@ "alias": "stg_3a_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -464,7 +464,7 @@ "alias": "tot_stg_3a_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -472,7 +472,7 @@ "alias": "stg_3b_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -480,7 +480,7 @@ "alias": "stg_3b_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -488,7 +488,7 @@ "alias": "tot_stg_3b_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -496,7 +496,7 @@ "alias": "stg_3b_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -504,7 +504,7 @@ "alias": "stg_3b_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -512,7 +512,7 @@ "alias": "tot_stg_3b_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -520,7 +520,7 @@ "alias": "stg_3b_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -528,7 +528,7 @@ "alias": "stg_3b_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -536,7 +536,7 @@ "alias": "tot_stg_3b_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -544,7 +544,7 @@ "alias": "stg_3b_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -552,7 +552,7 @@ "alias": "stg_3b_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -560,7 +560,7 @@ "alias": "tot_stg_3b_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -568,7 +568,7 @@ "alias": "stg_4_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -576,7 +576,7 @@ "alias": "stg_4_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -584,7 +584,7 @@ "alias": "tot_stg_4_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -592,7 +592,7 @@ "alias": "stg_4_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -600,7 +600,7 @@ "alias": "stg_4_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -608,7 +608,7 @@ "alias": "tot_stg_4_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -616,7 +616,7 @@ "alias": "stg_4_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -624,7 +624,7 @@ "alias": "stg_4_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -632,7 +632,7 @@ "alias": "tot_stg_4_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -640,7 +640,7 @@ "alias": "stg_4_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -648,7 +648,7 @@ "alias": "stg_4_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -656,7 +656,7 @@ "alias": "tot_stg_4_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -664,7 +664,7 @@ "alias": "stg_5_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -672,7 +672,7 @@ "alias": "stg_5_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -680,7 +680,7 @@ "alias": "tot_stg_5_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -688,7 +688,7 @@ "alias": "stg_5_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -696,7 +696,7 @@ "alias": "stg_5_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -704,7 +704,7 @@ "alias": "tot_stg_5_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -712,7 +712,7 @@ "alias": "stg_5_nw_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -720,7 +720,7 @@ "alias": "stg_5_nw_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -728,7 +728,7 @@ "alias": "tot_stg_5_nw_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -736,7 +736,7 @@ "alias": "stg_5_ct_acu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -744,7 +744,7 @@ "alias": "stg_5_ct_acu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -752,7 +752,7 @@ "alias": "tot_stg_5_ct_acu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "-1" + "expression": "null" } }, { @@ -760,7 +760,7 @@ "alias": "sub_tot_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -768,7 +768,7 @@ "alias": "sub_tot_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -776,7 +776,7 @@ "alias": "sub_tot_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -784,7 +784,7 @@ "alias": "sub_tot_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -792,7 +792,7 @@ "alias": "sub_tot_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -800,7 +800,7 @@ "alias": "sub_tot_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -856,7 +856,7 @@ "alias": "tot_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -864,7 +864,7 @@ "alias": "tot_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -888,7 +888,7 @@ "alias": "tot_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1), 1, 0)" } }, { @@ -904,7 +904,7 @@ "alias": "tot_kd", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.has_kd = 1, 1, 0)" + "expression": "IF((nmrd.has_kd = 1), 1, 0)" } } ], 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 index aa68d9bbd..e84ce2a1e 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = nmrd.person_id AND hmrd.endDate = nmrd.endDate AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" } }, { @@ -112,7 +112,7 @@ "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), 1, 0)" + "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)" } }, { @@ -120,7 +120,7 @@ "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), 1, 0)" + "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)" } }, { @@ -128,7 +128,7 @@ "alias": "tot_ct_dp_mh", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_depressive_mhd = 1 and hmrd.on_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.is_depressive_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -160,7 +160,7 @@ "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), 1, 0)" + "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)" } }, { @@ -168,7 +168,7 @@ "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), 1, 0)" + "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)" } }, { @@ -176,7 +176,7 @@ "alias": "tot_ct_anx_mh", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_anxiety_mhd = 1 and hmrd.on_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.is_anxiety_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -208,7 +208,7 @@ "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), 1, 0)" + "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)" } }, { @@ -216,7 +216,7 @@ "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), 1, 0)" + "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)" } }, { @@ -224,7 +224,7 @@ "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), 1, 0)" + "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)" } }, { @@ -256,7 +256,7 @@ "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), 1, 0)" + "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)" } }, { @@ -264,7 +264,7 @@ "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), 1, 0)" + "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)" } }, { @@ -272,7 +272,7 @@ "alias": "tot_ct_per_mh", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_personality_mhd = 1 and hmrd.on_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.is_personality_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -304,7 +304,7 @@ "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), 1, 0)" + "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)" } }, { @@ -312,7 +312,7 @@ "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), 1, 0)" + "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)" } }, { @@ -320,7 +320,7 @@ "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), 1, 0)" + "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)" } }, { @@ -352,7 +352,7 @@ "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), 1, 0)" + "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)" } }, { @@ -360,7 +360,7 @@ "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), 1, 0)" + "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)" } }, { @@ -368,7 +368,7 @@ "alias": "tot_ct_obs_mh", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ocd_mhd = 1 and hmrd.on_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.is_ocd_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -400,7 +400,7 @@ "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), 1, 0)" + "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)" } }, { @@ -408,7 +408,7 @@ "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), 1, 0)" + "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)" } }, { @@ -416,7 +416,7 @@ "alias": "ct_mh", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -429,10 +429,10 @@ }, { "type": "derived_column", - "alias": "tot_ct_mh", + "alias": "tot_ct_mh", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.has_mhd = 1 and hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -440,7 +440,7 @@ "alias": "tot_mh", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.has_mhd = 1 and (hmrd.started_art_this_month = 1 OR hmrd.on_art_this_month = 1)), 1, 0)" + "expression": "IF((nmrd.has_mhd = 1), 1, 0)" } } ], @@ -461,7 +461,7 @@ }, "groupBy": { "groupParam": "groupByParam", - "columns": ["hmrd.person_id"], + "columns": ["nmrd.person_id"], "excludeParam": "excludeParam" }, "paging": { 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 index a0d731518..b04cfe1d0 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = nmrd.person_id AND hmrd.endDate = nmrd.endDate AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" } }, { @@ -112,7 +112,7 @@ "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), 1, 0)" + "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)" } }, { @@ -120,7 +120,7 @@ "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), 1, 0)" + "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)" } }, { @@ -128,7 +128,7 @@ "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), 1, 0)" + "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)" } }, { @@ -160,7 +160,7 @@ "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), 1, 0)" + "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)" } }, { @@ -168,7 +168,7 @@ "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), 1, 0)" + "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)" } }, { @@ -176,7 +176,7 @@ "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), 1, 0)" + "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)" } }, { @@ -184,7 +184,7 @@ "alias": "sub_tot_nw_neu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND (nmrd.has_migraine = 1 OR nmrd.has_convulsive_disorder = 1) AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND nmrd.has_neurological_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -192,7 +192,7 @@ "alias": "sub_tot_nw_neu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND (nmrd.has_migraine = 1 OR nmrd.has_convulsive_disorder = 1) AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND nmrd.has_neurological_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -200,7 +200,7 @@ "alias": "sub_tot_nw_neu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.has_convulsive_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.has_neurological_disorder = 1 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -208,7 +208,7 @@ "alias": "sub_tot_ct_neu_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND (nmrd.has_migraine = 1 OR nmrd.has_convulsive_disorder = 1) AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -216,7 +216,7 @@ "alias": "sub_tot_ct_neu_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND (nmrd.has_migraine = 1 OR nmrd.has_convulsive_disorder = 1) AND hmrd.on_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -224,7 +224,7 @@ "alias": "sub_tot_ct_neu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.has_convulsive_disorder = 1 AND hmrd.on_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.has_neurological_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { @@ -240,7 +240,7 @@ "alias": "tot_ct_neu", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.has_neurological_disorder = 1 AND hmrd.on_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.has_neurological_disorder = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" } }, { 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..142b639c2 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-aggregate.json @@ -0,0 +1,238 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..ec916832d --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/rheumatologic-disease/rheu-base.json @@ -0,0 +1,280 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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 index ebfd4b045..d3582ce9e 100644 --- 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 @@ -1,6 +1,6 @@ [ { - "sectionTitle": "Hypertensive", + "sectionTitle": "Hypertension", "indicators": [ { "label": "Location", @@ -15,61 +15,154 @@ "indicator": ["F", "M", "T", "F", "M", "T"] }, { - "label": "Controlled (SBP <130 mmHg and DBP <80 mmHg)", + "label": "Controlled BP(SBP <130 mmHg and DBP <80 mmHg)", "indicator": [ - "nw_ctld_htn_f", - "nw_ctld_htn_m", - "tot_nw_ctld_htn", - "ct_ctld_htn_f", - "ct_ctld_htn_m", - "tot_ct_ctld_htn" + { + "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", + "label": "Not well controlled BP(SBP >130 mmHg and DBP >80 mmHg)", "indicator": [ - "nw_unctld_htn_f", - "nw_unctld_htn_m", - "tot_nw_unctld_htn", - "ct_unctld_htn_f", - "ct_unctld_htn_m", - "tot_ct_unctld_htn" + { + "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", + "label": "Unknown / Not Established BP(missing either SBP, DBP, or Both)", "indicator": [ - "nw_unk_htn_f", - "nw_unk_htn_m", - "tot_nw_unk_htn", - "ct_unk_htn_f", - "ct_unk_htn_m", - "tot_ct_unk_htn" + { + "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": "Sub Total", + "label": "Hypertensive", "indicator": [ - "nw_htn_f", - "nw_htn_m", - "nw_htn", - "ct_htn_f", - "ct_htn_m", - "ct_htn" + { + "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": ["tot_nw_htn", "tot_ct_htn"] + "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 HTN", - "indicator": "tot_htn" + "label": "Total Hypertensive", + "indicator": { + "type": "tot_htn", + "description": "PLHIV who are hypertensive" + } } ] }, { - "sectionTitle": "Diabetic", + "sectionTitle": "Diabetes", "indicators": [ { "label": "Location", @@ -84,56 +177,146 @@ "indicator": ["F", "M", "T", "F", "M", "T"] }, { - "label": "Controlled (HbA1c 7% - 8%)", + "label": "Controlled HbA1c(HbA1c <= 7%)", "indicator": [ - "nw_ctld_dm_f", - "nw_ctld_dm_m", - "tot_nw_ctld_dm", - "ct_ctld_dm_f", - "ct_ctld_dm_m", - "tot_ct_ctld_dm" + { + "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", + "label": "Uncontrolled HbA1c(HbA1c > 7%)", "indicator": [ - "nw_unctld_dm_f", - "nw_unctld_dm_m", - "tot_nw_unctld_dm", - "ct_unctld_dm_f", - "ct_unctld_dm_m", - "tot_ct_unctld_dm" + { + "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", + "label": "Unknown / Not Established HbA1c(missing HbA1c results)", "indicator": [ - "nw_unk_dm_f", - "nw_unk_dm_m", - "tot_nw_unk_dm", - "ct_unk_dm_f", - "ct_unk_dm_m", - "tot_ct_unk_dm" + { + "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": "Sub Total", + "label": "Diabetic", "indicator": [ - "nw_dm_f", - "nw_dm_m", - "nw_dm", - "ct_dm_f", - "ct_dm_m", - "ct_dm" + { + "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": ["tot_nw_dm", "tot_ct_dm"] + "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 DM", - "indicator": "tot_dm" + "label": "Total Diabetic", + "indicator": { + "type": "tot_dm", + "description": "Diabetic PLHIV" + } } ] }, @@ -155,87 +338,225 @@ { "label": "Depressive", "indicator": [ - "nw_dp_mh_f", - "nw_dp_mh_m", - "tot_nw_dp_mh", - "ct_dp_mh_f", - "ct_dp_mh_m", - "tot_ct_dp_mh" + { + "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": [ - "nw_anx_mh_f", - "nw_anx_mh_m", - "tot_nw_anx_mh", - "ct_anx_mh_f", - "ct_anx_mh_m", - "tot_ct_anx_mh" + { + "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": [ - "nw_bip_mh_f", - "nw_bip_mh_m", - "tot_nw_bip_mh", - "ct_bip_mh_f", - "ct_bip_mh_m", - "tot_ct_bip_mh" + { + "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": [ - "nw_per_mh_f", - "nw_per_mh_m", - "tot_nw_per_mh", - "ct_per_mh_f", - "ct_per_mh_m", - "tot_ct_per_mh" + { + "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": [ - "nw_fe_mh_f", - "nw_fe_mh_m", - "tot_nw_fe_mh", - "ct_fe_mh_f", - "ct_fe_mh_m", - "tot_ct_fe_mh" + { + "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": [ - "nw_obs_mh_f", - "nw_obs_mh_m", - "tot_nw_obs_mh", - "ct_obs_mh_f", - "ct_obs_mh_m", - "tot_ct_obs_mh" + { + "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": "Sub Total", + "label": "Mentally Ill", "indicator": [ - "nw_mh_f", - "nw_mh_m", - "nw_mh", - "ct_mh_f", - "ct_mh_m", - "ct_mh" + { + "type": "nw_mh_f", + "description": "Female new in care and have mental health disorder" + }, + { + "type": "nw_mh_m", + "description": "Male new in care and have mental health disorder" + }, + { + "type": "nw_mh", + "description": "PLHIV new in care and have mental health disorder" + }, + { + "type": "ct_mh_f", + "description": "Female continuing in care and have mental health disorder" + }, + { + "type": "ct_mh_m", + "description": "Male continuing in care and have mental health disorder" + }, + { + "type": "ct_mh", + "description": "PLHIV continuing in care and have mental health disorder" + } ] }, { "label": "Status Sub Total", - "indicator": ["tot_nw_mh", "tot_ct_mh"] + "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 MHD", - "indicator": "tot_mh" + "label": "Total Mental Health Disorder", + "indicator": { + "type": "tot_mh", + "description": "PLHIV having mental health disorder" + } } ] }, @@ -274,155 +595,509 @@ { "label": "Stage 1", "indicator": [ - "stg_1_nw_chr_m", - "stg_1_nw_chr_f", - "tot_stg_1_nw_chr", - "stg_1_ct_chr_m", - "stg_1_ct_chr_f", - "tot_stg_1_ct_chr", - "stg_1_nw_acu_m", - "stg_1_nw_acu_f", - "tot_stg_1_nw_acu", - "stg_1_ct_acu_m", - "stg_1_ct_acu_f", - "tot_stg_1_ct_acu" + { + "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": [ - "stg_2_nw_chr_m", - "stg_2_nw_chr_f", - "tot_stg_2_nw_chr", - "stg_2_ct_chr_m", - "stg_2_ct_chr_f", - "tot_stg_2_ct_chr", - "stg_2_nw_acu_m", - "stg_2_nw_acu_f", - "tot_stg_2_nw_acu", - "stg_2_ct_acu_m", - "stg_2_ct_acu_f", - "tot_stg_2_ct_acu" + { + "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": [ - "stg_3_nw_chr_m", - "stg_3_nw_chr_f", - "tot_stg_3_nw_chr", - "stg_3_ct_chr_m", - "stg_3_ct_chr_f", - "tot_stg_3_ct_chr", - "stg_3_nw_acu_m", - "stg_3_nw_acu_f", - "tot_stg_3_nw_acu", - "stg_3_ct_acu_m", - "stg_3_ct_acu_f", - "tot_stg_3_ct_acu" + { + "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": [ - "stg_3a_nw_chr_m", - "stg_3a_nw_chr_f", - "tot_stg_3a_nw_chr", - "stg_3a_ct_chr_m", - "stg_3a_ct_chr_f", - "tot_stg_3a_ct_chr", - "stg_3a_nw_acu_m", - "stg_3a_nw_acu_f", - "tot_stg_3a_nw_acu", - "stg_3a_ct_acu_m", - "stg_3a_ct_acu_f", - "tot_stg_3a_ct_acu" + { + "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": [ - "stg_3b_nw_chr_m", - "stg_3b_nw_chr_f", - "tot_stg_3b_nw_chr", - "stg_3b_ct_chr_m", - "stg_3b_ct_chr_f", - "tot_stg_3b_ct_chr", - "stg_3b_nw_acu_m", - "stg_3b_nw_acu_f", - "tot_stg_3b_nw_acu", - "stg_3b_ct_acu_m", - "stg_3b_ct_acu_f", - "tot_stg_3b_ct_acu" + { + "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": [ - "stg_4_nw_chr_m", - "stg_4_nw_chr_f", - "tot_stg_4_nw_chr", - "stg_4_ct_chr_m", - "stg_4_ct_chr_f", - "tot_stg_4_ct_chr", - "stg_4_nw_acu_m", - "stg_4_nw_acu_f", - "tot_stg_4_nw_acu", - "stg_4_ct_acu_m", - "stg_4_ct_acu_f", - "tot_stg_4_ct_acu" + { + "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": [ - "stg_5_nw_chr_m", - "stg_5_nw_chr_f", - "tot_stg_5_nw_chr", - "stg_5_ct_chr_m", - "stg_5_ct_chr_f", - "tot_stg_5_ct_chr", - "stg_5_nw_acu_m", - "stg_5_nw_acu_f", - "tot_stg_5_nw_acu", - "stg_5_ct_acu_m", - "stg_5_ct_acu_f", - "tot_stg_5_ct_acu" + { + "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": "Sub Total", + "label": "Kidney Disease", "indicator": [ - "sub_tot_nw_chr_m", - "sub_tot_nw_chr_f", - "sub_tot_nw_chr", - "sub_tot_ct_chr_m", - "sub_tot_ct_chr_f", - "sub_tot_ct_chr", - "sub_tot_nw_acu_m", - "sub_tot_nw_acu_f", - "sub_tot_nw_acu", - "sub_tot_ct_acu_m", - "sub_tot_ct_acu_f", - "sub_tot_ct_acu" + { + "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": [ - "tot_nw_chr", - "tot_ct_chr", - "tot_nw_acu", - "tot_ct_acu" + { + "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": ["tot_chr", "tot_acu"] + "indicator": [ + { + "type": "tot_chr", + "description": "PLHIV and have chronic kidney disease" + }, + { + "type": "tot_acu", + "description": "PLHIV and have acute kidney disease" + } + ] }, { - "label": "Grand Total KD", - "indicator": "tot_kd" + "label": "Grand Total Kidney Disorder", + "indicator": { + "type": "tot_kd", + "description": "PLHIV and have kidney disease" + } } ] }, @@ -444,43 +1119,109 @@ { "label": "Heart Failure", "indicator": [ - "nw_hf_m", - "nw_hf_f", - "tot_nw_hf", - "ct_hf_m", - "ct_hf_f", - "tot_ct_hf" + { + "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": [ - "nw_myo_inf_m", - "nw_myo_inf_f", - "tot_nw_myo_inf", - "ct_myo_inf_m", - "ct_myo_inf_f", - "tot_ct_myo_inft" + { + "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": "Sub Total", + "label": "General Cardiovascular Disorder ", "indicator": [ - "sub_tot_nw_cvd_m", - "sub_tot_nw_cvd_f", - "sub_tot_nw_cvd", - "sub_tot_ct_cvd_m", - "sub_tot_ct_cvd_f", - "sub_tot_ct_cvd" + { + "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": ["tot_nw_cvd", "tot_ct_cvd"] + "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 CVD", - "indicator": "tot_cvd" + "label": "Total Cardiovascular Disease", + "indicator": { + "type": "tot_cvd", + "description": "PLHIV having Cardiovascular Disease" + } } ] }, @@ -502,48 +1243,114 @@ { "label": "Migraine", "indicator": [ - "mg_nw_m", - "mg_nw_f", - "tot_mg_nw", - "mg_ct_m", - "mg_ct_f", - "tot_mg_ct" + { + "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": [ - "cnv_nw_m", - "cnv_nw_f", - "tot_cnv_nw", - "cnv_ct_m", - "cnv_ct_f", - "tot_cnv_ct" + { + "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": "Sub Total", + "label": "Neurological Disease", "indicator": [ - "sub_tot_nw_neu_m", - "sub_tot_nw_neu_f", - "sub_tot_nw_neu", - "sub_tot_ct_neu_m", - "sub_tot_ct_neu_f", - "sub_tot_ct_neu" + { + "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": ["tot_nw_neu", "tot_ct_neu"] + "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 Neurological Disorder", - "indicator": "tot_neu" + "label": "Total", + "indicator": { + "type": "tot_neu", + "description": "PLHIV having neurological disorder" + } } ] }, { - "sectionTitle": "Rheumatologic", + "sectionTitle": "Rheumatologic Disorders", "indicators": [ { "label": "Location", @@ -560,48 +1367,114 @@ { "label": "Arthritis", "indicator": [ - "ra_nw_m", - "ra_nw_f", - "tot_ra_nw", - "ra_ct_m", - "ra_ct_f", - "tot_ra_ct" + { + "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": [ - "sle_nw_m", - "sle_nw_f", - "tot_sle_nw", - "sle_ct_m", - "sle_ct_f", - "tot_sle_ct" + { + "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": "Sub Total", + "label": "Neurological Disease", "indicator": [ - "sub_tot_nw_rhe_m", - "sub_tot_nw_rhe_f", - "sub_tot_nw_rhe", - "sub_tot_ct_rhe_m", - "sub_tot_ct_rhe_f", - "sub_tot_ct_rhe" + { + "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": ["tot_nw_rhe", "tot_ct_rhe"] + "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": "tot_rhe" + "indicator": { + "type": "tot_rhe", + "description": "PLHIV having rheumatologic disorder" + } } ] }, { - "sectionTitle": "GI Malignacies", + "sectionTitle": "GI Malignancy", "indicators": [ { "label": "Location", @@ -618,70 +1491,172 @@ { "label": "Oesophageal", "indicator": [ - "oe_nw_m", - "oe_nw_f", - "tot_oe_nw", - "oe_ct_m", - "oe_ct_f", - "tot_oe_ct" + { + "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": [ - "pc_nw_m", - "pc_nw_f", - "tot_pc_nw", - "pc_ct_m", - "pc_ct_f", - "tot_pc_ct" + { + "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": [ - "gs_nw_m", - "gs_nw_f", - "tot_gs_nw", - "gs_ct_m", - "gs_ct_f", - "tot_gs_ct" + { + "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": [ - "col_nw_m", - "col_nw_f", - "tot_col_nw", - "col_ct_m", - "col_ct_f", - "tot_col_ct" + { + "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": [ - "sub_tot_nw_gi_m", - "sub_tot_nw_gi_f", - "sub_tot_nw_gi", - "sub_tot_ct_gi_m", - "sub_tot_ct_gi_f", - "sub_tot_ct_gi" + { + "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": ["tot_nw_gi", "tot_ct_gi"] + "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": "tot_gi" + "indicator": { + "type": "tot_gi", + "description": "PLHIV having GI Malignacies" + } } ] }, { - "sectionTitle": "Female Reproductive", + "sectionTitle": "Female Reproductive Malignancy", "indicators": [ { "label": "Location", @@ -693,28 +1668,67 @@ }, { "label": "Ovarian", - "indicator": ["ov_nw", "ov_ct"] + "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": ["cv_nw", "cv_ct"] + "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": ["endo_nw", "endo_ct"] + "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": ["tot_f_rep_nw", "tot_f_rep_ct"] + "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": "tot_f_rep" + "indicator": { + "type": "tot_f_rep", + "description": "Female having Reproductive Malignacies" + } } ] }, { - "sectionTitle": "Male Reproductive", + "sectionTitle": "Male Reproductive Malignancy", "indicators": [ { "label": "Location", @@ -726,24 +1740,54 @@ }, { "label": "Prostate", - "indicator": ["pro_nw", "pro_ct"] + "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": ["ts_nw", "ts_ct"] + "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": ["tot_m_rep_nw", "tot_m_rep_ct"] + "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": "tot_m_rep" + "indicator": { + "type": "tot_m_rep", + "description": "Male having Reproductive Malignacies" + } } ] }, { - "sectionTitle": "ENT Malignancies", + "sectionTitle": "ENT Malignancy", "indicators": [ { "label": "Location", @@ -760,26 +1804,56 @@ { "label": "Throat", "indicator": [ - "th_nw_m", - "th_nw_f", - "tot_th_nw", - "th_ct_m", - "th_ct_f", - "tot_th_ct" + { + "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": ["tot_nw_ent", "tot_ct_ent"] + "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": "tot_ent" + "indicator": { + "type": "tot_ent", + "description": "PLHIV having Throat Malignacies" + } } ] }, { - "sectionTitle": "Endocrine", + "sectionTitle": "Endocrine Malignancy", "indicators": [ { "label": "Location", @@ -796,59 +1870,143 @@ { "label": "Pituitary", "indicator": [ - "pit_nw_m", - "pit_nw_f", - "tot_pit_nw", - "pit_ct_m", - "pit_ct_f", - "tot_pit_ct" + { + "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": [ - "thy_nw_m", - "thy_nw_f", - "tot_thy_nw", - "thy_ct_m", - "thy_ct_f", - "tot_thy_ct" + { + "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": [ - "adr_nw_m", - "adr_nw_f", - "tot_adr_nw", - "adr_ct_m", - "adr_ct_f", - "tot_adr_ct" + { + "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": [ - "sub_tot_nw_endo_m", - "sub_tot_nw_endo_f", - "sub_tot_nw_endo", - "sub_tot_ct_endo_m", - "sub_tot_ct_endo_f", - "sub_tot_ct_endo" + { + "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": ["tot_nw_endo", "tot_ct_endo"] + "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": "tot_endo" + "indicator": { + "type": "tot_endo", + "description": "PLHIV having Endocrine Malignacies" + } } ] }, { - "sectionTitle": "Musculoskeletal", + "sectionTitle": "Musculoskeletal Malignancy", "indicators": [ { "label": "Location", @@ -865,26 +2023,56 @@ { "label": "Osteosarcoma", "indicator": [ - "ost_nw_m", - "ost_nw_f", - "tot_ost_nw", - "ost_ct_m", - "ost_ct_f", - "tot_ost_ct" + { + "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": ["tot_nw_musk", "tot_ct_musk"] + "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": "tot_musk" + "indicator": { + "type": "tot_musk", + "description": "PLHIV having Musculoskeletal disorder" + } } ] }, { - "sectionTitle": "Haematological", + "sectionTitle": "Haematological Malignancy", "indicators": [ { "label": "Location", @@ -901,48 +2089,114 @@ { "label": "Leukamia", "indicator": [ - "leu_nw_m", - "leu_nw_f", - "tot_leu_nw", - "leu_ct_m", - "leu_ct_f", - "tot_leu_ct" + { + "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": [ - "lym_nw_m", - "lym_nw_f", - "tot_lym_nw", - "lym_ct_m", - "lym_ct_f", - "tot_lym_ct" + { + "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": [ - "sub_tot_nw_hae_m", - "sub_tot_nw_hae_f", - "sub_tot_nw_hae", - "sub_tot_ct_hae_m", - "sub_tot_ct_hae_f", - "sub_tot_ct_hae" + { + "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": ["tot_nw_hae", "tot_ct_hae"] + "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": "tot_hae" + "indicator": { + "type": "tot_hae", + "description": "PLHIV having Haematological disorder" + } } ] }, { - "sectionTitle": "Neurological", + "sectionTitle": "Neurological Malignancy", "indicators": [ { "label": "Location", @@ -959,120 +2213,312 @@ { "label": "Gliomas, Glioneuronal and Neuronal Tumors", "indicator": [ - "ggn_nw_m", - "ggn_nw_f", - "tot_ggn_nw", - "ggn_ct_m", - "ggn_ct_f", - "tot_ggn_ct" + { + "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": [ - "cpt_nw_m", - "cpt_nw_f", - "tot_cpt_nw", - "cpt_ct_m", - "cpt_ct_f", - "tot_cpt_ct" + { + "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": [ - "emb_nw_m", - "emb_nw_f", - "tot_emb_nw", - "emb_ct_m", - "emb_ct_f", - "tot_emb_ct" + { + "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": [ - "pin_nw_m", - "pin_nw_f", - "tot_pin_nw", - "pin_ct_m", - "pin_ct_f", - "tot_pin_ct" + { + "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": [ - "men_nw_m", - "men_nw_f", - "tot_men_nw", - "men_ct_m", - "men_ct_f", - "tot_men_ct" + { + "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": [ - "mes_nw_m", - "mes_nw_f", - "tot_mes_nw", - "mes_ct_m", - "mes_ct_f", - "tot_mes_ct" + { + "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": [ - "mel_nw_m", - "mel_nw_f", - "tot_mel_nw", - "mel_ct_m", - "mel_ct_f", - "tot_mel_ct" + { + "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": [ - "hly_nw_m", - "hly_nw_f", - "tot_hly_nw", - "hly_ct_m", - "hly_ct_f", - "tot_hly_ct" + { + "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": [ - "gct_nw_m", - "gct_nw_f", - "tot_gct_nw", - "gct_ct_m", - "gct_ct_f", - "tot_gct_ct" + { + "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": [ - "sub_tot_nw_neu_m", - "sub_tot_nw_neu_f", - "sub_tot_nw_neu", - "sub_tot_ct_neu_m", - "sub_tot_ct_neu_f", - "sub_tot_ct_neu" + { + "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": ["tot_nw_neu", "tot_ct_neu"] + "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": "tot_neu" + "indicator": { + "type": "tot_neu_malig", + "description": "PLHIV having neurological Malignacies" + } } ] } From 84c19de79a25a1581b0113d213dc2ea6b7602c28 Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Thu, 11 Jan 2024 12:32:41 +0300 Subject: [PATCH 17/40] added week fix --- service/surge-reports/surge-report.service.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/service/surge-reports/surge-report.service.js b/service/surge-reports/surge-report.service.js index dbfd172d4..d56608519 100644 --- a/service/surge-reports/surge-report.service.js +++ b/service/surge-reports/surge-report.service.js @@ -163,7 +163,17 @@ export class SurgeService extends SurgeMultiDatasetPatientlistReport { determineSurgeReportSourceTables(yearWeek) { const self = this; - if (yearWeek >= moment().year() + '' + moment().week() - 1) { + var currentYear = moment().year(); + var currentWeek = moment().week() - 1; + if (currentWeek < 10) { + currentWeek = '0' + currentWeek; + } + + const diffWeek = currentYear + '' + currentWeek; + + console.log('yearWeek: ', yearWeek); + console.log('oldYear: ', diffWeek); + if (yearWeek >= diffWeek) { return (self.params.surgeWeeklyDatasetSource = 'etl.surge_weekly_report_dataset_2022'); } else { From 623908dab4695ed50d5a8cb3f0c4806a415d4b95 Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Thu, 11 Jan 2024 12:39:11 +0300 Subject: [PATCH 18/40] added week fix --- service/surge-reports/surge-report.service.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/service/surge-reports/surge-report.service.js b/service/surge-reports/surge-report.service.js index d56608519..1aa800ff4 100644 --- a/service/surge-reports/surge-report.service.js +++ b/service/surge-reports/surge-report.service.js @@ -170,9 +170,6 @@ export class SurgeService extends SurgeMultiDatasetPatientlistReport { } const diffWeek = currentYear + '' + currentWeek; - - console.log('yearWeek: ', yearWeek); - console.log('oldYear: ', diffWeek); if (yearWeek >= diffWeek) { return (self.params.surgeWeeklyDatasetSource = 'etl.surge_weekly_report_dataset_2022'); From 64a9fe0450c791253a0a4e800cb0da29c177a517 Mon Sep 17 00:00:00 2001 From: sainingo Date: Fri, 15 Dec 2023 15:32:17 +0300 Subject: [PATCH 19/40] Update query to use location uuid --- app/otz/cohort-module.service.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/otz/cohort-module.service.js b/app/otz/cohort-module.service.js index 5e7c14f14..72321c58f 100644 --- a/app/otz/cohort-module.service.js +++ b/app/otz/cohort-module.service.js @@ -20,6 +20,8 @@ export class CohortModuleService { 0) AS suppression_rate_percentage FROM amrs.cohort c + LEFT JOIN + amrs.location l ON l.location_id = c.location_id INNER JOIN amrs.cohort_member cm ON c.cohort_id = cm.cohort_id LEFT JOIN @@ -34,7 +36,7 @@ export class CohortModuleService { etl.flat_labs_and_imaging fl ON latest_tests.person_id = fl.person_id AND latest_tests.latest_test_datetime = fl.test_datetime WHERE - c.uuid in (${uuids}) + l.uuid = '${cohortUuids}' GROUP BY c.cohort_id; `; From 2b0f3789c6a316a87d872b7c393480d1c2c274d1 Mon Sep 17 00:00:00 2001 From: sainingo Date: Tue, 19 Dec 2023 14:33:20 +0300 Subject: [PATCH 20/40] work on defaulter tracing --- app/reporting-framework/json-reports/defaulter-list-base.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/reporting-framework/json-reports/defaulter-list-base.json b/app/reporting-framework/json-reports/defaulter-list-base.json index 7273b4c10..2cbdfbc35 100644 --- a/app/reporting-framework/json-reports/defaulter-list-base.json +++ b/app/reporting-framework/json-reports/defaulter-list-base.json @@ -18,7 +18,7 @@ } }, { - "table": "(SELECT MAX(am.encounter_datetime) AS max_encounter_datetime, am.encounter_datetime, am.encounter_type, am.patient_id, fd.person_id , fd.rtc_date FROM etl.flat_defaulters fd INNER JOIN amrs.encounter am on (am.patient_id = fd.person_id) WHERE am.encounter_type = 21 group by am.patient_id)", + "table": "(SELECT MAX(am.encounter_datetime) AS max_encounter_datetime, am.encounter_datetime, am.encounter_type, am.patient_id, fd.person_id , fd.rtc_date FROM etl.flat_defaulters fd INNER JOIN amrs.encounter am on (am.patient_id = fd.person_id) group by am.patient_id)", "alias": "am", "join": { "type": "INNER", From 41b91678772b1ff03d6d840816f32a5173ed4c10 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 19 Dec 2023 15:37:15 +0300 Subject: [PATCH 21/40] [bug-fix]: fixed missing blood pressure values in the DQA chart --- .../DQA/dqa-chart-abstraction-report-dao.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index b783dc969..c0b5c0364 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -91,12 +91,18 @@ export class DQAChartAbstractionDAO { etl.flat_hiv_summary_v15b e on (h.encounter_id=e.encounter_id) LEFT JOIN etl.flat_hiv_summary_v15b ls on (ls.next_clinical_datetime_hiv is null and ls.person_id=e.person_id) - left JOIN (SELECT fv.person_id, - fv.systolic_bp, - fv.diastolic_bp, - MAX(fv.encounter_datetime) AS max_date - FROM etl.flat_vitals fv where diastolic_bp is not null - GROUP BY fv.person_id,fv.encounter_datetime order by fv.encounter_datetime desc limit 1) fv ON e.person_id = fv.person_id + left JOIN (SELECT + person_id, + systolic_bp, + diastolic_bp, + MAX(encounter_datetime) AS max_date + FROM + etl.flat_vitals + WHERE + systolic_bp IS NOT NULL + AND diastolic_bp IS NOT NULL + GROUP BY person_id , encounter_datetime + ORDER BY encounter_datetime) fv ON e.person_id = fv.person_id INNER JOIN amrs.person t1 ON (h.person_id = t1.person_id) INNER JOIN From 9ca1e4e2038aaeb443042ceefd442baa8881bfe2 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Tue, 19 Dec 2023 16:09:22 +0300 Subject: [PATCH 22/40] [fix]: added check for bp starting from end date going back --- reports/DQA/dqa-chart-abstraction-report-dao.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index c0b5c0364..782133f86 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -100,7 +100,7 @@ export class DQAChartAbstractionDAO { etl.flat_vitals WHERE systolic_bp IS NOT NULL - AND diastolic_bp IS NOT NULL + AND diastolic_bp IS NOT NULL AND encounter_datetime <= '`+ endDate +`' GROUP BY person_id , encounter_datetime ORDER BY encounter_datetime) fv ON e.person_id = fv.person_id INNER JOIN From 21e7b67e445d11df2f62cde7920cf1052b9ff56e Mon Sep 17 00:00:00 2001 From: henrykorir Date: Fri, 5 Jan 2024 10:48:17 +0300 Subject: [PATCH 23/40] POC-610: added sql logic to get nascop dqa columns POC-610: fixed the query to retrieve TX_Curr POC-610: added sql logic to get nascop dqa columns POC-610: added sql logic to get nascop dqa columns POC-610: added sql logic to get nascop dqa columns --- .../DQA/dqa-chart-abstraction-report-dao.js | 252 +++++++++++------- 1 file changed, 157 insertions(+), 95 deletions(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index 782133f86..d278c1428 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -28,108 +28,170 @@ export class DQAChartAbstractionDAO { limit === 'all' ? '' : `limit ` + limit + ` offset ` + offset; let sqlQuery = ` - SELECT - h.person_uuid as uuid, - cc.identifier as ccc_number, - np.identifier as upi_number, - ov.identifier as ovcid_id, - EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), h.birthdate)))) AS age, - IF( date(h.tb_screening_datetime) > date_sub(h.endDate, interval 6 month),"YES","NO") as tb_screened_this_visit, - h.gender as 'sex_gender', - e.height, - e.weight, - DATE_FORMAT(h.birthdate,'%Y-%m-%d') AS birthdate, - h.encounter_id, - DATE_FORMAT(h.encounter_date,'%Y-%m-%d') as last_appointment_date, - h.rtc_date, - h.location_id, - h.cur_arv_meds, - h.tb_screen, - h.tb_screening_datetime, - e.hiv_start_date, - h.arv_start_date, - e.cd4_1, - ls.encounter_datetime AS last_clinical_encounter, - DATE_FORMAT(h.rtc_date,'%Y-%m-%d') as next_appointment, - h.vl_1, - case - when e.weight is not null and e.height is not null then 'YES' - else 'NO' - end as nutrition, - case - when e.visit_type in (37,58) then 'CARG' - when e.visit_type in (43,80,104,118,120,123) then 'Treatment Supporter' - else 'Self' - end as visit_type, - h.cur_arv_meds_names AS drugs_given, - case - when e.height is not null and e.weight is not null then e.weight/((e.height/100) * (e.height/100)) - else null - end as BMI, - IF(p.program_id = 9, 'DC', 'Standard') AS DSD, - TIMESTAMPDIFF(DAY,h.encounter_date,h.rtc_date) AS drugs_duration, - IF(h.ipt_start_date = h.encounter_date, - 1, - 0) AS ipt_started_this_visit, - DATE_FORMAT(h.ipt_start_date,'%Y-%m-%d') AS last_ipt_start_date, - case - when e.on_ipt = 1 then 'CONTINUING' - when e.ipt_completion_date is null and e.ipt_stop_date is not null then 'DISCONTINUED' - when e.ipt_completion_date is not null + SELECT + h.person_uuid as uuid, + cc.identifier as ccc_number, + np.identifier as upi_number, + -- ov.identifier as ovcid_id, + EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), h.birthdate)))) AS age, + IF( date(h.tb_screening_datetime) > date_sub(h.endDate, interval 6 month), + "YES", + "NO") as tb_screened_this_visit, + h.gender as 'sex_gender', + e.height, + e.weight, + DATE_FORMAT(h.birthdate, '%Y-%m-%d') AS birthdate, + h.encounter_id, + DATE_FORMAT(h.encounter_date, '%Y-%m-%d') as last_appointment_date, + h.rtc_date, + h.location_id, + h.cur_arv_meds, + h.tb_screen, + h.tb_screening_datetime, + e.hiv_start_date, + h.arv_start_date, + e.cd4_1, + -- ls.encounter_datetime AS last_clinical_encounter, + e.encounter_datetime AS last_clinical_encounter, + DATE_FORMAT(h.rtc_date, '%Y-%m-%d') as next_appointment, + h.vl_1, + case + when e.weight is not null + and e.height is not null then 'YES' + else 'NO' + end as nutrition, + case + when e.visit_type in (37, 58) then 'CARG' + when e.visit_type in (43, 80, 104, 118, 120, 123) then 'Treatment Supporter' + else 'Self' + end as visit_type, + h.cur_arv_meds_names AS drugs_given, + case + when e.height is not null + and e.weight is not null then e.weight /((e.height / 100) * (e.height / 100)) + else null + end as BMI, + IF(p.program_id = 9, + 'DC', + 'Standard') AS DSD, + TIMESTAMPDIFF(DAY, + h.encounter_date, + h.rtc_date) AS drugs_duration, + IF(h.ipt_start_date = h.encounter_date, + 1, + 0) AS ipt_started_this_visit, + DATE_FORMAT(h.ipt_start_date, '%Y-%m-%d') AS last_ipt_start_date, + case + when e.on_ipt = 1 then 'CONTINUING' + when e.ipt_completion_date is null + and e.ipt_stop_date is not null then 'DISCONTINUED' + when e.ipt_completion_date is not null then 'COMPLETED' - else 'NA' - end as tpt_status, - h.ipt_stop_date, - h.ipt_completion_date, - IF(h.ipt_stop_date = h.encounter_date - OR h.ipt_completion_date = h.encounter_date, - 1, - 0) AS ipt_ended_this_visit,fv.systolic_bp as sysBP,fv.diastolic_bp as dysBP - FROM - etl.hiv_monthly_report_dataset_frozen h - LEFT JOIN - etl.flat_hiv_summary_v15b e on (h.encounter_id=e.encounter_id) - LEFT JOIN - etl.flat_hiv_summary_v15b ls on (ls.next_clinical_datetime_hiv is null and ls.person_id=e.person_id) - left JOIN (SELECT - person_id, - systolic_bp, - diastolic_bp, - MAX(encounter_datetime) AS max_date - FROM - etl.flat_vitals - WHERE - systolic_bp IS NOT NULL - AND diastolic_bp IS NOT NULL AND encounter_datetime <= '`+ endDate +`' - GROUP BY person_id , encounter_datetime - ORDER BY encounter_datetime) fv ON e.person_id = fv.person_id - INNER JOIN - amrs.person t1 ON (h.person_id = t1.person_id) - INNER JOIN - amrs.person_name person_name ON (t1.person_id = person_name.person_id AND (person_name.voided = 0 || person_name.voided = 0)) - LEFT JOIN - amrs.patient_identifier id ON (t1.person_id = id.patient_id AND id.voided = 0) - LEFT JOIN - amrs.patient_identifier cc ON (t1.person_id = cc.patient_id and cc.identifier_type in (28) AND cc.voided = 0) - LEFT JOIN - amrs.patient_identifier ov ON (t1.person_id = ov.patient_id and ov.identifier_type in (43) AND ov.voided = 0) - LEFT JOIN - amrs.patient_identifier np ON (t1.person_id = np.patient_id and np.identifier_type in (45) AND np.voided = 0) - left join amrs.patient_program p on (p.patient_id = h.person_id and p.program_id in (4,9) and p.date_completed is null and p.voided = 0) - WHERE h.status = "active" and visit_this_month=1 - AND h.endDate >= '` + + else 'NA' + end as tpt_status, + h.ipt_stop_date, + h.ipt_completion_date, + e.cur_who_stage, + e.cd4_1, + fv.muac, + IF(h.ipt_stop_date = h.encounter_date + OR h.ipt_completion_date = h.encounter_date, + 1, + 0) AS ipt_ended_this_visit, + fv.systolic_bp as sysBP, + fv.diastolic_bp as dysBP, + h.status, + IF((o.value_coded IS NULL), 'NO', 'YES') AS is_crag_screened, + case + when (h.vl_1 < 200) then 'suppressed' + when (h.vl_1 >= 200) then 'unsuppressed' + end as vl_suppression, + case + when (e.tb_screening_result = 6971) then 'Pr TB' + when (e.tb_screening_result = 6137) then 'confirmed' + when (e.tb_screening_result = 1107 OR e.tb_screening_result = 10678) then 'No TB' + when (e.tb_screening_result = 10767) then 'TB tx' + when (e.tb_screening_result = 10974) then 'INH' + end as tb_screening_result +FROM + etl.hiv_monthly_report_dataset_v1_2 h +LEFT JOIN + etl.flat_hiv_summary_v15b e on + (h.encounter_id = e.encounter_id) +-- LEFT JOIN +-- etl.flat_hiv_summary_v15b ls on +-- (ls.next_clinical_datetime_hiv is null +-- and ls.person_id = e.person_id) +left JOIN ( + SELECT + *, + MAX(encounter_datetime) AS max_date + FROM + etl.flat_vitals + WHERE + -- systolic_bp IS NOT NULL + -- AND diastolic_bp IS NOT NULL + -- AND + encounter_datetime <= '` + + endDate + + `' + GROUP BY + person_id , + encounter_datetime + ORDER BY + encounter_datetime) fv ON + e.person_id = fv.person_id +INNER JOIN + amrs.person t1 ON + (h.person_id = t1.person_id) +INNER JOIN + amrs.person_name person_name ON + (t1.person_id = person_name.person_id + AND (person_name.voided = 0)) +-- LEFT JOIN +-- amrs.patient_identifier id ON +-- (t1.person_id = id.patient_id +-- AND id.voided = 0) +INNER JOIN + amrs.patient_identifier cc ON + (t1.person_id = cc.patient_id + and cc.identifier_type in (28) + AND cc.voided = 0) +-- LEFT JOIN +-- amrs.patient_identifier ov ON +-- (t1.person_id = ov.patient_id +-- and ov.identifier_type in (43) +-- AND ov.voided = 0) +LEFT JOIN + amrs.patient_identifier np ON + (t1.person_id = np.patient_id + and np.identifier_type in (45) + AND np.voided = 0) +left join amrs.patient_program p on + (p.patient_id = h.person_id + and p.program_id in (4, 9) + and p.date_completed is null + and p.voided = 0) +LEFT JOIN amrs.obs o ON + (o.encounter_id = h.encounter_id + AND o.person_id = h.person_id and o.concept_id = 9812 and o.voided = 0) +WHERE +h.endDate >= '` + startDate + `' - AND h.endDate <= '` + +AND h.endDate <= '` + endDate + `' - AND h.location_id IN (` + + AND h.location_id IN (` + locations + - `) AND ` + + `) + AND ` + where + - ` - GROUP BY h.person_id - ORDER BY RAND() DESC ` + + ` +GROUP BY + h.person_id +ORDER BY + RAND() DESC ` + limitOffSetDefinition; return new Promise((resolve, reject) => { From 5862bb7bb6e3ff95b7be4fd320bef79dc0f29a62 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Thu, 11 Jan 2024 10:01:19 +0300 Subject: [PATCH 24/40] POC-610: DQA Report Update --- reports/DQA/dqa-chart-abstraction-report-dao.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index d278c1428..014ff7347 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -108,9 +108,9 @@ export class DQAChartAbstractionDAO { end as vl_suppression, case when (e.tb_screening_result = 6971) then 'Pr TB' - when (e.tb_screening_result = 6137) then 'confirmed' + when (e.tb_screening_result = 6137) then 'Confirmed' when (e.tb_screening_result = 1107 OR e.tb_screening_result = 10678) then 'No TB' - when (e.tb_screening_result = 10767) then 'TB tx' + when (e.tb_screening_result = 10767) then 'TB Rx' when (e.tb_screening_result = 10974) then 'INH' end as tb_screening_result FROM From 384b57d3a40ccace8c7b4884bc87843116434e44 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Thu, 11 Jan 2024 13:14:13 +0300 Subject: [PATCH 25/40] POC-610: DQA Report Update --- .../DQA/dqa-chart-abstraction-report-dao.js | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index 014ff7347..c92233dea 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -30,9 +30,12 @@ export class DQAChartAbstractionDAO { ` SELECT h.person_uuid as uuid, - cc.identifier as ccc_number, - np.identifier as upi_number, + -- cc.identifier as ccc_number, + -- np.identifier as upi_number, -- ov.identifier as ovcid_id, + max(case WHEN id.identifier_type in (28) then id.identifier end) AS ccc_number, + max(case WHEN id.identifier_type in (43) then id.identifier end) AS ovc_number, + max(case WHEN id.identifier_type in (45) then id.identifier end) AS upi_number, EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), h.birthdate)))) AS age, IF( date(h.tb_screening_datetime) > date_sub(h.endDate, interval 6 month), "YES", @@ -148,25 +151,25 @@ INNER JOIN amrs.person_name person_name ON (t1.person_id = person_name.person_id AND (person_name.voided = 0)) --- LEFT JOIN --- amrs.patient_identifier id ON --- (t1.person_id = id.patient_id --- AND id.voided = 0) -INNER JOIN - amrs.patient_identifier cc ON - (t1.person_id = cc.patient_id - and cc.identifier_type in (28) - AND cc.voided = 0) + INNER JOIN + amrs.patient_identifier id ON + (t1.person_id = id.patient_id + AND id.voided = 0) +-- INNER JOIN +-- amrs.patient_identifier cc ON +-- (t1.person_id = cc.patient_id +-- and cc.identifier_type in (28) +-- AND cc.voided = 0) -- LEFT JOIN -- amrs.patient_identifier ov ON -- (t1.person_id = ov.patient_id -- and ov.identifier_type in (43) -- AND ov.voided = 0) -LEFT JOIN - amrs.patient_identifier np ON - (t1.person_id = np.patient_id - and np.identifier_type in (45) - AND np.voided = 0) +-- LEFT JOIN +-- amrs.patient_identifier np ON +-- (t1.person_id = np.patient_id +-- and np.identifier_type in (45) +-- AND np.voided = 0) left join amrs.patient_program p on (p.patient_id = h.person_id and p.program_id in (4, 9) @@ -175,7 +178,7 @@ left join amrs.patient_program p on LEFT JOIN amrs.obs o ON (o.encounter_id = h.encounter_id AND o.person_id = h.person_id and o.concept_id = 9812 and o.voided = 0) -WHERE +WHERE h.endDate >= '` + startDate + `' From 1ea8330da0c67d899d88218d77386ca30e1fedad Mon Sep 17 00:00:00 2001 From: henrykorir Date: Fri, 12 Jan 2024 16:08:06 +0300 Subject: [PATCH 26/40] POC-610: Optimized the DQA Query POC-610: Optimized DQA Query --- .../DQA/dqa-chart-abstraction-report-dao.js | 273 ++++++++---------- 1 file changed, 123 insertions(+), 150 deletions(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index c92233dea..298dbecf4 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -28,157 +28,131 @@ export class DQAChartAbstractionDAO { limit === 'all' ? '' : `limit ` + limit + ` offset ` + offset; let sqlQuery = ` - SELECT - h.person_uuid as uuid, - -- cc.identifier as ccc_number, - -- np.identifier as upi_number, - -- ov.identifier as ovcid_id, - max(case WHEN id.identifier_type in (28) then id.identifier end) AS ccc_number, - max(case WHEN id.identifier_type in (43) then id.identifier end) AS ovc_number, - max(case WHEN id.identifier_type in (45) then id.identifier end) AS upi_number, - EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), h.birthdate)))) AS age, - IF( date(h.tb_screening_datetime) > date_sub(h.endDate, interval 6 month), - "YES", - "NO") as tb_screened_this_visit, - h.gender as 'sex_gender', - e.height, - e.weight, - DATE_FORMAT(h.birthdate, '%Y-%m-%d') AS birthdate, - h.encounter_id, - DATE_FORMAT(h.encounter_date, '%Y-%m-%d') as last_appointment_date, - h.rtc_date, - h.location_id, - h.cur_arv_meds, - h.tb_screen, - h.tb_screening_datetime, - e.hiv_start_date, - h.arv_start_date, - e.cd4_1, - -- ls.encounter_datetime AS last_clinical_encounter, - e.encounter_datetime AS last_clinical_encounter, - DATE_FORMAT(h.rtc_date, '%Y-%m-%d') as next_appointment, - h.vl_1, - case - when e.weight is not null - and e.height is not null then 'YES' - else 'NO' - end as nutrition, - case - when e.visit_type in (37, 58) then 'CARG' - when e.visit_type in (43, 80, 104, 118, 120, 123) then 'Treatment Supporter' - else 'Self' - end as visit_type, - h.cur_arv_meds_names AS drugs_given, - case - when e.height is not null - and e.weight is not null then e.weight /((e.height / 100) * (e.height / 100)) - else null - end as BMI, - IF(p.program_id = 9, - 'DC', - 'Standard') AS DSD, - TIMESTAMPDIFF(DAY, - h.encounter_date, - h.rtc_date) AS drugs_duration, - IF(h.ipt_start_date = h.encounter_date, - 1, - 0) AS ipt_started_this_visit, - DATE_FORMAT(h.ipt_start_date, '%Y-%m-%d') AS last_ipt_start_date, - case - when e.on_ipt = 1 then 'CONTINUING' - when e.ipt_completion_date is null - and e.ipt_stop_date is not null then 'DISCONTINUED' - when e.ipt_completion_date is not null - then 'COMPLETED' - else 'NA' - end as tpt_status, - h.ipt_stop_date, - h.ipt_completion_date, - e.cur_who_stage, - e.cd4_1, - fv.muac, - IF(h.ipt_stop_date = h.encounter_date - OR h.ipt_completion_date = h.encounter_date, - 1, - 0) AS ipt_ended_this_visit, - fv.systolic_bp as sysBP, - fv.diastolic_bp as dysBP, - h.status, - IF((o.value_coded IS NULL), 'NO', 'YES') AS is_crag_screened, - case - when (h.vl_1 < 200) then 'suppressed' - when (h.vl_1 >= 200) then 'unsuppressed' - end as vl_suppression, - case - when (e.tb_screening_result = 6971) then 'Pr TB' - when (e.tb_screening_result = 6137) then 'Confirmed' - when (e.tb_screening_result = 1107 OR e.tb_screening_result = 10678) then 'No TB' - when (e.tb_screening_result = 10767) then 'TB Rx' - when (e.tb_screening_result = 10974) then 'INH' - end as tb_screening_result + SELECT + h.person_uuid AS uuid, + fpiv.ccc AS ccc_number, + fpiv.nupi AS upi_number, + fpiv.ovcid AS ovcid_id, + EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), h.birthdate)))) AS age, + IF(DATE(h.tb_screening_datetime) > DATE_SUB(h.endDate, INTERVAL 6 MONTH), + 'YES', + 'NO') AS tb_screened_this_visit, + h.gender AS 'sex_gender', + e.height, + e.weight, + DATE_FORMAT(h.birthdate, '%Y-%m-%d') AS birthdate, + h.encounter_id, + DATE_FORMAT(h.encounter_date, '%Y-%m-%d') AS last_appointment_date, + h.rtc_date, + h.location_id, + h.cur_arv_meds, + h.tb_screen, + h.tb_screening_datetime, + e.hiv_start_date, + h.arv_start_date, + e.cd4_1, + e.encounter_datetime AS last_clinical_encounter, + DATE_FORMAT(h.rtc_date, '%Y-%m-%d') AS next_appointment, + h.vl_1, + CASE + WHEN + e.weight IS NOT NULL + AND e.height IS NOT NULL + THEN + 'YES' + ELSE 'NO' + END AS nutrition, + CASE + WHEN e.visit_type IN (37 , 58) THEN 'CARG' + WHEN e.visit_type IN (43 , 80, 104, 118, 120, 123) THEN 'Treatment Supporter' + ELSE 'Self' + END AS visit_type, + h.cur_arv_meds_names AS drugs_given, + CASE + WHEN + e.height IS NOT NULL + AND e.weight IS NOT NULL + THEN + e.weight / ((e.height / 100) * (e.height / 100)) + ELSE NULL + END AS BMI, + IF(p.program_id = 9, 'DC', 'Standard') AS DSD, + TIMESTAMPDIFF(DAY, + h.encounter_date, + h.rtc_date) AS drugs_duration, + IF(h.ipt_start_date = h.encounter_date, + 1, + 0) AS ipt_started_this_visit, + DATE_FORMAT(h.ipt_start_date, '%Y-%m-%d') AS last_ipt_start_date, + CASE + WHEN e.on_ipt = 1 THEN 'CONTINUING' + WHEN + e.ipt_completion_date IS NULL + AND e.ipt_stop_date IS NOT NULL + THEN + 'DISCONTINUED' + WHEN e.ipt_completion_date IS NOT NULL THEN 'COMPLETED' + ELSE 'NA' + END AS tpt_status, + h.ipt_stop_date, + h.ipt_completion_date, + e.cur_who_stage, + e.cd4_1, + fv.muac, + IF(h.ipt_stop_date = h.encounter_date + OR h.ipt_completion_date = h.encounter_date, + 1, + 0) AS ipt_ended_this_visit, + fv.systolic_bp AS sysBP, + fv.diastolic_bp AS dysBP, + h.status, + IF((o.value_coded IS NULL), 'NO', 'YES') AS is_crag_screened, + CASE + WHEN (h.vl_1 < 200) THEN 'suppressed' + WHEN (h.vl_1 >= 200) THEN 'unsuppressed' + END AS vl_suppression, + CASE + WHEN (e.tb_screening_result = 6971) THEN 'Pr TB' + WHEN (e.tb_screening_result = 6137) THEN 'Confirmed' + WHEN (e.tb_screening_result IN (1107 , 10678)) THEN 'No TB' + WHEN (e.tb_screening_result = 10767) THEN 'TB Rx' + WHEN (e.tb_screening_result = 10974) THEN 'INH' + END AS tb_screening_result FROM - etl.hiv_monthly_report_dataset_v1_2 h -LEFT JOIN - etl.flat_hiv_summary_v15b e on - (h.encounter_id = e.encounter_id) --- LEFT JOIN --- etl.flat_hiv_summary_v15b ls on --- (ls.next_clinical_datetime_hiv is null --- and ls.person_id = e.person_id) -left JOIN ( - SELECT - *, - MAX(encounter_datetime) AS max_date - FROM - etl.flat_vitals - WHERE - -- systolic_bp IS NOT NULL - -- AND diastolic_bp IS NOT NULL - -- AND - encounter_datetime <= '` + + etl.hiv_monthly_report_dataset_v1_2 h + LEFT JOIN + etl.flat_hiv_summary_v15b e ON (h.encounter_id = e.encounter_id) + LEFT JOIN +-- etl.flat_hiv_summary_v15b ls ON (ls.next_clinical_datetime_hiv IS NULL +-- AND ls.person_id = e.person_id) +-- LEFT JOIN +-- (SELECT +-- *, MAX(encounter_datetime) AS max_date +-- FROM +-- etl.flat_vitals +-- WHERE +-- encounter_datetime <= '` + endDate + `' - GROUP BY - person_id , - encounter_datetime - ORDER BY - encounter_datetime) fv ON - e.person_id = fv.person_id -INNER JOIN - amrs.person t1 ON - (h.person_id = t1.person_id) -INNER JOIN - amrs.person_name person_name ON - (t1.person_id = person_name.person_id - AND (person_name.voided = 0)) - INNER JOIN - amrs.patient_identifier id ON - (t1.person_id = id.patient_id - AND id.voided = 0) --- INNER JOIN --- amrs.patient_identifier cc ON --- (t1.person_id = cc.patient_id --- and cc.identifier_type in (28) --- AND cc.voided = 0) --- LEFT JOIN --- amrs.patient_identifier ov ON --- (t1.person_id = ov.patient_id --- and ov.identifier_type in (43) --- AND ov.voided = 0) --- LEFT JOIN --- amrs.patient_identifier np ON --- (t1.person_id = np.patient_id --- and np.identifier_type in (45) --- AND np.voided = 0) -left join amrs.patient_program p on - (p.patient_id = h.person_id - and p.program_id in (4, 9) - and p.date_completed is null - and p.voided = 0) -LEFT JOIN amrs.obs o ON - (o.encounter_id = h.encounter_id - AND o.person_id = h.person_id and o.concept_id = 9812 and o.voided = 0) -WHERE +-- GROUP BY person_id , encounter_datetime +-- ORDER BY encounter_datetime) + etl.flat_vitals fv ON (e.person_id = fv.person_id) + INNER JOIN + amrs.person t1 ON (h.person_id = t1.person_id) + inner JOIN + etl.flat_patient_identifiers_v1 fpiv ON (t1.person_id = fpiv.patient_id and fpiv.ccc is not null) + LEFT JOIN + amrs.patient_program p ON (p.patient_id = h.person_id + AND p.program_id IN (4 , 9) + AND p.date_completed IS NULL + AND p.voided = 0) + LEFT JOIN + amrs.obs o ON (o.encounter_id = e.encounter_id + AND o.person_id = h.person_id + AND o.concept_id = 9812 + AND o.voided = 0 and e.is_clinical_encounter = 1) +WHERE + e.encounter_datetime >= "2022-01-01" AND (e.weight is not null) AND h.endDate >= '` + startDate + `' @@ -193,8 +167,7 @@ AND h.endDate <= '` + ` GROUP BY h.person_id -ORDER BY - RAND() DESC ` + + ` + limitOffSetDefinition; return new Promise((resolve, reject) => { From dcc15bd059c4328d3455b201b30533a5daf5bfe3 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Sat, 13 Jan 2024 00:36:48 +0300 Subject: [PATCH 27/40] POC-610: Modified DQA Query to suit indicators requested POC-610: Modified query to get DQA as per nascop indicators POC-610: Updated DQA Report to reflect updated indicators --- .../DQA/dqa-chart-abstraction-report-dao.js | 128 +++++++++--------- 1 file changed, 61 insertions(+), 67 deletions(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index 298dbecf4..6561f7e7e 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -14,13 +14,13 @@ export class DQAChartAbstractionDAO { let where = ''; switch (patientType) { case 'PEADS': - where = `EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), h.birthdate)))) < 15`; + where = `TIMESTAMPDIFF(YEAR, h.birthdate, '` + endDate + `') < 15`; break; case 'PMTCT': where = `p.program_id = 4`; break; default: - where = `EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), h.birthdate)))) >= 15`; + where = `TIMESTAMPDIFF(YEAR, h.birthdate, '` + endDate + `') >= 15`; } let runner = this.getSqlRunner(); @@ -31,42 +31,48 @@ export class DQAChartAbstractionDAO { SELECT h.person_uuid AS uuid, fpiv.ccc AS ccc_number, - fpiv.nupi AS upi_number, - fpiv.ovcid AS ovcid_id, - EXTRACT(YEAR FROM (FROM_DAYS(DATEDIFF(NOW(), h.birthdate)))) AS age, + IF((fpiv.nupi IS NOT NULL), fpiv.nupi, 'missing') AS NUPI, + TIMESTAMPDIFF(year,h.birthdate,'` + + endDate + + `') AS age, IF(DATE(h.tb_screening_datetime) > DATE_SUB(h.endDate, INTERVAL 6 MONTH), - 'YES', - 'NO') AS tb_screened_this_visit, - h.gender AS 'sex_gender', + 'Yes', + 'No') AS tb_screened_this_visit, + CASE + WHEN (h.gender = 'F') then 'Female' + WHEN (h.gender = 'M') then 'Male' + ELSE 'missing' + END AS 'sex_gender', e.height, e.weight, - DATE_FORMAT(h.birthdate, '%Y-%m-%d') AS birthdate, + DATE_FORMAT(h.birthdate, "%d-%b-%Y") AS birthdate, h.encounter_id, - DATE_FORMAT(h.encounter_date, '%Y-%m-%d') AS last_appointment_date, + DATE_FORMAT(h.encounter_date, "%d-%b-%Y") AS last_appointment_date, h.rtc_date, h.location_id, h.cur_arv_meds, + CASE + WHEN (h.cur_arv_meds_names regexp '[[:<:]]DTG[[:>:]]') THEN 'DTG-based' + WHEN (h.cur_arv_meds_names NOT regexp '[[:<:]]DTG[[:>:]]') THEN 'Non-DTG-based' + ELSE 'NON DTG' + END as cur_arv_med_basis, h.tb_screen, - h.tb_screening_datetime, - e.hiv_start_date, + DATE_FORMAT(h.tb_screening_datetime,"%d-%b-%Y") as tb_screening_datetime, + DATE_FORMAT(e.hiv_start_date,"%d-%b-%Y") as hiv_start_date, h.arv_start_date, + DATE_FORMAT(h.arv_first_regimen_start_date,"%d-%b-%Y") as arv_first_regimen_start_date, e.cd4_1, - e.encounter_datetime AS last_clinical_encounter, - DATE_FORMAT(h.rtc_date, '%Y-%m-%d') AS next_appointment, + IF((e.cd4_1 IS NOT NULL), 'Y', 'N') as has_cd4_1, + DATE_FORMAT(e.encounter_datetime, "%d-%b-%Y") AS last_clinical_encounter, + DATE_FORMAT(h.rtc_date, "%d-%b-%Y") AS next_appointment, h.vl_1, CASE - WHEN - e.weight IS NOT NULL - AND e.height IS NOT NULL - THEN - 'YES' - ELSE 'NO' - END AS nutrition, - CASE - WHEN e.visit_type IN (37 , 58) THEN 'CARG' - WHEN e.visit_type IN (43 , 80, 104, 118, 120, 123) THEN 'Treatment Supporter' - ELSE 'Self' - END AS visit_type, + WHEN (TIMESTAMPDIFF(MONTH,h.arv_start_date,'` + + endDate + + `') < 6 ) THEN 'NA' + WHEN (h.vl_1 is NOT NULL) THEN 'Y' + ELSE 'missing' + END AS viral_load_validity, h.cur_arv_meds_names AS drugs_given, CASE WHEN @@ -76,83 +82,71 @@ export class DQAChartAbstractionDAO { e.weight / ((e.height / 100) * (e.height / 100)) ELSE NULL END AS BMI, - IF(p.program_id = 9, 'DC', 'Standard') AS DSD, TIMESTAMPDIFF(DAY, h.encounter_date, h.rtc_date) AS drugs_duration, IF(h.ipt_start_date = h.encounter_date, 1, 0) AS ipt_started_this_visit, - DATE_FORMAT(h.ipt_start_date, '%Y-%m-%d') AS last_ipt_start_date, + DATE_FORMAT(h.ipt_start_date, "%d-%b-%Y") AS last_ipt_start_date, CASE - WHEN e.on_ipt = 1 THEN 'CONTINUING' + WHEN h.on_ipt_this_month = 1 THEN 'continuing' WHEN - e.ipt_completion_date IS NULL - AND e.ipt_stop_date IS NOT NULL + h.ipt_completion_date IS NULL + AND h.ipt_stop_date IS NOT NULL THEN - 'DISCONTINUED' - WHEN e.ipt_completion_date IS NOT NULL THEN 'COMPLETED' + 'Discontinued' + WHEN h.ipt_completion_date IS NOT NULL THEN 'INH Completed' + WHEN (h.on_ipt_this_month = 0 AND h.on_tb_tx_this_month = 0) THEN 'Missing' + WHEN ((TIMESTAMPDIFF(MONTH,h.ipt_start_date,'` + + endDate + + `') < 3) AND h.on_ipt_this_month = 1) THEN 'Defaulted' ELSE 'NA' END AS tpt_status, - h.ipt_stop_date, - h.ipt_completion_date, - e.cur_who_stage, - e.cd4_1, - fv.muac, + DATE_FORMAT(h.ipt_stop_date,"%d-%b-%Y") as ipt_stop_date, + DATE_FORMAT(h.ipt_completion_date, "%d-%b-%Y") as ipt_completion_date, + fv.muac as muac, IF(h.ipt_stop_date = h.encounter_date OR h.ipt_completion_date = h.encounter_date, 1, 0) AS ipt_ended_this_visit, - fv.systolic_bp AS sysBP, - fv.diastolic_bp AS dysBP, h.status, - IF((o.value_coded IS NULL), 'NO', 'YES') AS is_crag_screened, + IF((o.value_coded IS NULL), 'N', 'Y') AS is_crag_screened, CASE - WHEN (h.vl_1 < 200) THEN 'suppressed' - WHEN (h.vl_1 >= 200) THEN 'unsuppressed' + WHEN (h.vl_1 < 200) THEN 'Y' + WHEN (h.vl_1 >= 200) THEN 'N' + ELSE 'Missing' END AS vl_suppression, CASE - WHEN (e.tb_screening_result = 6971) THEN 'Pr TB' - WHEN (e.tb_screening_result = 6137) THEN 'Confirmed' - WHEN (e.tb_screening_result IN (1107 , 10678)) THEN 'No TB' - WHEN (e.tb_screening_result = 10767) THEN 'TB Rx' - WHEN (e.tb_screening_result = 10974) THEN 'INH' + WHEN (e.tb_screening_result IN (6621,1118)) THEN 'TB Screening not done' + WHEN (e.tb_screening_result = 6971) THEN 'Presumed TB' + WHEN (e.tb_screening_result IN (6137, 6176, 10767)) THEN 'TB confirmed' + WHEN (e.tb_screening_result IN (1107 , 10678)) THEN 'No TB signs' + ELSE 'Missing' END AS tb_screening_result FROM etl.hiv_monthly_report_dataset_v1_2 h LEFT JOIN etl.flat_hiv_summary_v15b e ON (h.encounter_id = e.encounter_id) LEFT JOIN --- etl.flat_hiv_summary_v15b ls ON (ls.next_clinical_datetime_hiv IS NULL --- AND ls.person_id = e.person_id) --- LEFT JOIN --- (SELECT --- *, MAX(encounter_datetime) AS max_date --- FROM --- etl.flat_vitals --- WHERE --- encounter_datetime <= '` + - endDate + - `' --- GROUP BY person_id , encounter_datetime --- ORDER BY encounter_datetime) etl.flat_vitals fv ON (e.person_id = fv.person_id) INNER JOIN amrs.person t1 ON (h.person_id = t1.person_id) inner JOIN - etl.flat_patient_identifiers_v1 fpiv ON (t1.person_id = fpiv.patient_id and fpiv.ccc is not null) + etl.flat_patient_identifiers_v1 fpiv ON (t1.person_id = fpiv.patient_id) LEFT JOIN amrs.patient_program p ON (p.patient_id = h.person_id - AND p.program_id IN (4 , 9) + AND p.program_id IN (4) AND p.date_completed IS NULL AND p.voided = 0) LEFT JOIN amrs.obs o ON (o.encounter_id = e.encounter_id AND o.person_id = h.person_id - AND o.concept_id = 9812 - AND o.voided = 0 and e.is_clinical_encounter = 1) + AND o.concept_id in (9812) + AND o.voided = 0 + ) WHERE - e.encounter_datetime >= "2022-01-01" AND (e.weight is not null) AND + h.status = "active" AND h.endDate >= '` + startDate + `' @@ -169,7 +163,7 @@ GROUP BY h.person_id ` + limitOffSetDefinition; - + console.log(sqlQuery); return new Promise((resolve, reject) => { runner .executeQuery(sqlQuery) From 7df1d7f7d27b0a32bb5020046a4324815b70f196 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 15 Jan 2024 15:37:56 +0300 Subject: [PATCH 28/40] POC-610: Updated DQA Report to reflect updated indicators --- reports/DQA/dqa-chart-abstraction-report-dao.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index 6561f7e7e..884d4eed4 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -163,7 +163,7 @@ GROUP BY h.person_id ` + limitOffSetDefinition; - console.log(sqlQuery); + return new Promise((resolve, reject) => { runner .executeQuery(sqlQuery) From 1158a718f553465c011588f3743b64e5228c3ffb Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 15 Jan 2024 15:51:18 +0300 Subject: [PATCH 29/40] POC-610: Updated DQA Report to reflect updated indicators --- reports/DQA/dqa-chart-abstraction-report-dao.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index 884d4eed4..5df84b98c 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -163,7 +163,7 @@ GROUP BY h.person_id ` + limitOffSetDefinition; - + return new Promise((resolve, reject) => { runner .executeQuery(sqlQuery) From a44403eed6327f0e8a326261819f12ea1ef4480c Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 15 Jan 2024 17:51:29 +0300 Subject: [PATCH 30/40] POC-610: Updated columns to display category --- .../DQA/dqa-chart-abstraction-report-dao.js | 39 +++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index 5df84b98c..79d848817 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -35,9 +35,11 @@ export class DQAChartAbstractionDAO { TIMESTAMPDIFF(year,h.birthdate,'` + endDate + `') AS age, - IF(DATE(h.tb_screening_datetime) > DATE_SUB(h.endDate, INTERVAL 6 MONTH), - 'Yes', - 'No') AS tb_screened_this_visit, + CASE + WHEN e.tb_screen = 1 then 'Yes' + WHEN e.tb_screen = 0 then 'No' + ELSE 'Not documented' + END AS 'tb_screened_this_visit', CASE WHEN (h.gender = 'F') then 'Female' WHEN (h.gender = 'M') then 'Male' @@ -58,11 +60,17 @@ export class DQAChartAbstractionDAO { END as cur_arv_med_basis, h.tb_screen, DATE_FORMAT(h.tb_screening_datetime,"%d-%b-%Y") as tb_screening_datetime, - DATE_FORMAT(e.hiv_start_date,"%d-%b-%Y") as hiv_start_date, + CASE + WHEN (e.hiv_start_date <= '1900-01-01') THEN '' + ELSE DATE_FORMAT(e.hiv_start_date,"%d-%b-%Y") + END as hiv_start_date, h.arv_start_date, - DATE_FORMAT(h.arv_first_regimen_start_date,"%d-%b-%Y") as arv_first_regimen_start_date, + CASE + WHEN (h.arv_first_regimen_start_date <= '1900-01-01') THEN '' + ELSE DATE_FORMAT(h.arv_first_regimen_start_date,"%d-%b-%Y") + END as arv_first_regimen_start_date, e.cd4_1, - IF((e.cd4_1 IS NOT NULL), 'Y', 'N') as has_cd4_1, + IF((e.cd4_1 IS NOT NULL), 'Yes', 'No') as has_cd4_1, DATE_FORMAT(e.encounter_datetime, "%d-%b-%Y") AS last_clinical_encounter, DATE_FORMAT(h.rtc_date, "%d-%b-%Y") AS next_appointment, h.vl_1, @@ -70,7 +78,7 @@ export class DQAChartAbstractionDAO { WHEN (TIMESTAMPDIFF(MONTH,h.arv_start_date,'` + endDate + `') < 6 ) THEN 'NA' - WHEN (h.vl_1 is NOT NULL) THEN 'Y' + WHEN (h.vl_1 is NOT NULL) THEN 'Yes' ELSE 'missing' END AS viral_load_validity, h.cur_arv_meds_names AS drugs_given, @@ -111,10 +119,10 @@ export class DQAChartAbstractionDAO { 1, 0) AS ipt_ended_this_visit, h.status, - IF((o.value_coded IS NULL), 'N', 'Y') AS is_crag_screened, + IF((o.value_coded IS NULL), 'No', 'Yes') AS is_crag_screened, CASE - WHEN (h.vl_1 < 200) THEN 'Y' - WHEN (h.vl_1 >= 200) THEN 'N' + WHEN (h.vl_1 < 200) THEN 'Yes' + WHEN (h.vl_1 >= 200) THEN 'No' ELSE 'Missing' END AS vl_suppression, CASE @@ -123,7 +131,16 @@ export class DQAChartAbstractionDAO { WHEN (e.tb_screening_result IN (6137, 6176, 10767)) THEN 'TB confirmed' WHEN (e.tb_screening_result IN (1107 , 10678)) THEN 'No TB signs' ELSE 'Missing' - END AS tb_screening_result + END AS tb_screening_result, + CASE + WHEN (p.program_id = 4) THEN 'PMTCT' + WHEN (TIMESTAMPDIFF(YEAR, h.birthdate, '` + + endDate + + `') < 15) THEN 'PEAD' + WHEN (TIMESTAMPDIFF(YEAR, h.birthdate, '` + + endDate + + `') >= 15) THEN 'ADULT' + END AS category FROM etl.hiv_monthly_report_dataset_v1_2 h LEFT JOIN From 2cbad6e28f1cd90da8ddce48fbd0a7cd7c10929c Mon Sep 17 00:00:00 2001 From: henrykorir Date: Wed, 17 Jan 2024 11:13:35 +0300 Subject: [PATCH 31/40] POC-610: Updated the dates and category --- .../DQA/dqa-chart-abstraction-report-dao.js | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/reports/DQA/dqa-chart-abstraction-report-dao.js b/reports/DQA/dqa-chart-abstraction-report-dao.js index 79d848817..76e9d6074 100644 --- a/reports/DQA/dqa-chart-abstraction-report-dao.js +++ b/reports/DQA/dqa-chart-abstraction-report-dao.js @@ -31,25 +31,25 @@ export class DQAChartAbstractionDAO { SELECT h.person_uuid AS uuid, fpiv.ccc AS ccc_number, - IF((fpiv.nupi IS NOT NULL), fpiv.nupi, 'missing') AS NUPI, + IF((fpiv.nupi IS NOT NULL), fpiv.nupi, 'Missing') AS NUPI, TIMESTAMPDIFF(year,h.birthdate,'` + endDate + `') AS age, CASE WHEN e.tb_screen = 1 then 'Yes' - WHEN e.tb_screen = 0 then 'No' - ELSE 'Not documented' + -- WHEN e.tb_screen = 0 then 'No' + ELSE 'No' END AS 'tb_screened_this_visit', CASE WHEN (h.gender = 'F') then 'Female' WHEN (h.gender = 'M') then 'Male' - ELSE 'missing' + ELSE 'Missing' END AS 'sex_gender', e.height, e.weight, - DATE_FORMAT(h.birthdate, "%d-%b-%Y") AS birthdate, + DATE_FORMAT(h.birthdate, '%d/%m/%Y') AS birthdate, h.encounter_id, - DATE_FORMAT(h.encounter_date, "%d-%b-%Y") AS last_appointment_date, + DATE_FORMAT(h.encounter_date, '%d/%m/%Y') AS last_appointment_date, h.rtc_date, h.location_id, h.cur_arv_meds, @@ -59,27 +59,27 @@ export class DQAChartAbstractionDAO { ELSE 'NON DTG' END as cur_arv_med_basis, h.tb_screen, - DATE_FORMAT(h.tb_screening_datetime,"%d-%b-%Y") as tb_screening_datetime, + DATE_FORMAT(h.tb_screening_datetime,'%d/%m/%Y') as tb_screening_datetime, CASE WHEN (e.hiv_start_date <= '1900-01-01') THEN '' - ELSE DATE_FORMAT(e.hiv_start_date,"%d-%b-%Y") + ELSE DATE_FORMAT(e.hiv_start_date,'%d/%m/%Y') END as hiv_start_date, h.arv_start_date, CASE WHEN (h.arv_first_regimen_start_date <= '1900-01-01') THEN '' - ELSE DATE_FORMAT(h.arv_first_regimen_start_date,"%d-%b-%Y") + ELSE DATE_FORMAT(h.arv_first_regimen_start_date,'%d/%m/%Y') END as arv_first_regimen_start_date, e.cd4_1, IF((e.cd4_1 IS NOT NULL), 'Yes', 'No') as has_cd4_1, - DATE_FORMAT(e.encounter_datetime, "%d-%b-%Y") AS last_clinical_encounter, - DATE_FORMAT(h.rtc_date, "%d-%b-%Y") AS next_appointment, + DATE_FORMAT(e.encounter_datetime, '%d/%m/%Y') AS last_clinical_encounter, + DATE_FORMAT(h.rtc_date, '%d/%m/%Y') AS next_appointment, h.vl_1, CASE WHEN (TIMESTAMPDIFF(MONTH,h.arv_start_date,'` + endDate + `') < 6 ) THEN 'NA' WHEN (h.vl_1 is NOT NULL) THEN 'Yes' - ELSE 'missing' + ELSE 'Missing' END AS viral_load_validity, h.cur_arv_meds_names AS drugs_given, CASE @@ -96,9 +96,9 @@ export class DQAChartAbstractionDAO { IF(h.ipt_start_date = h.encounter_date, 1, 0) AS ipt_started_this_visit, - DATE_FORMAT(h.ipt_start_date, "%d-%b-%Y") AS last_ipt_start_date, + DATE_FORMAT(h.ipt_start_date, '%d/%m/%Y') AS last_ipt_start_date, CASE - WHEN h.on_ipt_this_month = 1 THEN 'continuing' + WHEN h.on_ipt_this_month = 1 THEN 'Continuing' WHEN h.ipt_completion_date IS NULL AND h.ipt_stop_date IS NOT NULL @@ -111,8 +111,8 @@ export class DQAChartAbstractionDAO { `') < 3) AND h.on_ipt_this_month = 1) THEN 'Defaulted' ELSE 'NA' END AS tpt_status, - DATE_FORMAT(h.ipt_stop_date,"%d-%b-%Y") as ipt_stop_date, - DATE_FORMAT(h.ipt_completion_date, "%d-%b-%Y") as ipt_completion_date, + DATE_FORMAT(h.ipt_stop_date,'%d/%m/%Y') as ipt_stop_date, + DATE_FORMAT(h.ipt_completion_date, '%d/%m/%Y') as ipt_completion_date, fv.muac as muac, IF(h.ipt_stop_date = h.encounter_date OR h.ipt_completion_date = h.encounter_date, @@ -136,10 +136,10 @@ export class DQAChartAbstractionDAO { WHEN (p.program_id = 4) THEN 'PMTCT' WHEN (TIMESTAMPDIFF(YEAR, h.birthdate, '` + endDate + - `') < 15) THEN 'PEAD' + `') < 15) THEN 'Paeds (0-14yrs)' WHEN (TIMESTAMPDIFF(YEAR, h.birthdate, '` + endDate + - `') >= 15) THEN 'ADULT' + `') >= 15) THEN 'Adults (>15 yrs)' END AS category FROM etl.hiv_monthly_report_dataset_v1_2 h From 2ca75c30e2a9d9b8ecf6867f96a8edda551814fa Mon Sep 17 00:00:00 2001 From: henrykorir Date: Sun, 21 Jan 2024 18:16:40 +0300 Subject: [PATCH 32/40] POC-544-v2: Added disaggregated mental health disorder report --- app/reporting-framework/base-mysql.report.js | 98 ++++++++++- .../disaggregations/diabetic/dm-base.json | 2 +- .../anxiety-aggregate.json | 100 +++++++++++ .../mental-health-disorder/anxiety-base.json | 160 ++++++++++++++++++ .../bipolar-and-related-mh-aggregate.json | 100 +++++++++++ .../bipolar-and-related-mh-base.json | 160 ++++++++++++++++++ .../depressive-aggregate.json | 100 +++++++++++ .../depressive-base.json | 159 +++++++++++++++++ .../feeding-and-eating-mh-aggregate.json | 100 +++++++++++ .../feeding-and-eating-mh-base.json | 160 ++++++++++++++++++ .../general-mental-disorder-aggregate.json | 100 +++++++++++ .../general-mental-disorder-base.json | 160 ++++++++++++++++++ .../mental-health-disorder/mh-base.json | 2 +- .../mental-health-disorder/ocd-aggregate.json | 100 +++++++++++ .../mental-health-disorder/ocd-base.json | 160 ++++++++++++++++++ .../personality-mh-aggregate.json | 100 +++++++++++ .../personality-mh-base.json | 160 ++++++++++++++++++ .../status-sub-total-aggregate.json | 80 +++++++++ .../status-sub-total-base.json | 128 ++++++++++++++ .../total-mh-aggregate.json | 75 ++++++++ .../mental-health-disorder/total-mh-base.json | 120 +++++++++++++ .../plhiv-ncd-v2-report.json | 12 +- 22 files changed, 2329 insertions(+), 7 deletions(-) create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/bipolar-and-related-mh-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/feeding-and-eating-mh-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-base.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-aggregate.json create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-base.json diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index 331eb3f8e..20de90568 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -396,6 +396,33 @@ import * as dm_plhiv_aggregate from './json-reports/plhiv-ncd-v2-reports/disaggr 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'; @@ -1835,10 +1862,73 @@ export class BaseMysqlReport { dmPlhivBase: this.cloneJsonSchema(dm_plhiv_base) }); break; - case 'mhPlhivAggregate': + // case 'mhPlhivAggregate': + // resolve({ + // main: this.cloneJsonSchema(mh_plhiv_aggregate), + // mhPlhivBase: this.cloneJsonSchema(mh_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(mh_plhiv_aggregate), - mhPlhivBase: this.cloneJsonSchema(mh_plhiv_base) + 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': @@ -1858,7 +1948,7 @@ export class BaseMysqlReport { main: this.cloneJsonSchema(rhe_plhiv_aggregate), rhePlhivBase: this.cloneJsonSchema(rhe_plhiv_base) }); - break; + break; case 'kdPlhivAggregate': resolve({ main: this.cloneJsonSchema(kd_plhiv_aggregate), 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 index 1a91d6dcb..71299be34 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "hmrd.person_id = nmrd.person_id AND hmrd.endDate = nmrd.endDate AND hmrd.status = 'active'" + "joinCondition": "hmrd.person_id = nmrd.person_id AND hmrd.status = 'active'" } }, { 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..0c8078dc0 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-aggregate.json @@ -0,0 +1,100 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..2bd6c90db --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/anxiety-base.json @@ -0,0 +1,160 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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..80d937b9a --- /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,100 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..97805edfb --- /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,160 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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..9590c2ec0 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-aggregate.json @@ -0,0 +1,100 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..eae946904 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/depressive-base.json @@ -0,0 +1,159 @@ +{ + "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": "endDate" + } + ] + }, + "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..460034298 --- /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,100 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..cb440bcb3 --- /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,160 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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..e45bf535e --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-aggregate.json @@ -0,0 +1,100 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..c65c6e4cd --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/general-mental-disorder-base.json @@ -0,0 +1,160 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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 index e84ce2a1e..57f0e1073 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" } }, { 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..fcd2004b6 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-aggregate.json @@ -0,0 +1,100 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..478097424 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/ocd-base.json @@ -0,0 +1,160 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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..ff59e2372 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-aggregate.json @@ -0,0 +1,100 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..865e53c3f --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/personality-mh-base.json @@ -0,0 +1,160 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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..115c3427e --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-aggregate.json @@ -0,0 +1,80 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..e912b742c --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/status-sub-total-base.json @@ -0,0 +1,128 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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..a6989fab3 --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-aggregate.json @@ -0,0 +1,75 @@ +{ + "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" + } + } + } + } + } + \ No newline at end of file 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..23f70448c --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/mental-health-disorder/total-mh-base.json @@ -0,0 +1,120 @@ +{ + "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": "endDate" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" + } + } + \ No newline at end of file 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 index d43da2463..90ab4fbab 100644 --- 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 @@ -4,7 +4,17 @@ "dmPlhivAggregate", "cvdPlhivAggregate", "kdPlhivAggregate", - "mhPlhivAggregate", + + "depPlhivAggregate", + "anxPlhivAggregate", + "bipPlhivAggregate", + "perPlhivAggregate", + "fedPlhivAggregate", + "ocdPlhivAggregate", + "genMDPlhivAggregate", + "stMDPlhivAggregate", + "totMDPlhivAggregate", + "endoPlhivAggregate", "entPlhivAggregate", "frmPlhivAggregate", From 30ce25ae45df2ebb2a454021a1ac178108722b44 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Wed, 24 Jan 2024 11:58:00 +0300 Subject: [PATCH 33/40] POC-544-v2: Updated mental health report --- .../cardiovascular-disease/cvd-base.json | 12 +++++++- .../disaggregations/diabetic/dm-base.json | 12 +++++++- .../hypertensive/htn-base.json | 18 +++++++++--- .../kidney-disease/kd-base.json | 14 ++++++++-- .../mental-health-disorder/anxiety-base.json | 28 +++++++++++++------ .../bipolar-and-related-mh-base.json | 12 +++++++- .../depressive-base.json | 12 +++++++- .../feeding-and-eating-mh-base.json | 12 +++++++- .../general-mental-disorder-base.json | 12 +++++++- .../mental-health-disorder/mh-base.json | 12 +++++++- .../mental-health-disorder/ocd-base.json | 12 +++++++- .../personality-mh-base.json | 12 +++++++- .../status-sub-total-base.json | 12 +++++++- .../mental-health-disorder/total-mh-base.json | 14 ++++++++-- .../neurological-disease/neuro-base.json | 12 +++++++- .../rheumatologic-disease/rheu-base.json | 12 +++++++- app/routes/plhiv-ncd-v2-report.route.js | 8 ++++-- .../plhiv-ncd-v2-summary.service.js | 1 + 18 files changed, 196 insertions(+), 31 deletions(-) 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 index 2f52e4c9a..56a2a0af5 100644 --- 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 @@ -256,8 +256,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index 71299be34..4e12f5e67 100644 --- 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 @@ -310,8 +310,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index 7aaf2791f..70164f198 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" } }, { @@ -310,13 +310,23 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "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.is_hypertensive,nmrd.htn_state"] + "columns": ["nmrd.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 index 8deb90f4d..39ef4f1ce 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" } }, { @@ -918,8 +918,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index 2bd6c90db..ea637dbb4 100644 --- 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 @@ -136,15 +136,25 @@ "conditionJoinOperator": "and", "conditions": [ { - "filterType": "tableColumns", - "conditionExpression": "nmrd.location_id in ?", - "parameterName": "locations" - }, - { - "filterType": "tableColumns", - "conditionExpression": "nmrd.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": { 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 index 97805edfb..6f08b9bef 100644 --- 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 @@ -142,8 +142,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index eae946904..09550954a 100644 --- 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 @@ -142,8 +142,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index cb440bcb3..b892f6e9a 100644 --- 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 @@ -142,8 +142,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index c65c6e4cd..7353dd08a 100644 --- 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 @@ -142,8 +142,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index 57f0e1073..f417f497f 100644 --- 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 @@ -454,8 +454,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index 478097424..cd2113100 100644 --- 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 @@ -142,8 +142,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index 865e53c3f..8dcc0b620 100644 --- 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 @@ -142,8 +142,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index e912b742c..faf29e1d0 100644 --- 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 @@ -110,8 +110,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index 23f70448c..ce7a047e1 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id" } }, { @@ -102,8 +102,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index b04cfe1d0..e305c787c 100644 --- 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 @@ -262,8 +262,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, 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 index ec916832d..1cd6e23a2 100644 --- 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 @@ -262,8 +262,18 @@ }, { "filterType": "tableColumns", - "conditionExpression": "nmrd.endDate = ?", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } ] }, diff --git a/app/routes/plhiv-ncd-v2-report.route.js b/app/routes/plhiv-ncd-v2-report.route.js index cbceaa5ff..9a239d6dd 100644 --- a/app/routes/plhiv-ncd-v2-report.route.js +++ b/app/routes/plhiv-ncd-v2-report.route.js @@ -18,9 +18,11 @@ const routes = [ 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', - ['endDate', 'locationUuids'], + ['startDate', 'endDate', 'locationUuids'], requestParams ); reportParams.requestParams.isAggregated = true; @@ -67,9 +69,11 @@ const routes = [ request.query, request.params ); + requestParams.visitState = + requestParams.currentView === 'monthly' ? [0, 1] : [1]; let reportParams = etlHelpers.getReportParams( 'plhiv-ncd-v2-monthly-report', - ['endDate', 'locationUuids'], + ['startDate','endDate', 'locationUuids'], requestParams ); delete reportParams.requestParams['gender']; diff --git a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js index d5f228bdc..0ef7f02d8 100644 --- a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js +++ b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js @@ -16,6 +16,7 @@ export class PLHIVNCDv2SummaryReportService extends MultiDatasetPatientlistRepor } generateReport(additionalParams) { + console.log("params: ", this.params, additionalParams) const that = this; return new Promise((resolve, reject) => { that From 77af0a6db37f351d86c9b92672be58bb8ab55663 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Wed, 31 Jan 2024 05:55:37 +0300 Subject: [PATCH 34/40] POC-544-v2: Indicator name fix and list of active ncd clients --- .../disaggregations/hypertensive/htn-base.json | 12 +++++++++++- .../disaggregations/kidney-disease/kd-base.json | 2 +- .../mental-health-disorder/total-mh-base.json | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) 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 index 70164f198..dc50e3207 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" } }, { @@ -303,6 +303,16 @@ "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 ?", 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 index 39ef4f1ce..a509534e0 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" + "joinCondition": "nmrd.person_id = hmrd.person_id AND nmrd.endDate = hmrd.endDate AND hmrd.status = 'active'" } }, { 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 index ce7a047e1..ab59943de 100644 --- 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 @@ -14,7 +14,7 @@ "alias": "hmrd", "join": { "type": "INNER", - "joinCondition": "nmrd.person_id = hmrd.person_id" + "joinCondition": "nmrd.person_id = hmrd.person_id AND hmrd.status = 'active'" } }, { From 79dc4faa878dade78c3314a74a410b2ff245e42a Mon Sep 17 00:00:00 2001 From: henrykorir Date: Wed, 31 Jan 2024 06:23:22 +0300 Subject: [PATCH 35/40] POC-544-v2: Indicator name fix and list of active ncd clients --- .../plhiv-ncd-v2-reports/plhiv-ncd-v2-report-indicators.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index d3582ce9e..15bb2e2ea 100644 --- 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 @@ -1423,7 +1423,7 @@ ] }, { - "label": "Neurological Disease", + "label": "Rheumatologic Disorder", "indicator": [ { "type": "sub_tot_nw_rhe_f", From 4858d6e79bb6b02535c2960d89fab1c0bd6df9a7 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 5 Feb 2024 10:26:32 +0300 Subject: [PATCH 36/40] POC-544-v2: made the query to appropriately display KD --- .../kidney-disease/kd-base.json | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) 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 index a509534e0..0d5a4f435 100644 --- 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 @@ -88,7 +88,7 @@ "alias": "stg_1_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" + "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)" } }, { @@ -96,7 +96,7 @@ "alias": "stg_1_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" + "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)" } }, { @@ -104,7 +104,7 @@ "alias": "tot_stg_1_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8079 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -112,7 +112,7 @@ "alias": "stg_1_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -120,7 +120,7 @@ "alias": "stg_1_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -128,7 +128,7 @@ "alias": "tot_stg_1_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8079 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -184,7 +184,7 @@ "alias": "stg_2_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender ='M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" + "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)" } }, { @@ -192,7 +192,7 @@ "alias": "stg_2_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender ='F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" + "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)" } }, { @@ -200,7 +200,7 @@ "alias": "tot_stg_2_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8080 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -208,7 +208,7 @@ "alias": "stg_2_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -216,7 +216,7 @@ "alias": "stg_2_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -224,7 +224,7 @@ "alias": "tot_stg_2_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8080 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -280,7 +280,7 @@ "alias": "stg_3_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" + "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)" } }, { @@ -288,7 +288,7 @@ "alias": "stg_3_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" + "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)" } }, { @@ -296,7 +296,7 @@ "alias": "tot_stg_3_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8081 AND hmrd.started_art_this_month = 1, 1, 0)" } }, { @@ -304,7 +304,7 @@ "alias": "stg_3_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -312,7 +312,7 @@ "alias": "stg_3_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -320,7 +320,7 @@ "alias": "tot_stg_3_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8081 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -376,7 +376,7 @@ "alias": "stg_3a_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1, 1, 0)" + "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)" } }, { @@ -384,7 +384,7 @@ "alias": "stg_3a_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1, 1, 0)" + "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)" } }, { @@ -392,7 +392,7 @@ "alias": "tot_stg_3a_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12294 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -400,7 +400,7 @@ "alias": "stg_3a_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -408,7 +408,7 @@ "alias": "stg_3a_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -416,7 +416,7 @@ "alias": "tot_stg_3a_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF(nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12294 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0, 1, 0)" + "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)" } }, { @@ -472,7 +472,7 @@ "alias": "stg_3b_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -480,7 +480,7 @@ "alias": "stg_3b_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -488,7 +488,7 @@ "alias": "tot_stg_3b_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 12295 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -496,7 +496,7 @@ "alias": "stg_3b_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -504,7 +504,7 @@ "alias": "stg_3b_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -512,7 +512,7 @@ "alias": "tot_stg_3b_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 12295 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -568,7 +568,7 @@ "alias": "stg_4_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -576,7 +576,7 @@ "alias": "stg_4_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -584,7 +584,7 @@ "alias": "tot_stg_4_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8082 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -592,7 +592,7 @@ "alias": "stg_4_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -600,7 +600,7 @@ "alias": "stg_4_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -608,7 +608,7 @@ "alias": "tot_stg_4_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8082 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -664,7 +664,7 @@ "alias": "stg_5_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -672,7 +672,7 @@ "alias": "stg_5_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" + "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)" } }, { @@ -680,7 +680,7 @@ "alias": "tot_stg_5_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND nmrd.ckd_stage = 8083 AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -688,7 +688,7 @@ "alias": "stg_5_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -696,7 +696,7 @@ "alias": "stg_5_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -704,7 +704,7 @@ "alias": "tot_stg_5_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND nmrd.ckd_stage = 8083 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -760,7 +760,7 @@ "alias": "sub_tot_nw_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.gender = 'M' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -768,7 +768,7 @@ "alias": "sub_tot_nw_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF((nmrd.gender = 'F' AND (nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -776,7 +776,7 @@ "alias": "sub_tot_nw_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND hmrd.started_art_this_month = 1), 1, 0)" + "expression": "IF(((nmrd.is_ckd = 1 || nmrd.has_kd = 1) AND hmrd.started_art_this_month = 1), 1, 0)" } }, { @@ -784,7 +784,7 @@ "alias": "sub_tot_ct_chr_m", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'M' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -792,7 +792,7 @@ "alias": "sub_tot_ct_chr_f", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.gender = 'F' AND nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -800,7 +800,7 @@ "alias": "sub_tot_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "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)" } }, { @@ -864,7 +864,7 @@ "alias": "tot_ct_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1 AND hmrd.on_art_this_month = 1 AND hmrd.started_art_this_month = 0), 1, 0)" + "expression": "IF((nmrd.is_ckd = 1), 1, 0)" } }, { @@ -888,7 +888,7 @@ "alias": "tot_chr", "expressionType": "simple_expression", "expressionOptions": { - "expression": "IF((nmrd.is_ckd = 1), 1, 0)" + "expression": "IF((nmrd.is_ckd = 1 || has_kd = 1), 1, 0)" } }, { From 9b622ab4ae3a2b1730769435697810847a811f99 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Mon, 5 Feb 2024 11:02:08 +0300 Subject: [PATCH 37/40] POC-544-v2: Added Prettier Complience --- app/reporting-framework/base-mysql.report.js | 8 +- .../cardiovascular-disease/cvd-aggregate.json | 3 +- .../cardiovascular-disease/cvd-base.json | 3 +- .../anxiety-aggregate.json | 183 +++--- .../mental-health-disorder/anxiety-base.json | 293 +++++---- .../bipolar-and-related-mh-aggregate.json | 183 +++--- .../bipolar-and-related-mh-base.json | 317 +++++----- .../depressive-aggregate.json | 183 +++--- .../feeding-and-eating-mh-aggregate.json | 183 +++--- .../feeding-and-eating-mh-base.json | 317 +++++----- .../general-mental-disorder-aggregate.json | 183 +++--- .../general-mental-disorder-base.json | 317 +++++----- .../mental-health-disorder/mh-aggregate.json | 577 +++++++++--------- .../mental-health-disorder/mh-base.json | 2 +- .../mental-health-disorder/ocd-aggregate.json | 183 +++--- .../mental-health-disorder/ocd-base.json | 317 +++++----- .../personality-mh-aggregate.json | 183 +++--- .../personality-mh-base.json | 317 +++++----- .../status-sub-total-aggregate.json | 143 +++-- .../status-sub-total-base.json | 253 ++++---- .../total-mh-aggregate.json | 133 ++-- .../mental-health-disorder/total-mh-base.json | 237 ++++--- .../neurological-disease/neuro-aggregate.json | 337 +++++----- .../neurological-disease/neuro-base.json | 557 +++++++++-------- .../rheumatologic-disease/rheu-aggregate.json | 465 +++++++------- .../rheumatologic-disease/rheu-base.json | 559 +++++++++-------- app/routes/plhiv-ncd-v2-report.route.js | 2 +- .../plhiv-ncd-v2-summary.service.js | 1 - 28 files changed, 3205 insertions(+), 3234 deletions(-) diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index 20de90568..f48052933 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -1912,9 +1912,7 @@ export class BaseMysqlReport { case 'genMDPlhivAggregate': resolve({ main: this.cloneJsonSchema(genMD_plhiv_aggregate), - genMDPlhivBase: this.cloneJsonSchema( - genMD_plhiv_base - ) + genMDPlhivBase: this.cloneJsonSchema(genMD_plhiv_base) }); break; case 'stMDPlhivAggregate': @@ -1926,9 +1924,7 @@ export class BaseMysqlReport { case 'totMDPlhivAggregate': resolve({ main: this.cloneJsonSchema(totMD_plhiv_aggregate), - totMDPlhivBase: this.cloneJsonSchema( - totMD_plhiv_base - ) + totMDPlhivBase: this.cloneJsonSchema(totMD_plhiv_base) }); break; case 'cvdPlhivAggregate': 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 index 1f36a3f86..799765588 100644 --- 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 @@ -159,9 +159,8 @@ "expressionOptions": { "expression": "sum(b.sub_tot_nw_cvd)" } - } + }, - , { "type": "derived_column", "alias": "sub_tot_ct_cvd_m", 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 index 56a2a0af5..28d86a6e7 100644 --- 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 @@ -194,9 +194,8 @@ "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", 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 index 0c8078dc0..28064dc3b 100644 --- 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 @@ -1,100 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "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" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_id" - } + { + "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" } } } } - \ No newline at end of file +} 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 index ea637dbb4..ae0775dfa 100644 --- 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 @@ -1,141 +1,141 @@ { - "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" - } + "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'" } - ], - "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)" - } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "fi", + "join": { + "type": "LEFT", + "joinCondition": "nmrd.person_id = fi.patient_id" } - ], - "filters": { - "conditionJoinOperator": "and", - "conditions": [ - { + }, + { + "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" @@ -155,16 +155,15 @@ "conditionExpression": "nmrd.visit_this_month in ?", "parameterName": "visitState" } - ] - }, - "groupBy": { - "groupParam": "groupByParam", - "columns": ["nmrd.person_id"], - "excludeParam": "excludeParam" - }, - "paging": { - "offSetParam": "offSetParam", - "limitParam": "limitParam" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index 80d937b9a..fae4706ae 100644 --- 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 @@ -1,100 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "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" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_id" - } + { + "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" } } } } - \ No newline at end of file +} 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 index 6f08b9bef..08b976a95 100644 --- 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 @@ -1,170 +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" - } + "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'" } - ], - "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)" - } - }, + }, + { + "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": [ { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index 9590c2ec0..c6774d71c 100644 --- 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 @@ -1,100 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "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" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_id" - } + { + "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" } } } } - \ No newline at end of file +} 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 index 460034298..cd0f31b6c 100644 --- 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 @@ -1,100 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "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" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_id" - } + { + "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" } } } } - \ No newline at end of file +} 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 index b892f6e9a..bbbd9bbed 100644 --- 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 @@ -1,170 +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" - } + "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'" } - ], - "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)" - } - }, + }, + { + "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": [ { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index e45bf535e..f2664baaf 100644 --- 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 @@ -1,100 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "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" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_id" - } + { + "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" } } } } - \ No newline at end of file +} 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 index 7353dd08a..d9ecc9f21 100644 --- 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 @@ -1,170 +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" - } + "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'" } - ], - "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)" - } - }, + }, + { + "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": [ { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index 5e4217336..2b2914a72 100644 --- 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 @@ -1,295 +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)" + "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" } - ], - "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" - } + }, + { + "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" } } } } - \ No newline at end of file +} 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 index f417f497f..a5dcfa271 100644 --- 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 @@ -429,7 +429,7 @@ }, { "type": "derived_column", - "alias": "tot_ct_mh", + "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)" 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 index fcd2004b6..67e43f58b 100644 --- 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 @@ -1,100 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "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" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_id" - } + { + "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" } } } } - \ No newline at end of file +} 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 index cd2113100..fc6fd78ff 100644 --- 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 @@ -1,170 +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" - } + "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'" } - ], - "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)" - } - }, + }, + { + "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": [ { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index ff59e2372..15351177a 100644 --- 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 @@ -1,100 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "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" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_id" - } + { + "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" } } } } - \ No newline at end of file +} 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 index 8dcc0b620..2fe504d26 100644 --- 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 @@ -1,170 +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" - } + "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'" } - ], - "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)" - } - }, + }, + { + "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": [ { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index 115c3427e..ca33d177d 100644 --- 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 @@ -1,80 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_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" } } } } - \ No newline at end of file +} 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 index faf29e1d0..e3b4874e3 100644 --- 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 @@ -1,138 +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" - } + "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'" } - ], - "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" - }, + }, + { + "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": [ { - "type": "simple_column", - "alias": "location_id", - "column": "nmrd.location_id" + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "type": "simple_column", - "alias": "location", - "column": "nmrd.clinic" + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index a6989fab3..a563ddce9 100644 --- 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 @@ -1,75 +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)" + "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" } - ], - "groupBy": { - "groupParam": "groupByParam", - "columns": ["b.location_id"], - "excludeParam": "excludeParam" }, - "transFormDirectives": { - "joinColumn": "location_id", - "joinColumnParam": "", - "skipColumns": [""], - "disaggregationColumns": [] + { + "type": "simple_column", + "alias": "location_id", + "column": "b.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "b.location_uuid" }, - "dynamicJsonQueryGenerationDirectives": { - "patientListGenerator": { - "useTemplate": "patient-list-with-contacts-template", - "useTemplateVersion": "1.0", - "generatingDirectives": { - "joinDirectives": { - "joinType": "INNER", - "joinCondition": "<> = <>", - "baseColumn": "person_id", - "templateColumn": "person_id" - } + { + "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" } } } } - \ No newline at end of file +} 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 index ab59943de..0cb65798c 100644 --- 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 @@ -1,130 +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" - } + "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'" } - ], - "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" - }, + }, + { + "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": [ { - "type": "simple_column", - "alias": "age", - "column": "nmrd.age" + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "type": "simple_column", - "alias": "location_id", - "column": "nmrd.location_id" + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "type": "simple_column", - "alias": "location", - "column": "nmrd.clinic" + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "type": "derived_column", - "alias": "tot_mh", - "expressionType": "simple_expression", - "expressionOptions": { - "expression": "IF((nmrd.has_mhd = 1), 1, 0)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index 611868220..ee8dae2b8 100644 --- 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 @@ -1,175 +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)" + "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" } - ], - "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" - } + }, + { + "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" } } } } - \ No newline at end of file +} 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 index e305c787c..b5493a544 100644 --- 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 @@ -1,290 +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" - } + "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'" } - ], - "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)" - } - }, + }, + { + "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": [ { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "type": "derived_column", - "alias": "tot_neu", - "expressionType": "simple_expression", - "expressionOptions": { - "expression": "IF((nmrd.has_neurological_disorder = 1), 1, 0)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["hmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} 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 index 142b639c2..a9f7690d4 100644 --- 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 @@ -1,238 +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" - } + "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" } } } } - \ No newline at end of file +} 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 index 1cd6e23a2..85480798f 100644 --- 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 @@ -1,290 +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)" - } - }, + "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": [ { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.location_id in ?", + "parameterName": "locations" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate >= ?", + "parameterName": "startDate" }, { - "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)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.endDate <= ?", + "parameterName": "endDate" }, { - "type": "derived_column", - "alias": "tot_rhe", - "expressionType": "simple_expression", - "expressionOptions": { - "expression": "IF((nmrd.has_rheumatologic_disorder = 1), 1, 0)" - } + "filterType": "tableColumns", + "conditionExpression": "nmrd.visit_this_month in ?", + "parameterName": "visitState" } - ], - "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" - } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["nmrd.person_id"], + "excludeParam": "excludeParam" + }, + "paging": { + "offSetParam": "offSetParam", + "limitParam": "limitParam" } - \ No newline at end of file +} diff --git a/app/routes/plhiv-ncd-v2-report.route.js b/app/routes/plhiv-ncd-v2-report.route.js index 9a239d6dd..c3142b4e9 100644 --- a/app/routes/plhiv-ncd-v2-report.route.js +++ b/app/routes/plhiv-ncd-v2-report.route.js @@ -73,7 +73,7 @@ const routes = [ requestParams.currentView === 'monthly' ? [0, 1] : [1]; let reportParams = etlHelpers.getReportParams( 'plhiv-ncd-v2-monthly-report', - ['startDate','endDate', 'locationUuids'], + ['startDate', 'endDate', 'locationUuids'], requestParams ); delete reportParams.requestParams['gender']; diff --git a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js index 0ef7f02d8..d5f228bdc 100644 --- a/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js +++ b/service/plhiv-ncd-v2/plhiv-ncd-v2-summary.service.js @@ -16,7 +16,6 @@ export class PLHIVNCDv2SummaryReportService extends MultiDatasetPatientlistRepor } generateReport(additionalParams) { - console.log("params: ", this.params, additionalParams) const that = this; return new Promise((resolve, reject) => { that From b6679c23e5e72ce1dab8ea3ba6b825f24612bcf7 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Wed, 14 Feb 2024 10:42:18 +0300 Subject: [PATCH 38/40] POC-544: Create End Points for The NCD Monthly Report POC-544-v2: Added report to get latest vitals POC-544-v2: Create End Points for The NCD Monthly Report --- .../latest-hiv-ncd-triage.json | 46 ++++ .../plhiv-ncd-v2-report-indicators.json | 255 +++++++++--------- 2 files changed, 177 insertions(+), 124 deletions(-) create mode 100644 app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/latest-hiv-ncd-triage.json 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..6ebd5656c --- /dev/null +++ b/app/reporting-framework/json-reports/plhiv-ncd-v2-reports/disaggregations/latest-hiv-ncd-triage.json @@ -0,0 +1,46 @@ +{ + "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" + } + } + \ No newline at end of file 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 index 15bb2e2ea..84d1181f5 100644 --- 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 @@ -511,29 +511,36 @@ }, { "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" } ] @@ -560,6 +567,130 @@ } ] }, + { + "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": [ @@ -1101,130 +1232,6 @@ } ] }, - { - "sectionTitle": "Cardiovascular Disease (other than Hypertension)", - "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": "Neurologic Disease", "indicators": [ From a4a6f2af0b56cf61a74085cc60c204a05d244272 Mon Sep 17 00:00:00 2001 From: henrykorir Date: Thu, 15 Feb 2024 11:53:24 +0300 Subject: [PATCH 39/40] POC-544-v2b: Create End Points for the NCD Monthly Report --- .../latest-hiv-ncd-triage.json | 83 +++++++++---------- 1 file changed, 41 insertions(+), 42 deletions(-) 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 index 6ebd5656c..9ea84740e 100644 --- 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 @@ -1,46 +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": "" - } - ] + "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)" }, - "groupBy": { - "groupParam": "groupByParam", - "columns": ["t1.person_id"], - "excludeParam": "excludeParam" + { + "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" } - \ No newline at end of file +} From 2c474361e77499fb91cb95cda78574b1aeffb1ec Mon Sep 17 00:00:00 2001 From: henrykorir Date: Thu, 15 Feb 2024 12:49:16 +0300 Subject: [PATCH 40/40] POC-544-v2b: Create End Points for the NCD Monthly Report --- app/reporting-framework/base-mysql.report.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index f48052933..d7128c4e9 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -1862,12 +1862,7 @@ export class BaseMysqlReport { dmPlhivBase: this.cloneJsonSchema(dm_plhiv_base) }); break; - // case 'mhPlhivAggregate': - // resolve({ - // main: this.cloneJsonSchema(mh_plhiv_aggregate), - // mhPlhivBase: this.cloneJsonSchema(mh_plhiv_base) - // }); - // break; + case 'depPlhivAggregate': resolve({ main: this.cloneJsonSchema(dep_plhiv_aggregate),