@ampath/esm-reports-app 1.0.0-next.4 → 1.0.0-next.41
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/110.js +1 -0
- package/dist/110.js.map +1 -0
- package/dist/{260.js → 205.js} +1 -1
- package/dist/{260.js.map → 205.js.map} +1 -1
- package/dist/812.js +1 -1
- package/dist/812.js.map +1 -1
- package/dist/822.js +2 -0
- package/dist/822.js.map +1 -0
- package/dist/ampath-esm-reports-app.js +1 -1
- package/dist/ampath-esm-reports-app.js.buildmanifest.json +95 -74
- 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 +1 -1
- package/src/common/report-filters/report-filters.component.tsx +68 -7
- package/src/common/report-filters/report-filters.scss +42 -0
- package/src/dashboard/reports-dasboard.tsx +21 -0
- 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 +93 -0
- package/src/reports/moh-240/moh-240.scss +11 -0
- package/src/reports/moh-240/sub-reports/moh-240-register.component.tsx +75 -0
- package/src/reports/moh-240/sub-reports/page-summary.component.tsx +98 -0
- package/src/reports/moh-505/moh-505-header.component.tsx +62 -0
- package/src/reports/moh-505/moh-505.component.tsx +440 -0
- package/src/reports/moh-505/moh-505.scss +3 -0
- package/src/reports/moh-705B/moh-204b-register.component.tsx +236 -0
- package/src/reports/moh-705B/moh-705b.component.tsx +524 -0
- package/src/reports/moh-705B/moh-705b.scss +44 -0
- package/src/reports/moh-705a/moh-705a.component.tsx +528 -0
- package/src/reports/moh-705a/moh-705a.scss +45 -0
- package/src/reports/moh-705a/registers/moh-204a-register.component.tsx +321 -0
- package/src/reports/moh-705a/type.ts +6 -0
- package/src/reports/moh-706/moh-706-header.component.tsx +61 -0
- package/src/reports/moh-706/moh-706.component.tsx +117 -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 +211 -79
- package/src/reports/moh-710/moh-710.scss +5 -1
- package/src/reports/moh-710/registers/moh-511-710-register.component.tsx +263 -0
- package/src/reports/moh-710/registers/type.ts +31 -0
- package/src/reports/moh-711/moh-711.component.tsx +109 -1234
- package/src/reports/moh-711/moh711.scss +92 -8
- package/src/reports/moh-711/registers/moh-333-register.component.tsx +639 -0
- package/src/reports/moh-711/registers/moh-405-register.component.tsx +521 -0
- package/src/reports/moh-711/registers/moh-406-register.component.tsx +533 -0
- package/src/reports/moh-711/registers/moh-510-register.component.tsx +61 -0
- package/src/reports/moh-711/registers/moh-511-register.component.tsx +271 -0
- package/src/reports/moh-711/registers/type.ts +192 -0
- package/src/reports/moh-711/sections/anc.component.tsx +159 -0
- package/src/reports/moh-711/sections/cervical-cancer.component.tsx +148 -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 +326 -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 +125 -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 +120 -946
- package/src/reports/moh-717/moh717.scss +138 -3
- package/src/reports/moh-717/registers/nutrition-register.component.tsx +48 -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 +126 -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 +597 -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-731/moh-731.component.tsx +181 -0
- package/src/reports/moh-731/moh-731.scss +118 -0
- package/src/reports/moh-731/registers/moh-366.component.tsx +478 -0
- package/src/reports/moh-731/registers/moh-366.scss +45 -0
- package/src/reports/moh-731/registers/prep-register.component.tsx +292 -0
- package/src/reports/moh-731/registers/prep-registers.scss +45 -0
- package/src/reports/moh-731/sections/hiv-and-tb-treatment.component.tsx +932 -0
- package/src/reports/moh-731/sections/hiv-testing-and-pre-exposure.component.tsx +569 -0
- package/src/reports/moh-731/sections/pmtct.component.tsx +451 -0
- package/src/reports/moh-740/moh-740.component.scss +120 -0
- package/src/reports/moh-740/moh-740.component.tsx +1271 -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.scss +18 -0
- package/src/reports/moh-740/registers/moh-222-daily-register/moh-222-daily-register.tsx +104 -0
- package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.scss +18 -0
- package/src/reports/moh-740/registers/moh-270-permanent-register/moh-270-permanent-register.tsx +79 -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 +66 -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/shared/utils/format-indicator.ts +22 -0
- package/src/reports/moh-740/shared/utils/indicator-register-map.ts +157 -0
- package/src/reports/moh-740/types/index.ts +216 -0
- package/src/reports/moh-745/moh-745.component.tsx +928 -0
- package/src/reports/moh-745/moh-745.scss +74 -0
- package/src/reports/moh-745/registers/moh-412-register.component.tsx +191 -0
- package/src/reports/moh-745/registers/type.ts +30 -0
- package/src/reports/table-wrapper/table-row-mapper.component.tsx +53 -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-505.resource.ts +86 -0
- package/src/resources/moh-705.resource.ts +117 -0
- package/src/resources/moh-706.resource.ts +86 -0
- package/src/resources/moh-710.resource.ts +28 -0
- package/src/resources/moh-711.resource.ts +146 -0
- package/src/resources/moh-717.resource.ts +27 -0
- package/src/resources/moh-731.resource.ts +96 -0
- package/src/resources/moh-745.resource.ts +64 -0
- package/src/root.component.tsx +39 -0
- package/src/routes.json +3 -1
- package/src/utils/utils.ts +36 -0
- package/dist/367.js +0 -2
- package/dist/367.js.map +0 -1
- package/dist/86.js +0 -1
- package/dist/86.js.map +0 -1
- /package/dist/{367.js.LICENSE.txt → 822.js.LICENSE.txt} +0 -0
|
@@ -5,6 +5,7 @@ interface Moh710Params {
|
|
|
5
5
|
locationUuids: string;
|
|
6
6
|
startDate?: string;
|
|
7
7
|
endDate?: string;
|
|
8
|
+
indicator?: string | string[];
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export async function getMoh710(params: Moh710Params): Promise<any> {
|
|
@@ -32,3 +33,30 @@ export async function getMoh710(params: Moh710Params): Promise<any> {
|
|
|
32
33
|
throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
36
|
+
|
|
37
|
+
export async function getMoh710PatientList(params: Moh710Params): Promise<any> {
|
|
38
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
39
|
+
const url = `${etlBaseUrl}/moh-710-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
|
+
};
|
|
46
|
+
const queryString = new URLSearchParams(
|
|
47
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
48
|
+
).toString();
|
|
49
|
+
try {
|
|
50
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
51
|
+
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
const errorText = await response.text();
|
|
54
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const data = await response.json();
|
|
58
|
+
return data;
|
|
59
|
+
} catch (error: any) {
|
|
60
|
+
throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -5,6 +5,8 @@ interface Moh711Params {
|
|
|
5
5
|
locationUuids: string;
|
|
6
6
|
startDate?: string;
|
|
7
7
|
endDate?: string;
|
|
8
|
+
indicator?: string | string[];
|
|
9
|
+
reportName?: string;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export async function getMoh711(params: Moh711Params): Promise<any> {
|
|
@@ -32,3 +34,147 @@ export async function getMoh711(params: Moh711Params): Promise<any> {
|
|
|
32
34
|
throw new Error(`An error occurred while fetching the MOH-711 report: ${error.message}`);
|
|
33
35
|
}
|
|
34
36
|
}
|
|
37
|
+
|
|
38
|
+
export async function getMoh406PatientList(params: Moh711Params): Promise<any> {
|
|
39
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
40
|
+
const url = `${etlBaseUrl}/moh-406-patient-list`;
|
|
41
|
+
const queryparams = {
|
|
42
|
+
locationUuids: params.locationUuids || '',
|
|
43
|
+
startDate: params.startDate || '',
|
|
44
|
+
endDate: params.endDate || '',
|
|
45
|
+
indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
|
|
46
|
+
reportName: params.reportName || '',
|
|
47
|
+
limit: '300',
|
|
48
|
+
};
|
|
49
|
+
const queryString = new URLSearchParams(
|
|
50
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
51
|
+
).toString();
|
|
52
|
+
try {
|
|
53
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
54
|
+
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
const errorText = await response.text();
|
|
57
|
+
throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const data = await response.json();
|
|
61
|
+
return data;
|
|
62
|
+
} catch (error: any) {
|
|
63
|
+
throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function getMoh405PatientList(params: Moh711Params): Promise<any> {
|
|
68
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
69
|
+
const url = `${etlBaseUrl}/moh-405-patient-list`;
|
|
70
|
+
const queryparams = {
|
|
71
|
+
locationUuids: params.locationUuids || '',
|
|
72
|
+
startDate: params.startDate || '',
|
|
73
|
+
endDate: params.endDate || '',
|
|
74
|
+
indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
|
|
75
|
+
reportName: params.reportName || '',
|
|
76
|
+
limit: '300',
|
|
77
|
+
};
|
|
78
|
+
const queryString = new URLSearchParams(
|
|
79
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
80
|
+
).toString();
|
|
81
|
+
try {
|
|
82
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
83
|
+
|
|
84
|
+
if (!response.ok) {
|
|
85
|
+
const errorText = await response.text();
|
|
86
|
+
throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const data = await response.json();
|
|
90
|
+
return data;
|
|
91
|
+
} catch (error: any) {
|
|
92
|
+
throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function getMoh333PatientList(params: Moh711Params): Promise<any> {
|
|
97
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
98
|
+
const url = `${etlBaseUrl}/moh-333-patient-list`;
|
|
99
|
+
const queryparams = {
|
|
100
|
+
locationUuids: params.locationUuids || '',
|
|
101
|
+
startDate: params.startDate || '',
|
|
102
|
+
endDate: params.endDate || '',
|
|
103
|
+
indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
|
|
104
|
+
reportName: params.reportName || '',
|
|
105
|
+
limit: '300',
|
|
106
|
+
};
|
|
107
|
+
const queryString = new URLSearchParams(
|
|
108
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
109
|
+
).toString();
|
|
110
|
+
try {
|
|
111
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
112
|
+
|
|
113
|
+
if (!response.ok) {
|
|
114
|
+
const errorText = await response.text();
|
|
115
|
+
throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const data = await response.json();
|
|
119
|
+
return data;
|
|
120
|
+
} catch (error: any) {
|
|
121
|
+
throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export async function getMoh510PatientList(params: Moh711Params): Promise<any> {
|
|
126
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
127
|
+
const url = `${etlBaseUrl}/moh-510-patient-list`;
|
|
128
|
+
const queryparams = {
|
|
129
|
+
locationUuids: params.locationUuids || '',
|
|
130
|
+
startDate: params.startDate || '',
|
|
131
|
+
endDate: params.endDate || '',
|
|
132
|
+
indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
|
|
133
|
+
limit: '300',
|
|
134
|
+
};
|
|
135
|
+
const queryString = new URLSearchParams(
|
|
136
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
137
|
+
).toString();
|
|
138
|
+
try {
|
|
139
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
140
|
+
|
|
141
|
+
if (!response.ok) {
|
|
142
|
+
const errorText = await response.text();
|
|
143
|
+
throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const data = await response.json();
|
|
147
|
+
return data;
|
|
148
|
+
} catch (error: any) {
|
|
149
|
+
throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export async function getMoh511PatientList(params: Moh711Params): Promise<any> {
|
|
154
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
155
|
+
const url = `${etlBaseUrl}/moh-511-patient-list`;
|
|
156
|
+
const queryparams = {
|
|
157
|
+
locationUuids: params.locationUuids || '',
|
|
158
|
+
startDate: params.startDate || '',
|
|
159
|
+
endDate: params.endDate || '',
|
|
160
|
+
indicator: Array.isArray(params.indicator) ? params.indicator.join(',') : params.indicator || '',
|
|
161
|
+
reportName: params.reportName || '',
|
|
162
|
+
limit: '300',
|
|
163
|
+
};
|
|
164
|
+
const queryString = new URLSearchParams(
|
|
165
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
166
|
+
).toString();
|
|
167
|
+
try {
|
|
168
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
169
|
+
|
|
170
|
+
if (!response.ok) {
|
|
171
|
+
const errorText = await response.text();
|
|
172
|
+
throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const data = await response.json();
|
|
176
|
+
return data;
|
|
177
|
+
} catch (error: any) {
|
|
178
|
+
throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -33,3 +33,30 @@ export async function getMoh717(params: Moh717Params): Promise<any> {
|
|
|
33
33
|
throw new Error(`An error occurred while fetching the MOH-717 report: ${error.message}`);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
export async function getNutritionRegister(params: Moh717Params): Promise<any> {
|
|
38
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
39
|
+
const url = `${etlBaseUrl}/moh-717`;
|
|
40
|
+
const queryparams = {
|
|
41
|
+
locationUuids: params.locationUuids || '',
|
|
42
|
+
startDate: params.startDate || '',
|
|
43
|
+
endDate: params.endDate || '',
|
|
44
|
+
};
|
|
45
|
+
const queryString = new URLSearchParams(
|
|
46
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
47
|
+
).toString();
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
51
|
+
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
const errorText = await response.text();
|
|
54
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const data = await response.json();
|
|
58
|
+
return data;
|
|
59
|
+
} catch (error: any) {
|
|
60
|
+
throw new Error(`An error occurred while fetching the MOH-717 report: ${error.message}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { getEtlBaseUrl } from '../utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
interface Moh745Params {
|
|
5
|
+
locationUuids: string;
|
|
6
|
+
startDate?: string;
|
|
7
|
+
endDate?: string;
|
|
8
|
+
indicator?: string;
|
|
9
|
+
gender?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export async function getMoh731(params: Moh745Params): Promise<any> {
|
|
13
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
14
|
+
const url = `${etlBaseUrl}/moh-731-monthly-summary`;
|
|
15
|
+
const queryparams = {
|
|
16
|
+
locationUuids: params.locationUuids || '',
|
|
17
|
+
startDate: params.startDate || '',
|
|
18
|
+
endDate: params.endDate || '',
|
|
19
|
+
};
|
|
20
|
+
const queryString = new URLSearchParams(
|
|
21
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
22
|
+
).toString();
|
|
23
|
+
try {
|
|
24
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
25
|
+
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const errorText = await response.text();
|
|
28
|
+
throw new Error(`Failed to fetch dashboard summary: ${response.status} - ${errorText}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const data = await response.json();
|
|
32
|
+
return data;
|
|
33
|
+
} catch (error: any) {
|
|
34
|
+
throw new Error(`An error occurred while fetching the MOH-710 report: ${error.message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function getMoh366PatientList(params: Moh745Params): Promise<any> {
|
|
39
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
40
|
+
const url = `${etlBaseUrl}/moh-731-monthly-summary-patient-list`;
|
|
41
|
+
const queryparams = {
|
|
42
|
+
locationUuids: params.locationUuids || '',
|
|
43
|
+
startDate: params.startDate || '',
|
|
44
|
+
endDate: params.endDate || '',
|
|
45
|
+
indicator: params.indicator || '',
|
|
46
|
+
gender: params.gender || '',
|
|
47
|
+
limit: '300',
|
|
48
|
+
};
|
|
49
|
+
const queryString = new URLSearchParams(
|
|
50
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
51
|
+
).toString();
|
|
52
|
+
try {
|
|
53
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
54
|
+
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
const errorText = await response.text();
|
|
57
|
+
throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const data = await response.json();
|
|
61
|
+
return data;
|
|
62
|
+
} catch (error: any) {
|
|
63
|
+
console.error('Failed to fetch MOH 412 PATIENT LIST data', error);
|
|
64
|
+
throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function getPrepPatientList(params: Moh745Params): Promise<any> {
|
|
69
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
70
|
+
const url = `${etlBaseUrl}/prep-patient-list`;
|
|
71
|
+
const queryparams = {
|
|
72
|
+
locationUuids: params.locationUuids || '',
|
|
73
|
+
startDate: params.startDate || '',
|
|
74
|
+
endDate: params.endDate || '',
|
|
75
|
+
indicator: params.indicator || '',
|
|
76
|
+
gender: params.gender || '',
|
|
77
|
+
limit: '300',
|
|
78
|
+
};
|
|
79
|
+
const queryString = new URLSearchParams(
|
|
80
|
+
Object.fromEntries(Object.entries(queryparams).filter(([_, v]) => v !== undefined && v !== null)),
|
|
81
|
+
).toString();
|
|
82
|
+
try {
|
|
83
|
+
const response = await openmrsFetch(`${url}?${queryString}`);
|
|
84
|
+
|
|
85
|
+
if (!response.ok) {
|
|
86
|
+
const errorText = await response.text();
|
|
87
|
+
throw new Error(`Failed to fetch patient list: ${response.status} - ${errorText}`);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const data = await response.json();
|
|
91
|
+
return data;
|
|
92
|
+
} catch (error: any) {
|
|
93
|
+
console.error('Failed to fetch MOH 412 PATIENT LIST data', error);
|
|
94
|
+
throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { getEtlBaseUrl } from '../utils/get-base-url';
|
|
3
|
+
|
|
4
|
+
interface Moh745Params {
|
|
5
|
+
locationUuids: string;
|
|
6
|
+
startDate?: string;
|
|
7
|
+
endDate?: string;
|
|
8
|
+
indicator?: string | string[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function getMoh745(params: Moh745Params): Promise<any> {
|
|
12
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
13
|
+
const url = `${etlBaseUrl}/moh-745`;
|
|
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 getMoh412PatientList(params: Moh745Params): Promise<any> {
|
|
38
|
+
const etlBaseUrl = await getEtlBaseUrl();
|
|
39
|
+
const url = `${etlBaseUrl}/moh-412-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
|
+
console.error('Failed to fetch MOH 412 PATIENT LIST data', error);
|
|
62
|
+
throw new Error(`An error occurred while fetching the MOH-705 patient list: ${error.message}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/root.component.tsx
CHANGED
|
@@ -4,6 +4,25 @@ import ReportsDashboard from './dashboard/reports-dasboard';
|
|
|
4
4
|
import Moh710Report from './reports/moh-710/moh-710.component';
|
|
5
5
|
import Moh711Report from './reports/moh-711/moh-711.component';
|
|
6
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';
|
|
14
|
+
import Moh204ARegisterComponent from './reports/moh-705a/registers/moh-204a-register.component';
|
|
15
|
+
import Moh204BRegisterComponent from './reports/moh-705B/moh-204b-register.component';
|
|
16
|
+
import Moh412Register from './reports/moh-745/registers/moh-412-register.component';
|
|
17
|
+
import Moh405Register from './reports/moh-711/registers/moh-405-register.component';
|
|
18
|
+
import Moh406Register from './reports/moh-711/registers/moh-406-register.component';
|
|
19
|
+
import Moh333Register from './reports/moh-711/registers/moh-333-register.component';
|
|
20
|
+
import Moh511Register from './reports/moh-711/registers/moh-511-register.component';
|
|
21
|
+
import Moh510Register from './reports/moh-711/registers/moh-510-register.component';
|
|
22
|
+
import Moh511710Register from './reports/moh-710/registers/moh-511-710-register.component';
|
|
23
|
+
import Moh731Report from './reports/moh-731/moh-731.component';
|
|
24
|
+
import Moh366Register from './reports/moh-731/registers/moh-366.component';
|
|
25
|
+
import PrepRegisterComponent from './reports/moh-731/registers/prep-register.component';
|
|
7
26
|
|
|
8
27
|
const RootComponent: React.FC = () => {
|
|
9
28
|
const baseName = window.getOpenmrsSpaBase() + 'home/reports';
|
|
@@ -15,6 +34,26 @@ const RootComponent: React.FC = () => {
|
|
|
15
34
|
<Route path="/moh-710" element={<Moh710Report />} />
|
|
16
35
|
<Route path="/moh-711" element={<Moh711Report />} />
|
|
17
36
|
<Route path="/moh-717" element={<Moh717Report />} />
|
|
37
|
+
<Route path="/moh-706" element={<MoH706Report />} />
|
|
38
|
+
<Route path="/moh-240" element={<Moh240Report />} />
|
|
39
|
+
<Route path="/moh-505" element={<Moh505Report />} />
|
|
40
|
+
<Route path="/moh-705a" element={<Moh705AComponent />} />
|
|
41
|
+
<Route path="/moh-705b" element={<Moh705BComponent />} />
|
|
42
|
+
<Route path="/moh-745" element={<Moh745Component />} />
|
|
43
|
+
<Route path="/moh-740" element={<Moh740Report />} />
|
|
44
|
+
<Route path="/moh-412-register" element={<Moh412Register />} />
|
|
45
|
+
<Route path="/moh-204b" element={<Moh204BRegisterComponent />} />
|
|
46
|
+
<Route path="/moh-204a" element={<Moh204ARegisterComponent />} />
|
|
47
|
+
<Route path="/moh-405-register" element={<Moh405Register />} />
|
|
48
|
+
<Route path="/moh-406-register" element={<Moh406Register />} />
|
|
49
|
+
<Route path="/moh-333-register" element={<Moh333Register />} />
|
|
50
|
+
<Route path="/moh-511-register" element={<Moh511Register />} />
|
|
51
|
+
<Route path="/moh-510-register" element={<Moh510Register />} />
|
|
52
|
+
<Route path="/moh-412-register" element={<Moh412Register />} />
|
|
53
|
+
<Route path="/moh-511-710-register" element={<Moh511710Register />} />
|
|
54
|
+
<Route path="/moh-731" element={<Moh731Report />} />
|
|
55
|
+
<Route path="/moh-366-register" element={<Moh366Register />} />
|
|
56
|
+
<Route path="/prep-register" element={<PrepRegisterComponent />} />
|
|
18
57
|
</Routes>
|
|
19
58
|
</BrowserRouter>
|
|
20
59
|
);
|
package/src/routes.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"name": "ampath-reports-dashboard-link",
|
|
10
10
|
"component": "reportsDashboardLink",
|
|
11
11
|
"slot": "homepage-dashboard-slot",
|
|
12
|
+
"privileges": ["O3 View Reports Dashboard"],
|
|
12
13
|
"meta": {
|
|
13
14
|
"name": "reports",
|
|
14
15
|
"slot": "ampath-reports-dashboard-slot",
|
|
@@ -20,7 +21,8 @@
|
|
|
20
21
|
{
|
|
21
22
|
"component": "root",
|
|
22
23
|
"name": "ampath-reports-dashboard-root",
|
|
23
|
-
"slot": "ampath-reports-dashboard-slot"
|
|
24
|
+
"slot": "ampath-reports-dashboard-slot",
|
|
25
|
+
"privileges": ["O3 View Reports Dashboard"]
|
|
24
26
|
}
|
|
25
27
|
],
|
|
26
28
|
"pages": []
|
|
@@ -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
|
+
}
|