@ampath/esm-patient-registration-app 9.2.0-next.14 → 9.2.0-next.16

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 (71) hide show
  1. package/dist/4300.js +1 -1
  2. package/dist/4395.js +1 -0
  3. package/dist/4395.js.map +1 -0
  4. package/dist/5239.js +1 -1
  5. package/dist/5239.js.LICENSE.txt +10 -0
  6. package/dist/5239.js.map +1 -1
  7. package/dist/6276.js +1 -1
  8. package/dist/6276.js.map +1 -1
  9. package/dist/6687.js +1 -0
  10. package/dist/6687.js.map +1 -0
  11. package/dist/6996.js +1 -0
  12. package/dist/6996.js.map +1 -0
  13. package/dist/7125.js +2 -0
  14. package/dist/7125.js.map +1 -0
  15. package/dist/7821.js +1 -0
  16. package/dist/7821.js.map +1 -0
  17. package/dist/8414.js +1 -0
  18. package/dist/8414.js.map +1 -0
  19. package/dist/8434.js +1 -1
  20. package/dist/8434.js.map +1 -1
  21. package/dist/8882.js +1 -0
  22. package/dist/8882.js.map +1 -0
  23. package/dist/9898.js +1 -0
  24. package/dist/9898.js.map +1 -0
  25. package/dist/9933.js +2 -0
  26. package/dist/{1909.js.LICENSE.txt → 9933.js.LICENSE.txt} +9 -0
  27. package/dist/9933.js.map +1 -0
  28. package/dist/main.js +1 -1
  29. package/dist/main.js.map +1 -1
  30. package/dist/openmrs-esm-patient-registration-app.js +1 -1
  31. package/dist/openmrs-esm-patient-registration-app.js.buildmanifest.json +226 -150
  32. package/dist/openmrs-esm-patient-registration-app.js.map +1 -1
  33. package/dist/routes.json +1 -1
  34. package/package.json +1 -1
  35. package/src/index.ts +9 -0
  36. package/src/patient-registration/client-registry/client-registry-search.component.tsx +233 -0
  37. package/src/patient-registration/client-registry/client-registry.resource.ts +79 -0
  38. package/src/patient-registration/client-registry/map-client-registry-to-form-utils.ts +190 -0
  39. package/src/patient-registration/client-registry-search/client-registry-dependant-details.component.tsx +237 -0
  40. package/src/patient-registration/client-registry-search/client-registry-details.component.tsx +111 -0
  41. package/src/patient-registration/client-registry-search/client-registry-patient-details.component.tsx +234 -0
  42. package/src/patient-registration/client-registry-search/client-registry-search.component.tsx +234 -0
  43. package/src/patient-registration/client-registry-search/client-registry-verification-tag.component.tsx +78 -0
  44. package/src/patient-registration/client-registry-search/client-registry.resource.ts +135 -0
  45. package/src/patient-registration/client-registry-search/client-registry.types.ts +243 -0
  46. package/src/patient-registration/client-registry-search/map-client-registry-to-form-utils.ts +590 -0
  47. package/src/patient-registration/field/field.component.tsx +3 -0
  48. package/src/patient-registration/field/id/id-field.component.tsx +1 -1
  49. package/src/patient-registration/field/id/id-field.test.tsx +1 -1
  50. package/src/patient-registration/form-manager.test.ts +1 -0
  51. package/src/patient-registration/patient-registration.component.tsx +25 -9
  52. package/src/patient-registration/patient-registration.resource.ts +4 -3
  53. package/src/patient-registration/patient-registration.scss +4 -0
  54. package/src/routes.json +12 -1
  55. package/src/widgets/client-registry-verification.modal.tsx +27 -0
  56. package/translations/en.json +4 -0
  57. package/dist/1909.js +0 -2
  58. package/dist/1909.js.map +0 -1
  59. package/dist/320.js +0 -2
  60. package/dist/320.js.LICENSE.txt +0 -8
  61. package/dist/320.js.map +0 -1
  62. package/dist/3474.js +0 -2
  63. package/dist/3474.js.LICENSE.txt +0 -8
  64. package/dist/3474.js.map +0 -1
  65. package/dist/627.js +0 -1
  66. package/dist/627.js.map +0 -1
  67. package/dist/7071.js +0 -1
  68. package/dist/7071.js.map +0 -1
  69. package/dist/729.js +0 -2
  70. package/dist/729.js.map +0 -1
  71. /package/dist/{729.js.LICENSE.txt → 7125.js.LICENSE.txt} +0 -0
