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

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 (85) hide show
  1. package/dist/184.js +1 -1
  2. package/dist/184.js.map +1 -1
  3. package/dist/260.js +1 -0
  4. package/dist/260.js.map +1 -0
  5. package/dist/282.js +1 -1
  6. package/dist/282.js.LICENSE.txt +3 -3
  7. package/dist/282.js.map +1 -1
  8. package/dist/311.js +1 -0
  9. package/dist/311.js.map +1 -0
  10. package/dist/353.js +1 -1
  11. package/dist/353.js.map +1 -1
  12. package/dist/367.js +2 -0
  13. package/dist/367.js.LICENSE.txt +20 -0
  14. package/dist/367.js.map +1 -0
  15. package/dist/478.js +2 -0
  16. package/dist/478.js.LICENSE.txt +9 -0
  17. package/dist/478.js.map +1 -0
  18. package/dist/540.js +1 -1
  19. package/dist/540.js.map +1 -1
  20. package/dist/812.js +1 -0
  21. package/dist/812.js.map +1 -0
  22. package/dist/86.js +1 -0
  23. package/dist/86.js.map +1 -0
  24. package/dist/961.js +1 -1
  25. package/dist/961.js.map +1 -1
  26. package/dist/ampath-esm-reports-app.js +1 -1
  27. package/dist/ampath-esm-reports-app.js.buildmanifest.json +121 -165
  28. package/dist/ampath-esm-reports-app.js.map +1 -1
  29. package/dist/main.js +1 -1
  30. package/dist/main.js.map +1 -1
  31. package/dist/routes.json +1 -1
  32. package/package.json +2 -1
  33. package/src/common/report-filters/report-filters.component.tsx +125 -0
  34. package/src/common/report-filters/report-filters.scss +49 -0
  35. package/src/config-schema.ts +6 -37
  36. package/src/createDashboardLink.tsx +9 -0
  37. package/src/dashboard/reports-dasboard.tsx +26 -0
  38. package/src/dashboard/reports-dashboard.module.scss +14 -0
  39. package/src/dashboard-meta/reports-dashboard.meta.ts +6 -0
  40. package/src/index.ts +6 -35
  41. package/src/reports/moh-710/moh-710.component.tsx +674 -0
  42. package/src/reports/moh-710/moh-710.scss +41 -0
  43. package/src/reports/moh-711/moh-711.component.tsx +1309 -0
  44. package/src/reports/moh-711/moh711.scss +41 -0
  45. package/src/reports/moh-717/moh-717.component.tsx +1025 -0
  46. package/src/reports/moh-717/moh717.scss +41 -0
  47. package/src/resources/moh-710.resource.ts +34 -0
  48. package/src/resources/moh-711.resource.ts +34 -0
  49. package/src/resources/moh-717.resource.ts +35 -0
  50. package/src/root.component.tsx +16 -32
  51. package/src/routes.json +14 -17
  52. package/src/utils/get-base-url.ts +12 -0
  53. package/dist/19.js +0 -2
  54. package/dist/19.js.LICENSE.txt +0 -39
  55. package/dist/19.js.map +0 -1
  56. package/dist/255.js +0 -1
  57. package/dist/255.js.map +0 -1
  58. package/dist/389.js +0 -1
  59. package/dist/389.js.map +0 -1
  60. package/dist/451.js +0 -1
  61. package/dist/451.js.map +0 -1
  62. package/dist/488.js +0 -1
  63. package/dist/488.js.map +0 -1
  64. package/dist/557.js +0 -1
  65. package/dist/557.js.map +0 -1
  66. package/dist/91.js +0 -1
  67. package/dist/91.js.map +0 -1
  68. package/dist/970.js +0 -1
  69. package/dist/970.js.map +0 -1
  70. package/src/boxes/extensions/blue-box.component.tsx +0 -15
  71. package/src/boxes/extensions/box.scss +0 -23
  72. package/src/boxes/extensions/brand-box.component.tsx +0 -15
  73. package/src/boxes/extensions/red-box.component.tsx +0 -15
  74. package/src/boxes/slot/boxes.component.tsx +0 -25
  75. package/src/boxes/slot/boxes.scss +0 -29
  76. package/src/greeter/greeter.component.tsx +0 -42
  77. package/src/greeter/greeter.scss +0 -20
  78. package/src/greeter/greeter.test.tsx +0 -28
  79. package/src/patient-getter/patient-getter.component.tsx +0 -40
  80. package/src/patient-getter/patient-getter.resource.ts +0 -39
  81. package/src/patient-getter/patient-getter.scss +0 -16
  82. package/src/patient-getter/patient-getter.test.tsx +0 -40
  83. package/src/resources/resources.component.tsx +0 -56
  84. package/src/resources/resources.scss +0 -68
  85. package/src/root.test.tsx +0 -51
