@ampath/esm-reports-app 1.0.0-next.112 → 1.0.0-next.114

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 (41) hide show
  1. package/dist/410.js +1 -1
  2. package/dist/763.css +1 -0
  3. package/dist/763.css.map +1 -0
  4. package/dist/763.js +1 -0
  5. package/dist/763.js.map +1 -0
  6. package/dist/ampath-esm-reports-app.js +1 -1
  7. package/dist/routes.json +1 -1
  8. package/package.json +1 -1
  9. package/src/common/report-header/facility-clinics.component.tsx +42 -0
  10. package/src/common/report-header/facility-clinics.scss +61 -0
  11. package/src/common/report-header/index.ts +1 -0
  12. package/src/common/report-page/download-sheet-pdf.ts +2 -0
  13. package/src/common/report-register/index.ts +1 -0
  14. package/src/common/report-register/register-layout.component.tsx +3 -26
  15. package/src/common/report-register/register-layout.scss +0 -58
  16. package/src/common/report-register/xlsx.ts +263 -0
  17. package/src/dashboard/report-catalog.ts +39 -145
  18. package/src/dashboard/reports-dasboard.tsx +5 -4
  19. package/src/reports/moh-718/moh-718.component.tsx +1 -1
  20. package/src/reports/moh-740/line-list/moh-740-line-list.component.tsx +107 -0
  21. package/src/reports/moh-740/moh-740.component.tsx +1 -1
  22. package/src/reports/moh-740/registers/moh-740.columns.ts +1 -0
  23. package/src/reports/program/care-and-treatment/care-and-treatment-linelist.component.tsx +87 -0
  24. package/src/reports/program/care-and-treatment/care-and-treatment-table.component.tsx +1 -1
  25. package/src/reports/program/care-and-treatment/care-and-treatment.component.tsx +122 -59
  26. package/src/reports/program/care-and-treatment/care-and-treatment.config.ts +120 -2
  27. package/src/reports/program/program-report.component.tsx +11 -5
  28. package/src/reports/quality-improvement/case-surveillance.component.tsx +258 -0
  29. package/src/reports/quality-improvement/case-surveillance.config.ts +57 -0
  30. package/src/reports/quality-improvement/case-surveillance.scss +305 -0
  31. package/src/reports/quality-improvement/quality-improvement-linelist.component.tsx +137 -0
  32. package/src/reports/quality-improvement/quality-improvement.component.tsx +217 -0
  33. package/src/reports/quality-improvement/quality-improvement.config.ts +144 -0
  34. package/src/reports/quality-improvement/quality-improvement.scss +227 -0
  35. package/src/resources/care-and-treatment.resource.ts +1 -1
  36. package/src/resources/quality-improvement.resource.ts +91 -0
  37. package/src/root.component.tsx +29 -14
  38. package/dist/955.css +0 -1
  39. package/dist/955.css.map +0 -1
  40. package/dist/955.js +0 -1
  41. package/dist/955.js.map +0 -1
