oro-sdk 3.1.2-dev2 → 3.2.0
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/helpers/patient-registration.d.ts +16 -7
- package/dist/oro-sdk.cjs.development.js +54 -72
- package/dist/oro-sdk.cjs.development.js.map +1 -1
- package/dist/oro-sdk.cjs.production.min.js +1 -1
- package/dist/oro-sdk.cjs.production.min.js.map +1 -1
- package/dist/oro-sdk.esm.js +53 -71
- package/dist/oro-sdk.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/helpers/patient-registration.ts +54 -84
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ConsultRequest,
|
1
|
+
import { ConsultRequest, MetadataCategory, PopulatedWorkflowData, Uuid, WorkflowData } from 'oro-sdk-apis';
|
2
2
|
import { OroClient, RegisterPatientOutput } from '..';
|
3
3
|
/**
|
4
4
|
* Completes a registration for a user retrying the complete flow a maximum of 15 times
|
@@ -34,10 +34,19 @@ export declare function registerPatient(patientUuid: Uuid, consultRequest: Consu
|
|
34
34
|
* @returns The data uuid
|
35
35
|
*/
|
36
36
|
export declare function extractAndStorePersonalWorkflowData(workflow: WorkflowData, lockboxUuid: Uuid, consultationId: Uuid, category: MetadataCategory.Personal | MetadataCategory.ChildPersonal | MetadataCategory.OtherPersonal, oroClient: OroClient): Promise<Uuid | void>;
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
/**
|
38
|
+
* Given workflow data, it populates it with Personal, ChildPersonal, and OtherPersonal workflow data
|
39
|
+
* @param workflow
|
40
|
+
*/
|
41
|
+
export declare function extractPersonalInfoFromWorkflowData(workflow: WorkflowData): Promise<{
|
42
|
+
personalInfoPopulatedWfData: PopulatedWorkflowData;
|
43
|
+
childPersonalInfoPopulatedWfData: PopulatedWorkflowData;
|
44
|
+
otherPersonalInfoPopulatedWfData: PopulatedWorkflowData;
|
42
45
|
}>;
|
43
|
-
|
46
|
+
/**
|
47
|
+
* Creates the search index for the first and last name of the given consultation
|
48
|
+
* @param consultUuid the uuid of the consult to be search indexed
|
49
|
+
* @param workflow the workflow data
|
50
|
+
* @param oroClient
|
51
|
+
*/
|
52
|
+
export declare function buildConsultSearchIndex(consultUuid: string, workflow: WorkflowData, oroClient: OroClient): Promise<void>;
|
@@ -1808,24 +1808,27 @@ function _registerPatient() {
|
|
1808
1808
|
return Promise.all([].concat(grantPromises, consultIndexPromises));
|
1809
1809
|
|
1810
1810
|
case 43:
|
1811
|
+
_context3.next = 45;
|
1812
|
+
return buildConsultSearchIndex(consult.uuid, workflow, oroClient)["catch"](function (err) {
|
1813
|
+
console.error('[SDK: registration] personal information not found or another error occured during search indexing', err);
|
1814
|
+
if (retry <= 1) return; // this statement is to avoid failing the registration due to the failure in search indexing the consult, this practically implements a soft retry
|
1815
|
+
|
1816
|
+
// this statement is to avoid failing the registration due to the failure in search indexing the consult, this practically implements a soft retry
|
1817
|
+
errorsThrown.push(err);
|
1818
|
+
});
|
1819
|
+
|
1820
|
+
case 45:
|
1811
1821
|
if (!(errorsThrown.length > 0)) {
|
1812
|
-
_context3.next =
|
1822
|
+
_context3.next = 47;
|
1813
1823
|
break;
|
1814
1824
|
}
|
1815
1825
|
|
1816
1826
|
throw errorsThrown;
|
1817
1827
|
|
1818
|
-
case 45:
|
1819
|
-
_context3.next = 47;
|
1820
|
-
return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
|
1821
|
-
statusMedical: initApis.MedicalStatus.New
|
1822
|
-
});
|
1823
|
-
|
1824
1828
|
case 47:
|
1825
1829
|
_context3.next = 49;
|
1826
|
-
return
|
1827
|
-
|
1828
|
-
errorsThrown.push(err);
|
1830
|
+
return oroClient.consultClient.updateConsultByUUID(consult.uuid, {
|
1831
|
+
statusMedical: initApis.MedicalStatus.New
|
1829
1832
|
});
|
1830
1833
|
|
1831
1834
|
case 49:
|
@@ -2115,6 +2118,10 @@ function _storeImageAliases() {
|
|
2115
2118
|
function extractAndStorePersonalWorkflowData(_x19, _x20, _x21, _x22, _x23) {
|
2116
2119
|
return _extractAndStorePersonalWorkflowData.apply(this, arguments);
|
2117
2120
|
}
|
2121
|
+
/**
|
2122
|
+
* Given workflow data, it populates it with Personal, ChildPersonal, and OtherPersonal workflow data
|
2123
|
+
* @param workflow
|
2124
|
+
*/
|
2118
2125
|
|
2119
2126
|
function _extractAndStorePersonalWorkflowData() {
|
2120
2127
|
_extractAndStorePersonalWorkflowData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(workflow, lockboxUuid, consultationId, category, oroClient) {
|
@@ -2141,55 +2148,30 @@ function _extractAndStorePersonalWorkflowData() {
|
|
2141
2148
|
return _extractAndStorePersonalWorkflowData.apply(this, arguments);
|
2142
2149
|
}
|
2143
2150
|
|
2144
|
-
function
|
2145
|
-
return
|
2151
|
+
function extractPersonalInfoFromWorkflowData(_x24) {
|
2152
|
+
return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
|
2146
2153
|
}
|
2154
|
+
/**
|
2155
|
+
* Creates the search index for the first and last name of the given consultation
|
2156
|
+
* @param consultUuid the uuid of the consult to be search indexed
|
2157
|
+
* @param workflow the workflow data
|
2158
|
+
* @param oroClient
|
2159
|
+
*/
|
2147
2160
|
|
2148
|
-
function
|
2149
|
-
|
2161
|
+
function _extractPersonalInfoFromWorkflowData() {
|
2162
|
+
_extractPersonalInfoFromWorkflowData = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(workflow) {
|
2150
2163
|
return runtime_1.wrap(function _callee10$(_context10) {
|
2151
2164
|
while (1) {
|
2152
2165
|
switch (_context10.prev = _context10.next) {
|
2153
2166
|
case 0:
|
2154
|
-
return _context10.abrupt("return", Promise.all([
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
throw Error('No self personal information found');
|
2159
|
-
}
|
2160
|
-
|
2161
|
-
return personalInformations[0];
|
2162
|
-
}), // Retrieve MetadataCategory.ChildPersonal in any case in parallel
|
2163
|
-
oroClient.getPersonalInformationsFromConsultId(consultUuid, initApis.MetadataCategory.ChildPersonal, true).then(function (childInformations) {
|
2164
|
-
if (!childInformations[0]) {
|
2165
|
-
console.debug(initApis.MetadataCategory.ChildPersonal + " informations not found for consult:", consultUuid); // Retrieve MetadataCategory.OtherPersonal only if MetadataCategory.ChildPersonal does not exist
|
2166
|
-
|
2167
|
-
// Retrieve MetadataCategory.OtherPersonal only if MetadataCategory.ChildPersonal does not exist
|
2168
|
-
return oroClient.getPersonalInformationsFromConsultId(consultUuid, initApis.MetadataCategory.OtherPersonal, true).then(function (otherInformations) {
|
2169
|
-
if (!otherInformations[0]) {
|
2170
|
-
console.debug(initApis.MetadataCategory.OtherPersonal + " informations not found for consult:", consultUuid);
|
2171
|
-
return {};
|
2172
|
-
}
|
2173
|
-
|
2174
|
-
return {
|
2175
|
-
otherPersonalInformations: otherInformations[0]
|
2176
|
-
};
|
2177
|
-
});
|
2178
|
-
}
|
2179
|
-
|
2167
|
+
return _context10.abrupt("return", Promise.all([getWorkflowDataByCategory(workflow, initApis.MetadataCategory.Personal), getWorkflowDataByCategory(workflow, initApis.MetadataCategory.ChildPersonal), getWorkflowDataByCategory(workflow, initApis.MetadataCategory.OtherPersonal)]).then(function (_ref3) {
|
2168
|
+
var personalInfoPopulatedWfData = _ref3[0],
|
2169
|
+
childPersonalInfoPopulatedWfData = _ref3[1],
|
2170
|
+
otherPersonalInfoPopulatedWfData = _ref3[2];
|
2180
2171
|
return {
|
2181
|
-
|
2182
|
-
|
2183
|
-
|
2184
|
-
var personalInformations = _ref3[0],
|
2185
|
-
_ref3$ = _ref3[1],
|
2186
|
-
childPersonalInformations = _ref3$.childPersonalInformations,
|
2187
|
-
otherPersonalInformations = _ref3$.otherPersonalInformations;
|
2188
|
-
return {
|
2189
|
-
consultUuid: consultUuid,
|
2190
|
-
personalInformations: personalInformations,
|
2191
|
-
childPersonalInformations: childPersonalInformations,
|
2192
|
-
otherPersonalInformations: otherPersonalInformations
|
2172
|
+
personalInfoPopulatedWfData: personalInfoPopulatedWfData,
|
2173
|
+
childPersonalInfoPopulatedWfData: childPersonalInfoPopulatedWfData,
|
2174
|
+
otherPersonalInfoPopulatedWfData: otherPersonalInfoPopulatedWfData
|
2193
2175
|
};
|
2194
2176
|
}));
|
2195
2177
|
|
@@ -2200,16 +2182,16 @@ function _extractPersonalInfoFromConsultId() {
|
|
2200
2182
|
}
|
2201
2183
|
}, _callee10);
|
2202
2184
|
}));
|
2203
|
-
return
|
2185
|
+
return _extractPersonalInfoFromWorkflowData.apply(this, arguments);
|
2204
2186
|
}
|
2205
2187
|
|
2206
|
-
function
|
2207
|
-
return
|
2188
|
+
function buildConsultSearchIndex(_x25, _x26, _x27) {
|
2189
|
+
return _buildConsultSearchIndex.apply(this, arguments);
|
2208
2190
|
}
|
2209
2191
|
|
2210
|
-
function
|
2211
|
-
|
2212
|
-
var terms, _yield$extractPersona,
|
2192
|
+
function _buildConsultSearchIndex() {
|
2193
|
+
_buildConsultSearchIndex = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11(consultUuid, workflow, oroClient) {
|
2194
|
+
var terms, _yield$extractPersona, personalInfoPopulatedWfData, childPersonalInfoPopulatedWfData, otherPersonalInfoPopulatedWfData, personalInfo, childPersonalInfo, otherPersonalInfo;
|
2213
2195
|
|
2214
2196
|
return runtime_1.wrap(function _callee11$(_context11) {
|
2215
2197
|
while (1) {
|
@@ -2217,14 +2199,16 @@ function _searchIndexConsultation() {
|
|
2217
2199
|
case 0:
|
2218
2200
|
terms = [];
|
2219
2201
|
_context11.next = 3;
|
2220
|
-
return
|
2202
|
+
return extractPersonalInfoFromWorkflowData(workflow);
|
2221
2203
|
|
2222
2204
|
case 3:
|
2223
2205
|
_yield$extractPersona = _context11.sent;
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
personalInfo = identificationToPersonalInformations(toActualObject(
|
2206
|
+
personalInfoPopulatedWfData = _yield$extractPersona.personalInfoPopulatedWfData;
|
2207
|
+
childPersonalInfoPopulatedWfData = _yield$extractPersona.childPersonalInfoPopulatedWfData;
|
2208
|
+
otherPersonalInfoPopulatedWfData = _yield$extractPersona.otherPersonalInfoPopulatedWfData;
|
2209
|
+
personalInfo = identificationToPersonalInformations(toActualObject(personalInfoPopulatedWfData), initApis.MetadataCategory.Personal);
|
2210
|
+
childPersonalInfo = identificationToPersonalInformations(toActualObject(childPersonalInfoPopulatedWfData), initApis.MetadataCategory.ChildPersonal);
|
2211
|
+
otherPersonalInfo = identificationToPersonalInformations(toActualObject(otherPersonalInfoPopulatedWfData), initApis.MetadataCategory.OtherPersonal);
|
2228
2212
|
terms.push({
|
2229
2213
|
kind: 'first-name',
|
2230
2214
|
value: personalInfo.firstname
|
@@ -2233,8 +2217,7 @@ function _searchIndexConsultation() {
|
|
2233
2217
|
value: personalInfo.name
|
2234
2218
|
});
|
2235
2219
|
|
2236
|
-
if (
|
2237
|
-
childPersonalInfo = identificationToPersonalInformations(toActualObject(childPersonalInformations.data), initApis.MetadataCategory.ChildPersonal);
|
2220
|
+
if (childPersonalInfo.firstname && childPersonalInfo.name) {
|
2238
2221
|
terms.push({
|
2239
2222
|
kind: 'first-name',
|
2240
2223
|
value: childPersonalInfo.firstname
|
@@ -2244,8 +2227,7 @@ function _searchIndexConsultation() {
|
|
2244
2227
|
});
|
2245
2228
|
}
|
2246
2229
|
|
2247
|
-
if (
|
2248
|
-
otherPersonalInfo = identificationToPersonalInformations(toActualObject(otherPersonalInformations.data), initApis.MetadataCategory.OtherPersonal);
|
2230
|
+
if (otherPersonalInfo.firstname && otherPersonalInfo.name) {
|
2249
2231
|
terms.push({
|
2250
2232
|
kind: 'first-name',
|
2251
2233
|
value: otherPersonalInfo.firstname
|
@@ -2255,17 +2237,17 @@ function _searchIndexConsultation() {
|
|
2255
2237
|
});
|
2256
2238
|
}
|
2257
2239
|
|
2258
|
-
_context11.next =
|
2240
|
+
_context11.next = 15;
|
2259
2241
|
return oroClient.searchClient.index(consultUuid, terms);
|
2260
2242
|
|
2261
|
-
case
|
2243
|
+
case 15:
|
2262
2244
|
case "end":
|
2263
2245
|
return _context11.stop();
|
2264
2246
|
}
|
2265
2247
|
}
|
2266
2248
|
}, _callee11);
|
2267
2249
|
}));
|
2268
|
-
return
|
2250
|
+
return _buildConsultSearchIndex.apply(this, arguments);
|
2269
2251
|
}
|
2270
2252
|
|
2271
2253
|
/**
|
@@ -5755,12 +5737,13 @@ exports.MissingLockbox = MissingLockbox;
|
|
5755
5737
|
exports.MissingLockboxOwner = MissingLockboxOwner;
|
5756
5738
|
exports.OroClient = OroClient;
|
5757
5739
|
exports.WorkflowAnswersMissingError = WorkflowAnswersMissingError;
|
5740
|
+
exports.buildConsultSearchIndex = buildConsultSearchIndex;
|
5758
5741
|
exports.decryptConsultLockboxGrants = decryptConsultLockboxGrants;
|
5759
5742
|
exports.decryptGrants = decryptGrants;
|
5760
5743
|
exports.default = init;
|
5761
5744
|
exports.extractAndStorePersonalWorkflowData = extractAndStorePersonalWorkflowData;
|
5762
5745
|
exports.extractISOLocalityForConsult = extractISOLocalityForConsult;
|
5763
|
-
exports.
|
5746
|
+
exports.extractPersonalInfoFromWorkflowData = extractPersonalInfoFromWorkflowData;
|
5764
5747
|
exports.fillWorkflowFromPopulatedWorkflow = fillWorkflowFromPopulatedWorkflow;
|
5765
5748
|
exports.filterTriggeredAnsweredWithKind = filterTriggeredAnsweredWithKind;
|
5766
5749
|
exports.flattenSelectedAnswers = flattenSelectedAnswers;
|
@@ -5770,7 +5753,6 @@ exports.getWorkflowDataByCategory = getWorkflowDataByCategory;
|
|
5770
5753
|
exports.identificationToPersonalInformations = identificationToPersonalInformations;
|
5771
5754
|
exports.isTriggered = isTriggered;
|
5772
5755
|
exports.registerPatient = registerPatient;
|
5773
|
-
exports.searchIndexConsultation = searchIndexConsultation;
|
5774
5756
|
exports.sessionStorePrivateKeyName = sessionStorePrivateKeyName;
|
5775
5757
|
exports.toActualObject = toActualObject;
|
5776
5758
|
exports.updatePersonalIntoPopulatedWorkflowData = updatePersonalIntoPopulatedWorkflowData;
|