oro-sdk 3.1.1 → 3.1.2-dev2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/dist/helpers/patient-registration.d.ts +8 -1
- package/dist/oro-sdk.cjs.development.js +1167 -606
- 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 +1166 -607
- package/dist/oro-sdk.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/helpers/patient-registration.ts +131 -5
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"version": "3.1.1",
|
2
|
+
"version": "3.1.2-dev2.1",
|
3
3
|
"main": "dist/index.js",
|
4
4
|
"typings": "dist/index.d.ts",
|
5
5
|
"files": [
|
@@ -54,8 +54,8 @@
|
|
54
54
|
"form-data": "^4.0.0",
|
55
55
|
"formdata-node": "^4.3.1",
|
56
56
|
"idb-keyval": "^5.0.6",
|
57
|
-
"oro-sdk-apis": "1.38.
|
57
|
+
"oro-sdk-apis": "1.38.2",
|
58
58
|
"oro-toolbox": "0.0.6",
|
59
59
|
"uuid": "^8.3.2"
|
60
60
|
}
|
61
|
-
}
|
61
|
+
}
|
@@ -5,14 +5,14 @@ import {
|
|
5
5
|
ConsultRequest,
|
6
6
|
DocumentType,
|
7
7
|
IdentityResponse,
|
8
|
-
IndexKey,
|
8
|
+
IndexKey, LocalizedData,
|
9
9
|
MedicalMeta,
|
10
10
|
MedicalStatus,
|
11
11
|
MetadataCategory,
|
12
|
-
PersonalMeta,
|
12
|
+
PersonalMeta, PopulatedWorkflowData,
|
13
13
|
Practitioner,
|
14
14
|
PreferenceMeta,
|
15
|
-
RawConsultationMeta,
|
15
|
+
RawConsultationMeta, Term, Terms,
|
16
16
|
Uuid,
|
17
17
|
VaultIndex,
|
18
18
|
WorkflowData,
|
@@ -20,9 +20,9 @@ import {
|
|
20
20
|
import {
|
21
21
|
filterTriggeredAnsweredWithKind,
|
22
22
|
getImagesFromIndexDb,
|
23
|
-
getWorkflowDataByCategory,
|
23
|
+
getWorkflowDataByCategory, identificationToPersonalInformations,
|
24
24
|
OroClient,
|
25
|
-
RegisterPatientOutput,
|
25
|
+
RegisterPatientOutput, toActualObject,
|
26
26
|
} from '..'
|
27
27
|
|
28
28
|
const MAX_RETRIES = 15
|
@@ -187,6 +187,11 @@ export async function registerPatient(
|
|
187
187
|
statusMedical: MedicalStatus.New,
|
188
188
|
})
|
189
189
|
|
190
|
+
await searchIndexConsultation(consult.uuid, oroClient).catch((err) => {
|
191
|
+
console.error('[SDK: registration] personal information not found or another error occured during search indexing', err)
|
192
|
+
errorsThrown.push(err)
|
193
|
+
})
|
194
|
+
|
190
195
|
// if we got through the complete flow, the registration succeeded
|
191
196
|
break
|
192
197
|
} catch (err) {
|
@@ -399,3 +404,124 @@ export async function extractAndStorePersonalWorkflowData(
|
|
399
404
|
)
|
400
405
|
})
|
401
406
|
}
|
407
|
+
|
408
|
+
export async function extractPersonalInfoFromConsultId(consultUuid: string, oroClient: OroClient): Promise<{
|
409
|
+
consultUuid: string,
|
410
|
+
personalInformations: LocalizedData<PopulatedWorkflowData>,
|
411
|
+
childPersonalInformations: LocalizedData<PopulatedWorkflowData>,
|
412
|
+
otherPersonalInformations: LocalizedData<PopulatedWorkflowData>,
|
413
|
+
}> {
|
414
|
+
return Promise.all([
|
415
|
+
// Retrieve MetadataCategory.Personal in any case
|
416
|
+
oroClient
|
417
|
+
.getPersonalInformationsFromConsultId(consultUuid, MetadataCategory.Personal, true)
|
418
|
+
.then((personalInformations) => {
|
419
|
+
if (!personalInformations[0]) {
|
420
|
+
console.error(
|
421
|
+
`${MetadataCategory.Personal} informations not found for consult:`,
|
422
|
+
consultUuid
|
423
|
+
)
|
424
|
+
|
425
|
+
throw Error('No self personal information found')
|
426
|
+
}
|
427
|
+
|
428
|
+
return personalInformations[0]
|
429
|
+
}),
|
430
|
+
// Retrieve MetadataCategory.ChildPersonal in any case in parallel
|
431
|
+
oroClient
|
432
|
+
.getPersonalInformationsFromConsultId(consultUuid, MetadataCategory.ChildPersonal, true)
|
433
|
+
.then((childInformations): any => {
|
434
|
+
if (!childInformations[0]) {
|
435
|
+
console.debug(
|
436
|
+
`${MetadataCategory.ChildPersonal} informations not found for consult:`,
|
437
|
+
consultUuid
|
438
|
+
)
|
439
|
+
|
440
|
+
// Retrieve MetadataCategory.OtherPersonal only if MetadataCategory.ChildPersonal does not exist
|
441
|
+
return oroClient
|
442
|
+
.getPersonalInformationsFromConsultId(
|
443
|
+
consultUuid,
|
444
|
+
MetadataCategory.OtherPersonal,
|
445
|
+
true
|
446
|
+
)
|
447
|
+
.then((otherInformations) => {
|
448
|
+
if (!otherInformations[0]) {
|
449
|
+
console.debug(
|
450
|
+
`${MetadataCategory.OtherPersonal} informations not found for consult:`,
|
451
|
+
consultUuid
|
452
|
+
)
|
453
|
+
|
454
|
+
return {}
|
455
|
+
}
|
456
|
+
|
457
|
+
return { otherPersonalInformations: otherInformations[0] }
|
458
|
+
})
|
459
|
+
}
|
460
|
+
|
461
|
+
return { childPersonalInformations: childInformations[0] }
|
462
|
+
}),
|
463
|
+
]).then(([personalInformations, { childPersonalInformations, otherPersonalInformations }]) => {
|
464
|
+
return {
|
465
|
+
consultUuid,
|
466
|
+
personalInformations,
|
467
|
+
childPersonalInformations,
|
468
|
+
otherPersonalInformations,
|
469
|
+
}
|
470
|
+
})
|
471
|
+
}
|
472
|
+
|
473
|
+
export async function searchIndexConsultation(consultUuid: string, oroClient: OroClient) {
|
474
|
+
let terms: Terms = []
|
475
|
+
|
476
|
+
console.log('here')
|
477
|
+
|
478
|
+
const {
|
479
|
+
personalInformations,
|
480
|
+
childPersonalInformations,
|
481
|
+
otherPersonalInformations
|
482
|
+
} = await extractPersonalInfoFromConsultId(consultUuid, oroClient)
|
483
|
+
|
484
|
+
console.log('personal=', personalInformations, 'child=', childPersonalInformations, 'other=', otherPersonalInformations)
|
485
|
+
|
486
|
+
const personalInfo = identificationToPersonalInformations(
|
487
|
+
toActualObject(personalInformations.data),
|
488
|
+
MetadataCategory.Personal
|
489
|
+
)
|
490
|
+
terms.push(<Term>{
|
491
|
+
kind: 'first-name',
|
492
|
+
value: personalInfo.firstname,
|
493
|
+
}, <Term> {
|
494
|
+
kind: 'last-name',
|
495
|
+
value: personalInfo.name
|
496
|
+
})
|
497
|
+
|
498
|
+
if(childPersonalInformations) {
|
499
|
+
const childPersonalInfo = identificationToPersonalInformations(
|
500
|
+
toActualObject(childPersonalInformations.data),
|
501
|
+
MetadataCategory.ChildPersonal
|
502
|
+
)
|
503
|
+
terms.push(<Term>{
|
504
|
+
kind: 'first-name',
|
505
|
+
value: childPersonalInfo.firstname,
|
506
|
+
}, <Term> {
|
507
|
+
kind: 'last-name',
|
508
|
+
value: childPersonalInfo.name
|
509
|
+
})
|
510
|
+
}
|
511
|
+
|
512
|
+
if(otherPersonalInformations) {
|
513
|
+
const otherPersonalInfo = identificationToPersonalInformations(
|
514
|
+
toActualObject(otherPersonalInformations.data),
|
515
|
+
MetadataCategory.OtherPersonal
|
516
|
+
)
|
517
|
+
terms.push(<Term>{
|
518
|
+
kind: 'first-name',
|
519
|
+
value: otherPersonalInfo.firstname,
|
520
|
+
}, <Term> {
|
521
|
+
kind: 'last-name',
|
522
|
+
value: otherPersonalInfo.name
|
523
|
+
})
|
524
|
+
}
|
525
|
+
|
526
|
+
await oroClient.searchClient.index(consultUuid, terms)
|
527
|
+
}
|