Skip to content

Commit f7eb016

Browse files
committed
POC-341: Revise Patient Requiring Viral Order report to Generate the report as per the selected Filters
1 parent 99dff0f commit f7eb016

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

app/reporting-framework/json-reports/differentiated-care-program-base.json

+8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
{
99
"table": "etl.dc_monthly_report_dataset",
1010
"alias": "dcr"
11+
},
12+
{
13+
"table": "(SELECT fli.person_id, fli.hiv_viral_load as vl_1, fli.test_datetime as vl_1_date FROM etl.flat_labs_and_imaging fli INNER JOIN (SELECT person_id, MAX(test_datetime) AS max_vl_1_date FROM etl.flat_labs_and_imaging fli where fli.hiv_viral_load is not null GROUP BY person_id) max_dates ON fli.person_id = max_dates.person_id AND fli.test_datetime = max_dates.max_vl_1_date and fli.hiv_viral_load is not null)",
14+
"alias": "fli1",
15+
"join": {
16+
"type": "LEFT",
17+
"joinCondition": "fli1.person_id = dcr.person_id"
18+
}
1119
}
1220
],
1321
"columns": [

app/reporting-framework/json-reports/labs-report-aggregate.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
{
7373
"filterType": "tableColumns",
7474
"conditionExpression": "(t1.next_clinical_datetime_hiv is null or date(t1.next_clinical_datetime_hiv) > ?)",
75-
"parameterName": "endDate"
75+
"parameterName": "reportMonth"
7676
},
7777
{
7878
"filterType": "tableColumns",

app/reporting-framework/json-reports/labs-report-base.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"alias": "needs_vl_in_period",
7070
"expressionType": "simple_expression",
7171
"expressionOptions": {
72-
"expression": "if(case when (t2.cur_arv_meds is not null and t2.vl_1 > 1000) and (timestampdiff(day,t2.vl_1_date, '{endDate}') >= 90) then true when (timestampdiff(month,t2.arv_start_date, '{endDate}') <= 12) and (t2.vl_1_date is null or timestampdiff(month,t2.vl_1_date, '{endDate}') >= 6) and (timestampdiff(month,t2.arv_start_date, '{endDate}')>=6) then true when (timestampdiff(month,t2.arv_start_date, '{endDate}') >= 12) and (t2.vl_1_date is null or timestampdiff(month,t2.vl_1_date, '{endDate}') >= 12) then true else false end,1,0)"
72+
"expression": "if(case when (t2.cur_arv_meds is not null and t2.vl_1 > 1000) and (timestampdiff(day,t2.vl_1_date, '{reportMonth}') >= 90) then true when (timestampdiff(month,t2.arv_start_date, '{reportMonth}') <= 12) and (t2.vl_1_date is null or timestampdiff(month,t2.vl_1_date, '{reportMonth}') >= 6) and (timestampdiff(month,t2.arv_start_date, '{reportMonth}')>=6) then true when (timestampdiff(month,t2.arv_start_date, '{reportMonth}') >= 12) and (t2.vl_1_date is null or timestampdiff(month,t2.vl_1_date, '{reportMonth}') >= 12) then true else false end,1,0)"
7373
}
7474
},
7575
{
@@ -152,7 +152,7 @@
152152
{
153153
"filterType": "tableColumns",
154154
"conditionExpression": "(t2.next_clinical_datetime_hiv is null or date(t2.next_clinical_datetime_hiv) > ?)",
155-
"parameterName": "endDate"
155+
"parameterName": "reportMonth"
156156
},
157157
{
158158
"filterType": "tableColumns",

etl-routes.js

+3
Original file line numberDiff line numberDiff line change
@@ -4375,6 +4375,9 @@ module.exports = (function () {
43754375
endDate: Joi.string()
43764376
.optional()
43774377
.description('The end date to filter by'),
4378+
reportMonth: Joi.string()
4379+
.required()
4380+
.description('The report month in the format "YYYY-MM-DD"'),
43784381
startIndex: Joi.number()
43794382
.required()
43804383
.description('The startIndex to control pagination'),

0 commit comments

Comments
 (0)