@ampath/esm-reports-app 1.0.0-next.111 → 1.0.0-next.113

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 (38) hide show
  1. package/dist/248.css +1 -0
  2. package/dist/248.css.map +1 -0
  3. package/dist/248.js +1 -0
  4. package/dist/248.js.map +1 -0
  5. package/dist/410.js +1 -1
  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/registers/moh-301/moh-301.register.tsx +0 -2
  20. package/src/reports/program/care-and-treatment/care-and-treatment-linelist.component.tsx +87 -0
  21. package/src/reports/program/care-and-treatment/care-and-treatment-table.component.tsx +1 -1
  22. package/src/reports/program/care-and-treatment/care-and-treatment.component.tsx +122 -59
  23. package/src/reports/program/care-and-treatment/care-and-treatment.config.ts +120 -2
  24. package/src/reports/program/program-report.component.tsx +11 -5
  25. package/src/reports/quality-improvement/case-surveillance.component.tsx +258 -0
  26. package/src/reports/quality-improvement/case-surveillance.config.ts +57 -0
  27. package/src/reports/quality-improvement/case-surveillance.scss +305 -0
  28. package/src/reports/quality-improvement/quality-improvement-linelist.component.tsx +137 -0
  29. package/src/reports/quality-improvement/quality-improvement.component.tsx +217 -0
  30. package/src/reports/quality-improvement/quality-improvement.config.ts +144 -0
  31. package/src/reports/quality-improvement/quality-improvement.scss +227 -0
  32. package/src/resources/care-and-treatment.resource.ts +1 -1
  33. package/src/resources/quality-improvement.resource.ts +91 -0
  34. package/src/root.component.tsx +27 -14
  35. package/dist/955.css +0 -1
  36. package/dist/955.css.map +0 -1
  37. package/dist/955.js +0 -1
  38. package/dist/955.js.map +0 -1
