@kenyaemr/esm-patient-registration-app 8.0.1-pre.103 → 8.0.1-pre.105

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/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":"cancelPatientEditModal","name":"cancel-patient-edit-modal","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},{"component":"deleteIdentifierConfirmationModal","name":"delete-identifier-confirmation-modal","online":true,"offline":true},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal","online":true,"offline":true},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal","online":true,"offline":true}],"modals":[{"component":"hieConfirmationModal","name":"hie-confirmation-modal"}],"version":"8.0.1-pre.103"}
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":"cancelPatientEditModal","name":"cancel-patient-edit-modal","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},{"component":"deleteIdentifierConfirmationModal","name":"delete-identifier-confirmation-modal","online":true,"offline":true},{"component":"emptyClientRegistryModal","name":"empty-client-registry-modal","online":true,"offline":true},{"component":"confirmClientRegistryModal","name":"confirm-client-registry-modal","online":true,"offline":true}],"modals":[{"component":"hieConfirmationModal","name":"hie-confirmation-modal"}],"version":"8.0.1-pre.105"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kenyaemr/esm-patient-registration-app",
3
- "version": "8.0.1-pre.103",
3
+ "version": "8.0.1-pre.105",
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",
@@ -1,8 +1,9 @@
1
1
  import { add, capitalize } from 'lodash-es';
2
2
  import { type PatientIdentifierValue, type FormValues } from '../../patient-registration/patient-registration.types';
3
- import { APIClientConfig, type MapperConfig, type HIEPatient, type ErrorResponse } from './hie-types';
3
+ import { type MapperConfig, type HIEPatient, type ErrorResponse } from './hie-types';
4
4
  import { getConfig } from '@openmrs/esm-framework';
5
5
  import { type RegistrationConfig } from '../../config-schema';
6
+ import { v4 } from 'uuid';
6
7
  /**
7
8
  * Represents a client for interacting with a Health Information Exchange (HIE) resource.
8
9
  * @template T - The type of the resource being fetched.
@@ -59,13 +60,18 @@ class PatientMapper extends Mapper<HIEPatient, FormValues> {
59
60
  address: extensionAddressEntries,
60
61
  identifiers: updatedIdentifiers,
61
62
  attributes: telecomAttributes,
63
+ relationships: [],
64
+ patientUuid: v4(),
62
65
  } as FormValues;
63
66
  }
64
67
 
65
68
  private mapTelecomToAttributes(telecom: Array<fhir.ContactPoint>): Record<string, string> {
66
69
  return telecom.reduce<Record<string, string>>((acc, { system, value }) => {
67
70
  if (system && value && this.config.teleComMap[system]) {
68
- acc[this.config.teleComMap[system]] = value.replace(/^254/, '0');
71
+ const filteredValue = value.replace(/^254/, '0');
72
+ if (filteredValue) {
73
+ acc[this.config.teleComMap[system]] = filteredValue;
74
+ }
69
75
  }
70
76
  return acc;
71
77
  }, {});
@@ -95,17 +101,27 @@ class PatientMapper extends Mapper<HIEPatient, FormValues> {
95
101
  }
96
102
  });
97
103
 
104
+ // Filter out undefined keys and values
105
+ Object.keys(updatedIdentifiers).forEach((key) => {
106
+ if (updatedIdentifiers[key] === undefined || updatedIdentifiers[key].identifierValue === undefined) {
107
+ delete updatedIdentifiers[key];
108
+ }
109
+ });
110
+
98
111
  return updatedIdentifiers;
99
112
  }
100
113
 
101
114
  private mapExtensionsToAddress(extensions: HIEPatient['extension']): Record<string, string> {
102
- return extensions
103
- .map((ext) => {
104
- const identifierType = ext.url.split('/').pop();
105
- const identifierValue = ext.valueString;
106
- return { [this.config.addressHierarchyMap[identifierType]]: capitalize(identifierValue) };
107
- })
108
- .reduce<Record<string, string>>((acc, curr) => ({ ...acc, ...curr }), {});
115
+ return extensions.reduce<Record<string, string>>((acc, ext) => {
116
+ const identifierType = ext.url.split('/').pop();
117
+ const mappedKey = this.config.addressHierarchyMap[identifierType];
118
+
119
+ if (mappedKey && ext.valueString) {
120
+ acc[mappedKey] = capitalize(ext.valueString);
121
+ }
122
+
123
+ return acc;
124
+ }, {});
109
125
  }
110
126
  }
111
127
 
@@ -53,7 +53,7 @@ const HIEConfirmationModal: React.FC<HIEConfirmationModalProps> = ({ closeModal,
53
53
  label={t('maritalStatus', 'Marital status')}
54
54
  value={patient.maritalStatus.coding.map((m) => m.code).join('')}
55
55
  />
56
- <PatientInfo label={t('relationships', 'Relationships')} value="--" />
56
+ <PatientInfo label={t('dependents', 'Dependents')} value="--" />
57
57
  </div>
58
58
  </div>
59
59
  <div>
@@ -33,6 +33,7 @@
33
33
  "deleteIdentifierTooltip": "Delete",
34
34
  "deleteRelationshipTooltipText": "Delete",
35
35
  "demographicsSection": "Basic Info",
36
+ "dependants": "Dependants",
36
37
  "discard": "Discard",
37
38
  "discardModalBody": "The changes you made to this patient's details have not been saved. Discard changes?",
38
39
  "discardModalHeader": "Confirm Discard Changes",
@@ -95,7 +96,6 @@
95
96
  "relationshipPersonMustExist": "Related person must be an existing person",
96
97
  "relationshipPlaceholder": "Relationship",
97
98
  "relationshipRemovedText": "Relationship removed",
98
- "relationships": "Relationships",
99
99
  "relationshipsSection": "Relationships",
100
100
  "relationshipToPatient": "Relationship to patient",
101
101
  "relativeFullNameLabelText": "Related person",