@ampath/esm-reports-app 1.0.0-next.112 → 1.0.0-next.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/410.js +1 -1
  2. package/dist/763.css +1 -0
  3. package/dist/763.css.map +1 -0
  4. package/dist/763.js +1 -0
  5. package/dist/763.js.map +1 -0
  6. package/dist/ampath-esm-reports-app.js +1 -1
  7. package/dist/routes.json +1 -1
  8. package/package.json +1 -1
  9. package/src/common/report-header/facility-clinics.component.tsx +42 -0
  10. package/src/common/report-header/facility-clinics.scss +61 -0
  11. package/src/common/report-header/index.ts +1 -0
  12. package/src/common/report-page/download-sheet-pdf.ts +2 -0
  13. package/src/common/report-register/index.ts +1 -0
  14. package/src/common/report-register/register-layout.component.tsx +3 -26
  15. package/src/common/report-register/register-layout.scss +0 -58
  16. package/src/common/report-register/xlsx.ts +263 -0
  17. package/src/dashboard/report-catalog.ts +39 -145
  18. package/src/dashboard/reports-dasboard.tsx +5 -4
  19. package/src/reports/moh-718/moh-718.component.tsx +1 -1
  20. package/src/reports/moh-740/line-list/moh-740-line-list.component.tsx +107 -0
  21. package/src/reports/moh-740/moh-740.component.tsx +1 -1
  22. package/src/reports/moh-740/registers/moh-740.columns.ts +1 -0
  23. package/src/reports/program/care-and-treatment/care-and-treatment-linelist.component.tsx +87 -0
  24. package/src/reports/program/care-and-treatment/care-and-treatment-table.component.tsx +1 -1
  25. package/src/reports/program/care-and-treatment/care-and-treatment.component.tsx +122 -59
  26. package/src/reports/program/care-and-treatment/care-and-treatment.config.ts +120 -2
  27. package/src/reports/program/program-report.component.tsx +11 -5
  28. package/src/reports/quality-improvement/case-surveillance.component.tsx +258 -0
  29. package/src/reports/quality-improvement/case-surveillance.config.ts +57 -0
  30. package/src/reports/quality-improvement/case-surveillance.scss +305 -0
  31. package/src/reports/quality-improvement/quality-improvement-linelist.component.tsx +137 -0
  32. package/src/reports/quality-improvement/quality-improvement.component.tsx +217 -0
  33. package/src/reports/quality-improvement/quality-improvement.config.ts +144 -0
  34. package/src/reports/quality-improvement/quality-improvement.scss +227 -0
  35. package/src/resources/care-and-treatment.resource.ts +1 -1
  36. package/src/resources/quality-improvement.resource.ts +91 -0
  37. package/src/root.component.tsx +29 -14
  38. package/dist/955.css +0 -1
  39. package/dist/955.css.map +0 -1
  40. package/dist/955.js +0 -1
  41. package/dist/955.js.map +0 -1
@@ -8,10 +8,10 @@ import { useSession } from '@openmrs/esm-framework';
8
8
  import { ReportFiltersComponent, type ReportPeriod, useRestorePeriod } from '../../../common/report-filters';
9
9
  import { downloadSheetsPdf } from '../../../common/report-page';
10
10
  import { showReportError } from '../../../common/report-error';
11
- import { columnsToCsv, downloadCsv, type RegisterColumn } from '../../../common/report-register';
11
+ import { buildXlsx, downloadBlob, rangeOf, type XlsxCell } from '../../../common/report-register';
12
12
  import { ReportPlaceholder, useGeneratedLocation } from '../../../common/report-placeholder';
13
13
  import { ReportSkeleton } from '../../../common/report-skeleton';
14
- import { useFacilityName } from '../../../common/report-header';
14
+ import { FacilityClinics, useFacility } from '../../../common/report-header';
15
15
  import { type ReportDefinition } from '../../../dashboard/report-catalog';
16
16
  import { getCareAndTreatment, type CareAndTreatmentGroup } from '../../../resources/care-and-treatment.resource';
17
17
  import { AGE_BANDS, CARE_AND_TREATMENT_SECTIONS, isMchRow, rowTitle, SEXES } from './care-and-treatment.config';
