@ampath/esm-reports-app 1.0.0-next.4 → 1.0.0-next.40

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 (131) hide show
  1. package/dist/110.js +1 -0
  2. package/dist/110.js.map +1 -0
  3. package/dist/{260.js → 205.js} +1 -1
  4. package/dist/{260.js.map → 205.js.map} +1 -1
  5. package/dist/812.js +1 -1
  6. package/dist/812.js.map +1 -1
  7. package/dist/822.js +2 -0
  8. package/dist/822.js.map +1 -0
  9. package/dist/ampath-esm-reports-app.js +1 -1
  10. package/dist/ampath-esm-reports-app.js.buildmanifest.json +95 -74
  11. package/dist/ampath-esm-reports-app.js.map +1 -1
  12. package/dist/main.js +1 -1
  13. package/dist/main.js.map +1 -1
  14. package/dist/routes.json +1 -1
  15. package/package.json +1 -1
  16. package/src/common/report-filters/report-filters.component.tsx +5 -1
  17. package/src/dashboard/reports-dasboard.tsx +21 -0
  18. package/src/reports/datatable-wrapper/datatable-wrapper.component.tsx +54 -0
  19. package/src/reports/moh-240/moh-240-header.component.tsx +61 -0
  20. package/src/reports/moh-240/moh-240.component.tsx +93 -0
  21. package/src/reports/moh-240/moh-240.scss +11 -0
  22. package/src/reports/moh-240/sub-reports/moh-240-register.component.tsx +75 -0
  23. package/src/reports/moh-240/sub-reports/page-summary.component.tsx +98 -0
  24. package/src/reports/moh-505/moh-505-header.component.tsx +62 -0
  25. package/src/reports/moh-505/moh-505.component.tsx +440 -0
  26. package/src/reports/moh-505/moh-505.scss +3 -0
  27. package/src/reports/moh-705B/moh-204b-register.component.tsx +236 -0
  28. package/src/reports/moh-705B/moh-705b.component.tsx +524 -0
  29. package/src/reports/moh-705B/moh-705b.scss +44 -0
  30. package/src/reports/moh-705a/moh-705a.component.tsx +528 -0
  31. package/src/reports/moh-705a/moh-705a.scss +45 -0
  32. package/src/reports/moh-705a/registers/moh-204a-register.component.tsx +321 -0
  33. package/src/reports/moh-705a/type.ts +6 -0
  34. package/src/reports/moh-706/moh-706-header.component.tsx +61 -0
  35. package/src/reports/moh-706/moh-706.component.tsx +117 -0
  36. package/src/reports/moh-706/moh-706.scss +30 -0
  37. package/src/reports/moh-706/sub-reports/bacteriology/bacteriology.component.tsx +124 -0
  38. package/src/reports/moh-706/sub-reports/blood-chemistry/blood-chemistry.component.tsx +318 -0
  39. package/src/reports/moh-706/sub-reports/drug-susceptibility-testing/drug-susceptibility-testing.component.tsx +137 -0
  40. package/src/reports/moh-706/sub-reports/haematology/haematology.component.tsx +179 -0
  41. package/src/reports/moh-706/sub-reports/histology-and-cytology/histology-and-cytology.component.tsx +88 -0
  42. package/src/reports/moh-706/sub-reports/parasitology/parasitology.component.tsx +121 -0
  43. package/src/reports/moh-706/sub-reports/serology/serology.component.tsx +47 -0
  44. package/src/reports/moh-706/sub-reports/specimen-referral-to-higher-levels/specimen-referral-to-higher-levels.component.tsx +39 -0
  45. package/src/reports/moh-706/sub-reports/urine-analysis/urine-analysis.component.tsx +108 -0
  46. package/src/reports/moh-710/moh-710.component.tsx +211 -79
  47. package/src/reports/moh-710/moh-710.scss +5 -1
  48. package/src/reports/moh-710/registers/moh-511-710-register.component.tsx +263 -0
  49. package/src/reports/moh-710/registers/type.ts +31 -0
  50. package/src/reports/moh-711/moh-711.component.tsx +109 -1234
  51. package/src/reports/moh-711/moh711.scss +92 -8
  52. package/src/reports/moh-711/registers/moh-333-register.component.tsx +639 -0
  53. package/src/reports/moh-711/registers/moh-405-register.component.tsx +521 -0
  54. package/src/reports/moh-711/registers/moh-406-register.component.tsx +533 -0
  55. package/src/reports/moh-711/registers/moh-510-register.component.tsx +61 -0
  56. package/src/reports/moh-711/registers/moh-511-register.component.tsx +271 -0
  57. package/src/reports/moh-711/registers/type.ts +192 -0
  58. package/src/reports/moh-711/sections/anc.component.tsx +159 -0
  59. package/src/reports/moh-711/sections/cervical-cancer.component.tsx +148 -0
  60. package/src/reports/moh-711/sections/chanis.component.tsx +367 -0
  61. package/src/reports/moh-711/sections/family-planning.component.tsx +221 -0
  62. package/src/reports/moh-711/sections/gbv.component.tsx +115 -0
  63. package/src/reports/moh-711/sections/maternity.component.tsx +326 -0
  64. package/src/reports/moh-711/sections/medical-social-work.component.tsx +83 -0
  65. package/src/reports/moh-711/sections/other.component.tsx +47 -0
  66. package/src/reports/moh-711/sections/physiotherapy.component.tsx +61 -0
  67. package/src/reports/moh-711/sections/pnc.component.tsx +125 -0
  68. package/src/reports/moh-711/sections/post-abortion.component.tsx +42 -0
  69. package/src/reports/moh-711/sections/rehabilitation.component.tsx +57 -0
  70. package/src/reports/moh-711/sections/report-compiled-by.component.tsx +42 -0
  71. package/src/reports/moh-711/sections/tb-screening.component.tsx +57 -0
  72. package/src/reports/moh-717/moh-717.component.tsx +120 -946
  73. package/src/reports/moh-717/moh717.scss +138 -3
  74. package/src/reports/moh-717/registers/nutrition-register.component.tsx +48 -0
  75. package/src/reports/moh-717/sections/finance.component.tsx +42 -0
  76. package/src/reports/moh-717/sections/inpatient.component.tsx +374 -0
  77. package/src/reports/moh-717/sections/maternity.component.tsx +126 -0
  78. package/src/reports/moh-717/sections/medical-records.component.tsx +35 -0
  79. package/src/reports/moh-717/sections/mortuary.component.tsx +43 -0
  80. package/src/reports/moh-717/sections/operations.component.tsx +53 -0
  81. package/src/reports/moh-717/sections/orthopaedic-trauma.component.tsx +98 -0
  82. package/src/reports/moh-717/sections/outpatient.component.tsx +597 -0
  83. package/src/reports/moh-717/sections/pharmacy.component.tsx +43 -0
  84. package/src/reports/moh-717/sections/preparedby.component.tsx +47 -0
  85. package/src/reports/moh-717/sections/special-services.component.tsx +114 -0
  86. package/src/reports/moh-731/moh-731.component.tsx +181 -0
  87. package/src/reports/moh-731/moh-731.scss +118 -0
  88. package/src/reports/moh-731/registers/moh-366.component.tsx +478 -0
  89. package/src/reports/moh-731/registers/moh-366.scss +45 -0
  90. package/src/reports/moh-731/registers/prep-register.component.tsx +292 -0
  91. package/src/reports/moh-731/registers/prep-registers.scss +45 -0
  92. package/src/reports/moh-731/sections/hiv-and-tb-treatment.component.tsx +932 -0
  93. package/src/reports/moh-731/sections/hiv-testing-and-pre-exposure.component.tsx +569 -0
  94. package/src/reports/moh-731/sections/pmtct.component.tsx +451 -0
  95. package/src/reports/moh-740/moh-740.component.scss +120 -0
  96. package/src/reports/moh-740/moh-740.component.tsx +1271 -0
  97. package/src/reports/moh-740/moh-740.resource.ts +42 -0
  98. package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.scss +18 -0
  99. package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.tsx +104 -0
  100. package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.scss +18 -0
  101. package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.tsx +79 -0
  102. package/src/reports/moh-740/registers/moh-740-patient-list.scss +0 -0
  103. package/src/reports/moh-740/registers/moh-740-patient-list.tsx +66 -0
  104. package/src/reports/moh-740/shared/data-cell/data-cell.scss +6 -0
  105. package/src/reports/moh-740/shared/data-cell/data-cell.tsx +23 -0
  106. package/src/reports/moh-740/shared/utils/format-indicator.ts +22 -0
  107. package/src/reports/moh-740/shared/utils/indicator-register-map.ts +157 -0
  108. package/src/reports/moh-740/types/index.ts +216 -0
  109. package/src/reports/moh-745/moh-745.component.tsx +928 -0
  110. package/src/reports/moh-745/moh-745.scss +74 -0
  111. package/src/reports/moh-745/registers/moh-412-register.component.tsx +191 -0
  112. package/src/reports/moh-745/registers/type.ts +30 -0
  113. package/src/reports/table-wrapper/table-row-mapper.component.tsx +53 -0
  114. package/src/reports/table-wrapper/table-wrapper.component.tsx +21 -0
  115. package/src/reports/table-wrapper/table-wrapper.scss +31 -0
  116. package/src/resources/moh-505.resource.ts +86 -0
  117. package/src/resources/moh-705.resource.ts +117 -0
  118. package/src/resources/moh-706.resource.ts +86 -0
  119. package/src/resources/moh-710.resource.ts +28 -0
  120. package/src/resources/moh-711.resource.ts +146 -0
  121. package/src/resources/moh-717.resource.ts +27 -0
  122. package/src/resources/moh-731.resource.ts +96 -0
  123. package/src/resources/moh-745.resource.ts +64 -0
  124. package/src/root.component.tsx +39 -0
  125. package/src/routes.json +3 -1
  126. package/src/utils/utils.ts +36 -0
  127. package/dist/367.js +0 -2
  128. package/dist/367.js.map +0 -1
  129. package/dist/86.js +0 -1
  130. package/dist/86.js.map +0 -1
  131. /package/dist/{367.js.LICENSE.txt → 822.js.LICENSE.txt} +0 -0