@@ -0,0 +1,234 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, TextInput, InlineLoading, InlineNotification, Select, SelectItem } from '@carbon/react';
3
+ import { showSnackbar } from '@openmrs/esm-framework';
4
+ import { useFormikContext } from 'formik';
5
+ import styles from '../patient-registration.scss';
6
+ import { requestCustomOtp, validateCustomOtp, fetchClientRegistryData } from './client-registry.resource';
7
+ import { applyClientRegistryMapping } from './map-client-registry-to-form-utils';
8
+ import { type RequestCustomOtpDto } from './client-registry.types';
9
+
10
+ export interface ClientRegistryLookupSectionProps {
11
+ onClientVerified?: (payload: RequestCustomOtpDto) => void;
12
+ }
13
+
14
+ const ClientRegistryLookupSection: React.FC<ClientRegistryLookupSectionProps> = ({ onClientVerified }) => {
15
+ const { setFieldValue, values } = useFormikContext<any>();
16
+ const [identifier, setIdentifier] = useState('');
17
+ const [otp, setOtp] = useState('');
18
+ const [otpSent, setOtpSent] = useState(false);
19
+ const [otpVerified, setOtpVerified] = useState(false);
20
+ const [loading, setLoading] = useState(false);
21
+ const [sessionId, setSessionId] = useState('');
22
+ const [error, setError] = useState<string>('');
23
+ const [identificationType, setIdentificationType] = useState('National ID');
24
+
25
+ const locationUuid = '18c343eb-b353-462a-9139-b16606e6b6c2';
26
+ const identificationTypes = [
27
+ { text: 'National ID', value: 'National ID' },
28
+ { text: 'Refugee ID', value: 'Refugee ID' },
29
+ { text: 'Alien ID', value: 'Alien ID' },
30
+ { text: 'Mandate Number', value: 'Mandate Number' },
31
+ ];
32
+
33
+ async function withTimeout<T>(promise: Promise<T>, ms = 10000): Promise<T> {
34
+ const controller = new AbortController();
35
+ const timeout = setTimeout(() => controller.abort(), ms);
36
+ try {
37
+ const response = await promise;
38
+ return response;
39
+ } catch (err) {
40
+ if (err.name === 'AbortError') {
41
+ throw new Error('Request timeout');
42
+ }
43
+ throw err;
44
+ } finally {
45
+ clearTimeout(timeout);
46
+ }
47
+ }
48
+
49
+ const handleFetchCR = async () => {
50
+ setLoading(true);
51
+ setError('');
52
+
53
+ try {
54
+ const payload = {
55
+ identificationNumber: identifier,
56
+ identificationType: identificationType,
57
+ locationUuid,
58
+ };
59
+ const result = await withTimeout(fetchClientRegistryData(payload));
60
+ const patients = Array.isArray(result) ? result : [];
61
+
62
+ if (patients.length === 0) {
63
+ throw new Error('No matching patient found in Client Registry.');
64
+ }
65
+
66
+ const patient = patients[0];
67
+ applyClientRegistryMapping(patient, setFieldValue);
68
+
69
+ showSnackbar({
70
+ kind: 'success',
71
+ title: 'Client Data Loaded',
72
+ subtitle: `Patient ${patient.first_name} ${patient.last_name} fetched successfully. Loaded education, next of kin, and relationships.`,
73
+ });
74
+ } catch (err) {
75
+ const errorMessage = err.message || 'Failed to fetch client data';
76
+ setError(errorMessage);
77
+ showSnackbar({
78
+ kind: 'error',
79
+ title: 'Fetch Failed',
80
+ subtitle: errorMessage,
81
+ });
82
+ } finally {
83
+ setLoading(false);
84
+ }
85
+ };
86
+
87
+ const handleSendOtp = async () => {
88
+ if (!identifier.trim()) {
89
+ setError('Please enter a valid National/Alien ID');
90
+ return;
91
+ }
92
+
93
+ setLoading(true);
94
+ setError('');
95
+ try {
96
+ const payload = {
97
+ identificationNumber: identifier,
98
+ identificationType: identificationType,
99
+ locationUuid,
100
+ };
101
+ const response = await withTimeout(requestCustomOtp(payload));
102
+ setSessionId(response.sessionId);
103
+ setOtpSent(true);
104
+
105
+ showSnackbar({
106
+ kind: 'success',
107
+ title: 'OTP sent successfully',
108
+ subtitle: `A code was sent to ${response.maskedPhone}`,
109
+ });
110
+ } catch (err) {
111
+ const errorMessage = err.message || 'Failed to send OTP';
112
+ setError(errorMessage);
113
+ showSnackbar({
114
+ kind: 'error',
115
+ title: 'Error sending OTP',
116
+ subtitle: errorMessage,
117
+ });
118
+ } finally {
119
+ setLoading(false);
120
+ }
121
+ };
122
+
123
+ const handleVerifyOtp = async () => {
124
+ if (!otp.trim()) {
125
+ setError('Please enter the OTP code');
126
+ return;
127
+ }
128
+
129
+ setLoading(true);
130
+ setError('');
131
+ try {
132
+ const payload = {
133
+ sessionId,
134
+ otp,
135
+ locationUuid,
136
+ };
137
+ await withTimeout(validateCustomOtp(payload));
138
+
139
+ const customOtpPayload = {
140
+ identificationNumber: identifier,
141
+ identificationType: identificationType,
142
+ locationUuid,
143
+ };
144
+ setOtpVerified(true);
145
+ onClientVerified?.(customOtpPayload);
146
+ showSnackbar({
147
+ kind: 'success',
148
+ title: 'OTP Verified',
149
+ subtitle: 'You can now fetch data from Client Registry.',
150
+ });
151
+ } catch (err) {
152
+ const errorMessage = err.message || 'OTP verification failed';
153
+ setError(errorMessage);
154
+ showSnackbar({
155
+ kind: 'error',
156
+ title: 'OTP Verification Failed',
157
+ subtitle: errorMessage,
158
+ });
159
+ } finally {
160
+ setLoading(false);
161
+ }
162
+ };
163
+
164
+ return (
165
+ <div className={styles.section}>
166
+ <h4 className={styles.sectionTitle}>Client Registry Verification</h4>
167
+
168
+ {error && (
169
+ <div className={styles.notificationSpacing}>
170
+ <InlineNotification title="Error" subtitle={error} kind="error" lowContrast />
171
+ </div>
172
+ )}
173
+
174
+ <div className={styles.fieldGroup}>
175
+ <Select labelText="Select Identification Type" onChange={(e) => setIdentificationType(e.target.value)}>
176
+ {identificationTypes.map((item) => (
177
+ <SelectItem text={item.text} value={item.value} />
178
+ ))}
179
+ </Select>
180
+ </div>
181
+
182
+ <div className={styles.fieldGroup}>
183
+ <TextInput
184
+ id="client-registry-id"
185
+ labelText="National ID or Alien ID"
186
+ value={identifier}
187
+ onChange={(e) => setIdentifier(e.target.value)}
188
+ disabled={otpSent}
189
+ placeholder="Enter identification number"
190
+ />
191
+ </div>
192
+
193
+ <div style={{ marginTop: '0.75rem' }}>
194
+ {!otpSent ? (
195
+ <Button kind="secondary" onClick={handleSendOtp} disabled={loading}>
196
+ {loading ? <InlineLoading description="Sending..." /> : 'Send OTP'}
197
+ </Button>
198
+ ) : (
199
+ <>
200
+ <div style={{ marginTop: '0.75rem' }}>
201
+ <TextInput
202
+ id="otp-input"
203
+ labelText="Enter OTP"
204
+ value={otp}
205
+ onChange={(e) => setOtp(e.target.value)}
206
+ disabled={otpVerified}
207
+ placeholder="Enter the code sent to your phone"
208
+ />
209
+ </div>
210
+
211
+ <div style={{ marginTop: '0.5rem', display: 'flex', gap: '0.5rem' }}>
212
+ {!otpVerified ? (
213
+ <Button size="sm" kind="secondary" onClick={handleVerifyOtp} disabled={loading}>
214
+ {loading ? <InlineLoading description="Verifying..." /> : 'Verify OTP'}
215
+ </Button>
216
+ ) : (
217
+ <Button kind="primary" onClick={handleFetchCR} disabled={loading}>
218
+ {loading ? <InlineLoading description="Fetching..." /> : 'Fetch Client Registry Data'}
219
+ </Button>
220
+ )}
221
+ {!otpVerified && (
222
+ <Button size="sm" kind="tertiary" onClick={() => setOtpSent(false)}>
223
+ Change ID
224
+ </Button>
225
+ )}
226
+ </div>
227
+ </>
228
+ )}
229
+ </div>
230
+ </div>
231
+ );
232
+ };
233
+
234
+ export default ClientRegistryLookupSection;
@@ -0,0 +1,78 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Button } from '@carbon/react';
3
+ import { showModal, age, usePatient } from '@openmrs/esm-framework';
4
+ import ClientRegistryLookupSection from './client-registry-search.component';
5
+ import { Formik } from 'formik';
6
+ import { type RequestCustomOtpDto } from './client-registry.types';
7
+ import ClientRegistryDetails from './client-registry-details.component';
8
+
9
+ const ClientRegistryVerificationTag = () => {
10
+ const { patient } = usePatient();
11
+ const [showCrBtn, setShowCrBtn] = useState(false);
12
+
13
+ useEffect(() => {
14
+ if (patient && patient.birthDate) {
15
+ const ageArr = age(patient.birthDate).split(' ');
16
+ if (ageArr.includes('yrs')) {
17
+ const yrs = Number(ageArr[0]);
18
+ setShowCrBtn(yrs > 17);
19
+ }
20
+ }
21
+ }, [patient]);
22
+
23
+ const handleClientRegistryVerification = () => {
24
+ const dispose = showModal(
25
+ 'client-registry-verification-modal',
26
+ {
27
+ onConfirm: () => {
28
+ dispose();
29
+ },
30
+ Component: CrFormikComponent,
31
+ props: {
32
+ forceClose: () => {
33
+ dispose();
34
+ },
35
+ },
36
+ },
37
+ () => {},
38
+ );
39
+ };
40
+
41
+ return showCrBtn ? (
42
+ <Button kind="ghost" onClick={handleClientRegistryVerification}>
43
+ Verify CR
44
+ </Button>
45
+ ) : (
46
+ <></>
47
+ );
48
+ };
49
+
50
+ interface CrFormicComponentProps {
51
+ forceClose?(): void;
52
+ }
53
+ const CrFormikComponent: React.FC<CrFormicComponentProps> = ({ forceClose }) => {
54
+ const initialFormValues = {};
55
+
56
+ const handleOnClientVerified = (payload: RequestCustomOtpDto) => {
57
+ forceClose?.();
58
+ const dispose = showModal(
59
+ 'client-registry-verification-modal',
60
+ {
61
+ onConfirm: () => {
62
+ dispose();
63
+ },
64
+ Component: ClientRegistryDetails,
65
+ props: { payload: payload },
66
+ },
67
+ () => {},
68
+ );
69
+ };
70
+
71
+ return (
72
+ <Formik initialValues={initialFormValues} onSubmit={null}>
73
+ <ClientRegistryLookupSection onClientVerified={handleOnClientVerified} />
74
+ </Formik>
75
+ );
76
+ };
77
+
78
+ export default ClientRegistryVerificationTag;
@@ -0,0 +1,135 @@
1
+ import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
2
+ import {
3
+ type AmrsPerson,
4
+ type ClientRegistrySearchRequest,
5
+ type ClientRegistrySearchResponse,
6
+ type RequestCustomOtpDto,
7
+ type RequestCustomOtpResponse,
8
+ type ValidateCustomOtpResponse,
9
+ type ValidateHieCustomOtpDto,
10
+ } from './client-registry.types';
11
+ import { mapAmrsPatientRelationship } from './map-client-registry-to-form-utils';
12
+
13
+ const HIE_BASE_URL = 'https://ngx.ampath.or.ke/hie';
14
+
15
+ async function postJson<T>(url: string, payload: unknown): Promise<T> {
16
+ const response = await fetch(url, {
17
+ method: 'POST',
18
+ headers: { 'Content-Type': 'application/json' },
19
+ body: JSON.stringify(payload),
20
+ });
21
+
22
+ if (!response.ok) {
23
+ const errorText = await response.text();
24
+ throw new Error(`Request failed with ${response.status}: ${errorText}`);
25
+ }
26
+
27
+ return response.json() as Promise<T>;
28
+ }
29
+
30
+ export async function requestCustomOtp(payload: RequestCustomOtpDto): Promise<RequestCustomOtpResponse> {
31
+ const url = `${HIE_BASE_URL}/client/send-custom-otp`;
32
+ const formattedPayload = {
33
+ identificationNumber: payload.identificationNumber,
34
+ identificationType: payload.identificationType,
35
+ locationUuid: payload.locationUuid,
36
+ };
37
+ return postJson<RequestCustomOtpResponse>(url, formattedPayload);
38
+ }
39
+
40
+ export async function validateCustomOtp(payload: ValidateHieCustomOtpDto): Promise<ValidateCustomOtpResponse> {
41
+ const url = `${HIE_BASE_URL}/client/validate-custom-otp`;
42
+ const formattedPayload = {
43
+ sessionId: payload.sessionId,
44
+ otp: payload.otp,
45
+ locationUuid: payload.locationUuid,
46
+ };
47
+ return postJson<ValidateCustomOtpResponse>(url, formattedPayload);
48
+ }
49
+
50
+ export async function fetchClientRegistryData(
51
+ payload: ClientRegistrySearchRequest,
52
+ ): Promise<ClientRegistrySearchResponse> {
53
+ const url = `${HIE_BASE_URL}/client/search`;
54
+ const formattedPayload = {
55
+ identificationNumber: payload.identificationNumber,
56
+ identificationType: payload.identificationType,
57
+ locationUuid: payload.locationUuid,
58
+ };
59
+ return postJson<ClientRegistrySearchResponse>(url, formattedPayload);
60
+ }
61
+
62
+ export async function fetchAmrsPatientData(patientUuid: string) {
63
+ return await openmrsFetch<AmrsPerson>(`${restBaseUrl}/patient/${patientUuid}?v=full`, {
64
+ method: 'GET',
65
+ }).catch((err) => {
66
+ console.error(err);
67
+ });
68
+ }
69
+
70
+ export async function updateAmrsPersonIdentifiers(
71
+ patientUuid: string,
72
+ identifierUuid: string,
73
+ payload: unknown,
74
+ fromDependant = false,
75
+ ) {
76
+ const resource = fromDependant ? 'person' : 'patient';
77
+ return await openmrsFetch(`${restBaseUrl}/${resource}/${patientUuid}/identifier/${identifierUuid}`, {
78
+ method: 'POST',
79
+ headers: {
80
+ 'Content-Type': 'application/json',
81
+ },
82
+ body: payload,
83
+ });
84
+ }
85
+
86
+ export async function fetchAmrsPersonData(personUuid: string) {
87
+ return await openmrsFetch(`${restBaseUrl}/person/${personUuid}?v=full`, {
88
+ method: 'GET',
89
+ }).catch((err) => {
90
+ console.error(err);
91
+ });
92
+ }
93
+
94
+ export async function updatePerson(patientUuid: string, payload: unknown) {
95
+ return await openmrsFetch<AmrsPerson>(`${restBaseUrl}/person/${patientUuid}`, {
96
+ method: 'POST',
97
+ headers: {
98
+ 'Content-Type': 'application/json',
99
+ },
100
+ body: payload,
101
+ });
102
+ }
103
+
104
+ export async function createPerson(payload: unknown) {
105
+ return await openmrsFetch<AmrsPerson>(`${restBaseUrl}/person`, {
106
+ method: 'POST',
107
+ headers: {
108
+ 'Content-Type': 'application/json',
109
+ },
110
+ body: payload,
111
+ });
112
+ }
113
+
114
+ export async function createRelationship(payload: unknown) {
115
+ return await openmrsFetch(`${restBaseUrl}/relationship`, {
116
+ method: 'POST',
117
+ headers: {
118
+ 'Content-Type': 'application/json',
119
+ },
120
+ body: payload,
121
+ });
122
+ }
123
+
124
+ export async function getRelationships(patientUuid: string) {
125
+ const response = await openmrsFetch(`${restBaseUrl}/relationship?person=${patientUuid}&v=full`, {
126
+ method: 'GET',
127
+ headers: {
128
+ 'Content-Type': 'application/json',
129
+ },
130
+ });
131
+ if (response && response.data) {
132
+ return mapAmrsPatientRelationship(patientUuid, response.data.results);
133
+ }
134
+ return [];
135
+ }
@@ -0,0 +1,243 @@
1
+ export type RequestCustomOtpDto = {
2
+ identificationNumber: string | number;
3
+ identificationType: string;
4
+ locationUuid: string;
5
+ };
6
+
7
+ export interface RequestCustomOtpResponse {
8
+ message: string;
9
+ sessionId: string;
10
+ maskedPhone: string;
11
+ }
12
+
13
+ export interface ValidateHieCustomOtpDto {
14
+ sessionId: string;
15
+ otp: number | string;
16
+ locationUuid: string;
17
+ }
18
+
19
+ export interface ValidateCustomOtpResponse {
20
+ message: string;
21
+ isValid?: boolean;
22
+ }
23
+
24
+ export type ClientRegistrySearchRequest = {
25
+ identificationNumber: string | number;
26
+ identificationType: string;
27
+ locationUuid: string;
28
+ };
29
+
30
+ export type ClientRegistryBody = {
31
+ id: string;
32
+ first_name: string;
33
+ middle_name: string;
34
+ last_name: string;
35
+ gender: string;
36
+ date_of_birth: string;
37
+ other_identifications: Array<{
38
+ identification_number: string;
39
+ identification_type: string;
40
+ }>;
41
+ dependants: Array<ClientRegistryDependantBody>;
42
+ citizenship: string;
43
+ kra_pin: string;
44
+ civil_status: string;
45
+ email: string;
46
+ phone: string;
47
+ place_of_birth: string;
48
+ country: string;
49
+ county: string;
50
+ sub_county: string;
51
+ ward: string;
52
+ village_estate: string;
53
+ building_house_no: string;
54
+ latitude: string;
55
+ longitude: string;
56
+ identification_number: string;
57
+ };
58
+
59
+ export type ClientRegistryDependantBody = {
60
+ relationship: string;
61
+ total: number;
62
+ result: Array<ClientRegistryBody>;
63
+ };
64
+
65
+ export interface CustomRelationship {
66
+ uuid: string;
67
+ display: string;
68
+ relative: string;
69
+ relatedPersonUuid: string;
70
+ relationshipType: string;
71
+ relationshipTypeUuId: string;
72
+ relationshipTypeName: string;
73
+ relatedPerson: any;
74
+ }
75
+
76
+ export interface AmrsPerson {
77
+ uuid: string;
78
+ identifiers: Identifier[];
79
+ display: string;
80
+ person: {
81
+ uuid: string;
82
+ display: string;
83
+ gender: string;
84
+ age: number;
85
+ birthdate: string;
86
+ birthdateEstimated: boolean;
87
+ dead: boolean;
88
+ deathDate?: any;
89
+ causeOfDeath?: any;
90
+ preferredAddress: {
91
+ address1: string;
92
+ address2: string;
93
+ address3: string;
94
+ address4: string;
95
+ address5: string;
96
+ address6: string;
97
+ address7: string;
98
+ cityVillage: string;
99
+ country: string;
100
+ postalCode: string;
101
+ stateProvince: string;
102
+ countyDistrict: string;
103
+ latitude: string;
104
+ longitude: string;
105
+ };
106
+ preferredName: {
107
+ display: string;
108
+ uuid: string;
109
+ givenName: string;
110
+ middleName: string;
111
+ familyName: string;
112
+ };
113
+ attributes: Array<Attributes>;
114
+ identifiers: Identifier[];
115
+ voided: boolean;
116
+ birthtime?: any;
117
+ deathdateEstimated: boolean;
118
+ resourceVersion: string;
119
+ };
120
+ attributes: { value: string; attributeType: { uuid: string; display: string } }[];
121
+ voided: boolean;
122
+ }
123
+
124
+ export interface Address {
125
+ preferred: boolean;
126
+ address1: string;
127
+ cityVillage: string;
128
+ country: string;
129
+ postalCode: string;
130
+ stateProvince: string;
131
+ }
132
+
133
+ export interface Identifier {
134
+ uuid: string;
135
+ display: string;
136
+ identifier: string;
137
+ identifierType: {
138
+ uuid: string;
139
+ display: string;
140
+ };
141
+ }
142
+
143
+ export interface Attributes {
144
+ uuid: string;
145
+ display: string;
146
+ value: {
147
+ uuid: string;
148
+ display: string;
149
+ };
150
+ attributeType: {
151
+ uuid: string;
152
+ display: string;
153
+ };
154
+ }
155
+
156
+ export type ClientRegistrySearchResponse = Array<ClientRegistryBody>;
157
+
158
+ export enum HieIdentificationType {
159
+ NationalID = 'National ID',
160
+ SHANumber = 'SHA Number',
161
+ HouseholdNumber = 'Household Number',
162
+ RefugeeID = 'Refugee ID',
163
+ AlienID = 'Alien ID',
164
+ MandateNumber = 'Mandate Number',
165
+ Cr = 'id',
166
+ TemporaryDependantID = 'Temporary Dependant ID',
167
+ }
168
+
169
+ const HOUSE_HOLD_NUMBER_UUID = 'bb74b20e-dcee-4f59-bdf1-2dffc3abf106';
170
+ const SHA_UUID = 'cf5362b2-8049-4442-b3c6-36f870e320cb';
171
+ const CLIENT_REGISTRY_NO_UUID = 'e88dc246-3614-4ee3-8141-1f2a83054e72';
172
+ const NATIONAL_ID_UUID = '58a47054-1359-11df-a1f1-0026b9348838';
173
+ const PROVIDER_NATIONAL_ID_UUID = '4550df92-c684-4597-8ab8-d6b10eabdcfb';
174
+ const REFUGEE_ID_UUID = '465e81af-8d69-47e9-9127-53a94adc75fb';
175
+ const MANDATE_NUMBER_UUID = 'aae2d097-20ba-43ca-9b71-fd8296068f39';
176
+ const ALIEN_ID_UUID = '12f5b147-3403-4a73-913d-7ded9ffec094';
177
+ const TEMPORARY_DEPENDANT_ID_UUID = 'a3d34214-93e8-4faf-bf4d-0272eee079eb';
178
+ const AMRS_UNIVERSAL_ID_UUID = '58a4732e-1359-11df-a1f1-0026b9348838';
179
+ const UPI_NUMBER_UUID = 'cba702b9-4664-4b43-83f1-9ab473cbd64d';
180
+
181
+ export const IdentifierTypesUuids = {
182
+ HOUSE_HOLD_NUMBER_UUID,
183
+ SHA_UUID,
184
+ CLIENT_REGISTRY_NO_UUID,
185
+ NATIONAL_ID_UUID,
186
+ PROVIDER_NATIONAL_ID_UUID,
187
+ REFUGEE_ID_UUID,
188
+ MANDATE_NUMBER_UUID,
189
+ ALIEN_ID_UUID,
190
+ TEMPORARY_DEPENDANT_ID_UUID,
191
+ AMRS_UNIVERSAL_ID_UUID,
192
+ UPI_NUMBER_UUID,
193
+ };
194
+
195
+ export enum HieAttributeType {
196
+ KRAPin = 'kra_pin',
197
+ CivilStatus = 'civil_status',
198
+ Email = 'email',
199
+ Phone = 'phone',
200
+ PlaceOfBirth = 'place_of_birth',
201
+ Citizenship = 'citizenship',
202
+ Cr = 'id',
203
+ }
204
+
205
+ const CONTACT_PHONE_NUMBER_UUID = '72a759a8-1359-11df-a1f1-0026b9348838';
206
+ const CITIZENSHIP_UUID = '72a759a8-1359-11df-a1f1-0026b9348838';
207
+ const CONTACT_EMAIL_ADDRESS_UUID = '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa';
208
+ const ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID = 'c725f524-c14a-4468-ac19-4a0e6661c930';
209
+ const KRA_PIN_UUID = 'ae683747-b3fc-4e5c-bad3-c3be743b248f';
210
+ const CIVIL_STATUS_UUID = '8d871f2a-c2cc-11de-8d13-0010c6dffd0f';
211
+ const CLIENT_REGISTRY_ID_UUID = 'e068e02b-faac-4baf-bd58-fe6e0c29a81f';
212
+ const PLACE_OF_BIRTH_UUID = '8d8718c2-c2cc-11de-8d13-0010c6dffd0f';
213
+ const EMAIL_UUID = '2f65dbcb-3e58-45a3-8be7-fd1dc9aa0faa';
214
+
215
+ export const PersonAttributeTypeUuids = {
216
+ CONTACT_PHONE_NUMBER_UUID,
217
+ CITIZENSHIP_UUID,
218
+ CONTACT_EMAIL_ADDRESS_UUID,
219
+ ALTERNATIVE_CONTACT_PHONE_NUMBER_UUID,
220
+ KRA_PIN_UUID,
221
+ CIVIL_STATUS_UUID,
222
+ CLIENT_REGISTRY_ID_UUID,
223
+ PLACE_OF_BIRTH_UUID,
224
+ EMAIL_UUID,
225
+ };
226
+
227
+ const PARENT_CHILD_UUID = '7878d348-1359-11df-a1f1-0026b9348838';
228
+ const AUNT_UNCLE_NIECE_NEPHEW_UUID = '7878dd3e-1359-11df-a1f1-0026b9348838';
229
+ const SPOUSE_UUID = '7878df3c-1359-11df-a1f1-0026b9348838';
230
+ const GRANDCHILD_GRANDPARENT_UUID = '7878e144-1359-11df-a1f1-0026b9348838';
231
+ const GUARDIAN_CHILD_UUD = '01bc0cf5-d428-427f-be13-305eb9cad7ba';
232
+ const FOSTER_CHILD_FOSTER_PARENT_UUID = '7878e52c-1359-11df-a1f1-0026b9348838';
233
+ const OTHER_NON_CODED_UUID = 'af78531e-98ab-41da-be3a-6a871ecbf8c0';
234
+
235
+ export const RelationshipTypeUuids = {
236
+ PARENT_CHILD_UUID,
237
+ AUNT_UNCLE_NIECE_NEPHEW_UUID,
238
+ SPOUSE_UUID,
239
+ GRANDCHILD_GRANDPARENT_UUID,
240
+ GUARDIAN_CHILD_UUD,
241
+ FOSTER_CHILD_FOSTER_PARENT_UUID,
242
+ OTHER_NON_CODED_UUID,
243
+ };