@@ -0,0 +1,41 @@
1
+
2
+ h3 {
3
+ text-align: center;
4
+ }
5
+
6
+ .container {
7
+ border: 1px solid #ccc;
8
+ margin: 0 2rem;
9
+ margin-top: 0.5px;
10
+ }
11
+
12
+ .tableContainer {
13
+ margin-left: 1rem;
14
+ margin-bottom: 1rem;
15
+ }
16
+
17
+ .sectionTitle {
18
+ margin-left: 1rem ;
19
+ }
20
+
21
+ .title {
22
+ text-align: center;
23
+ font-size: 1rem;
24
+ margin: 1rem;
25
+ }
26
+ .table {
27
+ width: auto;
28
+ border-collapse: collapse;
29
+
30
+ }
31
+
32
+ .tableBordered td,
33
+ .tableBordered th {
34
+ border: 1px solid #dee2e6;
35
+ padding: 0.3rem;
36
+ font-size: small;
37
+ }
38
+
39
+ .tableStriped tbody tr:nth-of-type(odd) {
40
+ background-color: #f9f9f9;
41
+ }
@@ -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
+ }
@@ -1,39 +1,23 @@
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 { useTranslation } from 'react-i18next';
13
- import { Boxes } from './boxes/slot/boxes.component';
14
- import Greeter from './greeter/greeter.component';
15
- import PatientGetter from './patient-getter/patient-getter.component';
16
- import Resources from './resources/resources.component';
17
- import styles from './root.scss';
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';
18
7
 
19
- const Root: React.FC = () => {
20
- const { t } = useTranslation();
8
+ const RootComponent: React.FC = () => {
9
+ const baseName = window.getOpenmrsSpaBase() + 'home/reports';
21
10
 
22
11
  return (
23
- <div className={styles.container}>
24
- <h3 className={styles.welcome}>{t('welcomeText', 'Welcome to the O3 Template app')}</h3>
25
- <p className={styles.explainer}>
26
- {t('explainer', 'The following examples demonstrate some key features of the O3 framework')}.
27
- </p>
28
- {/* Greeter: demonstrates the configuration system */}
29
- <Greeter />
30
- {/* Boxes: demonstrates the extension system */}
31
- <Boxes />
32
- {/* PatientGetter: demonstrates data fetching */}
33
- <PatientGetter />
34
- <Resources />
35
- </div>
12
+ <BrowserRouter basename={baseName}>
13
+ <Routes>
14
+ <Route path="/" element={<ReportsDashboard />} />
15
+ <Route path="/moh-710" element={<Moh710Report />} />
16
+ <Route path="/moh-711" element={<Moh711Report />} />
17
+ <Route path="/moh-717" element={<Moh717Report />} />
18
+ </Routes>
19
+ </BrowserRouter>
36
20
  );
37
21
  };
38
22
 
39
- export default Root;
23
+ export default RootComponent;
package/src/routes.json CHANGED
@@ -6,25 +6,22 @@
6
6
  },
7
7
  "extensions": [
8
8
  {
9
- "name": "Red box",
10
- "component": "redBox",
11
- "slot": "Boxes"
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
- "route": "root"
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
+ }