@ampath/esm-reports-app 1.0.0-next.2 → 1.0.0-next.21
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/138.js +2 -0
- package/dist/138.js.LICENSE.txt +20 -0
- package/dist/138.js.map +1 -0
- package/dist/184.js +1 -1
- package/dist/184.js.map +1 -1
- package/dist/205.js +1 -0
- package/dist/205.js.map +1 -0
- package/dist/282.js +1 -1
- package/dist/282.js.LICENSE.txt +3 -3
- package/dist/282.js.map +1 -1
- package/dist/311.js +1 -0
- package/dist/311.js.map +1 -0
- package/dist/353.js +1 -1
- package/dist/353.js.map +1 -1
- package/dist/478.js +2 -0
- package/dist/478.js.LICENSE.txt +9 -0
- package/dist/478.js.map +1 -0
- package/dist/51.js +1 -0
- package/dist/51.js.map +1 -0
- package/dist/540.js +1 -1
- package/dist/540.js.map +1 -1
- package/dist/812.js +1 -0
- package/dist/812.js.map +1 -0
- package/dist/961.js +1 -1
- package/dist/961.js.map +1 -1
- package/dist/ampath-esm-reports-app.js +1 -1
- package/dist/ampath-esm-reports-app.js.buildmanifest.json +128 -151
- package/dist/ampath-esm-reports-app.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +2 -1
- package/src/common/report-filters/report-filters.component.tsx +127 -0
- package/src/common/report-filters/report-filters.scss +49 -0
- package/src/config-schema.ts +6 -37
- package/src/createDashboardLink.tsx +9 -0
- package/src/dashboard/reports-dasboard.tsx +44 -0
- package/src/dashboard/reports-dashboard.module.scss +14 -0
- package/src/dashboard-meta/reports-dashboard.meta.ts +6 -0
- package/src/index.ts +6 -35
- package/src/reports/datatable-wrapper/datatable-wrapper.component.tsx +54 -0
- package/src/reports/moh-240/moh-240-header.component.tsx +61 -0
- package/src/reports/moh-240/moh-240.component.tsx +68 -0
- package/src/reports/moh-240/moh-240.scss +3 -0
- package/src/reports/moh-240/sub-reports/moh-240-register.component.tsx +72 -0
- package/src/reports/moh-240/sub-reports/page-summary.component.tsx +95 -0
- package/src/reports/moh-505/moh-505-header.component.tsx +62 -0
- package/src/reports/moh-505/moh-505.component.tsx +240 -0
- package/src/reports/moh-505/moh-505.scss +3 -0
- package/src/reports/moh-705B/moh-705b.component.tsx +466 -0
- package/src/reports/moh-705B/moh-705b.scss +41 -0
- package/src/reports/moh-705a/moh-705a.component.tsx +473 -0
- package/src/reports/moh-705a/moh-705a.scss +41 -0
- package/src/reports/moh-706/moh-706-header.component.tsx +61 -0
- package/src/reports/moh-706/moh-706.component.tsx +104 -0
- package/src/reports/moh-706/moh-706.scss +30 -0
- package/src/reports/moh-706/sub-reports/bacteriology/bacteriology.component.tsx +124 -0
- package/src/reports/moh-706/sub-reports/blood-chemistry/blood-chemistry.component.tsx +318 -0
- package/src/reports/moh-706/sub-reports/drug-susceptibility-testing/drug-susceptibility-testing.component.tsx +137 -0
- package/src/reports/moh-706/sub-reports/haematology/haematology.component.tsx +179 -0
- package/src/reports/moh-706/sub-reports/histology-and-cytology/histology-and-cytology.component.tsx +88 -0
- package/src/reports/moh-706/sub-reports/parasitology/parasitology.component.tsx +121 -0
- package/src/reports/moh-706/sub-reports/serology/serology.component.tsx +47 -0
- package/src/reports/moh-706/sub-reports/specimen-referral-to-higher-levels/specimen-referral-to-higher-levels.component.tsx +39 -0
- package/src/reports/moh-706/sub-reports/urine-analysis/urine-analysis.component.tsx +108 -0
- package/src/reports/moh-710/moh-710.component.tsx +663 -0
- package/src/reports/moh-710/moh-710.scss +41 -0
- package/src/reports/moh-711/moh-711.component.tsx +121 -0
- package/src/reports/moh-711/moh711.scss +71 -0
- package/src/reports/moh-711/sections/anc.component.tsx +134 -0
- package/src/reports/moh-711/sections/cervical-cancer.component.tsx +104 -0
- package/src/reports/moh-711/sections/chanis.component.tsx +367 -0
- package/src/reports/moh-711/sections/family-planning.component.tsx +221 -0
- package/src/reports/moh-711/sections/gbv.component.tsx +115 -0
- package/src/reports/moh-711/sections/maternity.component.tsx +280 -0
- package/src/reports/moh-711/sections/medical-social-work.component.tsx +83 -0
- package/src/reports/moh-711/sections/other.component.tsx +47 -0
- package/src/reports/moh-711/sections/physiotherapy.component.tsx +61 -0
- package/src/reports/moh-711/sections/pnc.component.tsx +92 -0
- package/src/reports/moh-711/sections/post-abortion.component.tsx +42 -0
- package/src/reports/moh-711/sections/rehabilitation.component.tsx +57 -0
- package/src/reports/moh-711/sections/report-compiled-by.component.tsx +42 -0
- package/src/reports/moh-711/sections/tb-screening.component.tsx +57 -0
- package/src/reports/moh-717/moh-717.component.tsx +152 -0
- package/src/reports/moh-717/moh717.scss +150 -0
- package/src/reports/moh-717/sections/finance.component.tsx +42 -0
- package/src/reports/moh-717/sections/inpatient.component.tsx +374 -0
- package/src/reports/moh-717/sections/maternity.component.tsx +94 -0
- package/src/reports/moh-717/sections/medical-records.component.tsx +35 -0
- package/src/reports/moh-717/sections/mortuary.component.tsx +43 -0
- package/src/reports/moh-717/sections/operations.component.tsx +53 -0
- package/src/reports/moh-717/sections/orthopaedic-trauma.component.tsx +98 -0
- package/src/reports/moh-717/sections/outpatient.component.tsx +489 -0
- package/src/reports/moh-717/sections/pharmacy.component.tsx +43 -0
- package/src/reports/moh-717/sections/preparedby.component.tsx +47 -0
- package/src/reports/moh-717/sections/special-services.component.tsx +114 -0
- package/src/reports/moh-740/moh-740.component.scss +120 -0
- package/src/reports/moh-740/moh-740.component.tsx +907 -0
- package/src/reports/moh-740/moh-740.resource.ts +42 -0
- package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.tsx +6 -0
- package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.tsx +58 -0
- package/src/reports/moh-740/registers/moh-740-patient-list.scss +0 -0
- package/src/reports/moh-740/registers/moh-740-patient-list.tsx +43 -0
- package/src/reports/moh-740/shared/data-cell/data-cell.scss +6 -0
- package/src/reports/moh-740/shared/data-cell/data-cell.tsx +23 -0
- package/src/reports/moh-740/types/index.ts +115 -0
- package/src/reports/moh-745/moh-745.component.tsx +629 -0
- package/src/reports/moh-745/moh-745.scss +69 -0
- package/src/reports/table-wrapper/table-row-mapper.component.tsx +51 -0
- package/src/reports/table-wrapper/table-wrapper.component.tsx +21 -0
- package/src/reports/table-wrapper/table-wrapper.scss +31 -0
- package/src/resources/moh-705.resource.ts +60 -0
- package/src/resources/moh-706.resource.ts +86 -0
- package/src/resources/moh-710.resource.ts +34 -0
- package/src/resources/moh-711.resource.ts +34 -0
- package/src/resources/moh-717.resource.ts +35 -0
- package/src/resources/moh-745.resource.ts +34 -0
- package/src/root.component.tsx +30 -32
- package/src/routes.json +14 -17
- package/src/utils/get-base-url.ts +12 -0
- package/src/utils/utils.ts +36 -0
- package/dist/19.js +0 -2
- package/dist/19.js.LICENSE.txt +0 -39
- package/dist/19.js.map +0 -1
- package/dist/255.js +0 -1
- package/dist/255.js.map +0 -1
- package/dist/389.js +0 -1
- package/dist/389.js.map +0 -1
- package/dist/451.js +0 -1
- package/dist/451.js.map +0 -1
- package/dist/488.js +0 -1
- package/dist/488.js.map +0 -1
- package/dist/557.js +0 -1
- package/dist/557.js.map +0 -1
- package/dist/91.js +0 -1
- package/dist/91.js.map +0 -1
- package/dist/970.js +0 -1
- package/dist/970.js.map +0 -1
- package/src/boxes/extensions/blue-box.component.tsx +0 -15
- package/src/boxes/extensions/box.scss +0 -23
- package/src/boxes/extensions/brand-box.component.tsx +0 -15
- package/src/boxes/extensions/red-box.component.tsx +0 -15
- package/src/boxes/slot/boxes.component.tsx +0 -25
- package/src/boxes/slot/boxes.scss +0 -29
- package/src/greeter/greeter.component.tsx +0 -42
- package/src/greeter/greeter.scss +0 -20
- package/src/greeter/greeter.test.tsx +0 -28
- package/src/patient-getter/patient-getter.component.tsx +0 -40
- package/src/patient-getter/patient-getter.resource.ts +0 -39
- package/src/patient-getter/patient-getter.scss +0 -16
- package/src/patient-getter/patient-getter.test.tsx +0 -40
- package/src/resources/resources.component.tsx +0 -56
- package/src/resources/resources.scss +0 -68
- package/src/root.test.tsx +0 -51
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
.tableBordered td,
|
|
22
|
+
.tableBordered th {
|
|
23
|
+
border: 1px solid #ccc;
|
|
24
|
+
padding: 0.3rem;
|
|
25
|
+
font-size: small;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tableBordered th {
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tableStriped tbody tr:nth-of-type(odd) {
|
|
33
|
+
background-color: #f9f9f9;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.rotateUp {
|
|
37
|
+
writing-mode: vertical-rl;
|
|
38
|
+
transform: rotate(180deg);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
span {
|
|
43
|
+
font-weight: normal;
|
|
44
|
+
padding: 2px;
|
|
45
|
+
}
|
|
46
|
+
*/
|
|
47
|
+
.location {
|
|
48
|
+
margin: 2rem;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-wrap: nowrap;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: 12px;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
.line {
|
|
58
|
+
display: inline-block;
|
|
59
|
+
width: 150px;
|
|
60
|
+
border-bottom: 1px solid #000;
|
|
61
|
+
margin-left: 4px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.shortLine {
|
|
65
|
+
display: inline-block;
|
|
66
|
+
width: 90px;
|
|
67
|
+
border-bottom: 1px solid #000;
|
|
68
|
+
margin-left: 4px;
|
|
69
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
}
|
|
22
|
+
|
|
23
|
+
const TableRowMapper: React.FC<TableRowMapperProps> = ({ tableRows, data, redirectTo = "home/reports/moh-240", locationUuids, startDate, endDate }) => {
|
|
24
|
+
return <>
|
|
25
|
+
{tableRows.map((tR) => (
|
|
26
|
+
<TableRow>
|
|
27
|
+
{tR.tableCells.map((tC, i) => {
|
|
28
|
+
const value = data ? data[tC.key] : "";
|
|
29
|
+
|
|
30
|
+
const onClick = () => {
|
|
31
|
+
if (!tC.label && tC.key) {
|
|
32
|
+
const params = new URLSearchParams();
|
|
33
|
+
if (locationUuids) params.append('locationUuids', locationUuids);
|
|
34
|
+
if (startDate) params.append('startDate', startDate);
|
|
35
|
+
if (endDate) params.append('endDate', endDate);
|
|
36
|
+
if (tC.key) params.append('indicators', tC.key);
|
|
37
|
+
navigate({ to: `${redirectTo}?${params.toString()}` });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return <TableCell className={styles.dataCell} colSpan={tC.colSpan} key={i} onClick={onClick} {...({ rowSpan: tC.rowSpan } as any)}>
|
|
42
|
+
{tC.label ? (tC.strong ? <strong>{tC.label}</strong> : tC.label) : value}
|
|
43
|
+
</TableCell>
|
|
44
|
+
|
|
45
|
+
})}
|
|
46
|
+
</TableRow>
|
|
47
|
+
))}
|
|
48
|
+
</>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
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 tr {
|
|
16
|
+
border-bottom: 1px solid #e0e0e0;
|
|
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,60 @@
|
|
|
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
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function getMoh705a(params: Moh710Params): Promise<any> {
|
|
11
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
12
|
+
const url = `${etlBaseUrl}/moh-705a`;
|
|
13
|
+
const queryparams = {
|
|
14
|
+
locationUuids: params.locationUuids || '',
|
|
15
|
+
startDate: params.startDate || '',
|
|
16
|
+
endDate: params.endDate || '',
|
|
17
|
+
};
|
|
18
|
+
const queryString = new URLSearchParams(
|
|
19
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
20
|
+
).toString();
|
|
21
|
+
try {
|
|
22
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
23
|
+
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const errorText = await response.text();
|
|
26
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
return data;
|
|
31
|
+
} catch (error: any) {
|
|
32
|
+
throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function getMoh705b(params: Moh710Params): Promise<any> {
|
|
37
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
38
|
+
const url = `${etlBaseUrl}/moh-705b`;
|
|
39
|
+
const queryparams = {
|
|
40
|
+
locationUuids: params.locationUuids || '',
|
|
41
|
+
startDate: params.startDate || '',
|
|
42
|
+
endDate: params.endDate || '',
|
|
43
|
+
};
|
|
44
|
+
const queryString = new URLSearchParams(
|
|
45
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
46
|
+
).toString();
|
|
47
|
+
try {
|
|
48
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
49
|
+
|
|
50
|
+
if (!response.ok) {
|
|
51
|
+
const errorText = await response.text();
|
|
52
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const data = await response.json();
|
|
56
|
+
return data;
|
|
57
|
+
} catch (error: any) {
|
|
58
|
+
throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function getMoh710(params: Moh710Params): Promise<any> {
|
|
11
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
12
|
+
const url = `${etlBaseUrl}/moh-710`;
|
|
13
|
+
const queryparams = {
|
|
14
|
+
locationUuids: params.locationUuids || '',
|
|
15
|
+
startDate: params.startDate || '',
|
|
16
|
+
endDate: params.endDate || '',
|
|
17
|
+
};
|
|
18
|
+
const queryString = new URLSearchParams(
|
|
19
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
20
|
+
).toString();
|
|
21
|
+
try {
|
|
22
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
23
|
+
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const errorText = await response.text();
|
|
26
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
return data;
|
|
31
|
+
} catch (error: any) {
|
|
32
|
+
throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { getEtlBaseUrl } from '../utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
interface Moh711Params {
|
|
5
|
+
locationUuids: string;
|
|
6
|
+
startDate?: string;
|
|
7
|
+
endDate?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function getMoh711(params: Moh711Params): Promise<any> {
|
|
11
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
12
|
+
const url = `${etlBaseUrl}/moh-711`;
|
|
13
|
+
const queryparams = {
|
|
14
|
+
locationUuids: params.locationUuids || '',
|
|
15
|
+
startDate: params.startDate || '',
|
|
16
|
+
endDate: params.endDate || '',
|
|
17
|
+
};
|
|
18
|
+
const queryString = new URLSearchParams(
|
|
19
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
20
|
+
).toString();
|
|
21
|
+
try {
|
|
22
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
23
|
+
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const errorText = await response.text();
|
|
26
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
return data;
|
|
31
|
+
} catch (error: any) {
|
|
32
|
+
throw new Error(`An error occurred while fetching the MOH-711 report: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { getEtlBaseUrl } from '../utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
interface Moh717Params {
|
|
5
|
+
locationUuids: string;
|
|
6
|
+
startDate?: string;
|
|
7
|
+
endDate?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function getMoh717(params: Moh717Params): Promise<any> {
|
|
11
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
12
|
+
const url = `${etlBaseUrl}/moh-717`;
|
|
13
|
+
const queryparams = {
|
|
14
|
+
locationUuids: params.locationUuids || '',
|
|
15
|
+
startDate: params.startDate || '',
|
|
16
|
+
endDate: params.endDate || '',
|
|
17
|
+
};
|
|
18
|
+
const queryString = new URLSearchParams(
|
|
19
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
20
|
+
).toString();
|
|
21
|
+
|
|
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-717 report: ${error.message}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function getMoh745(params: Moh710Params): Promise<any> {
|
|
11
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
12
|
+
const url = `${etlBaseUrl}/moh-745`;
|
|
13
|
+
const queryparams = {
|
|
14
|
+
locationUuids: params.locationUuids || '',
|
|
15
|
+
startDate: params.startDate || '',
|
|
16
|
+
endDate: params.endDate || '',
|
|
17
|
+
};
|
|
18
|
+
const queryString = new URLSearchParams(
|
|
19
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
20
|
+
).toString();
|
|
21
|
+
try {
|
|
22
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
23
|
+
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const errorText = await response.text();
|
|
26
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
return data;
|
|
31
|
+
} catch (error: any) {
|
|
32
|
+
throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
package/src/root.component.tsx
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* From here, the application is pretty typical React, but with lots of
|
|
3
|
-
* support from `@openmrs/esm-framework`. Check out `Greeter` to see
|
|
4
|
-
* usage of the configuration system, and check out `PatientGetter` to
|
|
5
|
-
* see data fetching using the OpenMRS FHIR API.
|
|
6
|
-
*
|
|
7
|
-
* Check out the Config docs:
|
|
8
|
-
* https://openmrs.github.io/openmrs-esm-core/#/main/config
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
1
|
import React from 'react';
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
2
|
+
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
|
3
|
+
import ReportsDashboard from './dashboard/reports-dasboard';
|
|
4
|
+
import Moh710Report from './reports/moh-710/moh-710.component';
|
|
5
|
+
import Moh711Report from './reports/moh-711/moh-711.component';
|
|
6
|
+
import Moh717Report from './reports/moh-717/moh-717.component';
|
|
7
|
+
import MoH706Report from './reports/moh-706/moh-706.component';
|
|
8
|
+
import Moh240Report from './reports/moh-240/moh-240.component';
|
|
9
|
+
import Moh505Report from './reports/moh-505/moh-505.component';
|
|
10
|
+
import Moh705BComponent from './reports/moh-705B/moh-705b.component';
|
|
11
|
+
import Moh705AComponent from './reports/moh-705a/moh-705a.component';
|
|
12
|
+
import Moh745Component from './reports/moh-745/moh-745.component';
|
|
13
|
+
import Moh740Report from './reports/moh-740/moh-740.component';
|
|
18
14
|
|
|
19
|
-
const
|
|
20
|
-
const
|
|
15
|
+
const RootComponent: React.FC = () => {
|
|
16
|
+
const baseName = window.getOpenmrsSpaBase() + 'home/reports';
|
|
21
17
|
|
|
22
18
|
return (
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
<BrowserRouter basename={baseName}>
|
|
20
|
+
<Routes>
|
|
21
|
+
<Route path="/" element={<ReportsDashboard />} />
|
|
22
|
+
<Route path="/moh-710" element={<Moh710Report />} />
|
|
23
|
+
<Route path="/moh-711" element={<Moh711Report />} />
|
|
24
|
+
<Route path="/moh-717" element={<Moh717Report />} />
|
|
25
|
+
<Route path="/moh-706" element={<MoH706Report />} />
|
|
26
|
+
<Route path="/moh-240" element={<Moh240Report />} />
|
|
27
|
+
<Route path="/moh-505" element={<Moh505Report />} />
|
|
28
|
+
<Route path="/moh-705a" element={<Moh705AComponent />} />
|
|
29
|
+
<Route path="/moh-705b" element={<Moh705BComponent />} />
|
|
30
|
+
<Route path="/moh-745" element={<Moh745Component />} />
|
|
31
|
+
<Route path="/moh-740" element={<Moh740Report />} />
|
|
32
|
+
</Routes>
|
|
33
|
+
</BrowserRouter>
|
|
36
34
|
);
|
|
37
35
|
};
|
|
38
36
|
|
|
39
|
-
export default
|
|
37
|
+
export default RootComponent;
|
package/src/routes.json
CHANGED
|
@@ -6,25 +6,22 @@
|
|
|
6
6
|
},
|
|
7
7
|
"extensions": [
|
|
8
8
|
{
|
|
9
|
-
"name": "
|
|
10
|
-
"component": "
|
|
11
|
-
"slot": "
|
|
9
|
+
"name": "ampath-reports-dashboard-link",
|
|
10
|
+
"component": "reportsDashboardLink",
|
|
11
|
+
"slot": "homepage-dashboard-slot",
|
|
12
|
+
"meta": {
|
|
13
|
+
"name": "reports",
|
|
14
|
+
"slot": "ampath-reports-dashboard-slot",
|
|
15
|
+
"title": "Reports"
|
|
16
|
+
},
|
|
17
|
+
"online": true,
|
|
18
|
+
"offline": true
|
|
12
19
|
},
|
|
13
|
-
{
|
|
14
|
-
"name": "Blue box",
|
|
15
|
-
"component": "blueBox",
|
|
16
|
-
"slot": "Boxes"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"name": "Brand box",
|
|
20
|
-
"component": "blueBox",
|
|
21
|
-
"slot": "Boxes"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"pages": [
|
|
25
20
|
{
|
|
26
21
|
"component": "root",
|
|
27
|
-
"
|
|
22
|
+
"name": "ampath-reports-dashboard-root",
|
|
23
|
+
"slot": "ampath-reports-dashboard-slot"
|
|
28
24
|
}
|
|
29
|
-
]
|
|
25
|
+
],
|
|
26
|
+
"pages": []
|
|
30
27
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getConfig } from '@openmrs/esm-framework';
|
|
2
|
+
import { moduleName } from '../index';
|
|
3
|
+
|
|
4
|
+
export async function getEtlBaseUrl() {
|
|
5
|
+
const { etlBaseUrl } = await getConfig(moduleName);
|
|
6
|
+
return etlBaseUrl ?? null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export async function getSubDomain() {
|
|
10
|
+
const { subDomain } = await getConfig(moduleName);
|
|
11
|
+
return subDomain ?? null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
|
|
3
|
+
export const getCell = (key = "", label = "", colSpan = 1, rowSpan = 1, strong = false) => ({
|
|
4
|
+
key,
|
|
5
|
+
label,
|
|
6
|
+
strong,
|
|
7
|
+
colSpan,
|
|
8
|
+
rowSpan
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export async function getJson<T>(url: string, payload: Record<string, unknown> | null = null): Promise<T> {
|
|
12
|
+
let requestUrl = url;
|
|
13
|
+
|
|
14
|
+
if (payload && Object.keys(payload).length > 0) {
|
|
15
|
+
const queryString = new URLSearchParams(
|
|
16
|
+
Object.entries(payload).filter(([, value]) => value !== undefined && value !== null) as Array<[string, string]>,
|
|
17
|
+
).toString();
|
|
18
|
+
|
|
19
|
+
if (queryString) {
|
|
20
|
+
requestUrl = `${url}?${queryString}`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const response = await openmrsFetch(requestUrl);
|
|
25
|
+
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const errorText = await response.text();
|
|
28
|
+
throw new Error(`Request failed with ${response.status}: ${errorText}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (response.status === 204 || response.headers.get('content-length') === '0') {
|
|
32
|
+
return Promise.resolve({} as T);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return response.json() as Promise<T>;
|
|
36
|
+
}
|