@@ -36,8 +36,9 @@ export function cellParams({ section, row, band, sex }: CellQuery) {
36
36
 
37
37
  /**
38
38
  * Care & Treatment and ARV Management (Program reports → HIV), sections 1.1
39
- * to 1.4: Starting on ART, Current on ART, months of ARVs dispensed and
40
- * TX_PVLS, by age band and sex, for the session location's whole facility in
39
+ * to 1.7: Starting on ART, Current on ART, months of ARVs dispensed, TX_PVLS,
40
+ * the inflows (transfers in, TX_RTT), TX_ML and the causes of death, by age
41
+ * band and sex, for the session location's whole facility in
41
42
  * the month chosen -- one table, laid out as the reporting form.
42
43
  *
43
44
  * The ETL adds the figures up by age band, sex and MCH/PMTCT (a few dozen rows
@@ -55,7 +56,8 @@ const CareAndTreatmentReport: React.FC<CareAndTreatmentReportProps> = ({ report
55
56
  const session = useSession();
56
57
  const locationUuids = session?.sessionLocation?.uuid ?? '';
57
58
  /* the figures cover the session location's whole facility, so it is named by its parent location (MTRH) */
58
- const facility = useFacilityName(locationUuids, session?.sessionLocation?.display ?? '');
59
+ const facilityDetails = useFacility(locationUuids, session?.sessionLocation?.display ?? '');
60
+ const facility = facilityDetails.name;
59
61
  const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('careAndTreatmentLocation');
60
62
  const isReportGenerated = groups !== null && isForCurrentLocation;
61
63
 
@@ -144,58 +146,116 @@ const CareAndTreatmentReport: React.FC<CareAndTreatmentReportProps> = ({ report
144
146
  .join('_')
145
147
  .replace(/[^a-z0-9_-]+/gi, '-');
146
148
 
147
- /* Download CSV: the table as it is laid out -- the age bands across the top
148
- with F and M under each, then the Total; each section's and group's name
149
- once, at its first row, as the merged cells read -- under the report's
150
- title, facility and period, with its notes after. Cells that do not apply
151
- are left empty. */
152
- const exportCsv = () => {
153
- const lines = CARE_AND_TREATMENT_SECTIONS.flatMap((section) =>
154
- section.groups.flatMap((group, groupIndex) =>
155
- group.rows.map((row, rowIndex) => ({
156
- section,
157
- group,
158
- row,
159
- firstInSection: groupIndex === 0 && rowIndex === 0,
160
- firstInGroup: rowIndex === 0,
161
- })),
162
- ),
163
- );
164
- const columns: RegisterColumn[] = [
165
- {
166
- header: 'Section',
167
- value: (line) => (line.firstInSection ? `${line.section.number} ${line.section.title}` : ''),
168
- },
169
- { header: 'Group', value: (line) => (line.firstInGroup ? (line.group.title ?? '') : '') },
170
- { header: 'Indicator', value: (line) => line.row.label },
149
+ /* Download Excel: the table as it is laid out, merged cells and all -- the
150
+ report's title, facility and period; the age bands across the top over
151
+ their F and M, then the Total; each section's and group's name merged down
152
+ beside its rows -- with its notes under it. Cells that do not apply are
153
+ shaded and left empty. */
154
+ const exportExcel = () => {
155
+ const bandColumns = AGE_BANDS.length * SEXES.length;
156
+ const totalColumn = 3 + bandColumns;
157
+ const width = totalColumn + 1;
158
+ const blank = (count: number): XlsxCell[] => Array.from({ length: count }, () => ({}));
159
+ const rows: XlsxCell[][] = [];
160
+ const merges: string[] = [];
161
+ const wholeRow = (value: string, style: XlsxCell['style']) => {
162
+ merges.push(rangeOf(rows.length, 0, rows.length, width - 1));
163
+ rows.push([{ value, style }, ...blank(width - 1)]);
164
+ };
165
+
166
+ wholeRow('Monthly Reporting Summary - 1.0 Care & Treatment and ARV Management', 'title');
167
+ wholeRow(`Facility: ${facility}`, 'meta');
168
+ wholeRow(`Period: ${periodLabel}`, 'meta');
169
+ rows.push(blank(width));
170
+
171
+ /* the heading: Indicator and Total down both rows, each band over its F and M */
172
+ const head = rows.length;
173
+ merges.push(rangeOf(head, 0, head + 1, 2), rangeOf(head, totalColumn, head + 1, totalColumn));
174
+ AGE_BANDS.forEach((_, index) => {
175
+ const column = 3 + index * SEXES.length;
176
+ merges.push(rangeOf(head, column, head, column + SEXES.length - 1));
177
+ });
178
+ rows.push([
179
+ { value: 'Indicator', style: 'header' },
180
+ { style: 'header' },
181
+ { style: 'header' },
171
182
  ...AGE_BANDS.flatMap((band) =>
172
- SEXES.map(
173
- (sex, index): RegisterColumn => ({
174
- /* the band over its F and M, as the table's heading */
175
- header: index === 0 ? band.label : '',
176
- value: (line) =>
177
- isMchRow(line.section, line.row) && (sex === 'M' || band.child)
178
- ? ''
179
- : count({ ...(line as CellQuery), band, sex }),
180
- }),
181
- ),
183
+ SEXES.map((_, index) => ({ value: index === 0 ? band.label : '', style: 'header' as const })),
182
184
  ),
183
- { header: 'Total', value: (line) => count(line as CellQuery) },
184
- ];
185
- const subHeaderRow = ['', '', '', ...AGE_BANDS.flatMap(() => SEXES), ''];
186
- const quoted = (text: string) => `"${text.replace(/"/g, '""')}"`;
187
- const title = [
188
- 'Monthly Reporting Summary - 1.0 Care & Treatment and ARV Management',
189
- `Facility: ${facility}`,
190
- `Period: ${periodLabel}`,
191
- ].map(quoted);
192
- const notes = [
185
+ { value: 'Total', style: 'header' },
186
+ ]);
187
+ rows.push([
188
+ { style: 'header' },
189
+ { style: 'header' },
190
+ { style: 'header' },
191
+ ...AGE_BANDS.flatMap(() => SEXES.map((sex) => ({ value: sex, style: 'header' as const }))),
192
+ { style: 'header' },
193
+ ]);
194
+
195
+ CARE_AND_TREATMENT_SECTIONS.forEach((section) => {
196
+ const sectionStart = rows.length;
197
+ section.groups.forEach((group) => {
198
+ const groupStart = rows.length;
199
+ group.rows.forEach((row) => {
200
+ const cell = { section, group, row };
201
+ const mchOnly = isMchRow(section, row);
202
+ const labelStyle = row.strong
203
+ ? 'labelStrong'
204
+ : row.reference
205
+ ? 'labelMuted'
206
+ : row.notRecorded
207
+ ? 'labelItalic'
208
+ : 'label';
209
+ const numberStyle = row.strong ? 'numberStrong' : row.reference ? 'numberMuted' : 'number';
210
+ if (!group.title) {
211
+ /* a row without a group spans the group's column too */
212
+ merges.push(rangeOf(rows.length, 1, rows.length, 2));
213
+ }
214
+ rows.push([
215
+ {
216
+ value: rows.length === sectionStart ? `${section.number} ${section.title}`.trim() : '',
217
+ style: 'section',
218
+ },
219
+ group.title
220
+ ? { value: rows.length === groupStart ? group.title : '', style: 'group' }
221
+ : { value: row.label, style: labelStyle },
222
+ group.title ? { value: row.label, style: labelStyle } : { style: labelStyle },
223
+ ...AGE_BANDS.flatMap((band) =>
224
+ SEXES.map(
225
+ (sex): XlsxCell =>
226
+ mchOnly && (sex === 'M' || band.child)
227
+ ? { style: 'notApplicable' }
228
+ : { value: count({ ...cell, band, sex }), style: numberStyle },
229
+ ),
230
+ ),
231
+ { value: count(cell), style: numberStyle },
232
+ ]);
233
+ });
234
+ if (group.title && group.rows.length > 1) {
235
+ merges.push(rangeOf(groupStart, 1, rows.length - 1, 1));
236
+ }
237
+ });
238
+ if (rows.length - sectionStart > 1) {
239
+ merges.push(rangeOf(sectionStart, 0, rows.length - 1, 0));
240
+ }
241
+ });
242
+
243
+ rows.push(blank(width));
244
+ wholeRow('Notes', 'meta');
245
+ [
193
246
  ...CARE_AND_TREATMENT_SECTIONS.filter((section) => section.note).map((section) => section.note ?? ''),
194
- 'Not categorized rows are clients whose detail is not recorded, shown so each part adds up to its total (for data cleanup); empty cells do not apply.',
195
- ].map(quoted);
196
- downloadCsv(
197
- [...title, '', columnsToCsv(lines, columns, { subHeaderRow }), '', 'Notes', ...notes].join('\n'),
198
- `${fileName}.csv`,
247
+ 'Not categorized rows (in italics) are clients whose detail is not recorded, shown so each part adds up to its total (for data cleanup); shaded cells do not apply.',
248
+ ].forEach((note) => wholeRow(note, 'note'));
249
+
250
+ downloadBlob(
251
+ buildXlsx({
252
+ sheetName: 'Care & Treatment',
253
+ rows,
254
+ merges,
255
+ columnWidths: [22, 20, 42, ...Array.from({ length: bandColumns }, () => 6), 8],
256
+ freeze: { rows: head + 2, columns: 3 },
257
+ }),
258
+ `${fileName}.xlsx`,
199
259
  );
200
260
  };
201
261
 
@@ -203,6 +263,7 @@ const CareAndTreatmentReport: React.FC<CareAndTreatmentReportProps> = ({ report
203
263
  <>
204
264
  <ReportFiltersComponent
205
265
  reportName={`${report.name} (${report.code})`}
266
+ /* monthly only: its figures are each client's status at the month's end (the HIV monthly dataset) */
206
267
  mode="monthly"
207
268
  onGenerate={generate}
208
269
  isLoading={isLoading}
@@ -218,7 +279,7 @@ const CareAndTreatmentReport: React.FC<CareAndTreatmentReportProps> = ({ report
218
279
  {!isLoading && isReportGenerated && (
219
280
  <div className={styles.report}>
220
281
  <Layer as="section" className={styles.sheet} ref={sheetRef}>
221
- {/* the title, facility and period, with the section links and the CSV
282
+ {/* the title, facility and period, with the section links and the Excel
222
283
  download under them, stay in view as the report scrolls */}
223
284
  <div className={styles.stickyHead} ref={headRef}>
224
285
  <header className={styles.masthead}>
@@ -229,7 +290,9 @@ const CareAndTreatmentReport: React.FC<CareAndTreatmentReportProps> = ({ report
229
290
  <dl className={styles.meta}>
230
291
  <div>
231
292
  <dt>Facility</dt>
232
- <dd>{facility}</dd>
293
+ <dd>
294
+ <FacilityClinics name={facility} clinics={facilityDetails.clinics} />
295
+ </dd>
233
296
  </div>
234
297
  <div>
235
298
  <dt>Period</dt>
@@ -246,13 +309,13 @@ const CareAndTreatmentReport: React.FC<CareAndTreatmentReportProps> = ({ report
246
309
  className={styles.sectionLink}
247
310
  onClick={() => scrollTo(section.id)}
248
311
  >
249
- <span className={styles.sectionNumber}>{section.number}</span>
312
+ {section.number && <span className={styles.sectionNumber}>{section.number}</span>}
250
313
  {section.shortTitle}
251
314
  </button>
252
315
  ))}
253
316
  </nav>
254
- <Button kind="tertiary" size="sm" renderIcon={Download} onClick={exportCsv}>
255
- Download CSV
317
+ <Button kind="tertiary" size="sm" renderIcon={Download} onClick={exportExcel}>
318
+ Download Excel
256
319
  </Button>
257
320
  </div>
258
321
  </div>
@@ -1,5 +1,6 @@
1
1
  /**
2
- * The Care & Treatment and ARV Management report, sections 1.1-1.4, as one
2
+ * The Care & Treatment and ARV Management report, sections 1.1-1.7 and the
3
+ * PMTCT VL tracking, as one
3
4
  * table: the age bands across the top once, female and male under each, and
4
5
  * every section's indicators down the side. Each row reads one or more of the
5
6
  * ETL's figures (the flags of careTreatmentBase), which come back added up by
@@ -58,6 +59,7 @@ export interface RowGroup {
58
59
 
59
60
  export interface ReportSection {
60
61
  id: string;
62
+ /** Empty for a part of the form without one, e.g. `Inflows (Net gain)` */
61
63
  number: string;
62
64
  /** Merged down beside the section's rows */
63
65
  title: string;
@@ -81,6 +83,28 @@ const MONTHS_DISPENSED: ReportRow[] = [
81
83
 
82
84
  const DISPENSING_NOT_RECORDED: ReportRow = { label: 'Not categorized', indicators: ['mmd_unknown'], notRecorded: true };
83
85
 
86
+ /** A client's CD4 when back on ART after an interruption */
87
+ const rttCd4 = (prefix: string): ReportRow[] => [
88
+ { label: 'CD4: <200', indicators: [`${prefix}_cd4_lt_200`] },
89
+ { label: 'CD4: ≥200', indicators: [`${prefix}_cd4_ge_200`] },
90
+ { label: 'CD4 % (subject to full haemogram result availability)', indicators: [`${prefix}_cd4_percent`] },
91
+ { label: 'Unknown CD4 (CD4 not done)', indicators: [`${prefix}_cd4_unknown`] },
92
+ ];
93
+
94
+ /** A PMTCT group's latest viral loads in the past 12 months, known and new positives */
95
+ const pmtctViralLoads = (group: string): ReportRow[] => [
96
+ { label: 'Viral load collected and results available', indicators: [`pmtct_${group}_vl`], strong: true },
97
+ ...[
98
+ ['known', 'Known positive'],
99
+ ['new', 'New positive'],
100
+ ].flatMap(([status, name]) => [
101
+ { label: `${name}: <50 copies/LDL`, indicators: [`pmtct_${group}_${status}_lt_50`] },
102
+ { label: `${name}: 50-199 copies/ml`, indicators: [`pmtct_${group}_${status}_50_199`] },
103
+ { label: `${name}: 200-999 copies/ml`, indicators: [`pmtct_${group}_${status}_200_999`] },
104
+ { label: `${name}: ≥1000 copies/ml`, indicators: [`pmtct_${group}_${status}_ge_1000`] },
105
+ ]),
106
+ ];
107
+
84
108
  const CURRENT_ON_ART: ReportRow = { label: 'Currently on ART (TX_CURR)', indicators: ['tx_curr'], reference: true };
85
109
 
86
110
  export const CARE_AND_TREATMENT_SECTIONS: ReportSection[] = [
@@ -171,7 +195,7 @@ export const CARE_AND_TREATMENT_SECTIONS: ReportSection[] = [
171
195
  number: '1.3b',
172
196
  title: 'Actual number of months ARV drug dispensed - MCH (PMTCT)',
173
197
  shortTitle: 'Months dispensed - MCH',
174
- note: 'MCH (PMTCT): women of 10 years and over on ART who are pregnant or breastfeeding, or in care at an MCH clinic.',
198
+ note: 'MCH (PMTCT): women of 10 years and over on ART who are pregnant, breastfeeding or with a child under 2 (one recorded as theirs, or an EDD in the past 24 months), or in care at an MCH clinic.',
175
199
  mch: true,
176
200
  groups: [
177
201
  { rows: [{ label: 'Currently on ART (TX_CURR)', indicators: ['tx_curr'], strong: true }] },
@@ -200,6 +224,100 @@ export const CARE_AND_TREATMENT_SECTIONS: ReportSection[] = [
200
224
  },
201
225
  ],
202
226
  },
227
+ {
228
+ id: 'ti',
229
+ number: '',
230
+ title: 'Inflows (Net gain)',
231
+ shortTitle: 'Transfer in',
232
+ note: 'Transfer In: on ART here this month but not last month, neither starting ART nor back after an interruption -- transferred in, or last on ART at another facility.',
233
+ groups: [{ rows: [{ label: 'Transfer In (TI)', indicators: ['ti'], strong: true }] }],
234
+ },
235
+ {
236
+ id: 'tx-rtt',
237
+ number: '1.5',
238
+ title: 'TX_RTT (returned to treatment) - Monthly',
239
+ shortTitle: 'TX_RTT',
240
+ note: 'TX_RTT: back on ART this month after being a defaulter or lost to follow-up last month. The interruption runs from the missed appointment to the return, and the CD4 is one done since the missed appointment.',
241
+ groups: [
242
+ {
243
+ rows: [
244
+ { label: 'TX_RTT (returned to treatment)', indicators: ['rtt'], strong: true },
245
+ { label: 'TX_RTT: Experienced a treatment interruption of <3 months', indicators: ['rtt_lt3'] },
246
+ ],
247
+ },
248
+ {
249
+ title: 'TX_RTT: Experienced a treatment interruption of 3-5 months',
250
+ rows: [{ label: 'Total', indicators: ['rtt_3_5'], strong: true }, ...rttCd4('rtt_3_5')],
251
+ },
252
+ {
253
+ title: 'TX_RTT: Experienced a treatment interruption of 6+ months',
254
+ rows: [{ label: 'Total', indicators: ['rtt_6_plus'], strong: true }, ...rttCd4('rtt_6_plus')],
255
+ },
256
+ ],
257
+ },
258
+ {
259
+ id: 'tx-ml',
260
+ number: '1.6',
261
+ title: 'TX_ML (Mortality & Loss) - Monthly',
262
+ shortTitle: 'TX_ML',
263
+ note: 'TX_ML: on ART here at the end of last month (last month’s TX_CURR) but not at the end of this month, by their status now. An interruption is a defaulter or lost to follow-up, by how long they had been on ART at the missed appointment.',
264
+ groups: [
265
+ {
266
+ title: 'Outflows (Net Loss)',
267
+ rows: [
268
+ { label: 'Total', indicators: ['ml_total'], strong: true },
269
+ { label: 'Interruption of Treatment for clients on ART for <3 months', indicators: ['ml_iit_lt3'] },
270
+ { label: 'Interruption of Treatment for clients on ART for 3-5 months', indicators: ['ml_iit_3_5'] },
271
+ { label: 'Interruption of Treatment for clients on ART for 6+ months', indicators: ['ml_iit_6_plus'] },
272
+ { label: 'Transfer Out (TO)', indicators: ['ml_to'] },
273
+ { label: 'Refused (Stopped) Treatment', indicators: ['ml_stopped'] },
274
+ { label: 'Deceased', indicators: ['ml_died'] },
275
+ { label: 'Not categorized', indicators: ['ml_unknown'], notRecorded: true },
276
+ ],
277
+ },
278
+ ],
279
+ },
280
+ {
281
+ id: 'cod',
282
+ number: '1.7',
283
+ title: 'Cause of Death - Monthly',
284
+ shortTitle: 'Cause of death',
285
+ note: 'Cause of death of the clients who died (TX_ML Deceased): the latest recorded on a death report or outreach form, else on the person; none recorded counts as unknown.',
286
+ groups: [
287
+ { rows: [{ label: 'Deceased (TX_ML)', indicators: ['ml_died'], reference: true }] },
288
+ {
289
+ title: 'Disaggregations of Cause of Death (Monthly Net Gain Analysis)',
290
+ rows: [
291
+ { label: 'COD- TB', indicators: ['cod_tb'] },
292
+ { label: 'COD- Cancer', indicators: ['cod_cancer'] },
293
+ { label: 'COD- HIV Disease', indicators: ['cod_hiv'] },
294
+ { label: 'COD- Other HIV Disease', indicators: ['cod_other_hiv'] },
295
+ { label: 'COD- Other Natural Causes', indicators: ['cod_other_natural'] },
296
+ { label: 'COD- Non Natural Causes', indicators: ['cod_non_natural'] },
297
+ { label: 'COD- Unknown Causes', indicators: ['cod_unknown'] },
298
+ ],
299
+ },
300
+ ],
301
+ },
302
+ {
303
+ id: 'pmtct-vl',
304
+ number: '',
305
+ title: 'Monthly PMTCT VL Tracking (Females only)',
306
+ shortTitle: 'PMTCT VL',
307
+ note: 'PMTCT VL tracking: each woman’s latest viral load in the past 12 months; pregnant first, then breastfeeding, then with a child under 2. A known positive was diagnosed before this pregnancy (280 days before the EDD or the child’s birth), a new positive since.',
308
+ mch: true,
309
+ groups: [
310
+ {
311
+ rows: [
312
+ { label: 'TX_Curr MCH', indicators: ['tx_curr'], strong: true },
313
+ { label: 'Eligible for Viral Load in the last 12 months', indicators: ['vl_eligible'] },
314
+ ],
315
+ },
316
+ { title: 'Pregnant', rows: pmtctViralLoads('pregnant') },
317
+ { title: 'Breastfeeding', rows: pmtctViralLoads('bf') },
318
+ { title: 'Other (non-breastfeeding with child below 24 months)', rows: pmtctViralLoads('other') },
319
+ ],
320
+ },
203
321
  ];
204
322
 
205
323
  /** Whether a row counts only the MCH/PMTCT clients */
@@ -6,7 +6,7 @@ import { useSession } from '@openmrs/esm-framework';
6
6
 
7
7
  import { ReportFiltersComponent, type ReportPeriod, useRestorePeriod } from '../../common/report-filters';
8
8
  import { ReportPlaceholder, useGeneratedLocation } from '../../common/report-placeholder';
9
- import { useFacilityName } from '../../common/report-header';
9
+ import { FacilityClinics, useFacility } from '../../common/report-header';
10
10
  import { type ReportDefinition } from '../../dashboard/report-catalog';
11
11
  import styles from './program-report.scss';
12
12
 
@@ -17,7 +17,7 @@ interface ProgramReportProps {
17
17
  }
18
18
 
19
19
  /**
20
- * The page every program and action summary report opens on (Reports tab),
20
+ * The page every program and quality improvement report opens on (Reports tab),
21
21
  * set up as the MOH reports are: the filter bar, generation for the session
22
22
  * location's facility, and the space below where the report's template goes.
23
23
  *
@@ -33,7 +33,8 @@ const ProgramReport: React.FC<ProgramReportProps> = ({ report, backLink }) => {
33
33
  const session = useSession();
34
34
  const locationUuids = session?.sessionLocation?.uuid ?? '';
35
35
  /* program reports cover the session location's whole facility, as the MOH ones do */
36
- const facility = useFacilityName(locationUuids, session?.sessionLocation?.display ?? '');
36
+ const facilityDetails = useFacility(locationUuids, session?.sessionLocation?.display ?? '');
37
+ const facility = facilityDetails.name;
37
38
  const storageKey = `programReportLocation:${report.path}`;
38
39
  const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation(storageKey);
39
40
  const isReportGenerated = isGenerated && isForCurrentLocation;
@@ -57,7 +58,9 @@ const ProgramReport: React.FC<ProgramReportProps> = ({ report, backLink }) => {
57
58
  <>
58
59
  <ReportFiltersComponent
59
60
  reportName={reportName}
60
- mode="monthly"
61
+ /* a month, or any dates */
62
+ mode="both"
63
+ defaultTab="monthly"
61
64
  onGenerate={generate}
62
65
  isLoading={false}
63
66
  isReportGenerated={isReportGenerated}
@@ -74,7 +77,10 @@ const ProgramReport: React.FC<ProgramReportProps> = ({ report, backLink }) => {
74
77
  <h4 className={styles.title}>{report.name}</h4>
75
78
  <p className={styles.meta}>
76
79
  <span>
77
- Facility: <strong>{facility}</strong>
80
+ Facility:{' '}
81
+ <strong>
82
+ <FacilityClinics name={facility} clinics={facilityDetails.clinics} />
83
+ </strong>
78
84
  </span>
79
85
  <span>
80
86
  Period: <strong>{periodLabel}</strong>