@kenyaemr/esm-facility-dashboard-app 5.4.1-pre.1976 → 5.4.1-pre.1978

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 (45) hide show
  1. package/.turbo/turbo-build.log +62 -31
  2. package/dist/10.js +2 -0
  3. package/dist/10.js.LICENSE.txt +9 -0
  4. package/dist/10.js.map +1 -0
  5. package/dist/30.js +2 -0
  6. package/dist/30.js.map +1 -0
  7. package/dist/300.js +1 -1
  8. package/dist/373.js +2 -0
  9. package/dist/373.js.LICENSE.txt +5 -0
  10. package/dist/373.js.map +1 -0
  11. package/dist/485.js +2 -0
  12. package/dist/485.js.LICENSE.txt +19 -0
  13. package/dist/485.js.map +1 -0
  14. package/dist/495.js +1 -0
  15. package/dist/495.js.map +1 -0
  16. package/dist/74.js +1 -0
  17. package/dist/74.js.map +1 -0
  18. package/dist/876.js +2 -0
  19. package/dist/876.js.LICENSE.txt +9 -0
  20. package/dist/876.js.map +1 -0
  21. package/dist/893.js +2 -0
  22. package/dist/{104.js.LICENSE.txt → 893.js.LICENSE.txt} +0 -10
  23. package/dist/893.js.map +1 -0
  24. package/dist/kenyaemr-esm-facility-dashboard-app.js +1 -1
  25. package/dist/kenyaemr-esm-facility-dashboard-app.js.buildmanifest.json +202 -55
  26. package/dist/kenyaemr-esm-facility-dashboard-app.js.map +1 -1
  27. package/dist/main.js +1 -1
  28. package/dist/main.js.map +1 -1
  29. package/dist/routes.json +1 -1
  30. package/package.json +1 -1
  31. package/src/surveillance/charts/charts.scss +3 -0
  32. package/src/surveillance/charts/hiv-not-linked-to-art.component.tsx +21 -7
  33. package/src/surveillance/charts/pbfw-not-in-prep.component.tsx +28 -34
  34. package/src/surveillance/empty-state/empty-state-log.components.tsx +20 -0
  35. package/src/surveillance/empty-state/empty-state-log.scss +28 -0
  36. package/src/surveillance/empty-state/empty-state-log.test.tsx +24 -0
  37. package/src/types/index.ts +2 -0
  38. package/translations/en.json +6 -5
  39. package/dist/104.js +0 -2
  40. package/dist/104.js.map +0 -1
  41. package/dist/245.js +0 -1
  42. package/dist/245.js.map +0 -1
  43. package/dist/90.js +0 -2
  44. package/dist/90.js.map +0 -1
  45. /package/dist/{90.js.LICENSE.txt → 30.js.LICENSE.txt} +0 -0
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemrCharts":"^1.6.7"},"extensions":[{"component":"surveillanceDashboardLink","name":"surveillance-dashboard-link","slot":"facility-dashboard-left-panel-slot"},{"component":"aboveSiteDashboardLink","name":"above-site-dashboard-link","slot":"facility-dashboard-left-panel-slot"}],"workspaces":[],"modals":[],"pages":[{"component":"root","route":"facility-dashboard"}],"version":"5.4.1-pre.1976"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemrCharts":"^1.6.7"},"extensions":[{"component":"surveillanceDashboardLink","name":"surveillance-dashboard-link","slot":"facility-dashboard-left-panel-slot"},{"component":"aboveSiteDashboardLink","name":"above-site-dashboard-link","slot":"facility-dashboard-left-panel-slot"}],"workspaces":[],"modals":[],"pages":[{"component":"root","route":"facility-dashboard"}],"version":"5.4.1-pre.1978"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-facility-dashboard-app",
3
- "version": "5.4.1-pre.1976",
3
+ "version": "5.4.1-pre.1978",
4
4
  "description": "Facility dashboard app",
5
5
  "browser": "dist/kenyaemr-esm-facility-dashboard-app.js",
6
6
  "main": "src/index.ts",
@@ -5,3 +5,6 @@
5
5
  .chartContainer {
6
6
  padding: layout.$spacing-05;
7
7
  }
