@ampath/esm-patient-registration-app 9.2.0-next.18 → 9.2.0-next.19

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 (36) hide show
  1. package/dist/2523.js +1 -0
  2. package/dist/2523.js.map +1 -0
  3. package/dist/6583.js +1 -0
  4. package/dist/6583.js.map +1 -0
  5. package/dist/7821.js +1 -1
  6. package/dist/8414.js +1 -1
  7. package/dist/8414.js.map +1 -1
  8. package/dist/9853.js +1 -0
  9. package/dist/9853.js.map +1 -0
  10. package/dist/main.js +1 -1
  11. package/dist/openmrs-esm-patient-registration-app.js.buildmanifest.json +76 -76
  12. package/dist/routes.json +1 -1
  13. package/package.json +1 -1
  14. package/src/index.ts +1 -1
  15. package/src/patient-registration/client-registry/client-registry-search.component.tsx +13 -4
  16. package/src/patient-registration/client-registry/existing-client/client-dependants-comparison/client-dependants-comparison.component.tsx +26 -0
  17. package/src/patient-registration/client-registry/existing-client/client-dependants-comparison/dependant-comparison-rows.component.tsx +153 -0
  18. package/src/patient-registration/client-registry/existing-client/client-details-comparison/client-details-comparison.component.tsx +181 -0
  19. package/src/patient-registration/client-registry/existing-client/client-details-comparison/comparison-table-row.component.tsx +42 -0
  20. package/src/patient-registration/client-registry/existing-client/client-registry-verification-tag.component.tsx +54 -0
  21. package/src/patient-registration/client-registry/existing-client/existing-client-tab.component.tsx +85 -0
  22. package/src/patient-registration/client-registry/existing-client/existing-client.resource.ts +78 -0
  23. package/src/patient-registration/client-registry/existing-client/mapper-utils.ts +419 -0
  24. package/src/patient-registration/client-registry/existing-client/types/index.ts +185 -0
  25. package/src/patient-registration/client-registry/{client-dependants → new-client/client-dependants}/list/client-depandants.component.tsx +1 -1
  26. package/src/patient-registration/client-registry/{client-details → new-client/client-details}/client-details.tsx +2 -2
  27. package/src/patient-registration/client-registry/new-client/new-client-tab.component.tsx +30 -0
  28. package/src/patient-registration/client-registry/types/index.ts +10 -0
  29. package/src/patient-registration/patient-registration.component.tsx +1 -0
  30. package/src/widgets/client-registry-verification.modal.tsx +13 -0
  31. package/dist/4395.js +0 -1
  32. package/dist/4395.js.map +0 -1
  33. package/dist/6741.js +0 -1
  34. package/dist/6741.js.map +0 -1
  35. package/dist/8882.js +0 -1
  36. package/dist/8882.js.map +0 -1
