@kenyaemr/esm-care-panel-app 5.4.2-pre.2898 → 5.4.2-pre.2900

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/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[],"extensions":[{"name":"care-panel-patient-summary","component":"carePanelPatientSummary","slot":"patient-chart-care-panel-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"care-panel-summary-dashboard-link","component":"carePanelSummaryDashboardLink","order":3,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-care-panel-dashboard-slot","layoutMode":"anchored","path":"Care panel"}},{"name":"delete-regimen-confirmation-dialog","component":"deleteRegimenConfirmationDialog"},{"name":"hiv-patient-visit-summary-dashboard-link","component":"hivPatientSummaryDashboardLink","slot":"hiv-care-and-treatment-slot","meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-hiv-patient-summary-slot","path":"HIV Patient Summary","layoutMode":"anchored"}},{"name":"hiv-patient-visit-summary","slot":"hiv-patient-summary-slot","component":"hivPatientSummary","order":3,"online":true,"offline":false},{"name":"dispensing-patient-vitals","component":"dispensingPaentientVitals","slot":"dispensing-condition-and-diagnoses","order":1,"online":true,"offline":true},{"name":"patient-discharge-side-rail-icon","component":"patientDischargeSideRailIcon","slot":"action-menu-ward-patient-items-slot"}],"workspaces":[{"name":"patient-regimen-workspace","title":"Patient Regimen","component":"regimenFormWorkspace","type":"form","canMaximize":true,"canHide":true,"width":"wider"},{"name":"patient-care-discharge-workspace","title":"Patient Discharge","component":"patientDischargeWorkspace","type":"workspace","canMaximize":true,"canHide":true,"width":"extra-wide","groups":["ward-patient"]},{"name":"mch-program-form-workspace","component":"mchProgramForm","title":"Program Form","type":"workspace"},{"name":"kvp-peer-linkage-form-workspace","component":"kvpPeerLinkageForm","title":"Program Form","type":"workspace"}],"version":"5.4.2-pre.2898"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"kenyaemr":"^19.0.0"},"pages":[],"extensions":[{"name":"care-panel-patient-summary","component":"carePanelPatientSummary","slot":"patient-chart-care-panel-dashboard-slot","order":10,"meta":{"columnSpan":4}},{"name":"care-panel-summary-dashboard-link","component":"carePanelSummaryDashboardLink","order":3,"meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-care-panel-dashboard-slot","layoutMode":"anchored","path":"Care panel"}},{"name":"delete-regimen-confirmation-dialog","component":"deleteRegimenConfirmationDialog"},{"name":"hiv-patient-visit-summary-dashboard-link","component":"hivPatientSummaryDashboardLink","slot":"hiv-care-and-treatment-slot","meta":{"columns":1,"columnSpan":1,"slot":"patient-chart-hiv-patient-summary-slot","path":"HIV Patient Summary","layoutMode":"anchored"}},{"name":"hiv-patient-visit-summary","slot":"hiv-patient-summary-slot","component":"hivPatientSummary","order":3,"online":true,"offline":false},{"name":"dispensing-patient-vitals","component":"dispensingPaentientVitals","slot":"dispensing-condition-and-diagnoses","order":1,"online":true,"offline":true},{"name":"patient-discharge-side-rail-icon","component":"patientDischargeSideRailIcon","slot":"action-menu-ward-patient-items-slot"}],"workspaces":[{"name":"patient-regimen-workspace","title":"Patient Regimen","component":"regimenFormWorkspace","type":"form","canMaximize":true,"canHide":true,"width":"wider"},{"name":"patient-care-discharge-workspace","title":"Patient Discharge","component":"patientDischargeWorkspace","type":"workspace","canMaximize":true,"canHide":true,"width":"extra-wide","groups":["ward-patient"]},{"name":"mch-program-form-workspace","component":"mchProgramForm","title":"Program Form","type":"workspace"},{"name":"kvp-peer-linkage-form-workspace","component":"kvpPeerLinkageForm","title":"Program Form","type":"workspace"}],"version":"5.4.2-pre.2900"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-care-panel-app",
3
- "version": "5.4.2-pre.2898",
3
+ "version": "5.4.2-pre.2900",
4
4
  "description": "Patient care panels microfrontend for the OpenMRS SPA",