@@ -0,0 +1,227 @@
1
+ @use 'sass:list';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+ @use '@openmrs/esm-styleguide/src/vars' as *;
5
+
6
+ /* each area's colour, as on the landing page: an accent for its bar, and an ink dark enough for text */
7
+ $tones: (
8
+ 'violet': (#8a3ffc, #6929c4),
9
+ 'magenta': (#d02670, #9f1853),
10
+ 'teal': (#009d9a, #005d5d),
11
+ 'blue': (#0f62fe, #0043ce),
12
+ );
13
+
14
+ .sheet {
15
+ margin: layout.$spacing-05 0;
16
+ padding: layout.$spacing-06;
17
+ background-color: $ui-02;
18
+ border: 1px solid $ui-03;
19
+ }
20
+
21
+ .masthead {
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ align-items: center;
25
+ justify-content: space-between;
26
+ gap: layout.$spacing-03 layout.$spacing-07;
27
+ padding-bottom: layout.$spacing-04;
28
+ margin-bottom: layout.$spacing-04;
29
+ border-bottom: 1px solid $ui-03;
30
+ }
31
+
32
+ .title {
33
+ @include type.type-style('productive-heading-02');
34
+ color: $color-gray-100;
35
+ }
36
+
37
+ .subtitle {
38
+ @include type.type-style('label-01');
39
+ margin-top: layout.$spacing-01;
40
+ color: $text-02;
41
+ }
42
+
43
+ /* the facility and month, as the landing page's header shows them */
44
+ .meta {
45
+ @include type.type-style('label-01');
46
+ display: flex;
47
+ flex-wrap: wrap;
48
+ gap: layout.$spacing-03;
49
+ }
50
+
51
+ .metaItem {
52
+ display: inline-flex;
53
+ align-items: center;
54
+ gap: layout.$spacing-02;
55
+ padding: layout.$spacing-01 layout.$spacing-03;
56
+ font-weight: 600;
57
+ color: $color-gray-100;
58
+ background-color: $ui-01;
59
+ border-radius: 1rem;
60
+
61
+ svg {
62
+ fill: $text-02;
63
+ }
64
+ }
65
+
66
+ .table {
67
+ width: 100%;
68
+ border-collapse: collapse;
69
+ border-bottom: 1px solid $ui-03;
70
+
71
+ thead th {
72
+ @include type.type-style('label-01');
73
+ padding: layout.$spacing-03 layout.$spacing-04;
74
+ text-align: left;
75
+ font-weight: 600;
76
+ letter-spacing: 0.04em;
77
+ text-transform: uppercase;
78
+ color: $text-02;
79
+ background-color: $ui-01;
80
+ border-bottom: 1px solid $ui-03;
81
+ }
82
+
83
+ thead th:first-child {
84
+ padding-left: layout.$spacing-05;
85
+ }
86
+
87
+ tbody {
88
+ --tone: var(--brand-01);
89
+ --tone-ink: var(--brand-01);
90
+ }
91
+
92
+ @each $name, $pair in $tones {
93
+ tbody[data-tone='#{$name}'] {
94
+ --tone: #{list.nth($pair, 1)};
95
+ --tone-ink: #{list.nth($pair, 2)};
96
+ }
97
+ }
98
+
99
+ tbody + tbody {
100
+ border-top: 1px solid $ui-03;
101
+ }
102
+
103
+ tbody tr + tr td,
104
+ tbody tr + tr .indicatorCell {
105
+ border-top: 1px solid $ui-01;
106
+ }
107
+
108
+ tbody tr:hover {
109
+ .codeCell,
110
+ .indicatorCell,
111
+ .countCell {
112
+ background-color: color-mix(in srgb, var(--tone) 5%, #{$ui-02});
113
+ }
114
+ }
115
+ }
116
+
117
+ .areaCell {
118
+ width: 13rem;
119
+ padding: layout.$spacing-04 layout.$spacing-05;
120
+ vertical-align: top;
121
+ text-align: left;
122
+ background-color: color-mix(in srgb, var(--tone) 5%, #{$ui-02});
123
+ box-shadow: inset 3px 0 0 var(--tone);
124
+ }
125
+
126
+ .areaName {
127
+ @include type.type-style('heading-compact-01');
128
+ display: block;
129
+ color: var(--tone-ink);
130
+ }
131
+
132
+ .areaDescription {
133
+ @include type.type-style('label-01');
134
+ display: block;
135
+ margin-top: layout.$spacing-02;
136
+ color: $text-02;
137
+ }
138
+
139
+ .codeCell {
140
+ width: 7.5rem;
141
+ padding: layout.$spacing-04;
142
+ vertical-align: top;
143
+ }
144
+
145
+ .code {
146
+ @include type.type-style('code-01');
147
+ display: inline-block;
148
+ padding: 0 layout.$spacing-02;
149
+ white-space: nowrap;
150
+ color: var(--tone-ink);
151
+ background-color: color-mix(in srgb, var(--tone) 10%, #{$ui-02});
152
+ border-radius: 2px;
153
+ }
154
+
155
+ .indicatorCell {
156
+ padding: layout.$spacing-04;
157
+ text-align: left;
158
+ font-weight: normal;
159
+ }
160
+
161
+ .indicatorName {
162
+ @include type.type-style('body-compact-01');
163
+ display: block;
164
+ font-weight: 600;
165
+ color: $color-gray-100;
166
+ }
167
+
168
+ .indicatorDescription {
169
+ @include type.type-style('label-01');
170
+ display: block;
171
+ margin-top: layout.$spacing-01;
172
+ color: $text-02;
173
+ }
174
+
175
+ .countHead {
176
+ text-align: right !important;
177
+ }
178
+
179
+ .countCell {
180
+ width: 8rem;
181
+ padding: layout.$spacing-04 layout.$spacing-05;
182
+ vertical-align: top;
183
+ text-align: right;
184
+ }
185
+
186
+ .count {
187
+ @include type.type-style('productive-heading-03');
188
+ padding: 0;
189
+ font-variant-numeric: tabular-nums;
190
+ color: var(--brand-01);
191
+ background: none;
192
+ border: 0;
193
+ cursor: pointer;
194
+
195
+ &:hover {
196
+ text-decoration: underline;
197
+ }
198
+ }
199
+
200
+ .none {
201
+ @include type.type-style('productive-heading-03');
202
+ color: $ui-04;
203
+ }
204
+
205
+ .pending {
206
+ @include type.type-style('label-01');
207
+ font-style: italic;
208
+ color: $text-02;
209
+ }
210
+
211
+ .note {
212
+ @include type.type-style('label-01');
213
+ margin-top: layout.$spacing-05;
214
+ color: $text-02;
215
+ }
216
+
217
+ @media (max-width: 42rem) {
218
+ .sheet {
219
+ padding: layout.$spacing-05 layout.$spacing-04;
220
+ }
221
+
222
+ .areaCell,
223
+ .codeCell,
224
+ .table thead th:nth-child(-n + 2) {
225
+ display: none;
226
+ }
227
+ }
@@ -11,7 +11,7 @@ export interface CareAndTreatmentGroup {
11
11
  }
12
12
 
13
13
  /**
14
- * Care & Treatment and ARV Management, sections 1.1-1.4, for the month ending
14
+ * Care & Treatment and ARV Management, sections 1.1-1.7, for the month ending
15
15
  * on `endDate`, for the whole facility of the location: each figure added up
16
16
  * by age band, sex and MCH/PMTCT -- a few dozen rows, which the report adds
17
17
  * up into its tables.
@@ -0,0 +1,91 @@
1
+ import { openmrsFetch } from '@openmrs/esm-framework';
2
+ import { buildEtlUrl } from '../utils/get-base-url';
3
+ import { PAGE_SIZE, pageParams, toPatientListPage, type PatientListPage } from './patient-list-page';
4
+
5
+ export interface QualityImprovementCounts {
6
+ /**
7
+ * The month's end the counts of a client's status on ART are for
8
+ * (YYYY-MM-DD): the period's last month, or the latest month in the HIV
9
+ * monthly dataset while that one is not in it yet
10
+ */
11
+ statusMonth: string;
12
+ /** Each indicator's count, e.g. `{ 'recent-defaulters': 744 }` */
13
+ counts: Record<string, number>;
14
+ }
15
+
16
+ /**
17
+ * The Quality Improvement report for the period from `startDate` to `endDate`
18
+ * (a month, or any dates), for the whole facility of the location: each
19
+ * indicator's count of clients needing an action.
20
+ */
21
+ export async function getQualityImprovement(params: {
22
+ locationUuids: string;
23
+ startDate: string;
24
+ endDate: string;
25
+ }): Promise<QualityImprovementCounts> {
26
+ const url = await buildEtlUrl('quality-improvement', {
27
+ locationUuids: params.locationUuids,
28
+ startDate: params.startDate,
29
+ endDate: params.endDate,
30
+ });
31
+ const response = await openmrsFetch(url);
32
+ if (!response.ok) {
33
+ throw new Error(`Failed to fetch the Quality Improvement report: ${response.status} - ${await response.text()}`);
34
+ }
35
+ const data = await response.json();
36
+ return { statusMonth: data?.statusMonth ?? '', counts: data?.counts ?? {} };
37
+ }
38
+
39
+ /** A Case Surveillance card: the gap (numerator) out of the clients it applies to (denominator) */
40
+ export interface CaseSurveillanceCard {
41
+ numerator: number;
42
+ denominator: number;
43
+ /** The indicators whose clients each figure lists */
44
+ numeratorIndicator: string;
45
+ denominatorIndicator: string;
46
+ }
47
+
48
+ /**
49
+ * The Case Surveillance report for the period, for the whole facility of the
50
+ * location: each gap review card, by id (e.g. `not-linked`).
51
+ */
52
+ export async function getCaseSurveillance(params: {
53
+ locationUuids: string;
54
+ startDate: string;
55
+ endDate: string;
56
+ }): Promise<{ statusMonth: string; cards: Record<string, CaseSurveillanceCard> }> {
57
+ const url = await buildEtlUrl('case-surveillance', {
58
+ locationUuids: params.locationUuids,
59
+ startDate: params.startDate,
60
+ endDate: params.endDate,
61
+ });
62
+ const response = await openmrsFetch(url);
63
+ if (!response.ok) {
64
+ throw new Error(`Failed to fetch the Case Surveillance report: ${response.status} - ${await response.text()}`);
65
+ }
66
+ const data = await response.json();
67
+ return { statusMonth: data?.statusMonth ?? '', cards: data?.cards ?? {} };
68
+ }
69
+
70
+ /** A page of the clients of one indicator (of either report) */
71
+ export async function getQualityImprovementPatientList(params: {
72
+ locationUuids: string;
73
+ startDate: string;
74
+ endDate: string;
75
+ indicator: string;
76
+ startIndex?: number;
77
+ limit?: number;
78
+ }): Promise<PatientListPage> {
79
+ const url = await buildEtlUrl('quality-improvement-patient-list', {
80
+ locationUuids: params.locationUuids,
81
+ startDate: params.startDate,
82
+ endDate: params.endDate,
83
+ indicator: params.indicator,
84
+ ...pageParams(params),
85
+ });
86
+ const response = await openmrsFetch(url);
87
+ if (!response.ok) {
88
+ throw new Error(`Failed to fetch the patient list: ${response.status} - ${await response.text()}`);
89
+ }
90
+ return toPatientListPage(await response.json(), params.startIndex ?? 0, params.limit ?? PAGE_SIZE);
91
+ }
@@ -59,11 +59,20 @@ import CareAndTreatmentReport, {
59
59
  CARE_AND_TREATMENT_LINELIST_PATH,
60
60
  } from './reports/program/care-and-treatment/care-and-treatment.component';
61
61
  import CareAndTreatmentLinelist from './reports/program/care-and-treatment/care-and-treatment-linelist.component';
62
- import { actionSummaryReports, programReports } from './dashboard/report-catalog';
62
+ import { qualityImprovementReports, programReports } from './dashboard/report-catalog';
63
+ import QualityImprovementReport from './reports/quality-improvement/quality-improvement.component';
64
+ import QualityImprovementLinelist from './reports/quality-improvement/quality-improvement-linelist.component';
65
+ import CaseSurveillanceReport from './reports/quality-improvement/case-surveillance.component';
66
+ import { CASE_SURVEILLANCE_PATH } from './reports/quality-improvement/case-surveillance.config';
67
+ import {
68
+ QUALITY_IMPROVEMENT_LINELIST_PATH,
69
+ QUALITY_IMPROVEMENT_PATH,
70
+ } from './reports/quality-improvement/quality-improvement.config';
63
71
  import Moh718Report from './reports/moh-718/moh-718.component';
64
72
  import MOH713Component from './reports/moh-713/moh-713.component';
65
73
  import MOH368Component from './registers/moh-368/moh-368.component';
66
74
  import Moh301Register from './reports/moh-718/registers/moh-301/moh-301.register';
75
+ import Moh740Linelist from './reports/moh-740/line-list/moh-740-line-list.component';
67
76
 
68
77
  const RootComponent: React.FC = () => {
69
78
  const baseName = window.getOpenmrsSpaBase() + 'home/reports';
@@ -81,7 +90,7 @@ const RootComponent: React.FC = () => {
81
90
  }
82
91
  />
83
92
  <Route path={CARE_AND_TREATMENT_LINELIST_PATH} element={<CareAndTreatmentLinelist />} />
84
- {/* Program and action summary reports: each on the shared report template page until its own template is built */}
93
+ {/* Program reports: each on the shared report template page until its own template is built */}
85
94
  {programReports
86
95
  .filter((report) => report.path !== '/program/care-and-treatment')
87
96
  .map((report) => (
@@ -93,18 +102,23 @@ const RootComponent: React.FC = () => {
93
102
  }
94
103
  />
95
104
  ))}
96
- {actionSummaryReports.map((report) => (
97
- <Route
98
- key={report.path}
99
- path={report.path}
100
- element={
101
- <ProgramReport
102
- report={report}
103
- backLink={{ label: 'Action summary reports', to: '/?group=action-summary' }}
104
- />
105
- }
106
- />
107
- ))}
105
+ <Route
106
+ path={QUALITY_IMPROVEMENT_PATH}
107
+ element={
108
+ <QualityImprovementReport
109
+ report={qualityImprovementReports.find((r) => r.path === QUALITY_IMPROVEMENT_PATH)}
110
+ />
111
+ }
112
+ />
113
+ <Route path={QUALITY_IMPROVEMENT_LINELIST_PATH} element={<QualityImprovementLinelist />} />
114
+ <Route
115
+ path={CASE_SURVEILLANCE_PATH}
116
+ element={
117
+ <CaseSurveillanceReport
118
+ report={qualityImprovementReports.find((r) => r.path === CASE_SURVEILLANCE_PATH)}
119
+ />
120
+ }
121
+ />
108
122
  <Route path="/moh-710" element={<Moh710Report />} />
109
123
  <Route path="/moh-711" element={<Moh711Report />} />
110
124
  <Route path="/moh-717" element={<Moh717Report />} />
@@ -140,6 +154,7 @@ const RootComponent: React.FC = () => {
140
154
  <Route path="/moh-510-register" element={<Moh510RegisterComponent />} />
141
155
  <Route path="/moh-362" element={<Moh362Register />} />
142
156
  <Route path="/moh-222" element={<Moh222DailyRegister />} />
157
+ <Route path="/moh-740-line-list" element={<Moh740Linelist />} />
143
158
  <Route path="/moh-270" element={<Moh270DailyRegister />} />
144
159
  <Route path="/moh-240-register" element={<Moh240LabRegister />} />
145
160
  <Route path="/tb-lab-register" element={<TbLabRegister />} />