@kenyaemr/esm-patient-clinical-view-app 5.4.1-pre.2075 → 5.4.1-pre.2083

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.
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useMemo, useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import {
4
4
  DataTable,
@@ -38,12 +38,15 @@ interface FamilyHistoryProps {
38
38
  const FamilyHistory: React.FC<FamilyHistoryProps> = ({ patientUuid }) => {
39
39
  const { t } = useTranslation();
40
40
  const config = useConfig<ConfigObject>();
41
- const { concepts, familyRelationshipsTypeList } = config;
41
+ const { concepts } = config;
42
42
  const layout = useLayoutType();
43
43
  const [pageSize, setPageSize] = useState(10);
44
44
  const { relationships, error, isLoading, isValidating } = usePatientRelationships(patientUuid);
45
-
46
- const familyRelationshipTypeUUIDs = new Set(familyRelationshipsTypeList.map((type) => type.uuid));
45
+ const familyRelationshipTypes = useMemo(
46
+ () => config.relationshipTypesList.filter((rl) => rl.category.some((c) => c === 'family')),
47
+ [config],
48
+ );
49
+ const familyRelationshipTypeUUIDs = new Set(familyRelationshipTypes.map((type) => type.uuid));
47
50
  const familyRelationships = relationships.filter((r) => familyRelationshipTypeUUIDs.has(r.relationshipTypeUUID));
48
51
 
49
52
  const headerTitle = t('familyContacts', 'Family contacts');
@@ -1,7 +1,7 @@
1
1
  import { Button, ButtonSet, Column, ComboBox, DatePicker, DatePickerInput, Form, Stack, TextArea } from '@carbon/react';
2
2
  import { zodResolver } from '@hookform/resolvers/zod';
3
3
  import { useConfig, useSession } from '@openmrs/esm-framework';
4
- import React from 'react';
4
+ import React, { useMemo } from 'react';
5
5
  import { Controller, FormProvider, SubmitHandler, useForm } from 'react-hook-form';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { z } from 'zod';
@@ -36,8 +36,11 @@ const FamilyRelationshipForm: React.FC<RelationshipFormProps> = ({ closeWorkspac
36
36
  const { t } = useTranslation();
37
37
  const { data: mappedRelationshipTypes } = useMappedRelationshipTypes();
38
38
  const config = useConfig<ConfigObject>();
39
- const { familyRelationshipsTypeList } = config;
40
- const familyRelationshipTypesUUIDs = new Set(familyRelationshipsTypeList.map((r) => r.uuid));
39
+ const familyRelationships = useMemo(
40
+ () => config.relationshipTypesList.filter((rl) => rl.category.some((c) => c === 'family')),
41
+ [config],
42
+ );
43
+ const familyRelationshipTypesUUIDs = new Set(familyRelationships.map((r) => r.uuid));
41
44
  const familyRelationshipTypes = mappedRelationshipTypes.filter((type) => familyRelationshipTypesUUIDs.has(type.uuid));
42
45
  const session = useSession();
43
46
 
@@ -109,17 +109,21 @@ const useContacts = (patientUuid: string) => {
109
109
  url,
110
110
  openmrsFetch,
111
111
  );
112
+ const pnsRelationships = useMemo(
113
+ () => config.relationshipTypesList.filter((rl) => rl.category.some((c) => c === 'pns')),
114
+ [config],
115
+ );
112
116
  const relationships = useMemo(() => {
113
117
  return data?.data?.results?.length
114
118
  ? extractContactData(
115
119
  patientUuid,
116
120
  data?.data?.results.filter((rel) =>
117
- config.pnsRelationships.some((famRel) => famRel.uuid === rel.relationshipType.uuid),
121
+ pnsRelationships.some((famRel) => famRel.uuid === rel.relationshipType.uuid),
118
122
  ),
119
123
  config,
120
124
  )
121
125
  : [];
122
- }, [data?.data?.results, patientUuid, config]);
126
+ }, [data?.data?.results, patientUuid, config, pnsRelationships]);
123
127
  return {
124
128
  contacts: relationships,
125
129
  error,
@@ -3,8 +3,14 @@ import useSWR from 'swr';
3
3
  import { Encounter } from '../types';
4
4
  import pickBy from 'lodash/pickBy';
5
5
 
6
- const useEncounters = (patientUuid: string, encounterTypeUuid: string, fromdate?: string, todate?: string) => {
7
- const customeRepresntation = 'custom:(uuid,display,encounterDatetime,obs:(uuid,display,value:(uuid,display)))';
6
+ const useEncounters = (
7
+ patientUuid: string,
8
+ encounterTypeUuid: string,
9
+ fromdate?: string,
10
+ todate?: string,
11
+ v?: string,
12
+ ) => {
13
+ const customeRepresntation = v ?? 'custom:(uuid,display,encounterDatetime,obs:(uuid,display,value:(uuid,display)))';
8
14
 
9
15
  const params = new URLSearchParams(
10
16
  pickBy(
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useMemo, useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import {
4
4
  DataTable,
@@ -39,11 +39,14 @@ export const OtherRelationships: React.FC<OtherRelationshipsProps> = ({ patientU
39
39
  const { t } = useTranslation();
40
40
  const config = useConfig<ConfigObject>();
41
41
  const layout = useLayoutType();
42
- const { concepts, familyRelationshipsTypeList } = config;
42
+ const { concepts } = config;
43
43
  const [pageSize, setPageSize] = useState(10);
44
-
44
+ const familyRelationships = useMemo(
45
+ () => config.relationshipTypesList.filter((rl) => rl.category.some((c) => c === 'family')),
46
+ [config],
47
+ );
45
48
  const { relationships, error, isLoading, isValidating } = usePatientRelationships(patientUuid);
46
- const familyRelationshipTypeUUIDs = new Set(familyRelationshipsTypeList.map((type) => type.uuid));
49
+ const familyRelationshipTypeUUIDs = new Set(familyRelationships.map((type) => type.uuid));
47
50
  const nonFamilyRelationships = relationships.filter((r) => !familyRelationshipTypeUUIDs.has(r.relationshipTypeUUID));
48
51
 
49
52
  const headerTitle = t('otherRelationships', 'Other Relationships');
@@ -1,7 +1,7 @@
1
1
  import { Button, ButtonSet, Column, ComboBox, DatePicker, DatePickerInput, Form, Stack, TextArea } from '@carbon/react';
2
2
  import { zodResolver } from '@hookform/resolvers/zod';
3
3
  import { useConfig, useSession } from '@openmrs/esm-framework';
4
- import React from 'react';
4
+ import React, { useMemo } from 'react';
5
5
  import { Controller, FormProvider, SubmitHandler, useForm } from 'react-hook-form';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { z } from 'zod';
@@ -36,8 +36,11 @@ export const OtherRelationshipsForm: React.FC<OtherRelationshipsFormProps> = ({
36
36
  const { t } = useTranslation();
37
37
  const { data: mappedRelationshipTypes } = useMappedRelationshipTypes();
38
38
  const config = useConfig<ConfigObject>();
39
- const { familyRelationshipsTypeList } = config;
40
- const familyRelationshipTypesUUIDs = new Set(familyRelationshipsTypeList.map((r) => r.uuid));
39
+ const familyRelationships = useMemo(
40
+ () => config.relationshipTypesList.filter((rl) => rl.category.some((c) => c === 'family')),
41
+ [config],
42
+ );
43
+ const familyRelationshipTypesUUIDs = new Set(familyRelationships.map((r) => r.uuid));
41
44
  const otherRelationshipTypes = mappedRelationshipTypes.filter((type) => !familyRelationshipTypesUUIDs.has(type.uuid));
42
45
  const session = useSession();
43
46
  const relationshipTypes = otherRelationshipTypes.map((relationship) => ({
@@ -34,7 +34,7 @@ const PeerCalendarActions: React.FC<PeerCalendarActionsProps> = ({ peer: { patie
34
34
  const to = dayjs(firstDay).add(1, 'month').format('YYYY-MM-DD');
35
35
 
36
36
  const handleLauchPeerOutreachForm = (encounterUuid?: string) => {
37
- launchWorkspace('peer-calendar-form', {
37
+ launchWorkspace('kenyaemr-cusom-form-entry-workspace', {
38
38
  formUuid,
39
39
  patientUuid,
40
40
  encounterUuid: encounterUuid ?? '',
package/src/routes.json CHANGED
@@ -347,7 +347,7 @@
347
347
  "type": "form"
348
348
  },
349
349
  {
350
- "name": "peer-calendar-form",
350
+ "name": "kenyaemr-cusom-form-entry-workspace",
351
351
  "component": "peerCalendarFormEntry",
352
352
  "title": "KVP Peer Educator Outreach Calendar",
353
353
  "type": "form",
@@ -43,6 +43,7 @@
43
43
  "contactCreated": "Contact created",
44
44
  "contacted": "Contacted",
45
45
  "contactList": "Contact list",
46
+ "contactType": "Contact Type",
46
47
  "customViews": "In this section, you'll find custom clinical views tailored to patients' conditions and enrolled care programs.",
47
48
  "date": "Date",
48
49
  "dateDate": "Date & time",
@@ -65,6 +66,7 @@
65
66
  "editEncounter": "Edit",
66
67
  "editForm": "Edit Form",
67
68
  "editThisEncounter": "Edit this encounter",
69
+ "editTracing": "Edit tracing",
68
70
  "encounterDate": "Date",
69
71
  "encounterDeleted": "Encounter deleted",
70
72
  "encounterDetails": "Encounter details",
@@ -78,6 +80,7 @@
78
80
  "error": "Error",
79
81
  "errorFetchingbedInformation": "Error fetching bed information",
80
82
  "facility": "Facility",
83
+ "facilityLinkedTo": "Facility Linked To",
81
84
  "failedDeleting": "couldn't be deleted",
82
85
  "familyContacts": "Family contacts",
83
86
  "feedingOrders": "Feeding Orders",
@@ -148,6 +151,7 @@
148
151
  "primaryDiagnosis": "Primary Diagnosis",
149
152
  "priorityOfAdmission": "Priority Of Admission",
150
153
  "provider": "Provider",
154
+ "reasonNotContacted": "Reason Not Contacted",
151
155
  "recommendedProcedure": "Recommended Procedure",
152
156
  "recordLabourDetails": "Record labour details",
153
157
  "referrals": "Referrals",
@@ -155,6 +159,7 @@
155
159
  "relationshipConfirmationText": "This will end the relationship. Are you sure you want to proceed?",
156
160
  "relationshipError": "Relationship Error",
157
161
  "relationshipErrorMessage": "Request Failed",
162
+ "remarks": "Remarks",
158
163
  "reportingMonth": "Month",
159
164
  "reportingYear": "Year",
160
165
  "save": "Save",
@@ -163,6 +168,7 @@
163
168
  "smoking": "Smoking",
164
169
  "smokingDuration": "Smoking Duration",
165
170
  "socialHistory": "Social History",
171
+ "status": "Status",
166
172
  "statusAtDischarge": "Status at Discharge",
167
173
  "successfullyDeleted": "successfully deleted",
168
174
  "surgicalHistory": "Surgical History",
@@ -179,6 +185,8 @@
179
185
  "timeRecorded": "Time Recorded",
180
186
  "total": "Total",
181
187
  "totalPeers": "Total Peers",
188
+ "traceContact": "Trace Contact",
189
+ "traceHistory": "Trace History",
182
190
  "tracingNumber": "Tracing No.",
183
191
  "tracingType": "Tracing Type",
184
192
  "typeOfSurgery": "Type of Surgery",