@@ -0,0 +1,74 @@
1
+
2
+ h3 {
3
+ text-align: center;
4
+ }
5
+ .tableContainer {
6
+ margin-left: 2rem;
7
+ margin-bottom: 2rem;
8
+ margin-top: 1rem;
9
+ }
10
+
11
+ .sectionTitle {
12
+ margin-left: 1rem ;
13
+ }
14
+
15
+ .table {
16
+ width: auto;
17
+ border-collapse: collapse;
18
+
19
+ }
20
+
21
+
22
+
23
+ .tableBordered td,
24
+ .tableBordered th {
25
+ border: 1px solid #ccc;
26
+ padding: 0.3rem;
27
+ font-size: small;
28
+ }
29
+
30
+ .tableBordered th {
31
+ font-weight: bold;
32
+ }
33
+
34
+ .tableStriped tbody tr:nth-of-type(odd) {
35
+ background-color: #f9f9f9;
36
+ }
37
+
38
+ .rotateUp {
39
+ writing-mode: vertical-rl;
40
+ transform: rotate(180deg);
41
+ }
42
+
43
+ /*
44
+ span {
45
+ font-weight: normal;
46
+ padding: 2px;
47
+ }
48
+ */
49
+ .location {
50
+ margin: 2rem;
51
+ display: flex;
52
+ flex-wrap: nowrap;
53
+ align-items: center;
54
+ gap: 12px;
55
+ white-space: nowrap;
56
+ }
57
+
58
+
59
+ .line {
60
+ display: inline-block;
61
+ width: 150px;
62
+ border-bottom: 1px solid #000;
63
+ margin-left: 4px;
64
+ }
65
+
66
+ .shortLine {
67
+ display: inline-block;
68
+ width: 90px;
69
+ border-bottom: 1px solid #000;
70
+ margin-left: 4px;
71
+ }
72
+ .buttonContainer {
73
+ margin: 2rem;
74
+ }
@@ -0,0 +1,191 @@
1
+ import { Button, Loading, Table, TableBody, TableHead, TableHeader, TableRow } from '@carbon/react';
2
+ import React, { useEffect, useState } from 'react';
3
+
4
+ import styles from '../moh-745.scss';
5
+ import classNames from 'classnames';
6
+ import { useNavigate, useSearchParams } from 'react-router-dom';
7
+ import { moh412Columns } from './type';
8
+ import { getMoh412PatientList } from '../../../resources/moh-745.resource';
9
+
10
+ const Moh412Register: React.FC = () => {
11
+ const navigate = useNavigate();
12
+ const [patientlist, setPatientList] = useState<any[]>([]);
13
+ const [isLoading, setIsLoading] = useState(false);
14
+
15
+ const [searchParams] = useSearchParams();
16
+
17
+ const startDate = searchParams.get('startDate');
18
+ const endDate = searchParams.get('endDate');
19
+ const locationUuids = searchParams.get('locationUuids');
20
+ const indicator = searchParams.get('indicator');
21
+
22
+ useEffect(() => {
23
+ const fetchData = async () => {
24
+ if (!startDate || !endDate || !locationUuids || !indicator) return;
25
+
26
+ setIsLoading(true);
27
+
28
+ try {
29
+ const params = {
30
+ startDate,
31
+ endDate,
32
+ locationUuids,
33
+ indicator,
34
+ };
35
+
36
+ const data = await getMoh412PatientList(params);
37
+
38
+ setPatientList(data?.results.results || []);
39
+ } catch (error) {
40
+ console.error('Failed to fetch register data', error);
41
+ } finally {
42
+ setIsLoading(false);
43
+ }
44
+ };
45
+
46
+ fetchData();
47
+ }, [startDate, endDate, locationUuids, indicator]);
48
+
49
+ function navigateBack() {
50
+ navigate('/moh-745');
51
+ }
52
+ return (
53
+ <>
54
+ <div className={styles.buttonContainer}>
55
+ <Button onClick={navigateBack}>Back</Button>
56
+ </div>
57
+ <div>{isLoading && <Loading />}</div>
58
+ <div className={styles.tableContainer}>
59
+ <Table className={classNames(`${styles.table}`, `${styles.tableBordered}`, `${styles.tableStriped}`)}>
60
+ <TableHead>
61
+ <TableRow>
62
+ <TableHeader colSpan={3}>Month:</TableHeader>
63
+ <TableHeader colSpan={2}>Year</TableHeader>
64
+ <TableHeader></TableHeader>
65
+ <TableHeader></TableHeader>
66
+ <TableHeader></TableHeader>
67
+ <TableHeader></TableHeader>
68
+ <TableHeader colSpan={6}>CERVICAL CANCER</TableHeader>
69
+ <TableHeader colSpan={3}>Breast Cancer</TableHeader>
70
+ <TableHeader colSpan={2}>Colorectal Cancer</TableHeader>
71
+ <TableHeader></TableHeader>
72
+ <TableHeader></TableHeader>
73
+ <TableHeader></TableHeader>
74
+ <TableHeader></TableHeader>
75
+ </TableRow>
76
+ <TableRow>
77
+ <TableHeader colSpan={9}>Client Details</TableHeader>
78
+ <TableHeader colSpan={3}>Screening Methods and Results</TableHeader>
79
+ <TableHeader colSpan={3}>Pre-Cancer Treatment</TableHeader>
80
+ <TableHeader colSpan={3}>Methods and Results</TableHeader>
81
+ <TableHeader colSpan={2}>Methods and Results</TableHeader>
82
+ <TableHeader></TableHeader>
83
+ <TableHeader></TableHeader>
84
+ <TableHeader></TableHeader>
85
+ <TableHeader></TableHeader>
86
+ </TableRow>
87
+ <TableRow>
88
+ <TableHeader>
89
+ a)S/No
90
+ <br />
91
+ No
92
+ </TableHeader>
93
+ <TableHeader>
94
+ b)Visit <br />
95
+ Date
96
+ </TableHeader>
97
+ <TableHeader>
98
+ c)Visit <br />
99
+ Type
100
+ </TableHeader>
101
+ <TableHeader>
102
+ d)Client <br />
103
+ No
104
+ </TableHeader>
105
+ <TableHeader>e)Client Names</TableHeader>
106
+ <TableHeader>
107
+ f)Client's Phone <br />
108
+ Number
109
+ </TableHeader>
110
+ <TableHeader>
111
+ g)Client's <br /> Age
112
+ </TableHeader>
113
+ <TableHeader>
114
+ h)Location
115
+ <br />
116
+ Residence
117
+ </TableHeader>
118
+ <TableHeader>
119
+ i)Treatment
120
+ <br />
121
+ Suppoter's Phone
122
+ <br />
123
+ Number
124
+ </TableHeader>
125
+ <TableHeader>
126
+ j)Via or <br />
127
+ VIA/VILLI
128
+ </TableHeader>
129
+ <TableHeader>
130
+ k)Pap <br />
131
+ Smear
132
+ </TableHeader>
133
+ <TableHeader>
134
+ l)HPV Test
135
+ <br />
136
+ (over 30 years)
137
+ </TableHeader>
138
+ <TableHeader>m)cryotherapy</TableHeader>
139
+ <TableHeader>
140
+ n)Thermo-
141
+ <br />
142
+ ablation
143
+ </TableHeader>
144
+ <TableHeader>o)LEEP</TableHeader>
145
+ <TableHeader>p)CBE</TableHeader>
146
+ <TableHeader>q)Ultrasound</TableHeader>
147
+ <TableHeader>r)Mammogram</TableHeader>
148
+ <TableHeader>s)Colonoscopy</TableHeader>
149
+ <TableHeader>t)FOBT</TableHeader>
150
+ <TableHeader>u)HIV Status</TableHeader>
151
+ <TableHeader>
152
+ v)Referral <br />
153
+ To/From
154
+ </TableHeader>
155
+ <TableHeader>
156
+ w)Follow-
157
+ <br />
158
+ up Date
159
+ </TableHeader>
160
+ <TableHeader>
161
+ Remarks(e.g Colposcopy done,
162
+ <br />
163
+ Cervicography results, Call
164
+ <br />
165
+ Client for follow up, Return for <br />
166
+ post-treatment screening, <br />
167
+ Communicate with the referral site)
168
+ </TableHeader>
169
+ </TableRow>
170
+ </TableHead>
171
+ <TableBody>
172
+ {patientlist?.length > 0 ? (
173
+ patientlist.map((patient, index) => (
174
+ <TableRow key={index}>
175
+ {moh412Columns.map((col) => (
176
+ <td key={col}>{col === 'serial_no' ? index + 1 : (patient?.[col] ?? '')}</td>
177
+ ))}
178
+ </TableRow>
179
+ ))
180
+ ) : (
181
+ <TableRow>
182
+ <td colSpan={moh412Columns.length}>No data available</td>
183
+ </TableRow>
184
+ )}
185
+ </TableBody>
186
+ </Table>
187
+ </div>
188
+ </>
189
+ );
190
+ };
191
+ export default Moh412Register;
@@ -0,0 +1,30 @@
1
+ export const moh412Columns = [
2
+ 'serial_no',
3
+ 'visit_date',
4
+ 'visit_type',
5
+ 'client_no',
6
+ 'full_names',
7
+ 'phone_number',
8
+ 'age',
9
+ 'location_residence',
10
+ 'treatment_supporter_phone_number',
11
+
12
+ 'via_villi',
13
+ 'pap_smear',
14
+ 'hpv',
15
+ 'cryotherapy',
16
+ 'thermocoagulation',
17
+ 'leep',
18
+
19
+ 'cbe',
20
+ 'ultrasound',
21
+ 'mammogram',
22
+ 'colonoscopy',
23
+ 'fobt',
24
+ 'hiv_status',
25
+
26
+ 'referral_from',
27
+ 'referral_to',
28
+ 'follow_up_date',
29
+ 'remarks',
30
+ ];
@@ -0,0 +1,53 @@
1
+ import React from "react";
2
+ import { TableRow, TableCell } from "@carbon/react";
3
+ import styles from './table-wrapper.scss';
4
+ import { navigate } from "@openmrs/esm-framework";
5
+
6
+ interface TableRowMapperProps {
7
+ tableRows: {
8
+ tableCells: Array<{
9
+ key: string;
10
+ label: any;
11
+ strong: boolean;
12
+ colSpan: number;
13
+ rowSpan: number;
14
+ }>
15
+ }[],
16
+ data?: any,
17
+ redirectTo?: string,
18
+ locationUuids?: string,
19
+ startDate?: string,
20
+ endDate?: string
21
+ report?: string,
22
+ }
23
+
24
+ const TableRowMapper: React.FC<TableRowMapperProps> = ({ tableRows, data, redirectTo = "home/reports/moh-240", locationUuids, startDate, endDate, report = "moh-706" }) => {
25
+ return <>
26
+ {tableRows.map((tR) => (
27
+ <TableRow>
28
+ {tR.tableCells.map((tC, i) => {
29
+ const value = data ? data[tC.key] : "";
30
+
31
+ const onClick = () => {
32
+ if (!tC.label && tC.key) {
33
+ const params = new URLSearchParams();
34
+ if (locationUuids) params.append('locationUuids', locationUuids);
35
+ if (startDate) params.append('startDate', startDate);
36
+ if (endDate) params.append('endDate', endDate);
37
+ if (tC.key) params.append('indicators', tC.key);
38
+ params.append('report', report);
39
+ navigate({ to: `${redirectTo}?${params.toString()}` });
40
+ }
41
+ };
42
+
43
+ return <TableCell className={styles.dataCell} colSpan={tC.colSpan} key={i} onClick={onClick} {...({ rowSpan: tC.rowSpan } as any)}>
44
+ {tC.label ? (tC.strong ? <strong>{tC.label}</strong> : tC.label) : value}
45
+ </TableCell>
46
+
47
+ })}
48
+ </TableRow>
49
+ ))}
50
+ </>
51
+ }
52
+
53
+ export default TableRowMapper;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Table, TableBody } from '@carbon/react';
3
+ import styles from './table-wrapper.scss';
4
+
5
+ interface TableWrapperProps {
6
+ children: React.ReactNode;
7
+ }
8
+
9
+ const TableWrapper: React.FC<TableWrapperProps> = ({ children }) => {
10
+ return <>
11
+ <div className={styles.tableWrapper}>
12
+ <Table size="sm" className={styles.tableComponent}>
13
+ <TableBody>
14
+ {children}
15
+ </TableBody>
16
+ </Table>
17
+ </div>
18
+ </>
19
+ }
20
+
21
+ export default TableWrapper;
@@ -0,0 +1,31 @@
1
+ .tableWrapper {
2
+ overflow-x: auto;
3
+ border-radius: 4px;
4
+ padding: 5px;
5
+ }
6
+
7
+ .tableContainer {
8
+ width: 100%;
9
+ border-collapse: collapse;
10
+
11
+ thead {
12
+ background-color: #f4f4f4;
13
+ }
14
+
15
+ tbody {
16
+ background-color: white;
17
+ }
18
+ }
19
+
20
+ .dataCell {
21
+ padding: 0.01rem;
22
+ border: 1px solid #d0d0d0;
23
+ text-align: center;
24
+ height: 20px;
25
+ min-width: 50px;
26
+ font-size: small;
27
+
28
+ &:hover {
29
+ background-color: #f0f7ff;
30
+ }
31
+ }
@@ -0,0 +1,86 @@
1
+ import { openmrsFetch } from '@openmrs/esm-framework';
2
+ import { getEtlBaseUrl } from '../utils/get-base-url';
3
+
4
+ interface Moh505Params {
5
+ locationUuids: string;
6
+ startDate?: string;
7
+ endDate?: string;
8
+ }
9
+
10
+ interface Moh505Response {
11
+ result: Array<Record<string, unknown>>;
12
+ }
13
+
14
+ interface Moh505PatientListParams {
15
+ locationUuids: string;
16
+ startDate?: string;
17
+ endDate?: string;
18
+ indicators: string;
19
+ }
20
+
21
+ interface Moh505PatientListResponse {
22
+ result: Array<Record<string, unknown>>;
23
+ }
24
+
25
+ export async function getMoh505(params: Moh505Params): Promise<Array<Record<string, unknown>>> {
26
+ const etlBaseUrl = await getEtlBaseUrl();
27
+ const url = `${etlBaseUrl}/moh-505`;
28
+ const queryparams = {
29
+ locationUuids: params.locationUuids || '',
30
+ startDate: params.startDate || '',
31
+ endDate: params.endDate || '',
32
+ };
33
+ const queryString = new URLSearchParams(
34
+ Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
35
+ ).toString();
36
+ try {
37
+ const response = await openmrsFetch(`${url}?${queryString}`);
38
+
39
+ if (!response.ok) {
40
+ const errorText = await response.text();
41
+ throw new Error(`Failed to fetch MOH-505 report: ${response.status} - ${errorText}`);
42
+ }
43
+
44
+ const data = await response.json();
45
+
46
+ if (!Array.isArray(data.result)) {
47
+ throw new Error('Invalid MOH-505 response format: missing result array.');
48
+ }
49
+
50
+ return data.result;
51
+ } catch (error: any) {
52
+ throw new Error(`An error occurred while fetching the MOH-505 report: ${error.message}`);
53
+ }
54
+ }
55
+
56
+ export async function getMoh505PatientList(params: Moh505PatientListParams): Promise<Array<Record<string, unknown>>> {
57
+ const etlBaseUrl = await getEtlBaseUrl();
58
+ const url = `${etlBaseUrl}/moh-505/patient-list`;
59
+ const queryparams = {
60
+ locationUuids: params.locationUuids || '',
61
+ startDate: params.startDate || '',
62
+ endDate: params.endDate || '',
63
+ indicators: params.indicators || '',
64
+ };
65
+ const queryString = new URLSearchParams(
66
+ Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
67
+ ).toString();
68
+ try {
69
+ const response = await openmrsFetch(`${url}?${queryString}`);
70
+
71
+ if (!response.ok) {
72
+ const errorText = await response.text();
73
+ throw new Error(`Failed to fetch MOH-505 patient list: ${response.status} - ${errorText}`);
74
+ }
75
+
76
+ const data = await response.json();
77
+
78
+ if (!Array.isArray(data.result)) {
79
+ throw new Error('Invalid MOH-505 patient list response format: missing result array.');
80
+ }
81
+
82
+ return data.result;
83
+ } catch (error: any) {
84
+ throw new Error(`An error occurred while fetching the MOH-505 patient list: ${error.message}`);
85
+ }
86
+ }
@@ -0,0 +1,117 @@
1
+ import { openmrsFetch } from '@openmrs/esm-framework';
2
+ import { getEtlBaseUrl } from '../utils/get-base-url';
3
+
4
+ interface Moh710Params {
5
+ locationUuids: string;
6
+ startDate?: string;
7
+ endDate?: string;
8
+ indicator?: string | string[];
9
+ }
10
+
11
+ export async function getMoh705a(params: Moh710Params): Promise<any> {
12
+ const etlBaseUrl = await getEtlBaseUrl();
13
+ const url = `${etlBaseUrl}/moh-705a`;
14
+ const queryparams = {
15
+ locationUuids: params.locationUuids || '',
16
+ startDate: params.startDate || '',
17
+ endDate: params.endDate || '',
18
+ };
19
+ const queryString = new URLSearchParams(
20
+ Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
21
+ ).toString();
22
+ try {
23
+ const response = await openmrsFetch(`${url}?${queryString}`);
24
+
25
+ if (!response.ok) {
26
+ const errorText = await response.text();
27
+ throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
28
+ }
29
+
30
+ const data = await response.json();
31
+ return data;
32
+ } catch (error: any) {
33
+ throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
34
+ }
35
+ }
36
+
37
+ export async function getMoh705aPatientList(params: Moh710Params): Promise<any> {
38
+ const etlBaseUrl = await getEtlBaseUrl();
39
+ const url = `${etlBaseUrl}/moh-705a-patient-list`;
40
+ const queryparams = {
41
+ locationUuids: params.locationUuids || '',
42
+ startDate: params.startDate || '',
43
+ endDate: params.endDate || '',
44
+ indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
45
+ limit: '300',
46
+ };
47
+ const queryString = new URLSearchParams(
48
+ Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
49
+ ).toString();
50
+ try {
51
+ const response = await openmrsFetch(`${url}?${queryString}`);
52
+
53
+ if (!response.ok) {
54
+ const errorText = await response.text();
55
+ throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
56
+ }
57
+
58
+ const data = await response.json();
59
+ return data;
60
+ } catch (error: any) {
61
+ throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
62
+ }
63
+ }
64
+
65
+ export async function getMoh705b(params: Moh710Params): Promise<any> {
66
+ const etlBaseUrl = await getEtlBaseUrl();
67
+ const url = `${etlBaseUrl}/moh-705b`;
68
+ const queryparams = {
69
+ locationUuids: params.locationUuids || '',
70
+ startDate: params.startDate || '',
71
+ endDate: params.endDate || '',
72
+ };
73
+ const queryString = new URLSearchParams(
74
+ Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
75
+ ).toString();
76
+ try {
77
+ const response = await openmrsFetch(`${url}?${queryString}`);
78
+
79
+ if (!response.ok) {
80
+ const errorText = await response.text();
81
+ throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
82
+ }
83
+
84
+ const data = await response.json();
85
+ return data;
86
+ } catch (error: any) {
87
+ throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
88
+ }
89
+ }
90
+
91
+ export async function getMoh705bPatientList(params: Moh710Params): Promise<any> {
92
+ const etlBaseUrl = await getEtlBaseUrl();
93
+ const url = `${etlBaseUrl}/moh-705b-patient-list`;
94
+ const queryparams = {
95
+ locationUuids: params.locationUuids || '',
96
+ startDate: params.startDate || '',
97
+ endDate: params.endDate || '',
98
+ indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
99
+ limit: '300',
100
+ };
101
+ const queryString = new URLSearchParams(
102
+ Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
103
+ ).toString();
104
+ try {
105
+ const response = await openmrsFetch(`${url}?${queryString}`);
106
+
107
+ if (!response.ok) {
108
+ const errorText = await response.text();
109
+ throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
110
+ }
111
+
112
+ const data = await response.json();
113
+ return data;
114
+ } catch (error: any) {
115
+ throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
116
+ }
117
+ }
@@ -0,0 +1,86 @@
1
+ import { openmrsFetch } from '@openmrs/esm-framework';
2
+ import { getEtlBaseUrl } from '../utils/get-base-url';
3
+
4
+ interface Moh706Params {
5
+ locationUuids: string;
6
+ startDate?: string;
7
+ endDate?: string;
8
+ }
9
+
10
+ interface Moh706Response {
11
+ result: Array<Record<string, unknown>>;
12
+ }
13
+
14
+ interface Moh706PatientListParams {
15
+ locationUuids: string;
16
+ startDate?: string;
17
+ endDate?: string;
18
+ indicators: string;
19
+ }
20
+
21
+ interface Moh706PatientListResponse {
22
+ result: Array<Record<string, unknown>>;
23
+ }
24
+
25
+ export async function getMoh706(params: Moh706Params): Promise<Array<Record<string, unknown>>> {
26
+ const etlBaseUrl = await getEtlBaseUrl();
27
+ const url = `${etlBaseUrl}/lab-706`;
28
+ const queryparams = {
29
+ locationUuids: params.locationUuids || '',
30
+ startDate: params.startDate || '',
31
+ endDate: params.endDate || '',
32
+ };
33
+ const queryString = new URLSearchParams(
34
+ Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
35
+ ).toString();
36
+ try {
37
+ const response = await openmrsFetch(`${url}?${queryString}`);
38
+
39
+ if (!response.ok) {
40
+ const errorText = await response.text();
41
+ throw new Error(`Failed to fetch MOH-706 report: ${response.status} - ${errorText}`);
42
+ }
43
+
44
+ const data = await response.json();
45
+
46
+ if (!Array.isArray(data.result)) {
47
+ throw new Error('Invalid MOH-706 response format: missing result array.');
48
+ }
49
+
50
+ return data.result;
51
+ } catch (error: any) {
52
+ throw new Error(`An error occurred while fetching the MOH-706 report: ${error.message}`);
53
+ }
54
+ }
55
+
56
+ export async function getMoh706PatientList(params: Moh706PatientListParams): Promise<Array<Record<string, unknown>>> {
57
+ const etlBaseUrl = await getEtlBaseUrl();
58
+ const url = `${etlBaseUrl}/lab-706/patient-list`;
59
+ const queryparams = {
60
+ locationUuids: params.locationUuids || '',
61
+ startDate: params.startDate || '',
62
+ endDate: params.endDate || '',
63
+ indicators: params.indicators || '',
64
+ };
65
+ const queryString = new URLSearchParams(
66
+ Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
67
+ ).toString();
68
+ try {
69
+ const response = await openmrsFetch(`${url}?${queryString}`);
70
+
71
+ if (!response.ok) {
72
+ const errorText = await response.text();
73
+ throw new Error(`Failed to fetch MOH-706 patient list: ${response.status} - ${errorText}`);
74
+ }
75
+
76
+ const data = await response.json();
77
+
78
+ if (!Array.isArray(data.result)) {
79
+ throw new Error('Invalid MOH-706 patient list response format: missing result array.');
80
+ }
81
+
82
+ return data.result;
83
+ } catch (error: any) {
84
+ throw new Error(`An error occurred while fetching the MOH-706 patient list: ${error.message}`);
85
+ }
86
+ }