Skip to content

Commit 0b72ea7

Browse files
munaniadonaldkibet
authored andcommittedJan 5, 2025
Patient identifier mapping to fields now working (openmrs#29)
* patient identifier mapping to fields working * patient identifier mapping to fields working better * (fix) patient identifier mapping
1 parent 2a3414c commit 0b72ea7

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed
 

‎packages/esm-patient-registration-app/src/patient-verification/patient-verification-utils.ts

+33-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ import { type ClientRegistryPatient, type RegistryPatient } from './verification
44
import counties from './assets/counties.json';
55
import { type FormValues } from '../patient-registration/patient-registration.types';
66
import { capitalize } from 'lodash-es';
7+
import { IdentifierInput } from '../patient-registration/input/custom-input/identifier/identifier-input.component';
78

89
export function handleClientRegistryResponse(
910
clientResponse: ClientRegistryPatient,
1011
props: FormikProps<FormValues>,
1112
searchTerm: string,
13+
identifierType: string,
1214
) {
1315
if (clientResponse?.clientExists === false) {
14-
const nupiIdentifiers = {
15-
['nationalId']: {
16-
initialValue: searchTerm,
16+
const allNupiIdentifiers = {
17+
['national-id']: {
18+
initialValue: '',
1719
identifierUuid: undefined,
1820
selectedSource: { uuid: '', name: '' },
1921
preferred: false,
@@ -22,7 +24,35 @@ export function handleClientRegistryResponse(
2224
identifierName: 'National ID',
2325
identifierValue: searchTerm,
2426
},
27+
28+
['birth-certificate']: {
29+
initialValue: '',
30+
identifierUuid: undefined,
31+
selectedSource: { uuid: '', name: '' },
32+
preferred: false,
33+
required: false,
34+
identifierTypeUuid: '68449e5a-8829-44dd-bfef-c9c8cf2cb9b2',
35+
identifierName: 'Birth Certificate Number',
36+
identifierValue: searchTerm,
37+
},
38+
39+
['passport']: {
40+
initialValue: '',
41+
identifierUuid: undefined,
42+
selectedSource: { uuid: '', name: '' },
43+
preferred: false,
44+
required: false,
45+
identifierTypeUuid: 'be9beef6-aacc-4e1f-ac4e-5babeaa1e303',
46+
identifierName: 'Passport Number',
47+
identifierValue: searchTerm,
48+
},
2549
};
50+
51+
// Select only the relevant identifier
52+
const nupiIdentifiers = {
53+
[identifierType]: allNupiIdentifiers[identifierType],
54+
};
55+
2656
const dispose = showModal('empty-client-registry-modal', {
2757
onConfirm: () => {
2858
props.setValues({ ...props.values, identifiers: { ...props.values.identifiers, ...nupiIdentifiers } });

‎packages/esm-patient-registration-app/src/patient-verification/patient-verification.component.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ const PatientVerification: React.FC<PatientVerificationProps> = ({ props }) => {
3535
);
3636
setIsLoadingSearch(false);
3737

38-
handleClientRegistryResponse(clientRegistryResponse, props, verificationCriteria.searchTerm);
38+
handleClientRegistryResponse(
39+
clientRegistryResponse,
40+
props,
41+
verificationCriteria.searchTerm,
42+
verificationCriteria.identifierType,
43+
);
3944
} catch (error) {
4045
showSnackbar({
4146
title: 'Client registry error',

0 commit comments

Comments
 (0)
Failed to load comments.