@@ -0,0 +1,419 @@
1
+ import dayjs from 'dayjs';
2
+ import { HieAttributeType, type HieClient, HieIdentificationType } from '../types';
3
+ import {
4
+ type AmrsClient,
5
+ type CustomRelationship,
6
+ IdentifierTypesUuids,
7
+ PersonAttributeTypeUuids,
8
+ RelationshipTypeUuids,
9
+ } from './types';
10
+
11
+ export const nameFields = ['givenName', 'middleName', 'familyName'];
12
+
13
+ export const addressFields = [
14
+ 'country',
15
+ 'countyDistrict',
16
+ 'address2',
17
+ 'address7',
18
+ 'cityVillage',
19
+ 'longitude',
20
+ 'latitude',
21
+ ];
22
+
23
+ export const personSyncFields = [...nameFields, 'gender', 'birthdate', ...addressFields];
24
+
25
+ export const identifiersSyncFields = () => Object.keys(HieIdentificationType);
26
+
27
+ export const attributesSyncFields = () => Object.keys(HieAttributeType);
28
+
29
+ export const getIdentifierUuid = (identifier: string) => {
30
+ let val = '';
31
+ switch (identifier) {
32
+ case HieIdentificationType.AlienID:
33
+ val = IdentifierTypesUuids.ALIEN_ID_UUID;
34
+ break;
35
+ case HieIdentificationType.HouseholdNumber:
36
+ val = IdentifierTypesUuids.HOUSE_HOLD_NUMBER_UUID;
37
+ break;
38
+ case HieIdentificationType.MandateNumber:
39
+ val = IdentifierTypesUuids.MANDATE_NUMBER_UUID;
40
+ break;
41
+ case HieIdentificationType.Cr:
42
+ val = IdentifierTypesUuids.CLIENT_REGISTRY_NO_UUID;
43
+ break;
44
+ case HieIdentificationType.NationalID:
45
+ val = IdentifierTypesUuids.NATIONAL_ID_UUID;
46
+ break;
47
+ case HieIdentificationType.RefugeeID:
48
+ val = IdentifierTypesUuids.REFUGEE_ID_UUID;
49
+ break;
50
+ case HieIdentificationType.SHANumber:
51
+ val = IdentifierTypesUuids.SHA_UUID;
52
+ break;
53
+ case HieIdentificationType.TemporaryDependantID:
54
+ val = IdentifierTypesUuids.TEMPORARY_DEPENDANT_ID_UUID;
55
+ break;
56
+ default:
57
+ val = '';
58
+ }
59
+ return val;
60
+ };
61
+
62
+ export const getAttributeUuid = (attribute: string) => {
63
+ let val = '';
64
+ switch (attribute) {
65
+ case HieAttributeType.Citizenship:
66
+ val = PersonAttributeTypeUuids.CITIZENSHIP_UUID;
67
+ break;
68
+ case HieAttributeType.CivilStatus:
69
+ val = PersonAttributeTypeUuids.CIVIL_STATUS_UUID;
70
+ break;
71
+ case HieAttributeType.Email:
72
+ val = PersonAttributeTypeUuids.CONTACT_EMAIL_ADDRESS_UUID;
73
+ break;
74
+ case HieAttributeType.KRAPin:
75
+ val = PersonAttributeTypeUuids.KRA_PIN_UUID;
76
+ break;
77
+ case HieAttributeType.Phone:
78
+ val = PersonAttributeTypeUuids.CONTACT_PHONE_NUMBER_UUID;
79
+ break;
80
+ case HieAttributeType.PlaceOfBirth:
81
+ val = PersonAttributeTypeUuids.PLACE_OF_BIRTH_UUID;
82
+ break;
83
+ case HieAttributeType.Cr:
84
+ val = PersonAttributeTypeUuids.CLIENT_REGISTRY_ID_UUID;
85
+ break;
86
+ default:
87
+ val = '';
88
+ }
89
+ return val;
90
+ };
91
+
92
+ export const getAmrsRelationshipTypeUuid = (relationshipType: string) => {
93
+ let relationShipTypeUuid = '';
94
+ switch (relationshipType) {
95
+ case 'Spouse':
96
+ relationShipTypeUuid = RelationshipTypeUuids.SPOUSE_UUID;
97
+ break;
98
+ case 'Child':
99
+ relationShipTypeUuid = RelationshipTypeUuids.PARENT_CHILD_UUID;
100
+ break;
101
+ default:
102
+ relationShipTypeUuid = RelationshipTypeUuids.OTHER_NON_CODED_UUID;
103
+ }
104
+
105
+ return relationShipTypeUuid;
106
+ };
107
+
108
+ export const patientObjFields = [...personSyncFields, ...identifiersSyncFields()];
109
+
110
+ const sanitizeValue = (value: unknown) => {
111
+ if (value === null || value === undefined) {
112
+ return '';
113
+ }
114
+ return value;
115
+ };
116
+
117
+ export const mapFieldValue = (field: string, hieData: HieClient, amrsPerson: AmrsClient): Array<string> => {
118
+ let arr = [];
119
+ switch (field) {
120
+ case 'givenName':
121
+ arr = [sanitizeValue(amrsPerson?.person?.preferredName?.givenName), sanitizeValue(hieData?.first_name)];
122
+ break;
123
+ case 'middleName':
124
+ arr = [sanitizeValue(amrsPerson?.person?.preferredName?.middleName), sanitizeValue(hieData?.middle_name)];
125
+ break;
126
+ case 'familyName':
127
+ arr = [sanitizeValue(amrsPerson?.person?.preferredName?.familyName), sanitizeValue(hieData?.last_name)];
128
+ break;
129
+ case 'gender':
130
+ arr = [sanitizeValue(amrsPerson?.person?.gender), sanitizeValue(hieData?.gender)];
131
+ break;
132
+ case 'birthdate':
133
+ arr = [
134
+ dayjs(sanitizeValue(amrsPerson?.person?.birthdate) + '', 'YYYY-MM-DD', true).isValid()
135
+ ? dayjs(sanitizeValue(amrsPerson?.person?.birthdate) + '').format('YYYY-MM-DD')
136
+ : sanitizeValue(amrsPerson?.person?.birthdate),
137
+ sanitizeValue(hieData?.date_of_birth),
138
+ ];
139
+ break;
140
+ case 'country':
141
+ arr = [sanitizeValue(amrsPerson?.person?.preferredAddress?.country), sanitizeValue(hieData?.country)];
142
+ break;
143
+ case 'countyDistrict':
144
+ arr = [sanitizeValue(amrsPerson?.person?.preferredAddress?.countyDistrict), sanitizeValue(hieData?.county)];
145
+ break;
146
+ case 'address2':
147
+ arr = [sanitizeValue(amrsPerson?.person?.preferredAddress?.address2), sanitizeValue(hieData?.sub_county)];
148
+ break;
149
+ case 'address7':
150
+ arr = [sanitizeValue(amrsPerson?.person?.preferredAddress?.address7), sanitizeValue(hieData?.ward)];
151
+ break;
152
+ case 'cityVillage':
153
+ arr = [sanitizeValue(amrsPerson?.person?.preferredAddress?.cityVillage), sanitizeValue(hieData?.village_estate)];
154
+ break;
155
+ case 'longitude':
156
+ arr = [sanitizeValue(amrsPerson?.person?.preferredAddress?.longitude), sanitizeValue(hieData?.longitude)];
157
+ break;
158
+ case 'latitude':
159
+ arr = [sanitizeValue(amrsPerson?.person?.preferredAddress?.latitude), sanitizeValue(hieData?.latitude)];
160
+ break;
161
+ case 'NationalID':
162
+ arr = [
163
+ sanitizeValue(
164
+ amrsPerson?.person?.identifiers?.find(
165
+ (v) => v.identifierType.uuid === getIdentifierUuid(HieIdentificationType.NationalID),
166
+ )?.identifier,
167
+ ),
168
+ sanitizeValue(
169
+ hieData?.other_identifications.find((v) => v.identification_type === HieIdentificationType.NationalID)
170
+ ?.identification_number,
171
+ ),
172
+ ];
173
+ break;
174
+ case 'SHANumber':
175
+ arr = [
176
+ sanitizeValue(
177
+ amrsPerson?.person?.identifiers?.find(
178
+ (v) => v.identifierType.uuid === getIdentifierUuid(HieIdentificationType.SHANumber),
179
+ )?.identifier,
180
+ ),
181
+ sanitizeValue(
182
+ hieData?.other_identifications.find((v) => v.identification_type === HieIdentificationType.SHANumber)
183
+ ?.identification_number,
184
+ ),
185
+ ];
186
+ break;
187
+ case 'HouseholdNumber':
188
+ arr = [
189
+ sanitizeValue(
190
+ amrsPerson?.person?.identifiers?.find(
191
+ (v) => v.identifierType.uuid === getIdentifierUuid(HieIdentificationType.HouseholdNumber),
192
+ )?.identifier,
193
+ ),
194
+ sanitizeValue(
195
+ hieData?.other_identifications?.find((v) => v.identification_type === HieIdentificationType.HouseholdNumber)
196
+ ?.identification_number,
197
+ ),
198
+ ];
199
+ break;
200
+ case 'RefugeeID':
201
+ arr = [
202
+ sanitizeValue(
203
+ amrsPerson?.person?.identifiers?.find(
204
+ (v) => v.identifierType.uuid === getIdentifierUuid(HieIdentificationType.RefugeeID),
205
+ )?.identifier,
206
+ ),
207
+ sanitizeValue(
208
+ hieData?.other_identifications.find((v) => v.identification_type === HieIdentificationType.RefugeeID)
209
+ ?.identification_number,
210
+ ),
211
+ ];
212
+ break;
213
+ case 'AlienID':
214
+ arr = [
215
+ sanitizeValue(
216
+ amrsPerson?.person?.identifiers?.find(
217
+ (v) => v.identifierType.uuid === getIdentifierUuid(HieIdentificationType.AlienID),
218
+ )?.identifier,
219
+ ),
220
+ sanitizeValue(
221
+ hieData?.other_identifications.find((v) => v.identification_type === HieIdentificationType.AlienID)
222
+ ?.identification_number,
223
+ ),
224
+ ];
225
+ break;
226
+ case 'MandateNumber':
227
+ arr = [
228
+ sanitizeValue(
229
+ amrsPerson?.person?.identifiers?.find(
230
+ (v) => v.identifierType.uuid === getIdentifierUuid(HieIdentificationType.MandateNumber),
231
+ )?.identifier,
232
+ ),
233
+ sanitizeValue(
234
+ hieData?.other_identifications.find((v) => v.identification_type === HieIdentificationType.MandateNumber)
235
+ ?.identification_number,
236
+ ),
237
+ ];
238
+ break;
239
+ case 'Cr':
240
+ arr = [
241
+ sanitizeValue(
242
+ amrsPerson?.person?.identifiers?.find(
243
+ (v) => v.identifierType.uuid === getIdentifierUuid(HieIdentificationType.Cr),
244
+ )?.identifier,
245
+ ),
246
+ sanitizeValue(
247
+ hieData?.other_identifications.find((v) => v.identification_type === HieIdentificationType.Cr)
248
+ ?.identification_number,
249
+ ),
250
+ ];
251
+ break;
252
+ case 'TemporaryDependantID':
253
+ arr = [
254
+ sanitizeValue(
255
+ amrsPerson?.person?.identifiers?.find(
256
+ (v) => v.identifierType.uuid === getIdentifierUuid(HieIdentificationType.TemporaryDependantID),
257
+ )?.identifier,
258
+ ),
259
+ sanitizeValue(
260
+ hieData?.other_identifications.find(
261
+ (v) => v.identification_type === HieIdentificationType.TemporaryDependantID,
262
+ )?.identification_number,
263
+ ),
264
+ ];
265
+ break;
266
+ case 'PlaceOfBirth':
267
+ arr = [
268
+ sanitizeValue(
269
+ amrsPerson?.person?.attributes.find(
270
+ (v) => v.attributeType.uuid === getAttributeUuid(HieAttributeType.PlaceOfBirth),
271
+ )?.value,
272
+ ),
273
+ sanitizeValue(hieData?.place_of_birth),
274
+ ];
275
+ break;
276
+ case 'CivilStatus':
277
+ arr = [
278
+ sanitizeValue(
279
+ amrsPerson?.person?.attributes.find(
280
+ (v) => v.attributeType.uuid === getAttributeUuid(HieAttributeType.CivilStatus),
281
+ )?.value,
282
+ ),
283
+ sanitizeValue(hieData?.civil_status),
284
+ ];
285
+ break;
286
+ case 'Email':
287
+ arr = [
288
+ sanitizeValue(
289
+ amrsPerson?.person?.attributes.find((v) => v.attributeType.uuid === getAttributeUuid(HieAttributeType.Email))
290
+ ?.value,
291
+ ),
292
+ sanitizeValue(hieData?.email),
293
+ ];
294
+ break;
295
+ case 'Phone':
296
+ arr = [
297
+ sanitizeValue(
298
+ amrsPerson?.person?.attributes.find((v) => v.attributeType.uuid === getAttributeUuid(HieAttributeType.Phone))
299
+ ?.value,
300
+ ),
301
+ sanitizeValue(hieData?.phone),
302
+ ];
303
+ break;
304
+ case 'KRAPin':
305
+ arr = [
306
+ sanitizeValue(
307
+ amrsPerson?.person?.attributes.find((v) => v.attributeType.uuid === getAttributeUuid(HieAttributeType.KRAPin))
308
+ ?.value,
309
+ ),
310
+ sanitizeValue(hieData?.kra_pin),
311
+ ];
312
+ break;
313
+ case 'Citizenship':
314
+ arr = [
315
+ sanitizeValue(
316
+ amrsPerson?.person?.attributes.find(
317
+ (v) => v.attributeType.uuid === getAttributeUuid(HieAttributeType.Citizenship),
318
+ )?.value,
319
+ ),
320
+ sanitizeValue(hieData?.citizenship),
321
+ ];
322
+ break;
323
+ default:
324
+ arr = ['', ''];
325
+ }
326
+ return arr;
327
+ };
328
+
329
+ export function getPatientRelationshipPayload(amrsPerson: AmrsClient, relationshipType: string, dependantUuid: string) {
330
+ const startDate = dayjs().format('YYYY-MM-DDTHH:mm:ss.SSSZZ');
331
+ const patientRelationshipPayload = {
332
+ personA: amrsPerson.person.uuid,
333
+ relationshipType: getAmrsRelationshipTypeUuid(relationshipType),
334
+ personB: dependantUuid,
335
+ startDate: startDate,
336
+ };
337
+ return patientRelationshipPayload;
338
+ }
339
+
340
+ export function mapAmrsPatientRelationship(uuid: string, relationships: Array<any>) {
341
+ const relationshipsArr: Array<CustomRelationship> = [];
342
+ if (relationships) {
343
+ for (const relationship of relationships) {
344
+ if (uuid === relationship?.personA?.uuid) {
345
+ const relation = {
346
+ uuid: relationship?.uuid,
347
+ display: relationship?.personB?.display,
348
+ relative: relationship?.personB?.display,
349
+ relatedPersonUuid: relationship?.personB?.uuid,
350
+ relationshipType: relationship?.relationshipType?.bIsToA,
351
+ relationshipTypeUuId: relationship?.relationshipType?.uuid,
352
+ relationshipTypeName: relationship?.relationshipType?.display,
353
+ relatedPerson: relationship?.personB,
354
+ };
355
+ relationshipsArr.push(relation);
356
+ } else {
357
+ const relation = {
358
+ uuid: relationship?.uuid,
359
+ display: relationship?.personA?.display,
360
+ relative: relationship?.personA?.display,
361
+ relatedPersonUuid: relationship?.personA?.uuid,
362
+ relationshipType: relationship?.relationshipType?.aIsToB,
363
+ relatedPerson: relationship?.personA,
364
+ relationshipTypeUuId: relationship?.relationshipType?.uuid,
365
+ relationshipTypeName: relationship?.relationshipType?.display,
366
+ };
367
+ relationshipsArr.push(relation);
368
+ }
369
+ }
370
+ }
371
+ return relationshipsArr;
372
+ }
373
+
374
+ export function getPatientAttributes(hieClient: HieClient) {
375
+ const attributes = [];
376
+ if (hieClient.place_of_birth.length > 0) {
377
+ attributes.push({
378
+ value: hieClient.place_of_birth,
379
+ attributeType: getAttributeUuid(HieAttributeType.PlaceOfBirth),
380
+ });
381
+ }
382
+ if (hieClient.phone.length > 0) {
383
+ attributes.push({
384
+ value: hieClient.phone,
385
+ attributeType: getAttributeUuid(HieAttributeType.Phone),
386
+ });
387
+ }
388
+ if (hieClient.email.length > 0) {
389
+ attributes.push({
390
+ value: hieClient.email,
391
+ attributeType: getAttributeUuid(HieAttributeType.Email),
392
+ });
393
+ }
394
+ if (hieClient.kra_pin.length > 0) {
395
+ attributes.push({
396
+ value: hieClient.kra_pin,
397
+ attributeType: getAttributeUuid(HieAttributeType.KRAPin),
398
+ });
399
+ }
400
+ if (hieClient.civil_status.length > 0) {
401
+ attributes.push({
402
+ value: this.getAmrsConceptUuidFromField(hieClient.civil_status),
403
+ attributeType: getAttributeUuid(HieAttributeType.CivilStatus),
404
+ });
405
+ }
406
+ if (hieClient.id) {
407
+ attributes.push({
408
+ value: hieClient.id,
409
+ attributeType: getAttributeUuid(HieAttributeType.Cr),
410
+ });
411
+ }
412
+ if (hieClient.citizenship) {
413
+ attributes.push({
414
+ value: hieClient.citizenship,
415
+ attributeType: getAttributeUuid(HieAttributeType.Citizenship),
416
+ });
417
+ }
418
+ return attributes;
419
+ }
@@ -0,0 +1,185 @@
1
+ import { type HieDependant, type HieClient } from '../../types';
2
+
3
+ const HOUSE_HOLD_NUMBER_UUID = 'bb74b20e-dcee-4f59-bdf1-2dffc3abf106';
4
+ const SHA_UUID = 'cf5362b2-8049-4442-b3c6-36f870e320cb';
5
+ const CLIENT_REGISTRY_NO_UUID = 'e88dc246-3614-4ee3-8141-1f2a83054e72';
6
+ const NATIONAL_ID_UUID = '58a47054-1359-11df-a1f1-0026b9348838';
7
+ const PROVIDER_NATIONAL_ID_UUID = '4550df92-c684-4597-8ab8-d6b10eabdcfb';
8
+ const REFUGEE_ID_UUID = '465e81af-8d69-47e9-9127-53a94adc75fb';
9
+ const MANDATE_NUMBER_UUID = 'aae2d097-20ba-43ca-9b71-fd8296068f39';
10
+ const ALIEN_ID_UUID = '12f5b147-3403-4a73-913d-7ded9ffec094';
11
+ const TEMPORARY_DEPENDANT_ID_UUID = 'a3d34214-93e8-4faf-bf4d-0272eee079eb';
12
+ const AMRS_UNIVERSAL_ID_UUID = '58a4732e-1359-11df-a1f1-0026b9348838';
13
+ const UPI_NUMBER_UUID = 'cba702b9-4664-4b43-83f1-9ab473cbd64d';
14
+
15
+ export const IdentifierTypesUuids = {
16
+ HOUSE_HOLD_NUMBER_UUID,
17
+ SHA_UUID,
18
+ CLIENT_REGISTRY_NO_UUID,
19
+ NATIONAL_ID_UUID,
20
+ PROVIDER_NATIONAL_ID_UUID,
21
+ REFUGEE_ID_UUID,
22
+ MANDATE_NUMBER_UUID,
23
+ ALIEN_ID_UUID,
24
+ TEMPORARY_DEPENDANT_ID_UUID,
25
+ AMRS_UNIVERSAL_ID_UUID,
26
+ UPI_NUMBER_UUID,
27
+ };
28
+
29
+ const CONTACT_PHONE_NUMBER_UUID = '72a759a8-1359-11df-a1f1-0026b9348838';
30
+ const CITIZENSHIP_UUID = '72a759a8-1359-11df-a1f1-0026b9348838';
31
+ const CONTACT_EMAIL_ADDRESS_UUID = '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa';
32
+ const ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID = 'c725f524-c14a-4468-ac19-4a0e6661c930';
33
+ const KRA_PIN_UUID = 'ae683747-b3fc-4e5c-bad3-c3be743b248f';
34
+ const CIVIL_STATUS_UUID = '8d871f2a-c2cc-11de-8d13-0010c6dffd0f';
35
+ const CLIENT_REGISTRY_ID_UUID = 'e068e02b-faac-4baf-bd58-fe6e0c29a81f';
36
+ const PLACE_OF_BIRTH_UUID = '8d8718c2-c2cc-11de-8d13-0010c6dffd0f';
37
+ const EMAIL_UUID = '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa';
38
+
39
+ export const PersonAttributeTypeUuids = {
40
+ CONTACT_PHONE_NUMBER_UUID,
41
+ CITIZENSHIP_UUID,
42
+ CONTACT_EMAIL_ADDRESS_UUID,
43
+ ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID,
44
+ KRA_PIN_UUID,
45
+ CIVIL_STATUS_UUID,
46
+ CLIENT_REGISTRY_ID_UUID,
47
+ PLACE_OF_BIRTH_UUID,
48
+ EMAIL_UUID,
49
+ };
50
+
51
+ const PARENT_CHILD_UUID = '7878d348-1359-11df-a1f1-0026b9348838';
52
+ const AUNT_UNCLE_NIECE_NEPHEW_UUID = '7878dd3e-1359-11df-a1f1-0026b9348838';
53
+ const SPOUSE_UUID = '7878df3c-1359-11df-a1f1-0026b9348838';
54
+ const GRANDCHILD_GRANDPARENT_UUID = '7878e144-1359-11df-a1f1-0026b9348838';
55
+ const GUARDIAN_CHILD_UUUD = '01bc0cf5-d428-427f-be13-305eb9cad7ba';
56
+ const FOSTER_CHILD_FOSTER_PARENT_UUID = '7878e52c-1359-11df-a1f1-0026b9348838';
57
+ const OTHER_NON_CODED_UUID = 'af78531e-98ab-41da-be3a-6a871ecbf8c0';
58
+
59
+ export const RelationshipTypeUuids = {
60
+ PARENT_CHILD_UUID,
61
+ AUNT_UNCLE_NIECE_NEPHEW_UUID,
62
+ SPOUSE_UUID,
63
+ GRANDCHILD_GRANDPARENT_UUID,
64
+ GUARDIAN_CHILD_UUUD,
65
+ FOSTER_CHILD_FOSTER_PARENT_UUID,
66
+ OTHER_NON_CODED_UUID,
67
+ };
68
+
69
+ export interface AmrsClient {
70
+ uuid: string;
71
+ identifiers: Identifier[];
72
+ display: string;
73
+ person: {
74
+ uuid: string;
75
+ display: string;
76
+ gender: string;
77
+ age: number;
78
+ birthdate: string;
79
+ birthdateEstimated: boolean;
80
+ dead: boolean;
81
+ deathDate?: any;
82
+ causeOfDeath?: any;
83
+ preferredAddress: {
84
+ address1: string;
85
+ address2: string;
86
+ address3: string;
87
+ address4: string;
88
+ address5: string;
89
+ address6: string;
90
+ address7: string;
91
+ cityVillage: string;
92
+ country: string;
93
+ postalCode: string;
94
+ stateProvince: string;
95
+ countyDistrict: string;
96
+ latitude: string;
97
+ longitude: string;
98
+ };
99
+ preferredName: {
100
+ display: string;
101
+ uuid: string;
102
+ givenName: string;
103
+ middleName: string;
104
+ familyName: string;
105
+ };
106
+ attributes: Array<Attributes>;
107
+ identifiers: Identifier[];
108
+ voided: boolean;
109
+ birthtime?: any;
110
+ deathdateEstimated: boolean;
111
+ resourceVersion: string;
112
+ };
113
+ attributes: { value: string; attributeType: { uuid: string; display: string } }[];
114
+ voided: boolean;
115
+ }
116
+
117
+ export interface Address {
118
+ preferred: boolean;
119
+ address1: string;
120
+ cityVillage: string;
121
+ country: string;
122
+ postalCode: string;
123
+ stateProvince: string;
124
+ }
125
+
126
+ export interface Identifier {
127
+ uuid: string;
128
+ display: string;
129
+ identifier: string;
130
+ identifierType: {
131
+ uuid: string;
132
+ display: string;
133
+ };
134
+ }
135
+
136
+ export interface Attributes {
137
+ uuid: string;
138
+ display: string;
139
+ value: {
140
+ uuid: string;
141
+ display: string;
142
+ };
143
+ attributeType: {
144
+ uuid: string;
145
+ display: string;
146
+ };
147
+ }
148
+
149
+ export interface CustomRelationship {
150
+ uuid: string;
151
+ display: string;
152
+ relative: string;
153
+ relatedPersonUuid: string;
154
+ relationshipType: string;
155
+ relationshipTypeUuId: string;
156
+ relationshipTypeName: string;
157
+ relatedPerson: any;
158
+ }
159
+
160
+ export interface ClientDetailsComparisonProps {
161
+ hieClient: HieClient;
162
+ amrsClient: AmrsClient;
163
+ fromDependant?: boolean;
164
+ }
165
+
166
+ export interface ComparisonTableRowProps {
167
+ field: string;
168
+ label: string;
169
+ amrsValue: string;
170
+ hieValue: string;
171
+ onChange?(e: boolean, field: string, value: string, multiple: boolean): void;
172
+ allChecked: boolean;
173
+ }
174
+
175
+ export interface ClientDependantsComparisonProps {
176
+ hieDependants: Array<HieDependant>;
177
+ amrsClient: AmrsClient;
178
+ patientRelationships: Array<CustomRelationship>;
179
+ }
180
+
181
+ export interface ClientDependantComparisonRowsProps {
182
+ hieDependant: HieDependant;
183
+ patientRelationships: Array<CustomRelationship>;
184
+ amrsClient: AmrsClient;
185
+ }
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
- import { HieClient, type HieDependant } from '../../types';
3
2
  import { Table, TableHead, TableRow, TableHeader, TableBody, TableCell } from '@carbon/react';
