From 5a6d662cd9e32082e3feb583967c4ca9d3304bc6 Mon Sep 17 00:00:00 2001 From: njorocs Date: Tue, 11 Mar 2025 11:56:02 +0300 Subject: [PATCH] Fixed bug on clients eligible for VL indicator query for realtime facility dashboards. Updated comments for vl indicators in Clinical action report --- .../kenyaemr/FacilityDashboardUtil.java | 28 ++----------------- .../PublicHealthActionCohortLibrary.java | 4 +-- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/FacilityDashboardUtil.java b/api/src/main/java/org/openmrs/module/kenyaemr/FacilityDashboardUtil.java index 7147da26e..5436e5d30 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/FacilityDashboardUtil.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/FacilityDashboardUtil.java @@ -211,7 +211,7 @@ public static Long getPregnantPostpartumNotInPrep() { /** * Surveillance dashboards - * 3. Delayed viral load testing. Eligible without VL test taken + * Clients eligible for VL test * @return long value */ public static Long getEligibleForVl() { @@ -269,31 +269,7 @@ public static Long getEligibleForVl() { " TIMESTAMPDIFF(MONTH, v.date_test_requested, DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) >=\n" + " 12) and\n" + " v.vl_result < 200) -- PG & BF after PG/BF baseline < 200\n" + - ") b on e.patient_id = b.patient_id;\n" + - "\n" + - "-- Eligible for VL sample not taken\n" + - "select count(v.patient_id) as eligible_for_vl\n" + - "from kenyaemr_etl.etl_viral_load_validity_tracker v\n" + - " inner join kenyaemr_etl.etl_patient_demographics d on v.patient_id = d.patient_id\n" + - "where ((TIMESTAMPDIFF(MONTH, v.date_started_art, DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) >= 3 and\n" + - " v.base_viral_load_test_result is null) -- First VL new on ART\n" + - " OR ((v.pregnancy_status = 1065 or v.breastfeeding_status = 1065) and\n" + - " TIMESTAMPDIFF(MONTH, v.date_started_art, DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) >= 3 and\n" + - " (v.vl_result is not null and v.date_test_requested < v.latest_hiv_followup_visit)) -- immediate for PG & BF\n" + - " OR (v.vl_result >= 200 AND\n" + - " TIMESTAMPDIFF(MONTH, v.date_test_requested, DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) >= 3) -- Unsuppressed VL\n" + - " OR (v.vl_result < 200 AND\n" + - " TIMESTAMPDIFF(MONTH, v.date_test_requested, DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) >= 6 and\n" + - " TIMESTAMPDIFF(YEAR, v.date_test_requested, d.DOB) BETWEEN 0 AND 24) -- 0-24 with last suppressed vl\n" + - " OR (v.vl_result < 200 AND\n" + - " TIMESTAMPDIFF(MONTH, v.date_test_requested, DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) >= 12 and\n" + - " TIMESTAMPDIFF(YEAR, v.date_test_requested, d.DOB) > 24) -- > 24 with last suppressed vl\n" + - " OR ((v.pregnancy_status = 1065 or v.breastfeeding_status = 1065) and\n" + - " TIMESTAMPDIFF(MONTH, v.date_started_art, DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) >= 3\n" + - " and (v.order_reason in (159882, 1434) and\n" + - " TIMESTAMPDIFF(MONTH, v.date_test_requested, DATE_SUB(CURRENT_DATE, INTERVAL 7 DAY)) >= 12) and\n" + - " v.vl_result < 200)) -- PG & BF after PG/BF baseline < 200\n" + - " and v.latest_hiv_followup_visit != v.date_test_requested;"; + ") b on e.patient_id = b.patient_id;"; try { Context.addProxyPrivilege(PrivilegeConstants.SQL_LEVEL_ACCESS); diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/publicHealthActionReport/PublicHealthActionCohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/publicHealthActionReport/PublicHealthActionCohortLibrary.java index c417b85e7..7b72fa91f 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/publicHealthActionReport/PublicHealthActionCohortLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/publicHealthActionReport/PublicHealthActionCohortLibrary.java @@ -917,11 +917,11 @@ public CohortDefinition eligibleForVLSampleNotTaken() { " v.vl_result < 200)) -- PG & BF after PG/BF baseline < 200\n" + " and v.latest_hiv_followup_visit > v.date_test_requested;\n"; SqlCohortDefinition cd = new SqlCohortDefinition(); - cd.setName("allSuppressedWithoutEAC"); + cd.setName("eligibleForVLSampleNotTaken"); cd.setQuery(sqlQuery); cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); cd.addParameter(new Parameter("endDate", "End Date", Date.class)); - cd.setDescription("Patients with unsuppressed without Enhanced Adherence Counseling"); + cd.setDescription("Patients Eligible for VL, no sample taken during last visit"); return cd; }