8
+ .chart {
9
+ margin-top: layout.$spacing-05;
10
+ }
@@ -1,10 +1,12 @@
1
1
  import '@carbon/charts/styles.css';
2
- import React, { useMemo } from 'react';
2
+ import React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import BaseIndicatorTrendChart from './base-indicator-trend-chart.component';
5
5
  import BaseArtProgressTrackingChart from './base-art-progress-tracking-chart.component';
6
6
  import useFacilityDashboardSurveillance from '../../hooks/useFacilityDashboardSurveillance';
7
7
  import { useSurveillanceData } from '../../hooks/useSurveillanceData';
8
+ import EmptyState from '../empty-state/empty-state-log.components';
9
+ import styles from './charts.scss';
8
10
  type HIVPositiveNotLinkedToARTProps = {
9
11
  startDate?: Date;
10
12
  endDate?: Date;
@@ -23,12 +25,24 @@ const HIVPositiveNotLinkedToART: React.FC<HIVPositiveNotLinkedToARTProps> = ({ s
23
25
 
24
26
  return (
25
27
  <>
26
- <BaseIndicatorTrendChart
27
- data={hivPositivePatientValue}
28
- title={t('hivPositiveNotLinkedToART', 'HIV +VE Not linked to ART')}
29
- yAxisTitle={t('numberTestedPositiveNotLinked', 'no tested positive not linked')}
30
- />
31
- <BaseArtProgressTrackingChart data={monthlyHivPositivePatientData} />
28
+ <div className={styles.chart}>
29
+ {hivPositivePatientValue.length > 0 ? (
30
+ <BaseIndicatorTrendChart
31
+ data={hivPositivePatientValue}
32
+ title={t('hivPositiveNotLinkedToART', 'HIV +VE Not linked to ART')}
33
+ yAxisTitle={t('numberTestedPositiveNotLinked', 'Number tested positive not linked')}
34
+ />
35
+ ) : (
36
+ <EmptyState subTitle={t('noHivPositiveNotLinked', 'No HIV +VE Not linked to ART data to display')} />
37
+ )}
38
+ </div>
39
+ <div className={styles.chart}>
40
+ {monthlyHivPositivePatientData.length > 0 ? (
41
+ <BaseArtProgressTrackingChart data={monthlyHivPositivePatientData} />
42
+ ) : (
43
+ <EmptyState subTitle={'No Linkage to ART data to display'} />
44
+ )}
45
+ </div>
32
46
  </>
33
47
  );
34
48
  };
@@ -1,9 +1,11 @@
1
1
  import '@carbon/charts/styles.css';
2
- import React, { useMemo } from 'react';
2
+ import React from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import BaseIndicatorTrendChart from './base-indicator-trend-chart.component';
5
5
  import BaseProgressTrackingChart from './base-progress-tracking-chart.component';
6
- import { getNumberOfDays, sevenDaysRunningDates } from '../../constants';
6
+ import useFacilityDashboardSurveillance from '../../hooks/useFacilityDashboardSurveillance';
7
+ import { useSurveillanceData } from '../../hooks/useSurveillanceData';
8
+ import EmptyState from '../empty-state/empty-state-log.components';
7
9
  import styles from './charts.scss';
8
10
 
9
11
  type PBFWNotInPrepProps = {
@@ -12,42 +14,34 @@ type PBFWNotInPrepProps = {
12
14
  };
13
15
  const PBFWNotInPrep: React.FC<PBFWNotInPrepProps> = ({ startDate, endDate }) => {
14
16
  const { t } = useTranslation();
15
- const generateRandomData = (numRecords: number) => {
16
- return Array.from({ length: numRecords }, (_, i) => ({
17
- day: sevenDaysRunningDates(i, endDate),
18
- value: Math.floor(Math.random() * 50),
19
- }));
20
- };
17
+ const { error, isLoading, surveillanceSummary } = useFacilityDashboardSurveillance(startDate, endDate);
18
+ const highRiskPBFWNotOnPrepValue = useSurveillanceData(surveillanceSummary, 'getMonthlyHighRiskPBFWNotOnPrep');
21
19
 
22
- const numberSequence = useMemo(() => Math.max(1, getNumberOfDays(startDate, endDate)), [startDate, endDate]);
23
-
24
- const generateRandomDataForProgress = (numRecords: number) => {
25
- const data = [];
26
- for (let i = 1; i <= numRecords; i++) {
27
- data.push({
28
- group: 'Declined',
29
- key: sevenDaysRunningDates(i, endDate),
30
- value: Math.floor(Math.random() * 50),
31
- });
32
- data.push({
33
- group: 'StartedPrEP',
34
- key: sevenDaysRunningDates(i, endDate),
35
- value: Math.floor(Math.random() * 50),
36
- });
37
- }
38
- return data;
39
- };
20
+ const monthlyhighRiskPBFWNotOnPrepPatientData = useSurveillanceData(
21
+ surveillanceSummary,
22
+ 'getMonthlyHighRiskPBFWNotOnPrepPatients',
23
+ );
40
24
 
41
- const data = useMemo(() => generateRandomDataForProgress(numberSequence), [numberSequence, startDate, endDate]);
42
- const values = useMemo(() => generateRandomData(numberSequence), [numberSequence, startDate, endDate]);
43
25
  return (
44
26
  <>
45
- <BaseIndicatorTrendChart
46
- data={values}
47
- title={t('prepNotlinked', 'High risk +ve PBFW not on PrEP')}
48
- yAxisTitle={t('percentageHightRiskPBFW', '% High risk PBFW Not in PrEP')}
49
- />
50
- <BaseProgressTrackingChart data={data} />
27
+ <div className={styles.chart}>
28
+ {highRiskPBFWNotOnPrepValue.length > 0 ? (
29
+ <BaseIndicatorTrendChart
30
+ data={highRiskPBFWNotOnPrepValue}
31
+ title={t('prepNotlinked', 'High risk +ve PBFW not on PrEP')}
32
+ yAxisTitle={t('numberHightRiskPBFW', 'Number of High risk PBFW Not on PrEP')}
33
+ />
34
+ ) : (
35
+ <EmptyState subTitle={t('noHighRiskPBFW', 'No High risk PBFW Not on PrEP data to display')} />
36
+ )}
37
+ </div>
38
+ <div>
39
+ {monthlyhighRiskPBFWNotOnPrepPatientData.length > 0 ? (
40
+ <BaseProgressTrackingChart data={monthlyhighRiskPBFWNotOnPrepPatientData} />
41
+ ) : (
42
+ <EmptyState subTitle={t('noHighRiskPBFW', 'No High risk PBFW Not on PrEP data to display')} />
43
+ )}
44
+ </div>
51
45
  </>
52
46
  );
53
47
  };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import styles from './empty-state-log.scss';
4
+ import { DataEnrichment } from '@carbon/react/icons';
5
+ import { EmptyDataIllustration } from '@openmrs/esm-patient-common-lib';
6
+
7
+ interface EmptyStateProps {
8
+ subTitle: string;
9
+ }
10
+
11
+ const EmptyState: React.FC<EmptyStateProps> = ({ subTitle }) => {
12
+ return (
13
+ <div className={styles.emptyStateContainer}>
14
+ <EmptyDataIllustration />
15
+ <p className={styles.subTitle}>{subTitle}</p>
16
+ </div>
17
+ );
18
+ };
19
+
20
+ export default EmptyState;
@@ -0,0 +1,28 @@
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
4
+
5
+ .emptyStateContainer {
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: center;
9
+ justify-content: center;
10
+ min-height: 300px;
11
+ background-color: colors.$gray-10;
12
+ row-gap: layout.$spacing-02;
13
+
14
+ & form {
15
+ border: none;
16
+ }
17
+ .subTitle {
18
+ @include type.type-style('body-compact-01');
19
+ color: colors.$cool-gray-70;
20
+ margin-top: layout.$spacing-04;
21
+ }
22
+ }
23
+
24
+ svg.iconOverrides {
25
+ width: layout.$spacing-11;
26
+ height: layout.$spacing-11;
27
+ fill: var(--brand-03);
28
+ }
@@ -0,0 +1,24 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import '@testing-library/jest-dom';
3
+ import { EmptyDataIllustration } from '@openmrs/esm-patient-common-lib';
4
+ import EmptyState from './empty-state-log.components';
5
+ import React from 'react';
6
+
7
+ // Mock the EmptyDataIllustration component
8
+ jest.mock('@openmrs/esm-patient-common-lib', () => ({
9
+ EmptyDataIllustration: jest.fn(() => <div>Mocked EmptyDataIllustration</div>),
10
+ }));
11
+
12
+ describe('EmptyState', () => {
13
+ it('renders the EmptyState component with the given subtitle', () => {
14
+ const testSubtitle = 'No data available';
15
+
16
+ render(<EmptyState subTitle={testSubtitle} />);
17
+
18
+ const subtitleElement = screen.getByText(testSubtitle);
19
+ expect(subtitleElement).toBeInTheDocument();
20
+
21
+ const illustrationElement = screen.getByText('Mocked EmptyDataIllustration');
22
+ expect(illustrationElement).toBeInTheDocument();
23
+ });
24
+ });
@@ -15,6 +15,8 @@ export type SurveillanceSummary = {
15
15
  heiClinicalActionThreshold: number;
16
16
  getMonthlyHivPositiveNotLinked: HivPositiveNotLinkedData;
17
17
  getMonthlyHivPositiveNotLinkedPatients: HivPositiveNotLinkedData;
18
+ getMonthlyHighRiskPBFWNotOnPrep: HivPositiveNotLinkedData;
19
+ getMonthlyHighRiskPBFWNotOnPrepPatients: HivPositiveNotLinkedData;
18
20
  };
19
21
 
20
22
  export type IndicationMode = 'decreasing' | 'increasing';
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "aboveSiteDashboard": "Above site facility Dashboard",
3
3
  "aboveSiteFacilityDashboard": "Above site facility Dashboard",
4
+ "day": "Day",
4
5
  "days": "Days",
5
6
  "delayedEAC": "Delayed enhanced adherence counselling",
6
7
  "delayedVLTesting": "Number of client on ART that visited, were eligible for VL sampling and no VL was done",
7
8
  "dnapcrPending": "HEI (6-8 weeks) without DNA-PCR Results",
8
- "durationInDays": "Duration in days",
9
9
  "endDate": "End date",
10
10
  "facilitydashboard": "Facility Dashboard",
11
11
  "facilitydashboardLeftPannel": "facility Dashboard Left Panel",
@@ -17,16 +17,17 @@
17
17
  "hivPositiveNotLinkedToART": "HIV +VE Not linked to ART",
18
18
  "indicator": "Indicator",
19
19
  "missedoppotunityVL": "Missed opportunity in viral load testing",
20
+ "numberHivPositive": "Number HIV positive",
21
+ "numberTestedPositiveNotLinked": "Number tested positive not linked",
20
22
  "pbfwNotLinked": "High risk -ve PBFW Not linked to PrEP",
21
- "percentage": "Percentage",
23
+ "numberOfPatients": "Number of Patients",
22
24
  "percentageDelatedEAC": "% Delayed EAC",
23
25
  "percentageHEIOutcome": "% of Undocumented final outcome",
24
- "percentageHightRiskPBFW": "% High risk PBFW Not in PrEP",
26
+ "numberHightRiskPBFW": "Number of High risk PBFW Not on PrEP",
25
27
  "percentageMissedVL": "% of missed opportunity VL",
26
28
  "percentagePendingPCRDNAResults": "% of HEI (6-8 weeks) without DNA-PCR Results",
27
- "numberTestedPositiveNotLinked": "no tested positive not linked",
28
29
  "prepNotlinked": "High risk -ve PBFW not on PrEP",
29
- "progressInAdressingLinkedToArt": "Progress in adressing Linkage to ART",
30
+ "progressInAddressingLinkedToArt": "Progress in addressing Linkage to ART",
30
31
  "progresstracking": "Progress tracking",
31
32
  "startDate": "Start date",
32
33
  "surveillance": "Surveillance",