3
+ import { type HieDependant } from '../../../types';
4
4
 
5
5
  interface ClientDependantsListProps {
6
6
  hieDependants: HieDependant[];
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo } from 'react';
2
- import { type HieClient } from '../types';
2
+ import { type HieClient } from '../../types';
3
3
  import { DataTable, Table, TableHead, TableRow, TableHeader, TableBody, TableCell } from '@carbon/react';
4
- import { generateHieClientDetails } from '../hie-client-adapter';
4
+ import { generateHieClientDetails } from '../../hie-client-adapter';
5
5
 
6
6
  interface ClientdetailsProps {
7
7
  client: HieClient;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { Tabs, TabList, Tab, TabPanels, TabPanel, Button } from '@carbon/react';
3
+ import { type HieClient } from '../types';
4
+ import ClientDependantList from './client-dependants/list/client-depandants.component';
5
+ import ClientDetails from './client-details/client-details';
6
+
7
+ interface NewClientTabProps {
8
+ client: HieClient;
9
+ useHieData: () => void;
10
+ }
11
+
12
+ const NewClientTab: React.FC<NewClientTabProps> = ({ client, useHieData }) => {
13
+ return (
14
+ <>
15
+ <Tabs>
16
+ <TabList contained>
17
+ <Tab>Patient</Tab>
18
+ <Tab>Dependants</Tab>
19
+ </TabList>
20
+ <TabPanels>
21
+ <TabPanel>{client ? <ClientDetails client={client} /> : <></>}</TabPanel>
22
+ <TabPanel>{client.dependants ? <ClientDependantList hieDependants={client.dependants} /> : <></>}</TabPanel>
23
+ </TabPanels>
24
+ </Tabs>
25
+ <Button onClick={useHieData}>Use Data</Button>
26
+ </>
27
+ );
28
+ };
29
+
30
+ export default NewClientTab;
@@ -9,6 +9,16 @@ export enum HieIdentificationType {
9
9
  TemporaryDependantID = 'Temporary Dependant ID',
10
10
  }
11
11
 
12
+ export enum HieAttributeType {
13
+ KRAPin = 'kra_pin',
14
+ CivilStatus = 'civil_status',
15
+ Email = 'email',
16
+ Phone = 'phone',
17
+ PlaceOfBirth = 'place_of_birth',
18
+ Citizenship = 'citizenship',
19
+ Cr = 'id',
20
+ }
21
+
12
22
  export interface HieIdentifications {
13
23
  identification_number: string;
14
24
  identification_type: HieIdentificationType;
@@ -262,6 +262,7 @@ export const PatientRegistration: React.FC<PatientRegistrationProps> = ({ savePa
262
262
  onClientVerified={() => setIsClientVerified(true)}
263
263
  onModalClose={closeVerifyModal}
264
264
  open={showVerifyModal}
265
+ isNewClient={true}
265
266
  />
266
267
  </>
267
268
  ) : (