From d59c5969087a156d38ba105435b3dd83e92c1d51 Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:36:47 +0300 Subject: [PATCH 01/13] Poc 352 (#1325) * POC-352 * POC:352 recommended PR Changes * Update app/reporting-framework/multi-dataset-patientlist.report.js Co-authored-by: Drizzentic --------- Co-authored-by: Drizzentic --- app/reporting-framework/base-mysql.report.js | 69 +++++- .../RRI/hei-infant-rri-testing-aggregate.json | 122 ++++++++++ .../RRI/hei-infant-rri-testing-base.json | 168 +++++++++++++ .../RRI/pmtct-rri-cal-hiv-aggregate.json | 84 +++++++ .../RRI/pmtct-rri-calhiv-dataset-base.json | 191 +++++++++++++++ .../RRI/pmtct-rri-dataset-base.json | 214 +++++++++++++++++ .../json-reports/RRI/pmtct-rri-framework.json | 92 ++++++++ .../RRI/pmtct-rri-pbfw-aggregate.json | 84 +++++++ .../RRI/pmtct-rri-pbfw-dataset-base.json | 218 +++++++++++++++++ .../RRI/pmtct-rri-wra-aggregate.json | 84 +++++++ .../RRI/pmtct-rri-wra-dataset-base.json | 222 ++++++++++++++++++ .../json-reports/RRI/pmtct-rri.json | 8 + .../RRI/pmtct_rri_patient_list_template.json | 116 +++++++++ .../multi-dataset-patientlist.report.js | 1 - app/routes/pmtct-rri-report.route.js | 142 +++++++++++ service/rri/pmtct-rri-service.js | 125 ++++++++++ service/rri/pmtct_rri_reporting.service.js | 24 ++ 17 files changed, 1959 insertions(+), 5 deletions(-) create mode 100644 app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-aggregate.json create mode 100644 app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-base.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri-cal-hiv-aggregate.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri-calhiv-dataset-base.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri-dataset-base.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri-framework.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-aggregate.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-dataset-base.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri-wra-aggregate.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri-wra-dataset-base.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct-rri.json create mode 100644 app/reporting-framework/json-reports/RRI/pmtct_rri_patient_list_template.json create mode 100644 app/routes/pmtct-rri-report.route.js create mode 100644 service/rri/pmtct-rri-service.js create mode 100644 service/rri/pmtct_rri_reporting.service.js diff --git a/app/reporting-framework/base-mysql.report.js b/app/reporting-framework/base-mysql.report.js index 005bf2c4e..6961f2216 100755 --- a/app/reporting-framework/base-mysql.report.js +++ b/app/reporting-framework/base-mysql.report.js @@ -38,6 +38,19 @@ import * as starting_art_aggregation_age15 from './json-reports/starting-art-agg import * as starting_art_base_age15 from './json-reports/starting-art-base-age15.json'; import * as starting_art_disaggregation_age15 from './json-reports/starting-art-disaggregation-age15.json'; +//PMTC RRI +// import * as pmtc_rri_dataset_base from './json-reports/rri/pmtct-rri-dataset-base.json'; +import * as pmtct_rri from './json-reports/rri/pmtct-rri.json'; +import * as pmtct_rri_cal_hiv_aggregate from './json-reports/rri/pmtct-rri-cal-hiv-aggregate.json'; +import * as pmtct_rri_pbfw_aggregate from './json-reports/rri/pmtct-rri-pbfw-aggregate.json'; +import * as pmtct_rri_wra_aggregate from './json-reports/rri/pmtct-rri-wra-aggregate.json'; +import * as pmtct_rri_hei_aggregate from './json-reports/rri/hei-infant-rri-testing-aggregate.json'; +import * as pmtc_rri_hei_dataset_base from './json-reports/rri/hei-infant-rri-testing-base.json'; +import * as pmtc_rri_calhiv_dataset_base from './json-reports/rri/pmtct-rri-calhiv-dataset-base.json'; +import * as pmtc_rri__pbfw_dataset_base from './json-reports/rri/pmtct-rri-pbfw-dataset-base.json'; +import * as pmtct_rri_patient_list_template from './json-reports/rri/pmtct_rri_patient_list_template.json'; +import * as pmtc_rri_wra_dataset_base from './json-reports/rri/pmtct-rri-wra-dataset-base.json'; + import * as starting_art_aggregation_age_green from './json-reports/starting-art-aggregation-age-green.json'; import * as starting_art_base_age_green from './json-reports/starting-art-base-age-green.json'; import * as starting_art_disaggregation_age_green from './json-reports/starting-art-disaggregation-age-green.json'; @@ -142,6 +155,7 @@ import * as prep_dataset_report from './json-reports/prep-dataset-report.json'; import * as ltfu_surge_baseline_report from './json-reports/ltfus-surge-baseline-base.json'; import * as ltfu_surge_baseline_aggregate_report from './json-reports/ltfus-surge-baseline-aggregate.json'; import * as prep_report_patient_list_template from './json-reports/prep-report-patient-list-template.json'; +import * as pmtct_rri_report_patient_list_template from './json-reports/rri/pmtct_rri_patient_list_template.json'; import * as hiv_latest_clinical_encounter_date_base from './json-reports/hiv-latest-clinical-encounter-date-base.json'; import * as prep_monthly_summary from './json-reports/prep-monthly-summary.json'; @@ -396,7 +410,7 @@ export class BaseMysqlReport { that.reportQuery = sqlQuery; // run query - // console.log('Query', sqlQuery); + console.log('Query', sqlQuery); that .executeReportQuery(that.reportQuery) .then((result) => { @@ -468,6 +482,11 @@ export class BaseMysqlReport { main: this.cloneJsonSchema(prep_report_patient_list_template) }); break; + case 'pmtct-rri-report-patient-list-template': + resolve({ + main: this.cloneJsonSchema(pmtct_rri_report_patient_list_template) + }); + break; case 'mainDatasetAggregate': resolve({ main: this.cloneJsonSchema(main_dataset_aggregate), @@ -850,6 +869,51 @@ export class BaseMysqlReport { main: this.cloneJsonSchema(cdm_dataset_base) }); break; + // PMTCT-RRI + case 'pmtct_rri_aggregate_summary': + resolve({ + main: this.cloneJsonSchema(pmtct_rri) + }); + break; + case 'pmtctrripatientlisttemplate': + resolve({ + main: this.cloneJsonSchema(pmtct_rri_patient_list_template) + }); + break; + case 'pmtctRriCalhivAggregate': + resolve({ + main: this.cloneJsonSchema(pmtct_rri_cal_hiv_aggregate), + pmtctRriCalhivDataSetBase: this.cloneJsonSchema( + pmtc_rri_calhiv_dataset_base + ) + }); + break; + + case 'pmtctRriPbfwAggregate': + resolve({ + main: this.cloneJsonSchema(pmtct_rri_pbfw_aggregate), + pmtctRriPbfwDataSetBase: this.cloneJsonSchema( + pmtc_rri__pbfw_dataset_base + ) + }); + break; + + case 'pmtctRriWraAggregate': + resolve({ + main: this.cloneJsonSchema(pmtct_rri_wra_aggregate), + pmtctRriWraDataSetBase: this.cloneJsonSchema( + pmtc_rri_wra_dataset_base + ) + }); + break; + case 'pmtctRriHeiAggregate': + resolve({ + main: this.cloneJsonSchema(pmtct_rri_hei_aggregate), + heiInfantRriTestingBase: this.cloneJsonSchema( + pmtc_rri_hei_dataset_base + ) + }); + break; case 'clinicalReminderReport': resolve({ main: this.cloneJsonSchema(clinical_reminders_report), @@ -1739,8 +1803,6 @@ export class BaseMysqlReport { } generateReportQuery(reportSchemas, params) { - // console.log('Passed params', params) - // console.log('report schemas', JSON.stringify(reportSchemas, null, 4)); let jSql = this.getJson2Sql(reportSchemas, params); return new Promise((resolve, reject) => { try { @@ -1757,7 +1819,6 @@ export class BaseMysqlReport { } executeReportQuery(sqlQuery) { - // console.log('Executing Query', sqlQuery); let runner = this.getSqlRunner(); return new Promise((resolve, reject) => { runner diff --git a/app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-aggregate.json b/app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-aggregate.json new file mode 100644 index 000000000..f9c929f94 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-aggregate.json @@ -0,0 +1,122 @@ +{ + "name": "heiInfantRriTestingAggregate", + "version": "1.0", + "tag": "", + "description": "", + "uses": [ + { + "name": "heiInfantRriTestingBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "heiInfantRriTestingBase", + "alias": "hmds" + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "reporting_month", + "column": "hmds.reporting_month" + }, + { + "type": "simple_column", + "alias": "location", + "column": "hmds.location" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "hmds.location_id" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "hmds.location_uuid" + }, + { + "type": "derived_column", + "alias": "initial_pcr_less_than_8_wks", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(hmds.initial_pcr_less_than_8_wks)" + } + }, + { + "type": "derived_column", + "alias": "initial_pcr_8_wks_to_12_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(hmds.initial_pcr_8_wks_to_12_months)" + } + }, + { + "type": "derived_column", + "alias": "initial_pcr_less_than_12_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(hmds.initial_pcr_less_than_12_months)" + } + }, + { + "type": "derived_column", + "alias": "second_pcr_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(hmds.second_pcr_6_months)" + } + }, + { + "type": "derived_column", + "alias": "third_pcr_12_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(hmds.third_pcr_12_months)" + } + }, + { + "type": "derived_column", + "alias": "antibody_at_18_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(hmds.antibody_at_18_months)" + } + }, + { + "type": "derived_column", + "alias": "antibody_post_18_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(hmds.antibody_post_18_months)" + } + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["hmds.reporting_month", "hmds.location_id"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "skipColumns": [], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "hei-report-patient-list-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + }, + "skipParams": [] + } + } +} diff --git a/app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-base.json b/app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-base.json new file mode 100644 index 000000000..8351baff2 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-base.json @@ -0,0 +1,168 @@ +{ + "name": "heiInfantRriTestingBase", + "version": "1.0", + "tag": "hei_infant_rri_testing_base", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.pmtct_rri_dataset", + "alias": "prd" + }, + { + "table": "etl.hei_monthly_report_dataset", + "alias": "hmd", + "join": { + "type": "inner", + "joinCondition": "prd.person_id = hmd.person_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "inner", + "joinCondition": "hmd.location_id = l.location_id" + } + }, + { + "table": "etl.flat_hei_summary", + "alias": "fhs", + "join": { + "type": "LEFT", + "joinCondition": "hmd.person_id = fhs.person_id AND fhs.next_clinical_datetime_hiv IS NULL" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "person_id", + "column": "hmd.person_id" + }, + { + "type": "simple_column", + "alias": "age", + "column": "prd.age" + }, + { + "type": "simple_column", + "alias": "location", + "column": "hmd.clinic" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "hmd.location_id" + }, + { + "type": "simple_column", + "alias": "reporting_month", + "column": "DATE_FORMAT(hmd.endDate,'%Y-%m')" + }, + { + "type": "simple_column", + "alias": "month", + "column": "DATE_FORMAT(hmd.endDate,'%Y-%m')" + }, + { + "type": "derived_column", + "alias": "initial_pcr_less_than_8_wks", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmd.initial_pcr_this_month is null AND hmd.age_in_months < 2 ,NULL,1)" + } + }, + { + "type": "derived_column", + "alias": "initial_pcr_8_wks_to_12_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmd.initial_pcr_this_month is null AND hmd.age_in_months between 2 and 12,NULL,1)" + } + }, + { + "type": "derived_column", + "alias": "initial_pcr_less_than_12_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmd.initial_pcr_this_month is null AND hmd.age_in_months < 12,NULL,1)" + } + }, + { + "type": "derived_column", + "alias": "second_pcr_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmd.second_pcr_this_month is null AND hmd.age_in_months = 6,NULL,1)" + } + }, + { + "type": "derived_column", + "alias": "third_pcr_12_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmd.third_pcr_this_month is null AND hmd.age_in_months = 12,NULL,1)" + } + }, + { + "type": "derived_column", + "alias": "antibody_at_18_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmd.initial_antibody_screening_this_month is null AND hmd.age_in_months = 18,NULL,1)" + } + }, + { + "type": "derived_column", + "alias": "antibody_post_18_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "IF(hmd.initial_antibody_screening_this_month is null AND hmd.age_in_months > 18,NULL,1)" + } + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_type in (115)" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmd.endDate=?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.age <=20" + }, + { + "filterType": "tableColumns", + "conditionExpression": "hmd.location_id in (?)", + "parameterName": "locations" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["prd.person_id"], + "excludeParam": "excludeParam" + } +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-cal-hiv-aggregate.json b/app/reporting-framework/json-reports/RRI/pmtct-rri-cal-hiv-aggregate.json new file mode 100644 index 000000000..0610e66c3 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri-cal-hiv-aggregate.json @@ -0,0 +1,84 @@ +{ + "name": "pmtctRriCalhivAggregate", + "version": "1.0", + "tag": "pmtct_rri_cal_hiv_aggregate", + "uses": [ + { + "name": "pmtctRriCalhivDataSetBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "pmtctRriCalhivDataSetBase", + "alias": "prd_base" + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "Reporting_Month", + "column": "prd_base.reporting_month" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "prd_base.location_id" + }, + { + "type": "simple_column", + "alias": "location_Name", + "column": "prd_base.location" + }, + { + "type": "derived_column", + "alias": "all_calhiv", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(prd_base.person_id)" + } + }, + { + "type": "derived_column", + "alias": "calhiv_vl_done_past_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "SUM(prd_base.calhiv_vl_done_past_6_months)" + } + }, + { + "type": "derived_column", + "alias": "calhiv_virally_unsuppressed", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "SUM(prd_base.calhiv_virally_unsuppressed)" + } + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["prd_base.location_id", "prd_base.reporting_month"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "pmtct-rri-report-patient-list-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-calhiv-dataset-base.json b/app/reporting-framework/json-reports/RRI/pmtct-rri-calhiv-dataset-base.json new file mode 100644 index 000000000..c5b5deb60 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri-calhiv-dataset-base.json @@ -0,0 +1,191 @@ +{ + "name": "pmtctRriCalhivDataSetBase", + "version": "1.0", + "tag": "pmtct_rri_calhiv_dataset_base", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.pmtct_rri_dataset", + "alias": "prd" + }, + { + "table": "etl.dates", + "alias": "dts", + "join": { + "type": "INNER", + "joinCondition": "prd.encounter_datetime <= dts.endDate and coalesce(prd.death_date, out_of_care) is null" + } + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "fhs", + "join": { + "type": "inner", + "joinCondition": "prd.person_id = fhs.person_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "prd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "p", + "join": { + "type": "INNER", + "joinCondition": "p.person_id = prd.person_id" + } + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "calhiv_vl_done_past_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " CASE WHEN prd.cur_arv_meds IS NOT NULL AND (prd.latest_vl_test_date IS NULL OR TIMESTAMPDIFF(MONTH, prd.latest_vl_test_date, prd.encounter_datetime) >= 6) THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "calhiv_virally_unsuppressed", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN TIMESTAMPDIFF(MONTH, DATE(prd.latest_vl_test_date), DATE(dts.endDate)) <= 6 AND prd.latest_viral_load >= 200 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "age_range", + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "extract(year from (from_days(datediff(now(),p.birthdate)))) >= 15", + "value": "15_and_above" + }, + { + "condition": "else", + "value": "below_15" + } + ] + } + }, + { + "type": "derived_column", + "alias": "encounter_month", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "MONTH(prd.encounter_datetime)" + } + }, + { + "type": "derived_column", + "alias": "reporting_month", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "date_format(prd.encounter_datetime, '%m/%Y')" + } + }, + { + "type": "derived_column", + "alias": "encounter_year", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "YEAR(prd.encounter_datetime)" + } + }, + { + "type": "simple_column", + "alias": "location", + "column": "l.name" + }, + { + "type": "simple_column", + "alias": "regimen", + "column": "prd.cur_arv_meds" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "prd.location_id" + }, + { + "type": "simple_column", + "alias": "encounter_datetime", + "column": "prd.encounter_datetime" + }, + { + "type": "simple_column", + "alias": "month", + "column": "prd.encounter_datetime" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "p.person_id" + }, + { + "type": "simple_column", + "alias": "gender", + "column": "p.gender" + }, + { + "type": "simple_column", + "alias": "age", + "column": "prd.age" + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "prd.age BETWEEN 0 AND 20" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "fhs.endDate=?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "l.uuid in (?)", + "parameterName": "locationUuids" + }, + { + "filterType": "tableColumns", + "conditionExpression": "round(datediff(prd.encounter_datetime,p.birthdate)/365) >= 0" + }, + { + "filterType": "tableColumns", + "conditionExpression": "round(datediff(prd.encounter_datetime,p.birthdate)/365) <= 120" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["prd.person_id"], + "excludeParam": "excludeParam" + } +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-dataset-base.json b/app/reporting-framework/json-reports/RRI/pmtct-rri-dataset-base.json new file mode 100644 index 000000000..13de87955 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri-dataset-base.json @@ -0,0 +1,214 @@ +{ + "name": "pmtctRriDataSetBase", + "version": "1.0", + "tag": "pmtct_rri_dataset_base", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.pmtct_rri_dataset", + "alias": "prd" + }, + { + "table": "etl.dates", + "alias": "dts", + "join": { + "type": "INNER", + "joinCondition": "prd.encounter_datetime <= dts.endDate and coalesce(prd.death_date, out_of_care) is null" + } + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "fhs", + "join": { + "type": "inner", + "joinCondition": "prd.person_id = fhs.person_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "prd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "p", + "join": { + "type": "INNER", + "joinCondition": "p.person_id = prd.person_id" + } + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "vl_done_past_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " CASE WHEN prd.cur_arv_meds IS NOT NULL AND (prd.latest_vl_test_date IS NULL OR TIMESTAMPDIFF(MONTH, prd.latest_vl_test_date, prd.encounter_datetime) >= 6) THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "pregnant", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_pregnant = 1 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "breastfeeding", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " CASE WHEN prd.is_mother_breastfeeding = 1 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "pregnant_and_on_arvs", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_pregnant = 1 AND prd.cur_arv_meds IS NOT NULL THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "breastfeeding_and_on_arvs", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_mother_breastfeeding = 1 AND prd.cur_arv_meds IS NOT NULL THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "virally_unsuppressed", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN TIMESTAMPDIFF(MONTH, DATE(prd.latest_vl_test_date), DATE(dts.endDate)) <= 6 AND prd.latest_viral_load >= 200 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "age_range", + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "extract(year from (from_days(datediff(now(),p.birthdate)))) >= 15", + "value": "15_and_above" + }, + { + "condition": "else", + "value": "below_15" + } + ] + } + }, + { + "type": "derived_column", + "alias": "encounter_month", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "MONTH(prd.encounter_datetime)" + } + }, + { + "type": "derived_column", + "alias": "reporting_month", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "date_format(prd.encounter_datetime, '%m/%Y')" + } + }, + { + "type": "derived_column", + "alias": "encounter_year", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "YEAR(prd.encounter_datetime)" + } + }, + { + "type": "simple_column", + "alias": "location", + "column": "l.name" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "prd.location_id" + }, + { + "type": "simple_column", + "alias": "encounter_datetime", + "column": "prd.encounter_datetime" + }, + { + "type": "simple_column", + "alias": "month", + "column": "prd.encounter_datetime" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "p.person_id" + }, + { + "type": "simple_column", + "alias": "gender", + "column": "p.gender" + }, + { + "type": "simple_column", + "alias": "age", + "column": "prd.age" + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "fhs.endDate=?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "l.uuid in (?)", + "parameterName": "locationUuids" + }, + { + "filterType": "tableColumns", + "conditionExpression": "round(datediff(prd.encounter_datetime,p.birthdate)/365) >= 0" + }, + { + "filterType": "tableColumns", + "conditionExpression": "round(datediff(prd.encounter_datetime,p.birthdate)/365) <= 120" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["prd.person_id"], + "excludeParam": "excludeParam" + } +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-framework.json b/app/reporting-framework/json-reports/RRI/pmtct-rri-framework.json new file mode 100644 index 000000000..72987825b --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri-framework.json @@ -0,0 +1,92 @@ +[ + { + "sectionTitle": "HEI Infant Missed PCR Testing", + "indicators": [ + { + "label": "Initial PCR < 8wks", + "ref": "HV02-44", + "indicator": "initial_pcr_less_than_8_wks" + }, + { + "label": "Initial PCR >= 8wks-12mnths", + "ref": "HV02-45", + "indicator": "initial_pcr_8_wks_to_12_months" + }, + { + "label": "Initial PCR < 12 mnths_Total", + "ref": "HV02-46", + "indicator": "initial_pcr_less_than_12_months" + }, + { + "label": "Second PCR at 6 months", + "ref": "", + "indicator": "second_pcr_6_months" + }, + { + "label": "Third PCR at 12 months", + "ref": "", + "indicator": "third_pcr_12_months" + } + ] + }, + { + "sectionTitle": "CALHIV Missed Viral Load Test", + "indicators": [ + { + "label": "Total CALHIV", + "ref": "", + "indicator": "all_calhiv" + }, + { + "label": "CALHIV Without Valid VL", + "ref": "", + "indicator": "calhiv_vl_done_past_6_months" + }, + { + "label": "CALHIV With Unsuppressed VL", + "ref": "", + "indicator": "calhiv_virally_unsuppressed" + }, + { + "label": "CALHIV Without DTG Based Regimen", + "ref": "", + "indicator": "regimen" + } + ] + }, + { + "sectionTitle": "PBFW Missed Viral Load Test", + "indicators": [ + { + "label": "Total Positive PBFW", + "ref": "", + "indicator": "all_pbfw" + }, + { + "label": "PBFW Without Valid VL", + "ref": "", + "indicator": "pbfw_vl_done_past_6_months" + }, + { + "label": "PBFW With Unsuppressed VL", + "ref": "", + "indicator": "pbfw_virally_unsuppressed" + } + ] + }, + { + "sectionTitle": "WRA Missed Viral Load Test", + "indicators": [ + { + "label": "Total WRA", + "ref": "", + "indicator": "all_wra" + }, + { + "label": "WRA Without contact", + "ref": "", + "indicator": "wra_vl_done_past_6_months" + } + ] + } +] diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-aggregate.json b/app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-aggregate.json new file mode 100644 index 000000000..57c7b2153 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-aggregate.json @@ -0,0 +1,84 @@ +{ + "name": "pmtctRriPbfwAggregate", + "version": "1.0", + "tag": "pmtct_rri_pbfw_aggregate", + "uses": [ + { + "name": "pmtctRriPbfwDataSetBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "pmtctRriPbfwDataSetBase", + "alias": "prd_base" + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "Reporting_Month", + "column": "reporting_month" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "location_id" + }, + { + "type": "simple_column", + "alias": "location_Name", + "column": "location" + }, + { + "type": "derived_column", + "alias": "all_pbfw", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(prd_base.person_id)" + } + }, + { + "type": "derived_column", + "alias": "pbfw_vl_done_past_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "SUM(prd_base.pbfw_vl_done_past_6_months)" + } + }, + { + "type": "derived_column", + "alias": "pbfw_virally_unsuppressed", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "SUM(prd_base.pbfw_virally_unsuppressed)" + } + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["prd_base.location_id", "prd_base.reporting_month"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "pmtct-rri-report-patient-list-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-dataset-base.json b/app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-dataset-base.json new file mode 100644 index 000000000..34d56663c --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-dataset-base.json @@ -0,0 +1,218 @@ +{ + "name": "pmtctRriPbfwDataSetBase", + "version": "1.0", + "tag": "pmtct_rri_pbfw_dataset_base", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.pmtct_rri_dataset", + "alias": "prd" + }, + { + "table": "etl.dates", + "alias": "dts", + "join": { + "type": "INNER", + "joinCondition": "prd.encounter_datetime <= dts.endDate and coalesce(prd.death_date, out_of_care) is null" + } + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "fhs", + "join": { + "type": "inner", + "joinCondition": "prd.person_id = fhs.person_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "prd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "p", + "join": { + "type": "INNER", + "joinCondition": "p.person_id = prd.person_id" + } + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "pbfw_vl_done_past_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " CASE WHEN prd.cur_arv_meds IS NOT NULL AND (prd.latest_vl_test_date IS NULL OR TIMESTAMPDIFF(MONTH, prd.latest_vl_test_date, prd.encounter_datetime) >= 6) THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "pregnant", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_pregnant = 1 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "breastfeeding", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " CASE WHEN prd.is_mother_breastfeeding = 1 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "pregnant_and_on_arvs", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_pregnant = 1 AND prd.cur_arv_meds IS NOT NULL THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "breastfeeding_and_on_arvs", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_mother_breastfeeding = 1 AND prd.cur_arv_meds IS NOT NULL THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "pbfw_virally_unsuppressed", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN TIMESTAMPDIFF(MONTH, DATE(prd.latest_vl_test_date), DATE(dts.endDate)) <= 6 AND prd.latest_viral_load >= 200 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "age_range", + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "extract(year from (from_days(datediff(now(),p.birthdate)))) >= 15", + "value": "15_and_above" + }, + { + "condition": "else", + "value": "below_15" + } + ] + } + }, + { + "type": "derived_column", + "alias": "encounter_month", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "MONTH(prd.encounter_datetime)" + } + }, + { + "type": "derived_column", + "alias": "reporting_month", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "date_format(prd.encounter_datetime, '%m/%Y')" + } + }, + { + "type": "derived_column", + "alias": "encounter_year", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "YEAR(prd.encounter_datetime)" + } + }, + { + "type": "simple_column", + "alias": "location", + "column": "l.name" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "prd.location_id" + }, + { + "type": "simple_column", + "alias": "encounter_datetime", + "column": "prd.encounter_datetime" + }, + { + "type": "simple_column", + "alias": "month", + "column": "prd.encounter_datetime" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "p.person_id" + }, + { + "type": "simple_column", + "alias": "gender", + "column": "p.gender" + }, + { + "type": "simple_column", + "alias": "age", + "column": "prd.age" + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "prd.is_pregnant = 1 OR prd.is_mother_breastfeeding = 1" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "fhs.endDate=?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "l.uuid in (?)", + "parameterName": "locationUuids" + }, + { + "filterType": "tableColumns", + "conditionExpression": "round(datediff(prd.encounter_datetime,p.birthdate)/365) >= 0" + }, + { + "filterType": "tableColumns", + "conditionExpression": "round(datediff(prd.encounter_datetime,p.birthdate)/365) <= 120" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["prd.person_id"], + "excludeParam": "excludeParam" + } +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-wra-aggregate.json b/app/reporting-framework/json-reports/RRI/pmtct-rri-wra-aggregate.json new file mode 100644 index 000000000..9d4677246 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri-wra-aggregate.json @@ -0,0 +1,84 @@ +{ + "name": "pmtctRriWraAggregate", + "version": "1.0", + "tag": "pmtct_rri_wra_aggregate", + "uses": [ + { + "name": "pmtctRriWraDataSetBase", + "version": "1.0", + "type": "dataset_def" + } + ], + "sources": [ + { + "dataSet": "pmtctRriWraDataSetBase", + "alias": "prd_base" + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "Reporting_Month", + "column": "reporting_month" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "location_id" + }, + { + "type": "simple_column", + "alias": "location_Name", + "column": "location" + }, + { + "type": "derived_column", + "alias": "all_wra", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "COUNT(prd_base.person_id)" + } + }, + { + "type": "derived_column", + "alias": "wra_vl_done_past_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "SUM(prd_base.wra_vl_done_past_6_months)" + } + }, + { + "type": "derived_column", + "alias": "wra_virally_unsuppressed", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "SUM(prd_base.wra_virally_unsuppressed)" + } + } + ], + "groupBy": { + "groupParam": "groupByParam", + "columns": ["prd_base.location_id", "prd_base.reporting_month"], + "excludeParam": "excludeParam" + }, + "transFormDirectives": { + "joinColumn": "location_id", + "joinColumnParam": "", + "skipColumns": [""], + "disaggregationColumns": [] + }, + "dynamicJsonQueryGenerationDirectives": { + "patientListGenerator": { + "useTemplate": "pmtct-rri-report-patient-list-template", + "useTemplateVersion": "1.0", + "generatingDirectives": { + "joinDirectives": { + "joinType": "INNER", + "joinCondition": "<> = <>", + "baseColumn": "person_id", + "templateColumn": "person_id" + } + } + } + } +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-wra-dataset-base.json b/app/reporting-framework/json-reports/RRI/pmtct-rri-wra-dataset-base.json new file mode 100644 index 000000000..0f7b5c498 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri-wra-dataset-base.json @@ -0,0 +1,222 @@ +{ + "name": "pmtctRriWraDataSetBase", + "version": "1.0", + "tag": "pmtct_rri_wra_dataset_base", + "description": "", + "uses": [], + "sources": [ + { + "table": "etl.pmtct_rri_dataset", + "alias": "prd" + }, + { + "table": "etl.dates", + "alias": "dts", + "join": { + "type": "INNER", + "joinCondition": "prd.encounter_datetime <= dts.endDate and coalesce(prd.death_date, out_of_care) is null" + } + }, + { + "table": "etl.hiv_monthly_report_dataset_v1_2", + "alias": "fhs", + "join": { + "type": "inner", + "joinCondition": "prd.person_id = fhs.person_id" + } + }, + { + "table": "amrs.location", + "alias": "l", + "join": { + "type": "INNER", + "joinCondition": "prd.location_id = l.location_id" + } + }, + { + "table": "amrs.person", + "alias": "p", + "join": { + "type": "INNER", + "joinCondition": "p.person_id = prd.person_id" + } + } + ], + "columns": [ + { + "type": "derived_column", + "alias": "wra_vl_done_past_6_months", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " CASE WHEN prd.cur_arv_meds IS NOT NULL AND (prd.latest_vl_test_date IS NULL OR TIMESTAMPDIFF(MONTH, prd.latest_vl_test_date, prd.encounter_datetime) >= 6) THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "pregnant", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_pregnant = 1 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "breastfeeding", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " CASE WHEN prd.is_mother_breastfeeding = 1 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "pregnant_and_on_arvs", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_pregnant = 1 AND prd.cur_arv_meds IS NOT NULL THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "breastfeeding_and_on_arvs", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN prd.is_mother_breastfeeding = 1 AND prd.cur_arv_meds IS NOT NULL THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "wra_virally_unsuppressed", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "CASE WHEN TIMESTAMPDIFF(MONTH, DATE(prd.latest_vl_test_date), DATE(dts.endDate)) <= 6 AND prd.latest_viral_load >= 200 THEN 1 ELSE NULL END" + } + }, + { + "type": "derived_column", + "alias": "age_range", + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "extract(year from (from_days(datediff(now(),p.birthdate)))) >= 15", + "value": "15_and_above" + }, + { + "condition": "else", + "value": "below_15" + } + ] + } + }, + { + "type": "derived_column", + "alias": "encounter_month", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "MONTH(prd.encounter_datetime)" + } + }, + { + "type": "derived_column", + "alias": "reporting_month", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "date_format(prd.encounter_datetime, '%m/%Y')" + } + }, + { + "type": "derived_column", + "alias": "encounter_year", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "YEAR(prd.encounter_datetime)" + } + }, + { + "type": "simple_column", + "alias": "location", + "column": "l.name" + }, + { + "type": "simple_column", + "alias": "location_uuid", + "column": "l.uuid" + }, + { + "type": "simple_column", + "alias": "location_id", + "column": "prd.location_id" + }, + { + "type": "simple_column", + "alias": "encounter_datetime", + "column": "prd.encounter_datetime" + }, + { + "type": "simple_column", + "alias": "month", + "column": "prd.encounter_datetime" + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "p.person_id" + }, + { + "type": "simple_column", + "alias": "gender", + "column": "p.gender" + }, + { + "type": "simple_column", + "alias": "age", + "column": "prd.age" + } + ], + "filters": { + "conditionJoinOperator": "and", + "conditions": [ + { + "filterType": "tableColumns", + "conditionExpression": "prd.age BETWEEN 15 AND 49" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.gender IN ('F')" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime >= ?", + "parameterName": "startDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "prd.encounter_datetime <= ?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "fhs.endDate=?", + "parameterName": "endDate" + }, + { + "filterType": "tableColumns", + "conditionExpression": "l.uuid in (?)", + "parameterName": "locationUuids" + }, + { + "filterType": "tableColumns", + "conditionExpression": "round(datediff(prd.encounter_datetime,p.birthdate)/365) >= 0" + }, + { + "filterType": "tableColumns", + "conditionExpression": "round(datediff(prd.encounter_datetime,p.birthdate)/365) <= 120" + } + ] + }, + "groupBy": { + "groupParam": "groupByParam", + "columns": ["prd.person_id"], + "excludeParam": "excludeParam" + } +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri.json b/app/reporting-framework/json-reports/RRI/pmtct-rri.json new file mode 100644 index 000000000..0f42d4592 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct-rri.json @@ -0,0 +1,8 @@ +{ + "reports": [ + "pmtctRriHeiAggregate", + "pmtctRriCalhivAggregate", + "pmtctRriPbfwAggregate", + "pmtctRriWraAggregate" + ] +} diff --git a/app/reporting-framework/json-reports/RRI/pmtct_rri_patient_list_template.json b/app/reporting-framework/json-reports/RRI/pmtct_rri_patient_list_template.json new file mode 100644 index 000000000..aa4c95288 --- /dev/null +++ b/app/reporting-framework/json-reports/RRI/pmtct_rri_patient_list_template.json @@ -0,0 +1,116 @@ +{ + "name": "pmtct-rri-report-patient-list-template", + "version": "1.0", + "tag": "pmtct-rri-report-patient-list-template", + "description": "PMTCT patient list template", + "sources": [ + { + "table": "amrs.person", + "alias": "t1" + }, + { + "table": "amrs.person_name", + "alias": "person_name", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = person_name.person_id AND (person_name.voided IS NULL || person_name.voided = 0) AND person_name.preferred = 1" + } + }, + { + "table": "amrs.patient_identifier", + "alias": "id", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = id.patient_id AND (id.voided IS NULL || id.voided = 0)" + } + }, + { + "table": "etl.flat_patient_identifiers_v1", + "alias": "flat_identifiers", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = flat_identifiers.patient_id" + } + }, + { + "table": "amrs.person_address", + "alias": "pa", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = pa.person_id" + } + } + ], + "columns": [ + { + "type": "simple_column", + "alias": "patient_uuid", + "column": "t1.uuid" + }, + { + "type": "simple_column", + "alias": "ccc_number", + "column": "flat_identifiers.ccc" + }, + { + "type": "simple_column", + "alias": "ovcid_id", + "column": "flat_identifiers.ovcid" + }, + { + "type": "simple_column", + "alias": "upi_number", + "column": "flat_identifiers.nupi" + }, + { + "type": "derived_column", + "alias": "uuid", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "t1.uuid" + } + }, + { + "type": "simple_column", + "alias": "person_id", + "column": "t1.person_id" + }, + { + "type": "simple_column", + "alias": "gender", + "column": "t1.gender" + }, + { + "type": "simple_column", + "alias": "birthdate", + "column": "t1.birthdate" + }, + { + "type": "derived_column", + "alias": "age", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": "extract(year from (from_days(datediff(now(),t1.birthdate))))" + } + }, + { + "type": "derived_column", + "alias": "person_name", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " CONCAT(COALESCE(person_name.given_name, ''), ' ', COALESCE(person_name.middle_name, ''), ' ', COALESCE(person_name.family_name, ''))" + } + }, + { + "type": "derived_column", + "alias": "identifiers", + "expressionType": "simple_expression", + "expressionOptions": { + "expression": " GROUP_CONCAT(DISTINCT id.identifier SEPARATOR ', ')" + } + } + ], + "groupBy": { + "columns": ["t1.person_id"] + } +} diff --git a/app/reporting-framework/multi-dataset-patientlist.report.js b/app/reporting-framework/multi-dataset-patientlist.report.js index 01c8e29ea..d06f5e13c 100755 --- a/app/reporting-framework/multi-dataset-patientlist.report.js +++ b/app/reporting-framework/multi-dataset-patientlist.report.js @@ -60,7 +60,6 @@ export class MultiDatasetPatientlistReport extends MultiDatasetReport { type: 'patient-list', indicators: indicators }; - let that = this; return new Promise((resolve, reject) => { this.generateReport(additionalParams) diff --git a/app/routes/pmtct-rri-report.route.js b/app/routes/pmtct-rri-report.route.js new file mode 100644 index 000000000..f4d7c23dd --- /dev/null +++ b/app/routes/pmtct-rri-report.route.js @@ -0,0 +1,142 @@ +var authorizer = require('../../authorization/etl-authorizer'); +import { PMTCTRRIReportingService } from '../../service/rri/pmtct_rri_reporting.service.js'; +import { PmtctRriSummaryService } from '../../service/rri/pmtct-rri-service.js'; +var etlHelpers = require('../../etl-helpers'); +var privileges = authorizer.getAllPrivileges(); +var preRequest = require('../../pre-request-processing'); +const routes = [ + { + method: 'GET', + + path: '/etl/pmtct_rri_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( + 'pmtct_rri_aggregate_summary', + ['startDate', 'endDate', 'locationUuids'], + requestParams + ); + + let service = new PmtctRriSummaryService( + 'pmtct_rri_aggregate_summary', + reportParams.requestParams + ); + service + .generateReport() + .then((result) => { + reply(result); + }) + .catch((error) => { + console.error('Error: ', error); + reply(error); + }); + }); + }, + description: 'PMTCT, HEI, CALHIV and WRA RRI reports', + notes: 'PMTCT, HEI, CALHIV and WRA RRI reports', + tags: ['api'], + validate: { + options: { + allowUnknown: true + }, + params: {} + } + } + }, + { + method: 'GET', + path: '/etl/pmtct_rri_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( + 'pmtct_rri_aggregate_summary', + ['endDate', 'locationUuids'], + requestParams + ); + delete reportParams.requestParams['gender']; + const pmtctrriService = new PmtctRriSummaryService( + 'pmtct_rri_aggregate_summary', + reportParams.requestParams + ); + pmtctrriService + .generatePatientListReport(reportParams.requestParams) + .then((result) => { + reply(result); + }) + .catch((error) => { + reply(error); + }); + }); + } + }, + description: + 'Get patient list for txnew summary report of the location and month provided', + notes: 'Returns patient list of txnew summary indicators', + tags: ['api'] + } + }, + + { + method: 'GET', + + path: '/etl/pmtct_rri_aggregate', + 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( + 'pmtct_rri_summary', + ['startDate', 'endDate', 'locationUuids'], + requestParams + ); + let service = new PMTCTRRIReportingService( + 'pmtctRriSummary', + reportParams.requestParams + ); + service + .getPmtctRriSummaryReport(reportParams.requestParams) + .then((result) => { + reply(result); + }) + .catch((error) => { + reply(error); + }); + }); + }, + description: 'PMTCT, HEI, CALHIV and WRA RRI reports', + notes: 'PMTCT, HEI, CALHIV and WRA RRI reports', + tags: ['api'], + validate: { + options: { + allowUnknown: true + }, + params: {} + } + } + } +]; +exports.routes = (server) => server.route(routes); diff --git a/service/rri/pmtct-rri-service.js b/service/rri/pmtct-rri-service.js new file mode 100644 index 000000000..d8d4bba1d --- /dev/null +++ b/service/rri/pmtct-rri-service.js @@ -0,0 +1,125 @@ +import ReportProcessorHelpersService from '../../app/reporting-framework/report-processor-helpers.service.js'; +import { MultiDatasetPatientlistReport } from '../../app/reporting-framework/multi-dataset-patientlist.report.js'; + +const _ = require('lodash'); +const Moment = require('moment'); + +const pmtctrriReportSections = require('../../app/reporting-framework/json-reports/rri/pmtct-rri-framework.json'); +const pmtctrriReportPatientListCols = require('../../app/reporting-framework/json-reports/rri/pmtct_rri_patient_list_template.json'); + +const etlHelpers = require('../../etl-helpers.js'); + +export class PmtctRriSummaryService 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: pmtctrriReportSections, + 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'] = pmtctrriReportPatientListCols; + delete results['result']; + _.each(results.results.results, (row) => { + row.cur_meds = etlHelpers.getARVNames(row.cur_meds); + }); + resolve(results); + }) + .catch((err) => { + reject(err); + }); + }); + } +} diff --git a/service/rri/pmtct_rri_reporting.service.js b/service/rri/pmtct_rri_reporting.service.js new file mode 100644 index 000000000..66493a43f --- /dev/null +++ b/service/rri/pmtct_rri_reporting.service.js @@ -0,0 +1,24 @@ +const Promise = require('bluebird'); +const Moment = require('moment'); +const _ = require('lodash'); +var processors = require('../../etl-processors.js'); +import { BaseMysqlReport } from '../../app/reporting-framework/base-mysql.report'; +export class PMTCTRRIReportingService { + getPmtctRriSummaryReport(reportParams) { + let self = this; + return new Promise(function (resolve, reject) { + let report = new BaseMysqlReport('pmtctRriSummary', reportParams); + console.log(report); + Promise.join(report.generateReport(), (results) => { + let result = results.results.results; + results.size = result ? result.length : 0; + results.result = result; + delete results['results']; + resolve(results); + // TODO Do some post processing + }).catch((errors) => { + reject(errors); + }); + }); + } +} From 5a7fee855d9723ff5b2d8ff4fd16bd97ca989ac4 Mon Sep 17 00:00:00 2001 From: Drizzentic Date: Fri, 6 Oct 2023 12:19:16 +0300 Subject: [PATCH 02/13] remove covid restriction (#1334) --- programs/patient-program-config.json | 366 +++++---------------------- 1 file changed, 63 insertions(+), 303 deletions(-) diff --git a/programs/patient-program-config.json b/programs/patient-program-config.json index b5f1f8a49..903b1679b 100755 --- a/programs/patient-program-config.json +++ b/programs/patient-program-config.json @@ -75,11 +75,7 @@ }, { "uuid": "8d5b27bc-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTINITIAL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTINITIAL" }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", @@ -140,11 +136,7 @@ }, { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTRETURN" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -205,27 +197,15 @@ }, { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTRETURN" }, { "uuid": "238625fc-8a25-44b2-aa5a-8bf48fa0e18d", @@ -290,11 +270,7 @@ }, { "uuid": "8d5b2dde-c2cc-11de-8d13-0010c6dffd0f", - "display": "PEDSINITIAL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "PEDSINITIAL" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -345,11 +321,7 @@ }, { "uuid": "8d5b3108-c2cc-11de-8d13-0010c6dffd0f", - "display": "PEDSRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "PEDSRETURN" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -405,11 +377,7 @@ }, { "uuid": "8d5b3108-c2cc-11de-8d13-0010c6dffd0f", - "display": "PEDSRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "PEDSRETURN" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -469,11 +437,7 @@ }, { "uuid": "fc8c1694-90fc-46a8-962b-73ce9a99a78f", - "display": "YOUTHINITIAL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "YOUTHINITIAL" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -529,11 +493,7 @@ }, { "uuid": "4e7553b4-373d-452f-bc89-3f4ad9a01ce7", - "display": "YOUTHRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "YOUTHRETURN" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -589,11 +549,7 @@ }, { "uuid": "4e7553b4-373d-452f-bc89-3f4ad9a01ce7", - "display": "YOUTHRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "YOUTHRETURN" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -674,11 +630,7 @@ }, { "uuid": "987009c6-6f24-43f7-9640-c285d6553c63", - "display": "DRUGPICKUP", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "DRUGPICKUP" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -749,19 +701,11 @@ "encounterTypes": [ { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -779,11 +723,7 @@ "encounterTypes": [ { "uuid": "10a86a62-b771-44d1-b1ad-3b8496c7bc47", - "display": "INPATIENTPEER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "INPATIENTPEER" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -1370,19 +1310,11 @@ }, { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTRETURN" }, { "uuid": "8e942fd1-135d-42bd-9701-04560f180ec5", - "display": "MOH257BLUECARD", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "MOH257BLUECARD" }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", @@ -1451,19 +1383,11 @@ }, { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTRETURN" }, { "uuid": "8e942fd1-135d-42bd-9701-04560f180ec5", - "display": "MOH257BLUECARD", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "MOH257BLUECARD" }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", @@ -1528,11 +1452,7 @@ "encounterTypes": [ { "uuid": "8d5b27bc-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTINITIAL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTINITIAL" }, { "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", @@ -1593,11 +1513,7 @@ "encounterTypes": [ { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTRETURN" }, { "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", @@ -1605,11 +1521,7 @@ }, { "uuid": "8e942fd1-135d-42bd-9701-04560f180ec5", - "display": "MOH257BLUECARD", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "MOH257BLUECARD" }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", @@ -1670,11 +1582,7 @@ "encounterTypes": [ { "uuid": "8d5b27bc-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTINITIAL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTINITIAL" }, { "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", @@ -1682,11 +1590,7 @@ }, { "uuid": "8d5b2dde-c2cc-11de-8d13-0010c6dffd0f", - "display": "PEDSINITIAL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "PEDSINITIAL" }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", @@ -1747,11 +1651,7 @@ "encounterTypes": [ { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTRETURN" }, { "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", @@ -1759,11 +1659,7 @@ }, { "uuid": "8e942fd1-135d-42bd-9701-04560f180ec5", - "display": "MOH257BLUECARD", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "MOH257BLUECARD" }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", @@ -1820,11 +1716,7 @@ "encounterTypes": [ { "uuid": "8d5b2dde-c2cc-11de-8d13-0010c6dffd0f", - "display": "PEDSINITIAL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "PEDSINITIAL" }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", @@ -1893,19 +1785,11 @@ }, { "uuid": "693559d3-4e44-4d33-83f9-bc70ca56fe34", - "display": "TXSUPPORTERMEDREFILL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "TXSUPPORTERMEDREFILL" }, { "uuid": "987009c6-6f24-43f7-9640-c285d6553c63", - "display": "DRUGPICKUP", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "DRUGPICKUP" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -1961,11 +1845,7 @@ "encounterTypes": [ { "uuid": "10a86a62-b771-44d1-b1ad-3b8496c7bc47", - "display": "INPATIENTPEER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "INPATIENTPEER" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -1983,19 +1863,11 @@ "encounterTypes": [ { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -2273,11 +2145,7 @@ "encounterTypes": [ { "uuid": "c3a78744-f94a-4a25-ac9d-1c48df887895", - "display": "PEPINITIAL", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "PEPINITIAL" }, { "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", @@ -2313,11 +2181,7 @@ "encounterTypes": [ { "uuid": "f091b833-9e1a-4eef-8364-fc289095a832", - "display": "PEPRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "PEPRETURN" }, { "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", @@ -2351,19 +2215,11 @@ "encounterTypes": [ { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -2381,11 +2237,7 @@ "encounterTypes": [ { "uuid": "10a86a62-b771-44d1-b1ad-3b8496c7bc47", - "display": "INPATIENTPEER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "INPATIENTPEER" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -2721,27 +2573,15 @@ }, { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", - "display": "ADULTRETURN", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "ADULTRETURN" }, { "uuid": "b690e24a-6dc7-40a8-8cbd-0924dd507dca", - "display": "YOUTHTHIRDLINE", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "YOUTHTHIRDLINE" }, { "uuid": "fed9ffa5-da88-484a-8259-bee7daa6d6f2", - "display": "PEDSTHIRDLINE", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "PEDSTHIRDLINE" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -2796,19 +2636,11 @@ "encounterTypes": [ { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -2826,11 +2658,7 @@ "encounterTypes": [ { "uuid": "10a86a62-b771-44d1-b1ad-3b8496c7bc47", - "display": "INPATIENTPEER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "INPATIENTPEER" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -3018,11 +2846,7 @@ "encounterTypes": [ { "uuid": "987009c6-6f24-43f7-9640-c285d6553c63", - "display": "DRUGPICKUP", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "DRUGPICKUP" }, { "uuid": "238625fc-8a25-44b2-aa5a-8bf48fa0e18d", @@ -3031,11 +2855,7 @@ }, { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -3043,11 +2863,7 @@ }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "cb5c0abd-0817-40e3-9413-8669561fadb9", @@ -3095,26 +2911,18 @@ { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", "display": "ADULTRETURN", - "allowedIf": "screenedForCovidToday && age > 24", + "allowedIf": " age > 24", "errors": { "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" } }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", @@ -3130,7 +2938,7 @@ }, { "uuid": "4e7553b4-373d-452f-bc89-3f4ad9a01ce7", - "allowedIf": "age >= 10 && age <= 24 && screenedForCovidToday", + "allowedIf": "age >= 10 && age <= 24", "display": "YOUTHRETURN" }, { @@ -3206,11 +3014,7 @@ }, { "uuid": "987009c6-6f24-43f7-9640-c285d6553c63", - "display": "DRUGPICKUP", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "DRUGPICKUP" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -3286,11 +3090,7 @@ }, { "uuid": "987009c6-6f24-43f7-9640-c285d6553c63", - "display": "DRUGPICKUP", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "DRUGPICKUP" }, { "uuid": "cb5c0abd-0817-40e3-9413-8669561fadb9", @@ -3320,19 +3120,11 @@ "encounterTypes": [ { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -3442,11 +3234,7 @@ }, { "uuid": "95f5847a-8952-4a3a-8610-caee271d351a", - "display": "TRANSITMEDICATION", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "TRANSITMEDICATION" }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", @@ -3463,11 +3251,7 @@ }, { "uuid": "987009c6-6f24-43f7-9640-c285d6553c63", - "display": "DRUGPICKUP", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "DRUGPICKUP" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -3485,19 +3269,11 @@ "encounterTypes": [ { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -3515,11 +3291,7 @@ "encounterTypes": [ { "uuid": "10a86a62-b771-44d1-b1ad-3b8496c7bc47", - "display": "INPATIENTPEER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "INPATIENTPEER" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -4672,7 +4444,7 @@ }, { "uuid": "c4efb6ba-e286-4933-8854-cd3af8e1ebef", - "allowedIf": "screenedForCovidToday && age >= 10 && age <= 24", + "allowedIf": " age >= 10 && age <= 24", "display": "YOUTHCOUNSELING" }, { @@ -4714,11 +4486,7 @@ }, { "uuid": "987009c6-6f24-43f7-9640-c285d6553c63", - "display": "DRUGPICKUP", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "DRUGPICKUP" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", @@ -4767,19 +4535,11 @@ "encounterTypes": [ { "uuid": "5ef97eed-18f5-40f6-9fbf-a11b1f06484a", - "display": "LABORDERENCOUNTER", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "LABORDERENCOUNTER" }, { "uuid": "5544894d-8add-4521-a0ea-c124c5886c8b", - "display": "POCLAB", - "allowedIf": "screenedForCovidToday", - "errors": { - "covidError": "To access clinical forms kindly fill Covid 19 Assessment Form" - } + "display": "POCLAB" }, { "uuid": "466d6707-8429-4e61-b5a0-d63444f5ad35", From 1ca79710cce8e997301ed49f59f32c3284d24a8b Mon Sep 17 00:00:00 2001 From: sharleenawinja <105132006+sharleenawinja@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:34:32 +0300 Subject: [PATCH 03/13] POC-548: Display the new Triage and Adherence forms under the clinical Visit (#1333) Co-authored-by: Drizzentic --- programs/patient-program-config.json | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/programs/patient-program-config.json b/programs/patient-program-config.json index 903b1679b..888de8993 100755 --- a/programs/patient-program-config.json +++ b/programs/patient-program-config.json @@ -73,6 +73,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "8d5b27bc-c2cc-11de-8d13-0010c6dffd0f", "display": "ADULTINITIAL" @@ -191,6 +195,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", "display": "TRANSFERENCOUNTER" @@ -264,6 +272,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", "display": "TRANSFERENCOUNTER" @@ -371,6 +383,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", "display": "TRANSFERENCOUNTER" @@ -431,6 +447,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", "display": "TRANSFERENCOUNTER" @@ -543,6 +563,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", "display": "TRANSFERENCOUNTER" @@ -1458,6 +1482,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "cbe2d31d-2201-44ce-b52e-fbd5dc7cff33", "display": "TRANSFERENCOUNTER" @@ -1519,6 +1547,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "8e942fd1-135d-42bd-9701-04560f180ec5", "display": "MOH257BLUECARD" @@ -1588,6 +1620,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "8d5b2dde-c2cc-11de-8d13-0010c6dffd0f", "display": "PEDSINITIAL" @@ -1657,6 +1693,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "8e942fd1-135d-42bd-9701-04560f180ec5", "display": "MOH257BLUECARD" @@ -2627,6 +2667,10 @@ { "uuid": "37770eca-8a2f-48d6-b3c8-54af0fa989c2", "display": "MENTALHEALTHSCREENING" + }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" } ] }, @@ -2932,6 +2976,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "df55584c-1350-11df-a1f1-0026b9348838", "display": "DEATHREPORT" @@ -4373,6 +4421,10 @@ "uuid": "a44ad5e2-b3ec-42e7-8cfa-8ba3dbcf5ed7", "display": "HIVTRIAGE" }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ADHERENCE" + }, { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", "display": "ADULTRETURN", From e48e08793ea3a834141d2df27314dae577f9627b Mon Sep 17 00:00:00 2001 From: Saningo Lekalantula Date: Thu, 12 Oct 2023 16:19:17 +0300 Subject: [PATCH 04/13] Add adherence encounter form to PMTCT(Viremia) program (#1337) Co-authored-by: kantush --- .../hei-infant-rri-testing-aggregate.json | 0 .../hei-infant-rri-testing-base.json | 0 .../pmtct-rri-cal-hiv-aggregate.json | 0 .../pmtct-rri-calhiv-dataset-base.json | 0 .../{RRI => rri}/pmtct-rri-dataset-base.json | 0 .../{RRI => rri}/pmtct-rri-framework.json | 0 .../{RRI => rri}/pmtct-rri-pbfw-aggregate.json | 0 .../pmtct-rri-pbfw-dataset-base.json | 0 .../{RRI => rri}/pmtct-rri-wra-aggregate.json | 0 .../{RRI => rri}/pmtct-rri-wra-dataset-base.json | 0 .../json-reports/{RRI => rri}/pmtct-rri.json | 0 .../pmtct_rri_patient_list_template.json | 0 programs/patient-program-config.json | 16 ++++++++++++++++ 13 files changed, 16 insertions(+) rename app/reporting-framework/json-reports/{RRI => rri}/hei-infant-rri-testing-aggregate.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/hei-infant-rri-testing-base.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri-cal-hiv-aggregate.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri-calhiv-dataset-base.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri-dataset-base.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri-framework.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri-pbfw-aggregate.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri-pbfw-dataset-base.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri-wra-aggregate.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri-wra-dataset-base.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct-rri.json (100%) rename app/reporting-framework/json-reports/{RRI => rri}/pmtct_rri_patient_list_template.json (100%) diff --git a/app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-aggregate.json b/app/reporting-framework/json-reports/rri/hei-infant-rri-testing-aggregate.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-aggregate.json rename to app/reporting-framework/json-reports/rri/hei-infant-rri-testing-aggregate.json diff --git a/app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-base.json b/app/reporting-framework/json-reports/rri/hei-infant-rri-testing-base.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/hei-infant-rri-testing-base.json rename to app/reporting-framework/json-reports/rri/hei-infant-rri-testing-base.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-cal-hiv-aggregate.json b/app/reporting-framework/json-reports/rri/pmtct-rri-cal-hiv-aggregate.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri-cal-hiv-aggregate.json rename to app/reporting-framework/json-reports/rri/pmtct-rri-cal-hiv-aggregate.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-calhiv-dataset-base.json b/app/reporting-framework/json-reports/rri/pmtct-rri-calhiv-dataset-base.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri-calhiv-dataset-base.json rename to app/reporting-framework/json-reports/rri/pmtct-rri-calhiv-dataset-base.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-dataset-base.json b/app/reporting-framework/json-reports/rri/pmtct-rri-dataset-base.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri-dataset-base.json rename to app/reporting-framework/json-reports/rri/pmtct-rri-dataset-base.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-framework.json b/app/reporting-framework/json-reports/rri/pmtct-rri-framework.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri-framework.json rename to app/reporting-framework/json-reports/rri/pmtct-rri-framework.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-aggregate.json b/app/reporting-framework/json-reports/rri/pmtct-rri-pbfw-aggregate.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-aggregate.json rename to app/reporting-framework/json-reports/rri/pmtct-rri-pbfw-aggregate.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-dataset-base.json b/app/reporting-framework/json-reports/rri/pmtct-rri-pbfw-dataset-base.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri-pbfw-dataset-base.json rename to app/reporting-framework/json-reports/rri/pmtct-rri-pbfw-dataset-base.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-wra-aggregate.json b/app/reporting-framework/json-reports/rri/pmtct-rri-wra-aggregate.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri-wra-aggregate.json rename to app/reporting-framework/json-reports/rri/pmtct-rri-wra-aggregate.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri-wra-dataset-base.json b/app/reporting-framework/json-reports/rri/pmtct-rri-wra-dataset-base.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri-wra-dataset-base.json rename to app/reporting-framework/json-reports/rri/pmtct-rri-wra-dataset-base.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct-rri.json b/app/reporting-framework/json-reports/rri/pmtct-rri.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct-rri.json rename to app/reporting-framework/json-reports/rri/pmtct-rri.json diff --git a/app/reporting-framework/json-reports/RRI/pmtct_rri_patient_list_template.json b/app/reporting-framework/json-reports/rri/pmtct_rri_patient_list_template.json similarity index 100% rename from app/reporting-framework/json-reports/RRI/pmtct_rri_patient_list_template.json rename to app/reporting-framework/json-reports/rri/pmtct_rri_patient_list_template.json diff --git a/programs/patient-program-config.json b/programs/patient-program-config.json index 888de8993..49deeab16 100755 --- a/programs/patient-program-config.json +++ b/programs/patient-program-config.json @@ -1392,6 +1392,10 @@ { "uuid": "37770eca-8a2f-48d6-b3c8-54af0fa989c2", "display": "MENTALHEALTHSCREENING" + }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ENHANCEDADHERENCE" } ] }, @@ -1465,6 +1469,10 @@ { "uuid": "37770eca-8a2f-48d6-b3c8-54af0fa989c2", "display": "MENTALHEALTHSCREENING" + }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ENHANCEDADHERENCE" } ] }, @@ -1530,6 +1538,10 @@ { "uuid": "37770eca-8a2f-48d6-b3c8-54af0fa989c2", "display": "MENTALHEALTHSCREENING" + }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ENHANCEDADHERENCE" } ] }, @@ -1603,6 +1615,10 @@ { "uuid": "37770eca-8a2f-48d6-b3c8-54af0fa989c2", "display": "MENTALHEALTHSCREENING" + }, + { + "uuid": "2226e81f-38fc-4672-a615-1d37e1c8e637", + "display": "ENHANCEDADHERENCE" } ] }, From 90ed1b3bc3e048849fd43cae3a9ea2b1f284b3f3 Mon Sep 17 00:00:00 2001 From: Saningo Lekalantula Date: Wed, 15 Nov 2023 12:44:13 +0300 Subject: [PATCH 05/13] Prep line Lists to populate data on the columns (#1338) Co-authored-by: kantush --- .../patient-list-with-contacts-template.json | 114 ++++++++++++++++++ .../new/new-for-prep-base.json | 31 ++++- 2 files changed, 142 insertions(+), 3 deletions(-) diff --git a/app/reporting-framework/json-reports/patient-list-with-contacts-template.json b/app/reporting-framework/json-reports/patient-list-with-contacts-template.json index f7ac08f90..0dc61d894 100755 --- a/app/reporting-framework/json-reports/patient-list-with-contacts-template.json +++ b/app/reporting-framework/json-reports/patient-list-with-contacts-template.json @@ -103,6 +103,14 @@ "type": "LEFT", "joinCondition": "delivery_report.person_id = t1.person_id and DATE_FORMAT(delivery_report.date_created, '%Y-%m-%d')='{startDate}'" } + }, + { + "table": "etl.flat_prep_summary_v1_1", + "alias": "fps", + "join": { + "type": "LEFT", + "joinCondition": "t1.person_id = fps.person_id AND fps.next_encounter_datetime IS NULL AND fps.encounter_type NOT IN (99999)" + } } ], "columns": [ @@ -142,6 +150,112 @@ "expression": "extract(year from (from_days(datediff(now(),t1.birthdate))))" } }, + { + "type": "simple_column", + "alias": "prev_rtc_date", + "column": "date_format(fps.prev_rtc_date, '%Y-%m-%d')" + }, + { + "type": "simple_column", + "alias": "cur_prep_meds_names", + "column": "fps.cur_prep_meds_names" + }, + { + "type": "simple_column", + "alias": "rapid_test_date", + "column": "date_format(fps.hiv_rapid_test_date, '%Y-%m-%d')" + }, + { + "type": "derived_column", + "alias": "hiv_rapid_test", + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "fps.hiv_rapid_test_result = 703", + "value": "Positive" + }, + { + "condition": "fps.hiv_rapid_test_result = 664", + "value": "Negative" + }, + { + "condition": "fps.hiv_rapid_test_result = 1138", + "value": "Indeterminate" + }, + { + "condition": "fps.hiv_rapid_test_result = 1304", + "value": "Poor sample quality" + }, + { + "condition": "fps.hiv_rapid_test_result = 1067", + "value": "Unknown" + } + ] + } + }, + { + "type": "derived_column", + "alias": "population_type_category", + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "fps.sub_population_type = 1", + "value": "MSM" + }, + { + "condition": "fps.sub_population_type = 2", + "value": "MSW" + }, + { + "condition": "fps.sub_population_type = 3", + "value": "FSW" + }, + { + "condition": "fps.sub_population_type = 4", + "value": "IDU" + }, + { + "condition": "fps.sub_population_type = 5", + "value": "TRANS WOMAN" + }, + { + "condition": "fps.sub_population_type = 6", + "value": "TRANS MAN" + }, + { + "condition": "fps.sub_population_type = 7", + "value": "FISHER FOLK" + }, + { + "condition": "fps.sub_population_type = 8", + "value": "CSW" + }, + { + "condition": "fps.sub_population_type = 9", + "value": "DISPLACED PERSONS" + }, + { + "condition": "fps.sub_population_type = 10", + "value": "Military and other" + }, + { + "condition": "fps.sub_population_type = 12", + "value": "TRUCK/LORRY DRIVER" + }, + { + "condition": "fps.sub_population_type = 13", + "value": "NIDU" + } + ] + } + }, + { + "type": "simple_column", + "alias": "enrollment_date", + "column": "date_format(fps.enrollment_date, '%Y-%m-%d')" + }, { "type": "derived_column", "alias": "person_name", diff --git a/app/reporting-framework/json-reports/prep-monthly/disaggregations/new/new-for-prep-base.json b/app/reporting-framework/json-reports/prep-monthly/disaggregations/new/new-for-prep-base.json index b0880c767..aa31e79ce 100644 --- a/app/reporting-framework/json-reports/prep-monthly/disaggregations/new/new-for-prep-base.json +++ b/app/reporting-framework/json-reports/prep-monthly/disaggregations/new/new-for-prep-base.json @@ -43,7 +43,7 @@ { "type": "simple_column", "alias": "ccc_number", - "column": "fi.ccc" + "column": "IFNULL(fi.ccc, 'No CCC')" }, { "type": "simple_column", @@ -60,6 +60,11 @@ "alias": "age", "column": "pd.age" }, + { + "type": "simple_column", + "alias": "latest_rtc_date", + "column": "date_format(pd.rtc_date, '%Y-%m-%d')" + }, { "type": "simple_column", "alias": "location_id", @@ -76,9 +81,29 @@ "column": "l.uuid" }, { - "type": "simple_column", + "type": "derived_column", "alias": "population_type", - "column": "pd.population_type" + "expressionType": "case_statement", + "expressionOptions": { + "caseOptions": [ + { + "condition": "pd.population_type = 1", + "value": "discordant" + }, + { + "condition": "pd.population_type = 2", + "value": "priority" + }, + { + "condition": "pd.population_type = 3 or pd.population_type is null", + "value": "general" + }, + { + "condition": "pd.population_type = 4", + "value": "key" + } + ] + } }, { "type": "derived_column", From 135ff2f5e58e73dfab41fac188784c932f6f0bba Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:19:13 +0300 Subject: [PATCH 06/13] POC-584a (#1343) * display patient intervention status based on latest pre-follow-up form * pre.encounter --------- Co-authored-by: Drizzentic --- .../ml-weekly-predictions-base.json | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json index f2fa4b3a7..847dff7fa 100644 --- a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json +++ b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json @@ -46,7 +46,16 @@ "alias": "pre", "join": { "type": "LEFT", - "joinCondition": "pre.person_id = ml.person_id" + "joinCondition": "pre.person_id = ml.person_id and(DATEDIFF(ml.start_date, pre.encounter_datetime) <= 7)" + } + }, + + { + "table": "( select max(is_successful_phone_follow_up) as latest_phone_follow_up, person_id, follow_up_type from etl.pre_appointment_summary group by person_id )", + "alias": "s", + "join": { + "type": "LEFT", + "joinCondition": "pre.person_id = s.person_id" } } ], @@ -180,12 +189,12 @@ }, { "filterType": "tableColumns", - "conditionExpression": "(if((pre.is_successful_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)) = ?", + "conditionExpression": "(if((latest_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)) = ?", "parameterName": "successfulOutcome" }, { "filterType": "tableColumns", - "conditionExpression": "(if((pre.is_successful_phone_follow_up = 'NO' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'NO')), 1, 0)) = ?", + "conditionExpression": "(if((latest_phone_follow_up = 'NO' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'NO')), 1, 0)) = ?", "parameterName": "failedOutcome" }, { From f39d96ebdc47358714a518420cabac8d0b72ca7b Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Wed, 15 Nov 2023 15:46:35 +0300 Subject: [PATCH 07/13] Poc 549 (#1341) * POC-549: change TPT reminder * changed IPT to TPT --------- Co-authored-by: Drizzentic --- service/patient-reminder.service.js | 42 ++++++++--------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/service/patient-reminder.service.js b/service/patient-reminder.service.js index f52fd9f7b..582953566 100755 --- a/service/patient-reminder.service.js +++ b/service/patient-reminder.service.js @@ -424,6 +424,12 @@ function TPTReminders(data) { data.inh_treatment_days_remaining < 150 ) { showReminder = true; + } else if ( + data.is_on_inh_treatment && + data.inh_treatment_days_remaining <= 30 && + data.inh_treatment_days_remaining > 0 + ) { + showReminder = true; } // INH Treatment Reminder - last month try { @@ -432,7 +438,7 @@ function TPTReminders(data) { message: 'Patient started ' + months + - ' months' + + ' months ' + treatment + ' treatment on (' + Moment(data.ipt_start_date).format('DD-MM-YYYY') + @@ -442,7 +448,7 @@ function TPTReminders(data) { '). ' + data.inh_treatment_days_remaining + ' days remaining.', - title: 'INH Treatment Reminder', + title: 'TPT Treatment Reminder', type: 'danger', display: { banner: true, @@ -453,32 +459,6 @@ function TPTReminders(data) { } catch (e) { console.log(e); } - // INH Treatment Reminder - last month - if ( - data.is_on_inh_treatment && - data.inh_treatment_days_remaining <= 30 && - data.inh_treatment_days_remaining > 0 - ) { - reminders.push({ - message: - 'Patient started ' + - months + - ' month ' + - treatment + - 'treatment since (' + - Moment(data.ipt_start_date).format('DD-MM-YYYY') + - '). Expected to end on (' + - Moment(data.ipt_completion_date).format('DD-MM-YYYY') + - ') ', - title: 'INH Treatment Reminder', - type: 'danger', - display: { - banner: true, - toast: true - } - }); - } - // TPT Reminders if ( calculateAge(data.birth_date) >= 1 && @@ -761,11 +741,11 @@ function getIptCompletionReminder(data) { message: 'Patient started ' + months + - ' month IPT on ' + + ' month TPT on ' + Moment(data.ipt_start_date).format('DD-MM-YYYY') + ' and was supposed to be completed on ' + Moment(data.ipt_start_date).add(months, 'months').format('DD-MM-YYYY'), - title: 'IPT Completion Reminder', + title: 'TPT Completion Reminder', type: 'danger', display: { banner: true, @@ -773,7 +753,7 @@ function getIptCompletionReminder(data) { } }); } else { - console.info.call('No IPT Completion Reminder For Selected Patient'); + console.info.call('No TPT Completion Reminder For Selected Patient'); } return reminders; From b87f768900e6a18fa566ec3859c2f9eca1818bba Mon Sep 17 00:00:00 2001 From: derrick rono Date: Thu, 16 Nov 2023 10:50:54 +0300 Subject: [PATCH 08/13] Revert viremia changes and add new ml locations --- programs/patient-program-config.json | 6 +++--- programs/scope-builder.service.js | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/programs/patient-program-config.json b/programs/patient-program-config.json index 49deeab16..4527cb34a 100755 --- a/programs/patient-program-config.json +++ b/programs/patient-program-config.json @@ -4444,7 +4444,7 @@ { "uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f", "display": "ADULTRETURN", - "allowedIf": "!isViremicHighVL && age > 24", + "allowedIf": "age > 24", "errors": { "viremiaError": "To access clinical forms kindly fill Enhanced Adherence Encounter Form" } @@ -4452,7 +4452,7 @@ { "uuid": "4e7553b4-373d-452f-bc89-3f4ad9a01ce7", "display": "YOUTHRETURN", - "allowedIf": "!isViremicHighVL && age >= 10 && age <= 24", + "allowedIf": "age >= 10 && age <= 24", "errors": { "viremiaError": "To access clinical forms kindly fill Enhanced Adherence Encounter Form" } @@ -4460,7 +4460,7 @@ { "uuid": "8d5b3108-c2cc-11de-8d13-0010c6dffd0f", "display": "PEDSRETURN", - "allowedIf": "!isViremicHighVL && age <= 14", + "allowedIf": "age <= 14", "errors": { "viremiaError": "To access clinical forms kindly fill Enhanced Adherence Encounter Form" } diff --git a/programs/scope-builder.service.js b/programs/scope-builder.service.js index c9e8f4dfb..60e7c3101 100755 --- a/programs/scope-builder.service.js +++ b/programs/scope-builder.service.js @@ -29,7 +29,13 @@ function buildScope(dataDictionary) { 'db2bdd7c-5fe6-4ea3-adc1-d2d8dfb3d658', '17c97881-90e5-43c8-b8a3-cc0322f89a89', 'e9f515c2-7c48-4099-ac76-41db9977f96f', - 'f7aabb83-7915-4c24-88b2-bcde8b3a9977' + 'f7aabb83-7915-4c24-88b2-bcde8b3a9977', + '08feae7c-1352-11df-a1f1-0026b9348838', + '1ce5034b-f05d-46b6-910f-fc959e091641', + '29124daf-6422-4896-b70e-daad3b252c9d', + '08fec42a-1352-11df-a1f1-0026b9348838', + 'a36c86bb-7ca3-4319-8674-28c66ba14deb', + '345514ae-8f37-42fc-9bbe-993828c2910d' ].includes(dataDictionary.intendedVisitLocationUuid); if (dataDictionary.patient) { buildPatientScopeMembers(scope, dataDictionary.patient); @@ -93,7 +99,13 @@ function buildScope(dataDictionary) { 'db2bdd7c-5fe6-4ea3-adc1-d2d8dfb3d658', '17c97881-90e5-43c8-b8a3-cc0322f89a89', 'e9f515c2-7c48-4099-ac76-41db9977f96f', - 'f7aabb83-7915-4c24-88b2-bcde8b3a9977' + 'f7aabb83-7915-4c24-88b2-bcde8b3a9977', + '08feae7c-1352-11df-a1f1-0026b9348838', + '1ce5034b-f05d-46b6-910f-fc959e091641', + '29124daf-6422-4896-b70e-daad3b252c9d', + '08fec42a-1352-11df-a1f1-0026b9348838', + 'a36c86bb-7ca3-4319-8674-28c66ba14deb', + '345514ae-8f37-42fc-9bbe-993828c2910d' ].includes(dataDictionary.intendedVisitLocationUuid); } From 00029c22e7730fef490660e5c152cff4505fe8bc Mon Sep 17 00:00:00 2001 From: Henry Korir <5462699+henrykorir@users.noreply.github.com> Date: Thu, 16 Nov 2023 15:28:45 +0300 Subject: [PATCH 09/13] POC-583: Stop display of the Reminder To Start TPT when the Client is on TB Treatment (#1347) --- .../clinical-reminder-report.json | 30 +++++++++++++++++++ service/patient-reminder.service.js | 3 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/reporting-framework/json-reports/clinical-reminder-report.json b/app/reporting-framework/json-reports/clinical-reminder-report.json index af46abd99..4af7a002a 100644 --- a/app/reporting-framework/json-reports/clinical-reminder-report.json +++ b/app/reporting-framework/json-reports/clinical-reminder-report.json @@ -229,6 +229,36 @@ "alias": "latest_CD4_Date", "column": "ls.cd4_1_date" }, + { + "type": "simple_column", + "alias": "ipt_start_date", + "column": "ls.ipt_start_date" + }, + { + "type": "simple_column", + "alias": "ipt_stop_date", + "column": "ls.ipt_stop_date" + }, + { + "type": "simple_column", + "alias": "on_ipt", + "column": "ls.on_ipt" + }, + { + "type": "simple_column", + "alias": "ipt_completion_date", + "column": "ls.ipt_completion_date" + }, + { + "type": "simple_column", + "alias": "tb_tx_start_date", + "column": "ls.tb_tx_start_date" + }, + { + "type": "simple_column", + "alias": "tb_tx_end_date", + "column": "ls.tb_tx_end_date" + }, { "type": "simple_column", "alias": "on_tb_tx", diff --git a/service/patient-reminder.service.js b/service/patient-reminder.service.js index 582953566..37cac3049 100755 --- a/service/patient-reminder.service.js +++ b/service/patient-reminder.service.js @@ -463,7 +463,8 @@ function TPTReminders(data) { if ( calculateAge(data.birth_date) >= 1 && !data.ipt_start_date && - !data.on_tb_tx + !data.on_tb_tx && + !(data.tb_tx_start_date && !data.tb_tx_end_date) ) { reminders.push({ message: From e82f61ef10e79c3958b64bbdd48cf7397f2e627c Mon Sep 17 00:00:00 2001 From: Faith Kamau <121166087+hiqedme@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:26:48 +0300 Subject: [PATCH 10/13] Added turbo new sites --- service/eid/eid-facility-mappings.json | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/service/eid/eid-facility-mappings.json b/service/eid/eid-facility-mappings.json index 5c46b9a0b..719daf228 100755 --- a/service/eid/eid-facility-mappings.json +++ b/service/eid/eid-facility-mappings.json @@ -2834,6 +2834,33 @@ "cityVillage": "", "eidDisplay": "" }, + "0cc1e6c8-69a5-4b78-932d-6170fcfb98fe": { + "mrsId": 496, + "mrsDisplay": "Bravo Module-Turbo", + "description": "Bravo Module-Turbo", + "mflCode": "15753", + "county": "Uasin Gishu County", + "cityVillage": "", + "eidDisplay": "" + }, + "a844aa95-e9a6-416b-942b-ac07c1ef84fe": { + "mrsId": 497, + "mrsDisplay": "Maisha Module-Turbo", + "description": "Maisha Module-Turbo", + "mflCode": "15753", + "county": "Uasin Gishu County", + "cityVillage": "", + "eidDisplay": "" + }, + "c22318da-d854-43fa-bd1e-8cb7d1d16ebf": { + "mrsId": 498, + "mrsDisplay": "Victor's Module-Turbo", + "description": "Victor's Module-Turbo", + "mflCode": "15753", + "county": "Uasin Gishu County", + "cityVillage": "", + "eidDisplay": "" + }, "469bb74e-18a4-4d74-872e-55fcebe12dc7": { "mrsId": 328, "mrsDisplay": "Soy MCH", From e035541ec915e7198c99782ae80c3e296c552cb5 Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Wed, 29 Nov 2023 09:53:42 +0300 Subject: [PATCH 11/13] failed follow-up attempt checks latest pre-appointment encounter (#1353) --- .../json-reports/ml-predictions/ml-weekly-predictions-base.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json index 847dff7fa..657e44139 100644 --- a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json +++ b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json @@ -165,7 +165,7 @@ "alias": "was_follow_up_successful", "expressionType": "simple_expression", "expressionOptions": { - "expression": "if((pre.is_successful_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)" + "expression": "if((latest_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)" } }, { From 73089a6c8b86ba9f805d56e61bd51c93ae1825d2 Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:12:11 +0300 Subject: [PATCH 12/13] POC-570: remove reminder after patient has made clinical visit (#1350) * remove reminder after patient has made clinical visit * POC-570: worked on query to select clinical encounters only --------- Co-authored-by: Drizzentic --- .../json-reports/clinical-reminder-report.json | 2 +- service/patient-reminder.service.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/reporting-framework/json-reports/clinical-reminder-report.json b/app/reporting-framework/json-reports/clinical-reminder-report.json index 4af7a002a..c5e0f3be0 100644 --- a/app/reporting-framework/json-reports/clinical-reminder-report.json +++ b/app/reporting-framework/json-reports/clinical-reminder-report.json @@ -222,7 +222,7 @@ { "type": "simple_column", "alias": "last_encounter_date", - "column": "ls.encounter_datetime" + "column": "t1.encounter_datetime" }, { "type": "simple_column", diff --git a/service/patient-reminder.service.js b/service/patient-reminder.service.js index 37cac3049..74498f2b2 100755 --- a/service/patient-reminder.service.js +++ b/service/patient-reminder.service.js @@ -945,7 +945,10 @@ function getFPExpiryDate(data) { function generateAppointmentNoShowUpRiskReminder(data) { let reminders = []; const predicted_score = (data.predicted_prob_disengage * 100).toFixed(2); - if (data.predicted_risk) { + if ( + data.predicted_risk && + data.last_encounter_date < data.prediction_generated_date + ) { if (data.predicted_risk === 'Medium Risk') { reminders.push({ message: From d5628163dc57ae5c8d3440c8549966200d396b6c Mon Sep 17 00:00:00 2001 From: Angie-540 <96350406+Angie-540@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:35:26 +0300 Subject: [PATCH 13/13] POC-492: added query to track failed phone attempts (#1340) * POC-492: added query to track failed phone attempts * added query to indicate number of failed phone attempts within prediction cycle * POC-492:added query to indicate number of failed phone attempts within prediction cycle --------- Co-authored-by: Drizzentic --- .../ml-predictions/ml-weekly-predictions-base.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json index 657e44139..39d5293e8 100644 --- a/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json +++ b/app/reporting-framework/json-reports/ml-predictions/ml-weekly-predictions-base.json @@ -49,7 +49,6 @@ "joinCondition": "pre.person_id = ml.person_id and(DATEDIFF(ml.start_date, pre.encounter_datetime) <= 7)" } }, - { "table": "( select max(is_successful_phone_follow_up) as latest_phone_follow_up, person_id, follow_up_type from etl.pre_appointment_summary group by person_id )", "alias": "s", @@ -57,6 +56,14 @@ "type": "LEFT", "joinCondition": "pre.person_id = s.person_id" } + }, + { + "table": "(SELECT et.person_id, SUM(CASE WHEN et.is_successful_phone_follow_up = 'YES' THEN 0 WHEN et.is_successful_phone_follow_up = 'NO' THEN 1 ELSE 0 END) AS counter FROM etl.pre_appointment_summary et left join predictions.ml_weekly_predictions mwl on et.person_id = mwl.person_id WHERE et.encounter_datetime BETWEEN mwl.prediction_generated_date AND DATE_ADD(mwl.prediction_generated_date, INTERVAL 14 DAY) GROUP BY et.person_id)", + "alias": "etc", + "join": { + "type": "LEFT", + "joinCondition": "ml.person_id = etc.person_id" + } } ], "columns": [ @@ -168,6 +175,11 @@ "expression": "if((latest_phone_follow_up = 'YES' OR (pre.attempted_home_visit = 'YES' AND pre.was_client_found = 'YES')), 1, 0)" } }, + { + "type": "simple_column", + "alias": "number_of_failed_phone_attempts", + "column": "etc.counter" + }, { "type": "simple_column", "alias": "comments",