@kenyaemr/esm-patient-registration-app 8.0.3-pre.143 → 8.0.3-pre.146
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/.turbo/turbo-build.log +6 -6
- package/dist/574.js +1 -1
- package/dist/610.js +1 -1
- package/dist/610.js.map +1 -1
- package/dist/kenyaemr-esm-patient-registration-app.js.buildmanifest.json +9 -9
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/client-registry/hie-client-registry/hie-client-registry.component.tsx +35 -7
- package/src/client-registry/hie-client-registry/hie-resource.ts +3 -3
- package/src/client-registry/hie-client-registry/hie-types.ts +2 -0
- package/src/client-registry/hie-client-registry/modal/hie-patient-detail-preview.component.tsx +1 -1
- package/translations/en.json +3 -0
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true}],"modals":[{"name":"cancel-patient-edit-modal","component":"cancelPatientEditModal"},{"name":"delete-identifier-confirmation-modal","component":"deleteIdentifierConfirmationModal"},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal"},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal"},{"component":"hieConfirmationModal","name":"hie-confirmation-modal"}],"version":"8.0.3-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":"^2.24.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true}],"modals":[{"name":"cancel-patient-edit-modal","component":"cancelPatientEditModal"},{"name":"delete-identifier-confirmation-modal","component":"deleteIdentifierConfirmationModal"},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal"},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal"},{"component":"hieConfirmationModal","name":"hie-confirmation-modal"}],"version":"8.0.3-pre.146"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kenyaemr/esm-patient-registration-app",
|
|
3
|
-
"version": "8.0.3-pre.
|
|
3
|
+
"version": "8.0.3-pre.146",
|
|
4
4
|
"description": "Patient registration microfrontend for the OpenMRS SPA",
|
|
5
5
|
"browser": "dist/kenyaemr-esm-patient-registration-app.js",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -11,7 +11,7 @@ import { type RegistrationConfig } from '../../config-schema';
|
|
|
11
11
|
import { useForm, Controller, type SubmitHandler } from 'react-hook-form';
|
|
12
12
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
13
13
|
import { fetchPatientFromHIE, mapHIEPatientToFormValues } from './hie-resource';
|
|
14
|
-
import { type HIEPatientResponse, type HIEPatient } from './hie-types';
|
|
14
|
+
import { type HIEPatientResponse, type HIEPatient, type ErrorResponse } from './hie-types';
|
|
15
15
|
|
|
16
16
|
type HIEClientRegistryProps = {
|
|
17
17
|
props: FormikProps<FormValues>;
|
|
@@ -39,11 +39,34 @@ const HIEClientRegistry: React.FC<HIEClientRegistryProps> = ({ setInitialFormVal
|
|
|
39
39
|
hieClientRegistry: { identifierTypes },
|
|
40
40
|
} = useConfig<RegistrationConfig>();
|
|
41
41
|
|
|
42
|
+
const isHIEPatientResponse = (
|
|
43
|
+
response: HIEPatientResponse | ErrorResponse | undefined,
|
|
44
|
+
): response is HIEPatientResponse => {
|
|
45
|
+
return response?.resourceType === 'Bundle' && 'total' in response;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const isOperationOutcome = (response: HIEPatientResponse | ErrorResponse | undefined): response is ErrorResponse => {
|
|
49
|
+
return response?.resourceType === 'OperationOutcome' && 'issue' in response;
|
|
50
|
+
};
|
|
51
|
+
|
|
42
52
|
const onSubmit: SubmitHandler<HIEFormValues> = async (data: HIEFormValues, event: React.BaseSyntheticEvent) => {
|
|
43
53
|
try {
|
|
44
54
|
const hieClientRegistry = await fetchPatientFromHIE(data.identifierType, data.identifierValue);
|
|
45
55
|
|
|
46
|
-
if (hieClientRegistry
|
|
56
|
+
if (isHIEPatientResponse(hieClientRegistry)) {
|
|
57
|
+
if (hieClientRegistry.total === 0) {
|
|
58
|
+
const dispose = showModal('empty-client-registry-modal', {
|
|
59
|
+
onConfirm: () => dispose(),
|
|
60
|
+
close: () => dispose(),
|
|
61
|
+
title: t('clientRegistryEmpty', 'Create & Post Patient'),
|
|
62
|
+
message: t(
|
|
63
|
+
'patientNotFound',
|
|
64
|
+
`No patient found with the provided ${data?.identifierType}. Proceed to register.`,
|
|
65
|
+
),
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
47
70
|
const dispose = showModal('hie-confirmation-modal', {
|
|
48
71
|
patient: hieClientRegistry,
|
|
49
72
|
closeModal: () => dispose(),
|
|
@@ -52,15 +75,20 @@ const HIEClientRegistry: React.FC<HIEClientRegistryProps> = ({ setInitialFormVal
|
|
|
52
75
|
mapHIEPatientToFormValues(hieClientRegistry as unknown as HIEPatientResponse, props.values),
|
|
53
76
|
),
|
|
54
77
|
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (hieClientRegistry && hieClientRegistry?.resourceType === 'OperationOutcome') {
|
|
58
|
-
const issueMessage = hieClientRegistry?.['issue']?.map((issue) => issue.diagnostics).join(', ');
|
|
78
|
+
} else if (isOperationOutcome(hieClientRegistry)) {
|
|
79
|
+
const issueMessage = hieClientRegistry?.issue?.map((issue) => issue.diagnostics).join(', ');
|
|
59
80
|
const dispose = showModal('empty-client-registry-modal', {
|
|
60
81
|
onConfirm: () => dispose(),
|
|
61
82
|
close: () => dispose(),
|
|
62
83
|
title: t('clientRegistryEmpty', 'Create & Post Patient'),
|
|
63
|
-
message: issueMessage,
|
|
84
|
+
message: issueMessage || t('errorOccurred', ' There was an error processing the request. Try again later'),
|
|
85
|
+
});
|
|
86
|
+
} else {
|
|
87
|
+
showSnackbar({
|
|
88
|
+
title: t('unexpectedResponse', 'Unexpected Response'),
|
|
89
|
+
subtitle: t('contactAdmin', 'Please contact the administrator.'),
|
|
90
|
+
kind: 'error',
|
|
91
|
+
isLowContrast: true,
|
|
64
92
|
});
|
|
65
93
|
}
|
|
66
94
|
} catch (error) {
|
|
@@ -147,15 +147,15 @@ const mapperConfig: MapperConfig = {
|
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
// Create instances
|
|
150
|
-
const hieApiClient = new HealthInformationExchangeClient<
|
|
150
|
+
const hieApiClient = new HealthInformationExchangeClient<HIEPatientResponse | ErrorResponse>();
|
|
151
151
|
const patientMapper = new PatientMapper(mapperConfig);
|
|
152
152
|
|
|
153
153
|
// Exported functions
|
|
154
154
|
export const fetchPatientFromHIE = async (
|
|
155
155
|
identifierType: string,
|
|
156
156
|
identifierValue: string,
|
|
157
|
-
): Promise<
|
|
158
|
-
return hieApiClient.fetchResource('
|
|
157
|
+
): Promise<HIEPatientResponse | ErrorResponse> => {
|
|
158
|
+
return hieApiClient.fetchResource('Bundle', { [identifierType]: identifierValue });
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
export const mapHIEPatientToFormValues = (
|
package/src/client-registry/hie-client-registry/modal/hie-patient-detail-preview.component.tsx
CHANGED
|
@@ -30,7 +30,7 @@ const HIEPatientDetailPreview: React.FC<HIEPatientDetailPreviewProps> = ({ patie
|
|
|
30
30
|
state={{ patientName: `${maskData(givenName)} . ${maskData(middleName)} . ${maskData(familyName)}` }}
|
|
31
31
|
/>
|
|
32
32
|
<div className={styles.patientInfoContainer}>
|
|
33
|
-
<PatientInfo label={t('healthID', 'HealthID')} value={getidentifier('
|
|
33
|
+
<PatientInfo label={t('healthID', 'HealthID')} value={getidentifier('sha-number')?.value} />
|
|
34
34
|
<PatientInfo
|
|
35
35
|
label={t('patientName', 'Patient name')}
|
|
36
36
|
customValue={
|
package/translations/en.json
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"confirmDiscardChangesBody": "Your unsaved changes will be lost if you proceed to discard the form",
|
|
25
25
|
"confirmDiscardChangesTitle": "Are you sure you want to discard these changes?",
|
|
26
26
|
"confirmIdentifierDeletionText": "Are you sure you want to remove this identifier?",
|
|
27
|
+
"contactAdmin": "Please contact the administrator.",
|
|
27
28
|
"contactSection": "Contact Details",
|
|
28
29
|
"continue": "Continue",
|
|
29
30
|
"createNewPatient": "Create new patient",
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
"errorFetchingCodedCausesOfDeath": "Error fetching coded causes of death",
|
|
60
61
|
"errorFetchingOrderedFields": "Error occured fetching ordered fields for address hierarchy",
|
|
61
62
|
"errorFetchingPatient": "Error fetching patient",
|
|
63
|
+
"errorOccurred": " There was an error processing the request. Try again later",
|
|
62
64
|
"estimatedAgeInMonthsLabelText": "Estimated age in months",
|
|
63
65
|
"estimatedAgeInYearsLabelText": "Estimated age in years",
|
|
64
66
|
"familyNameLabelText": "Family Name",
|
|
@@ -145,6 +147,7 @@
|
|
|
145
147
|
"timeFormat": "Time Format",
|
|
146
148
|
"timeOfDeathInputLabel": "Time of death (hh:mm)",
|
|
147
149
|
"unableToFetch": "Unable to fetch person attribute type - {{personattributetype}}",
|
|
150
|
+
"unexpectedResponse": "Unexpected Response",
|
|
148
151
|
"unknown": "Unknown",
|
|
149
152
|
"unknownPatientAttributeType": "Patient attribute type has unknown format {{personAttributeTypeFormat}}",
|
|
150
153
|
"unknownRelationship": "Unknown",
|