5
5
  "keywords": [
6
6
  "openmrs"
@@ -5,10 +5,13 @@ import {
5
5
  parseDate,
6
6
  restBaseUrl,
7
7
  showModal,
8
+ useConfig,
8
9
  } from '@openmrs/esm-framework';
9
10
  import dayjs from 'dayjs';
10
11
  import useSWR, { mutate } from 'swr';
11
12
  import z from 'zod';
13
+ import { CarePanelConfig } from '../config-schema';
14
+ import { useMemo } from 'react';
12
15
 
13
16
  export interface Enrollement {
14
17
  uuid: string;
@@ -66,13 +69,17 @@ export const usePrograms = () => {
66
69
 
67
70
  export const usePatientEnrolledPrograms = (patientUuid: string) => {
68
71
  const customRepresentation = `custom:(uuid,display,program,dateEnrolled,dateCompleted,location:(uuid,display),states:(startDate,endDate,voided,state:(uuid,concept:(display))))`;
69
-
72
+ const { excludedCarePrograms } = useConfig<CarePanelConfig>();
70
73
  const url = `${restBaseUrl}/programenrollment?patient=${patientUuid}&v=${customRepresentation}`;
71
74
  const { data, error, isLoading, mutate } = useSWR<FetchResponse<{ results: Array<Enrollement> }>>(url, openmrsFetch);
75
+ const enrollments = useMemo(() => {
76
+ const allEnrollments = data?.data?.results ?? [];
77
+ return allEnrollments.filter((enrollment) => !excludedCarePrograms.includes(enrollment.program.uuid));
78
+ }, [data, excludedCarePrograms]);
72
79
  return {
73
80
  isLoading,
74
81
  error,
75
- enrollments: data?.data?.results ?? [],
82
+ enrollments,
76
83
  mutate,
77
84
  };
78
85
  };
@@ -22,6 +22,7 @@ export interface CarePanelConfig {
22
22
  peerEducatorRelationshipType: string;
23
23
  peerCalendarOutreactForm: string;
24
24
  hideFilledProgramForm: boolean;
25
+ excludedCarePrograms: string[];
25
26
  }
26
27
 
27
28
  export const configSchema = {
@@ -606,4 +607,11 @@ export const configSchema = {
606
607
  },
607
608
  ],
608
609
  },
610
+ excludedCarePrograms: {
611
+ _type: Type.Array,
612
+ _description: 'List of care program UUIDs to be excluded from the care panel',
613
+ _default: [
614
+ 'b5d9e05f-f5ab-4612-98dd-adb75438ed34', // MCH Mother services
615
+ ],
616
+ },
609
617
  };
@@ -1,6 +1,7 @@
1
1
  import useSWR from 'swr';
2
- import { openmrsFetch } from '@openmrs/esm-framework';
2
+ import { openmrsFetch, useConfig } from '@openmrs/esm-framework';
3
3
  import { useMemo } from 'react';
4
+ import { CarePanelConfig } from '../config-schema';
4
5
 
5
6
  export type PatientCarePrograms = {
6
7
  uuid: string;
@@ -20,15 +21,22 @@ export const useCarePrograms = (patientUuid: string) => {
20
21
  isValidating,
21
22
  mutate: mutateEligiblePrograms,
22
23
  } = useSWR<{ data: Array<PatientCarePrograms> }>(url, openmrsFetch);
24
+ const { excludedCarePrograms } = useConfig<CarePanelConfig>();
23
25
 
24
26
  const eligibleCarePrograms = useMemo(
25
- () => data?.data?.filter((careProgram) => careProgram.enrollmentStatus !== 'active') ?? [],
26
- [data],
27
+ () =>
28
+ data?.data?.filter(
29
+ (careProgram) => careProgram.enrollmentStatus !== 'active' && !excludedCarePrograms.includes(careProgram.uuid),
30
+ ) ?? [],
31
+ [data, excludedCarePrograms],
27
32
  );
28
33
 
29
34
  const activeCarePrograms = useMemo(
30
- () => data?.data?.filter((careProgram) => careProgram.enrollmentStatus !== 'active') ?? [],
31
- [data],
35
+ () =>
36
+ data?.data?.filter(
37
+ (careProgram) => careProgram.enrollmentStatus !== 'active' && !excludedCarePrograms.includes(careProgram.uuid),
38
+ ) ?? [],
39
+ [data?.data, excludedCarePrograms],
32
40
  );
33
41
  return {
34
42
  eligibleCarePrograms,