@ampath/esm-reports-app 1.0.0-next.55 → 1.0.0-next.57
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.
- package/dist/295.js +1 -1
- package/dist/410.js +1 -1
- package/dist/580.js +1 -0
- package/dist/580.js.map +1 -0
- package/dist/907.js +2 -1
- package/dist/907.js.map +1 -1
- package/dist/998.css +1 -0
- package/dist/998.css.map +1 -0
- package/dist/998.js +1 -0
- package/dist/998.js.map +1 -0
- package/dist/ampath-esm-reports-app.js +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/common/daily-summary-table.tsx +55 -0
- package/src/common/linelist-table/index.ts +3 -0
- package/src/common/linelist-table/linelist-columns.ts +48 -0
- package/src/common/linelist-table/linelist-table.component.tsx +442 -0
- package/src/common/linelist-table/linelist-table.scss +306 -0
- package/src/common/linelist-table/linelist-table.test.tsx +120 -0
- package/src/common/linelist-table/use-all-rows.ts +93 -0
- package/src/common/linelist-table/use-column-layout.ts +123 -0
- package/src/common/report-filters/report-filters.component.tsx +11 -5
- package/src/common/report-filters/report-filters.scss +63 -7
- package/src/common/report-page/use-page-scale.ts +27 -17
- package/src/common/report-placeholder/index.ts +1 -0
- package/src/common/report-placeholder/report-placeholder.component.tsx +57 -32
- package/src/common/report-placeholder/report-placeholder.scss +2 -0
- package/src/common/report-placeholder/use-generated-location.ts +62 -0
- package/src/common/report-register/index.ts +1 -0
- package/src/common/report-register/register-layout.component.tsx +26 -4
- package/src/common/report-register/register-layout.scss +10 -0
- package/src/common/report-register/use-location-name.ts +54 -0
- package/src/reports/moh-505/moh-505.component.tsx +9 -3
- package/src/reports/moh-705B/moh-204b-register.component.tsx +11 -2
- package/src/reports/moh-705B/moh-705b.component.tsx +533 -418
- package/src/reports/moh-705B/moh-705b.scss +44 -2
- package/src/reports/moh-705a/moh-705a.component.tsx +533 -421
- package/src/reports/moh-705a/moh-705a.scss +44 -2
- package/src/reports/moh-705a/registers/moh-204a-register.component.tsx +12 -3
- package/src/reports/moh-706/moh-706.component.tsx +9 -3
- package/src/reports/moh-710/moh-710.component.tsx +9 -3
- package/src/reports/moh-711/moh-711.component.tsx +9 -3
- package/src/reports/moh-717/moh-717.component.tsx +12 -3
- package/src/reports/moh-731/linelist/moh-731-indicators.ts +1040 -0
- package/src/reports/moh-731/linelist/moh-731-linelist-sections.ts +423 -0
- package/src/reports/moh-731/linelist/moh-731-linelist.component.tsx +102 -0
- package/src/reports/moh-731/linelist/use-open-moh-731-linelist.ts +50 -0
- package/src/reports/moh-731/moh-731.component.tsx +138 -85
- package/src/reports/moh-731/moh-731.scss +51 -4
- package/src/reports/moh-731/sections/hiv-and-tb-treatment.component.tsx +74 -77
- package/src/reports/moh-731/sections/hiv-testing-and-pre-exposure.component.tsx +84 -70
- package/src/reports/moh-731/sections/pmtct.component.tsx +43 -43
- package/src/reports/moh-731/summary/moh-731-summary.component.tsx +313 -0
- package/src/reports/moh-731/summary/moh-731-summary.config.ts +520 -0
- package/src/reports/moh-731/summary/moh-731-summary.scss +242 -0
- package/src/reports/moh-740/moh-740.component.scss +3 -1
- package/src/reports/moh-740/moh-740.component.tsx +14 -4
- package/src/reports/moh-745/moh-745.component.tsx +7 -3
- package/src/root.component.tsx +2 -0
- package/webpack.config.js +22 -1
- package/dist/427.js +0 -2
- package/dist/427.js.map +0 -1
- package/dist/441.js +0 -1
- package/dist/441.js.map +0 -1
- package/dist/907.css +0 -1
- package/dist/907.css.map +0 -1
- /package/dist/{427.js.LICENSE.txt → 907.js.LICENSE.txt} +0 -0
|
@@ -64,23 +64,65 @@ $pad: 3mm;
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.container {
|
|
67
|
-
overflow-x:
|
|
67
|
+
overflow-x: visible;
|
|
68
68
|
margin: 0;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.table {
|
|
72
72
|
width: 100%;
|
|
73
|
+
table-layout: fixed;
|
|
73
74
|
border-collapse: collapse;
|
|
75
|
+
font-family: inherit;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.numberColumn {
|
|
79
|
+
width: 3mm;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.diseaseColumn {
|
|
83
|
+
width: 34mm;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.dayColumn {
|
|
87
|
+
width: 4.5mm;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.totalColumn {
|
|
91
|
+
width: 8mm;
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
.tableBordered td,
|
|
77
95
|
.tableBordered th {
|
|
78
|
-
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
padding: 0.6mm 0.45mm;
|
|
79
98
|
font-size: $text;
|
|
80
99
|
text-align: left;
|
|
81
100
|
border: $rule;
|
|
82
101
|
}
|
|
83
102
|
|
|
103
|
+
.tableBordered tbody td:nth-child(n + 3):not(:last-child),
|
|
104
|
+
.tableBordered thead th:nth-child(n + 2):not(:last-child) {
|
|
105
|
+
width: 4.5mm;
|
|
106
|
+
font-size: 5pt;
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
text-align: center;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.tableBordered tbody td:last-child,
|
|
112
|
+
.tableBordered thead th:last-child {
|
|
113
|
+
width: 8mm;
|
|
114
|
+
text-align: center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.tableBordered tbody td:nth-child(2) {
|
|
118
|
+
font-family: inherit;
|
|
119
|
+
overflow-wrap: anywhere;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.tableBordered tbody td:nth-child(n + 3) {
|
|
123
|
+
text-align: center;
|
|
124
|
+
}
|
|
125
|
+
|
|
84
126
|
.tableBordered th {
|
|
85
127
|
font-weight: 700;
|
|
86
128
|
color: $ink;
|
|
@@ -8,7 +8,7 @@ import { getMoh705aPatientList } from '../../../resources/moh-705.resource';
|
|
|
8
8
|
import { moh204aExportColumns } from './moh-204a.columns';
|
|
9
9
|
import { RegisterLayout, usePatientList } from '../../../common/report-register';
|
|
10
10
|
|
|
11
|
-
interface Moh204ARegisterComponentProps {}
|
|
11
|
+
interface Moh204ARegisterComponentProps { }
|
|
12
12
|
|
|
13
13
|
const Moh204ARegisterComponent: React.FC<Moh204ARegisterComponentProps> = () => {
|
|
14
14
|
const [searchParams] = useSearchParams();
|
|
@@ -39,6 +39,15 @@ const Moh204ARegisterComponent: React.FC<Moh204ARegisterComponentProps> = () =>
|
|
|
39
39
|
[startDate, endDate, locationUuids, indicator],
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
+
const removePatientListDuplicates = async () => {
|
|
43
|
+
const list = await fetchAll();
|
|
44
|
+
const filtered = uniqueBy(list, 'person_id');
|
|
45
|
+
return filtered;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const uniqueBy = (arr: any, key: string) =>
|
|
49
|
+
[...new Map(arr.map((item: any) => [item[key], item])).values()] as Record<string, any>[];
|
|
50
|
+
|
|
42
51
|
return (
|
|
43
52
|
<RegisterLayout
|
|
44
53
|
parentLabel="MOH-705A Report"
|
|
@@ -51,7 +60,7 @@ const Moh204ARegisterComponent: React.FC<Moh204ARegisterComponentProps> = () =>
|
|
|
51
60
|
total={total}
|
|
52
61
|
isTotalExact={isTotalExact}
|
|
53
62
|
onPageChange={onPageChange}
|
|
54
|
-
fetchAll={
|
|
63
|
+
fetchAll={removePatientListDuplicates}
|
|
55
64
|
columns={moh204aExportColumns}
|
|
56
65
|
>
|
|
57
66
|
<div className={styles.tableContainer}>
|
|
@@ -273,7 +282,7 @@ const Moh204ARegisterComponent: React.FC<Moh204ARegisterComponentProps> = () =>
|
|
|
273
282
|
</TableHead>
|
|
274
283
|
<TableBody>
|
|
275
284
|
{patientlist?.length > 0 ? (
|
|
276
|
-
patientlist?.map((patient) => (
|
|
285
|
+
uniqueBy(patientlist, 'person_id')?.map((patient) => (
|
|
277
286
|
<TableRow key={patient.person_id || patient.id}>
|
|
278
287
|
<TableCell>{patient.date}</TableCell>
|
|
279
288
|
<TableCell>{patient.opd_number_new_visit}</TableCell>
|
|
@@ -12,7 +12,7 @@ import SpecimenReferralToHigherLevels from './sub-reports/specimen-referral-to-h
|
|
|
12
12
|
import DrugSusceptibilityTesting from './sub-reports/drug-susceptibility-testing/drug-susceptibility-testing.component';
|
|
13
13
|
import { ReportFiltersComponent, type ReportPeriod } from '../../common/report-filters';
|
|
14
14
|
import { showReportError } from '../../common/report-error';
|
|
15
|
-
import { hasReportData, ReportPlaceholder } from '../../common/report-placeholder';
|
|
15
|
+
import { hasReportData, ReportPlaceholder, useGeneratedLocation } from '../../common/report-placeholder';
|
|
16
16
|
import { getMoh706 } from '../../resources/moh-706.resource';
|
|
17
17
|
import styles from './moh-706.scss';
|
|
18
18
|
import MOH706Header from './moh-706-header.component';
|
|
@@ -22,7 +22,10 @@ import { ReportPage } from '../../common/report-page';
|
|
|
22
22
|
|
|
23
23
|
const MoH706Report: React.FC = () => {
|
|
24
24
|
const [moh706Data, setMoh706Data] = useState<any>({});
|
|
25
|
-
|
|
25
|
+
/* Only a report for the current location counts: after switching location the
|
|
26
|
+
old figures would otherwise be shown, and labelled, as the new location's. */
|
|
27
|
+
const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation();
|
|
28
|
+
const isReportGenerated = hasReportData(moh706Data) && isForCurrentLocation;
|
|
26
29
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
27
30
|
const [filters, setFilters] = useState<{ locationUuids?: string; startDate?: string; endDate?: string }>({});
|
|
28
31
|
|
|
@@ -59,6 +62,7 @@ const MoH706Report: React.FC = () => {
|
|
|
59
62
|
const result = await getMoh706(params);
|
|
60
63
|
const flatData = Object.assign({}, ...result);
|
|
61
64
|
setMoh706Data(flatData);
|
|
65
|
+
markGenerated(params.locationUuids);
|
|
62
66
|
setFilters({ locationUuids: params.locationUuids, startDate, endDate });
|
|
63
67
|
} catch (error: any) {
|
|
64
68
|
showReportError('the MOH-706 report', error);
|
|
@@ -77,7 +81,9 @@ const MoH706Report: React.FC = () => {
|
|
|
77
81
|
isReportGenerated={isReportGenerated}
|
|
78
82
|
/>
|
|
79
83
|
{isLoading && <ReportSkeleton />}
|
|
80
|
-
{!isLoading && !isReportGenerated &&
|
|
84
|
+
{!isLoading && !isReportGenerated && (
|
|
85
|
+
<ReportPlaceholder reportName="MOH-706" isLocationChanged={hasReportData(moh706Data) && hasLocationChanged} />
|
|
86
|
+
)}
|
|
81
87
|
{!isLoading && isReportGenerated && (
|
|
82
88
|
<ReportPage>
|
|
83
89
|
<div className={styles.sheet}>
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
2
2
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
3
3
|
import { ReportFiltersComponent, type ReportPeriod } from '../../common/report-filters';
|
|
4
4
|
import { showReportError } from '../../common/report-error';
|
|
5
|
-
import { hasReportData, ReportPlaceholder } from '../../common/report-placeholder';
|
|
5
|
+
import { hasReportData, ReportPlaceholder, useGeneratedLocation } from '../../common/report-placeholder';
|
|
6
6
|
|
|
7
7
|
import styles from './moh-710.scss';
|
|
8
8
|
import classNames from 'classnames';
|
|
@@ -17,7 +17,10 @@ const Moh710Report: React.FC = () => {
|
|
|
17
17
|
const saved = sessionStorage.getItem('moh710Data');
|
|
18
18
|
return saved ? JSON.parse(saved) : [];
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
/* Only a report for the current location counts: after switching location the
|
|
21
|
+
old figures would otherwise be shown, and labelled, as the new location's. */
|
|
22
|
+
const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('moh710Location');
|
|
23
|
+
const isReportGenerated = hasReportData(moh710Data) && isForCurrentLocation;
|
|
21
24
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
22
25
|
const navigate = useNavigate();
|
|
23
26
|
|
|
@@ -65,6 +68,7 @@ const Moh710Report: React.FC = () => {
|
|
|
65
68
|
const data = await getMoh710(params);
|
|
66
69
|
const flatData = Object.assign({}, ...data.result);
|
|
67
70
|
setMoh710Data(flatData);
|
|
71
|
+
markGenerated(params.locationUuids);
|
|
68
72
|
setIsLoading(false);
|
|
69
73
|
} catch (error) {
|
|
70
74
|
setIsLoading(false);
|
|
@@ -94,7 +98,9 @@ const Moh710Report: React.FC = () => {
|
|
|
94
98
|
generatedPeriod={{ startDate, endDate }}
|
|
95
99
|
/>
|
|
96
100
|
{isLoading && <ReportSkeleton />}
|
|
97
|
-
{!isLoading && !isReportGenerated &&
|
|
101
|
+
{!isLoading && !isReportGenerated && (
|
|
102
|
+
<ReportPlaceholder reportName="MOH-710" isLocationChanged={hasReportData(moh710Data) && hasLocationChanged} />
|
|
103
|
+
)}
|
|
98
104
|
{!isLoading && isReportGenerated && (
|
|
99
105
|
<ReportPage>
|
|
100
106
|
<div className={styles.mainTitleBox}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { ReportFiltersComponent, type ReportPeriod } from '../../common/report-filters';
|
|
3
3
|
import { showReportError } from '../../common/report-error';
|
|
4
|
-
import { hasReportData, ReportPlaceholder } from '../../common/report-placeholder';
|
|
4
|
+
import { hasReportData, ReportPlaceholder, useGeneratedLocation } from '../../common/report-placeholder';
|
|
5
5
|
|
|
6
6
|
import styles from './moh711.scss';
|
|
7
7
|
import classNames from 'classnames';
|
|
@@ -30,7 +30,10 @@ const Moh711Report: React.FC = () => {
|
|
|
30
30
|
const saved = sessionStorage.getItem('moh711Data');
|
|
31
31
|
return saved ? JSON.parse(saved) : [];
|
|
32
32
|
});
|
|
33
|
-
|
|
33
|
+
/* Only a report for the current location counts: after switching location the
|
|
34
|
+
old figures would otherwise be shown, and labelled, as the new location's. */
|
|
35
|
+
const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('moh711Location');
|
|
36
|
+
const isReportGenerated = hasReportData(moh711Data) && isForCurrentLocation;
|
|
34
37
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
35
38
|
const [startDate, setStartDate] = useState<string>(() => {
|
|
36
39
|
return sessionStorage.getItem('moh711StartDate') || '';
|
|
@@ -77,6 +80,7 @@ const Moh711Report: React.FC = () => {
|
|
|
77
80
|
const data = await getMoh711(params);
|
|
78
81
|
const flatData = Object.assign({}, ...data.result);
|
|
79
82
|
setMoh711Data(flatData);
|
|
83
|
+
markGenerated(params.locationUuids);
|
|
80
84
|
setIsLoading(false);
|
|
81
85
|
} catch (error) {
|
|
82
86
|
setIsLoading(false);
|
|
@@ -95,7 +99,9 @@ const Moh711Report: React.FC = () => {
|
|
|
95
99
|
generatedPeriod={{ startDate, endDate }}
|
|
96
100
|
/>
|
|
97
101
|
{isLoading && <ReportSkeleton />}
|
|
98
|
-
{!isLoading && !isReportGenerated &&
|
|
102
|
+
{!isLoading && !isReportGenerated && (
|
|
103
|
+
<ReportPlaceholder reportName="MOH-711" isLocationChanged={hasReportData(moh711Data) && hasLocationChanged} />
|
|
104
|
+
)}
|
|
99
105
|
{!isLoading && isReportGenerated && (
|
|
100
106
|
<ReportPage>
|
|
101
107
|
<div className={styles.headerContainer}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { ReportFiltersComponent, type ReportPeriod } from '../../common/report-filters';
|
|
3
3
|
import { showReportError } from '../../common/report-error';
|
|
4
|
-
import { hasReportData, ReportPlaceholder } from '../../common/report-placeholder';
|
|
4
|
+
import { hasReportData, ReportPlaceholder, useGeneratedLocation } from '../../common/report-placeholder';
|
|
5
5
|
|
|
6
6
|
import styles from './moh717.scss';
|
|
7
7
|
import classNames from 'classnames';
|
|
@@ -28,7 +28,10 @@ const Moh717Report: React.FC = () => {
|
|
|
28
28
|
const saved = sessionStorage.getItem('moh717ReportData');
|
|
29
29
|
return saved ? JSON.parse(saved) : [];
|
|
30
30
|
});
|
|
31
|
-
|
|
31
|
+
/* Only a report for the current location counts: after switching location the
|
|
32
|
+
old figures would otherwise be shown, and labelled, as the new location's. */
|
|
33
|
+
const { isForCurrentLocation, hasLocationChanged, markGenerated } = useGeneratedLocation('moh717Location');
|
|
34
|
+
const isReportGenerated = hasReportData(moh717ReportData) && isForCurrentLocation;
|
|
32
35
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
33
36
|
const [startDate, setStartDate] = useState<string>(() => {
|
|
34
37
|
return sessionStorage.getItem('moh717StartDate') || '';
|
|
@@ -72,6 +75,7 @@ const Moh717Report: React.FC = () => {
|
|
|
72
75
|
const data = await getMoh717(params);
|
|
73
76
|
const flatData = Object.assign({}, ...data.result);
|
|
74
77
|
setMoh717ReportData(flatData);
|
|
78
|
+
markGenerated(params.locationUuids);
|
|
75
79
|
setIsLoading(false);
|
|
76
80
|
} catch (error) {
|
|
77
81
|
setIsLoading(false);
|
|
@@ -89,7 +93,12 @@ const Moh717Report: React.FC = () => {
|
|
|
89
93
|
generatedPeriod={{ startDate, endDate }}
|
|
90
94
|
/>
|
|
91
95
|
{isLoading && <ReportSkeleton />}
|
|
92
|
-
{!isLoading && !isReportGenerated &&
|
|
96
|
+
{!isLoading && !isReportGenerated && (
|
|
97
|
+
<ReportPlaceholder
|
|
98
|
+
reportName="MOH-717"
|
|
99
|
+
isLocationChanged={hasReportData(moh717ReportData) && hasLocationChanged}
|
|
100
|
+
/>
|
|
101
|
+
)}
|
|
93
102
|
{!isLoading && isReportGenerated && (
|
|
94
103
|
<ReportPage>
|
|
95
104
|
<div className={styles.headerContainer}>
|