@@ -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>
@@ -0,0 +1,258 @@
1
+ import React, { useCallback, useRef, useState } from 'react';
2
+ import { useNavigate } from 'react-router-dom';
3
+ import dayjs from 'dayjs';
4
+ import classNames from 'classnames';
5
+ import { Layer, Tab, TabList, TabPanel, TabPanels, Tabs } from '@carbon/react';
6
+ import { Calendar, Location } from '@carbon/react/icons';
7
+ import { useSession } from '@openmrs/esm-framework';
8
+
9
+ import { ReportFiltersComponent, type ReportPeriod, useRestorePeriod } from '../../common/report-filters';
10
+ import { downloadSheetsPdf } from '../../common/report-page';
11
+ import { showReportError } from '../../common/report-error';
12
+ import { ReportPlaceholder, useGeneratedLocation } from '../../common/report-placeholder';
13
+ import { ReportSkeleton } from '../../common/report-skeleton';
14
+ import { FacilityClinics, useFacility } from '../../common/report-header';
15
+ import { type ReportDefinition } from '../../dashboard/report-catalog';
16
+ import { type CaseSurveillanceCard, getCaseSurveillance } from '../../resources/quality-improvement.resource';
17
+ import {
18
+ CASE_SURVEILLANCE_CARDS,
19
+ GAP_ALERT_PERCENT,
20
+ type CaseSurveillanceCardDefinition,
21
+ } from './case-surveillance.config';
22
+ import { QUALITY_IMPROVEMENT_LINELIST_PATH } from './quality-improvement.config';
23
+ import styles from './case-surveillance.scss';
24
+
25
+ interface CaseSurveillanceReportProps {
26
+ report: ReportDefinition;
27
+ }
28
+
29
+ /** A share of the denominator, to one decimal; 0 when there is none */
30
+ const percentOf = (part: number, whole: number) => (whole > 0 ? Math.round((part / whole) * 1000) / 10 : 0);
31
+
32
+ /**
33
+ * Case Surveillance Report (Reports tab → Quality Improvement Reports), as the
34
+ * POC's case surveillance dashboard lays it out: for the period chosen, at the
35
+ * session location's whole facility, a card per gap -- the clients needing an
36
+ * action out of those it applies to, and its share, flagged red at 25% or
37
+ * more -- and a progress tracker of what has been done. Either figure opens
38
+ * the list of its clients.
39
+ */
40
+ const CaseSurveillanceReport: React.FC<CaseSurveillanceReportProps> = ({ report }) => {
41
+ const [result, setResult] = useState<{ statusMonth: string; cards: Record<string, CaseSurveillanceCard> } | null>(
42
+ null,
43
+ );
44
+ const [isLoading, setIsLoading] = useState(false);
45
+ const [period, setPeriod] = useState<{ startDate: string; endDate: string }>({ startDate: '', endDate: '' });
46
+ const sheetRef = useRef<HTMLElement>(null);
47
+ const navigate = useNavigate();
48
+
49
+ const session = useSession();
50
+ const locationUuids = session?.sessionLocation?.uuid ?? '';
51
+ /* the figures cover the session location's whole facility, so it is named by its parent location (MTRH) */
52
+ const facilityDetails = useFacility(locationUuids, session?.sessionLocation?.display ?? '');
53
+ const facility = facilityDetails.name;
54
+ const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('caseSurveillanceLocation');
55
+ const isReportGenerated = result !== null && isForCurrentLocation;
56
+
57
+ const generate = useCallback(
58
+ async ({ startDate, endDate }: ReportPeriod) => {
59
+ setIsLoading(true);
60
+ setPeriod({ startDate, endDate });
61
+ try {
62
+ setResult(await getCaseSurveillance({ locationUuids, startDate, endDate }));
63
+ markGenerated(locationUuids);
64
+ } catch (error) {
65
+ showReportError('the Case Surveillance report', error);
66
+ } finally {
67
+ setIsLoading(false);
68
+ }
69
+ },
70
+ // eslint-disable-next-line react-hooks/exhaustive-deps
71
+ [locationUuids],
72
+ );
73
+
74
+ useRestorePeriod(generate);
75
+
76
+ /* the list behind a figure, which leads back here */
77
+ const open = (indicator: string, label: string) => {
78
+ const params = new URLSearchParams({
79
+ i: indicator,
80
+ label,
81
+ startDate: period.startDate,
82
+ endDate: period.endDate,
83
+ locationUuids,
84
+ from: 'case-surveillance',
85
+ });
86
+ navigate(`${QUALITY_IMPROVEMENT_LINELIST_PATH}?${params}`);
87
+ };
88
+
89
+ const isWholeMonth =
90
+ Boolean(period.startDate) &&
91
+ dayjs(period.startDate).isSame(dayjs(period.startDate).startOf('month'), 'day') &&
92
+ dayjs(period.endDate).isSame(dayjs(period.startDate).endOf('month'), 'day');
93
+ const periodLabel = !period.endDate
94
+ ? ''
95
+ : isWholeMonth
96
+ ? dayjs(period.endDate).format('MMMM YYYY')
97
+ : `${dayjs(period.startDate).format('DD-MMM-YYYY')} to ${dayjs(period.endDate).format('DD-MMM-YYYY')}`;
98
+ const statusMonth = result?.statusMonth ? dayjs(result.statusMonth).format('DD-MMM-YYYY') : '';
99
+ const fileName = [
100
+ 'Case-Surveillance',
101
+ facility,
102
+ isWholeMonth ? period.endDate.slice(0, 7) : `${period.startDate}_${period.endDate}`,
103
+ ]
104
+ .filter(Boolean)
105
+ .join('_')
106
+ .replace(/[^a-z0-9_-]+/gi, '-');
107
+
108
+ /* Download PDF saves the sheet, on the tab showing, as one A4 landscape page */
109
+ const downloadPdf = async () => {
110
+ if (sheetRef.current) {
111
+ await downloadSheetsPdf([sheetRef.current], `${fileName}.pdf`, { orientation: 'landscape' });
112
+ }
113
+ };
114
+
115
+ const figure = (amount: number, indicator: string, label: string, className: string) =>
116
+ amount > 0 ? (
117
+ <button
118
+ type="button"
119
+ className={classNames(styles.figure, className)}
120
+ onClick={() => open(indicator, label)}
121
+ title={`List the ${amount.toLocaleString()} clients`}
122
+ >
123
+ {amount.toLocaleString()}
124
+ </button>
125
+ ) : (
126
+ <span className={classNames(styles.figure, className)}>0</span>
127
+ );
128
+
129
+ /* a card's figures: the gap, the clients it applies to and its share; red at 25% or more */
130
+ const figuresOf = (definition: CaseSurveillanceCardDefinition) => {
131
+ const card = result?.cards[definition.id];
132
+ const numerator = Number(card?.numerator ?? 0);
133
+ const denominator = Number(card?.denominator ?? 0);
134
+ const percent = percentOf(numerator, denominator);
135
+ return { card, numerator, denominator, percent, isAlert: percent >= GAP_ALERT_PERCENT };
136
+ };
137
+
138
+ const renderGapCard = (definition: CaseSurveillanceCardDefinition) => {
139
+ const { card, numerator, denominator, percent, isAlert } = figuresOf(definition);
140
+ return (
141
+ <article key={definition.id} className={classNames(styles.card, isAlert ? styles.alert : styles.good)}>
142
+ <header className={styles.cardHeader}>
143
+ <h5 className={styles.cardTitle}>{definition.title}</h5>
144
+ <span className={styles.status}>{isAlert ? 'Needs action' : 'On track'}</span>
145
+ </header>
146
+ <div className={styles.cardValue}>
147
+ <span className={styles.figures}>
148
+ {figure(numerator, card?.numeratorIndicator ?? '', definition.title, styles.numerator)}
149
+ <span className={styles.slash}>/</span>
150
+ {figure(
151
+ denominator,
152
+ card?.denominatorIndicator ?? '',
153
+ `${definition.title} - all clients`,
154
+ styles.denominator,
155
+ )}
156
+ </span>
157
+ <span className={styles.percent}>{percent}%</span>
158
+ </div>
159
+ {/* the gap's share of the clients it applies to */}
160
+ <div className={styles.gapTrack} aria-hidden="true">
161
+ <div className={styles.gapBar} style={{ width: `${Math.min(percent, 100)}%` }} />
162
+ </div>
163
+ <p className={styles.cardDescription}>{definition.description}</p>
164
+ </article>
165
+ );
166
+ };
167
+
168
+ const renderProgress = (definition: CaseSurveillanceCardDefinition) => {
169
+ const { numerator, denominator, isAlert } = figuresOf(definition);
170
+ const done = Math.max(denominator - numerator, 0);
171
+ const percent = percentOf(done, denominator);
172
+ return (
173
+ <li key={definition.id} className={classNames(styles.progressRow, isAlert ? styles.alert : styles.good)}>
174
+ <div className={styles.progressLabel}>
175
+ <span className={styles.progressTitle}>{definition.title}</span>
176
+ <span className={styles.progressCount}>
177
+ {definition.achieved}: <strong>{done.toLocaleString()}</strong> of {denominator.toLocaleString()}
178
+ </span>
179
+ </div>
180
+ <div
181
+ className={styles.track}
182
+ role="progressbar"
183
+ aria-label={definition.title}
184
+ aria-valuemin={0}
185
+ aria-valuemax={100}
186
+ aria-valuenow={percent}
187
+ >
188
+ <div className={styles.bar} style={{ width: `${percent}%` }} />
189
+ </div>
190
+ <span className={styles.progressPercent}>{denominator > 0 ? `${percent}%` : '—'}</span>
191
+ </li>
192
+ );
193
+ };
194
+
195
+ return (
196
+ <>
197
+ <ReportFiltersComponent
198
+ reportName={report.name}
199
+ /* a month, or any dates: the viral load cards read the end of the month the period ends in */
200
+ mode="both"
201
+ defaultTab="monthly"
202
+ onGenerate={generate}
203
+ isLoading={isLoading}
204
+ isReportGenerated={isReportGenerated}
205
+ generatedPeriod={period}
206
+ onDownloadPdf={downloadPdf}
207
+ backLink={{ label: 'Quality Improvement Reports', to: '/?group=quality-improvement' }}
208
+ />
209
+ {isLoading && <ReportSkeleton blocks={2} />}
210
+ {!isLoading && !isReportGenerated && (
211
+ <ReportPlaceholder reportName={report.name} isLocationChanged={result !== null && hasLocationChanged} />
212
+ )}
213
+ {!isLoading && isReportGenerated && (
214
+ <Layer as="section" className={styles.sheet} ref={sheetRef}>
215
+ <header className={styles.masthead}>
216
+ <div>
217
+ <h4 className={styles.title}>Case Surveillance Report</h4>
218
+ <p className={styles.subtitle}>
219
+ Gaps in care, out of the clients each applies to. Select a figure to list its clients.
220
+ </p>
221
+ </div>
222
+ <p className={styles.meta}>
223
+ <span className={styles.metaItem}>
224
+ <Location size={12} />
225
+ <FacilityClinics name={facility} clinics={facilityDetails.clinics} />
226
+ </span>
227
+ <span className={styles.metaItem}>
228
+ <Calendar size={12} />
229
+ {periodLabel}
230
+ </span>
231
+ </p>
232
+ </header>
233
+ <Tabs>
234
+ <TabList aria-label="Case surveillance views" className={styles.tabs}>
235
+ <Tab>Realtime gap review</Tab>
236
+ <Tab>Progress tracker</Tab>
237
+ </TabList>
238
+ <TabPanels>
239
+ <TabPanel className={styles.panel}>
240
+ <div className={styles.cardGrid}>{CASE_SURVEILLANCE_CARDS.map(renderGapCard)}</div>
241
+ </TabPanel>
242
+ <TabPanel className={styles.panel}>
243
+ <ul className={styles.progressList}>{CASE_SURVEILLANCE_CARDS.map(renderProgress)}</ul>
244
+ </TabPanel>
245
+ </TabPanels>
246
+ </Tabs>
247
+ <p className={styles.note}>
248
+ Figures are for the whole facility. The viral load and EAC cards are each client&rsquo;s status on ART at
249
+ the month&rsquo;s end ({statusMonth}); the rest are for the period. A gap of {GAP_ALERT_PERCENT}% or more
250
+ needs action.
251
+ </p>
252
+ </Layer>
253
+ )}
254
+ </>
255
+ );
256
+ };
257
+
258
+ export default CaseSurveillanceReport;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The Case Surveillance report's gap review cards, in their order on the page.
3
+ * Each `id` is the ETL's card (case-surveillance), which gives its gap and the
4
+ * clients it applies to, and the indicators listing each.
5
+ */
6
+
7
+ export interface CaseSurveillanceCardDefinition {
8
+ id: string;
9
+ title: string;
10
+ description: string;
11
+ /** What the clients not in the gap have had done, for the progress tracker */
12
+ achieved: string;
13
+ }
14
+
15
+ export const CASE_SURVEILLANCE_CARDS: CaseSurveillanceCardDefinition[] = [
16
+ {
17
+ id: 'not-linked',
18
+ title: 'HIV +ve not linked',
19
+ description: 'HIV positive clients not linked to ART',
20
+ achieved: 'Linked to ART',
21
+ },
22
+ {
23
+ id: 'pbfw-not-on-prep',
24
+ title: 'High risk -ve PBFW not on PrEP',
25
+ description: 'High risk -ve PBFW not linked to PrEP',
26
+ achieved: 'On PrEP',
27
+ },
28
+ {
29
+ id: 'delayed-eac',
30
+ title: 'Delayed enhanced adherence counselling',
31
+ description: 'Virally unsuppressed clients without EAC within 2 weeks',
32
+ achieved: 'Had EAC',
33
+ },
34
+ {
35
+ id: 'missed-vl',
36
+ title: 'Missed opportunity in viral load testing',
37
+ description: 'Clients on ART who visited the facility and were eligible for VL but no VL was done',
38
+ achieved: 'VL done',
39
+ },
40
+ {
41
+ id: 'hei-without-pcr',
42
+ title: 'HEI (6–8 weeks) without DNA-PCR results',
43
+ description: 'HEI (6–8 weeks) without DNA PCR results',
44
+ achieved: 'DNA PCR done',
45
+ },
46
+ {
47
+ id: 'hei-without-outcome',
48
+ title: 'Undocumented final outcome',
49
+ description: '24 months old HEI without documented outcome',
50
+ achieved: 'Outcome documented',
51
+ },
52
+ ];
53
+
54
+ /** A gap at or above this share of its clients is flagged red */
55
+ export const GAP_ALERT_PERCENT = 25;
56
+
57
+ export const CASE_SURVEILLANCE_PATH = '/quality-improvement/case-surveillance';