sdc-qrf 0.1.3 → 0.3.1
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/lib/components.d.ts +3 -3
- package/lib/components.js +12 -12
- package/lib/components.js.map +1 -1
- package/lib/context.d.ts +0 -1
- package/lib/converter/extensions.d.ts +35 -0
- package/lib/converter/extensions.js +128 -0
- package/lib/converter/extensions.js.map +1 -0
- package/lib/converter/fceToFhir/index.d.ts +4 -0
- package/lib/converter/fceToFhir/index.js +15 -0
- package/lib/converter/fceToFhir/index.js.map +1 -0
- package/lib/converter/fceToFhir/questionnaire/index.d.ts +3 -0
- package/lib/converter/fceToFhir/questionnaire/index.js +17 -0
- package/lib/converter/fceToFhir/questionnaire/index.js.map +1 -0
- package/lib/converter/fceToFhir/questionnaire/processExtensions.d.ts +3 -0
- package/lib/converter/fceToFhir/questionnaire/processExtensions.js +61 -0
- package/lib/converter/fceToFhir/questionnaire/processExtensions.js.map +1 -0
- package/lib/converter/fceToFhir/questionnaire/processItems.d.ts +3 -0
- package/lib/converter/fceToFhir/questionnaire/processItems.js +144 -0
- package/lib/converter/fceToFhir/questionnaire/processItems.js.map +1 -0
- package/lib/converter/fceToFhir/questionnaire/processMeta.d.ts +3 -0
- package/lib/converter/fceToFhir/questionnaire/processMeta.js +20 -0
- package/lib/converter/fceToFhir/questionnaire/processMeta.js.map +1 -0
- package/lib/converter/fceToFhir/questionnaireResponse/index.d.ts +3 -0
- package/lib/converter/fceToFhir/questionnaireResponse/index.js +20 -0
- package/lib/converter/fceToFhir/questionnaireResponse/index.js.map +1 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processAnswers.d.ts +2 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processAnswers.js +48 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processAnswers.js.map +1 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processMeta.d.ts +3 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processMeta.js +18 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processMeta.js.map +1 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processReference.d.ts +3 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processReference.js +19 -0
- package/lib/converter/fceToFhir/questionnaireResponse/processReference.js.map +1 -0
- package/lib/converter/fhirToFce/index.d.ts +4 -0
- package/lib/converter/fhirToFce/index.js +15 -0
- package/lib/converter/fhirToFce/index.js.map +1 -0
- package/lib/converter/fhirToFce/questionnaire/index.d.ts +3 -0
- package/lib/converter/fhirToFce/questionnaire/index.js +21 -0
- package/lib/converter/fhirToFce/questionnaire/index.js.map +1 -0
- package/lib/converter/fhirToFce/questionnaire/processExtensions.d.ts +8 -0
- package/lib/converter/fhirToFce/questionnaire/processExtensions.js +89 -0
- package/lib/converter/fhirToFce/questionnaire/processExtensions.js.map +1 -0
- package/lib/converter/fhirToFce/questionnaire/processItems.d.ts +3 -0
- package/lib/converter/fhirToFce/questionnaire/processItems.js +131 -0
- package/lib/converter/fhirToFce/questionnaire/processItems.js.map +1 -0
- package/lib/converter/fhirToFce/questionnaire/processMeta.d.ts +32 -0
- package/lib/converter/fhirToFce/questionnaire/processMeta.js +14 -0
- package/lib/converter/fhirToFce/questionnaire/processMeta.js.map +1 -0
- package/lib/converter/fhirToFce/questionnaireResponse/index.d.ts +3 -0
- package/lib/converter/fhirToFce/questionnaireResponse/index.js +20 -0
- package/lib/converter/fhirToFce/questionnaireResponse/index.js.map +1 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processAnswers.d.ts +2 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processAnswers.js +46 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processAnswers.js.map +1 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processMeta.d.ts +3 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processMeta.js +15 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processMeta.js.map +1 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processReference.d.ts +3 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processReference.js +18 -0
- package/lib/converter/fhirToFce/questionnaireResponse/processReference.js.map +1 -0
- package/lib/converter/fhirToFce/utils.d.ts +3 -0
- package/lib/converter/fhirToFce/utils.js +37 -0
- package/lib/converter/fhirToFce/utils.js.map +1 -0
- package/lib/converter/index.d.ts +12 -0
- package/lib/converter/index.js +84 -0
- package/lib/converter/index.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/setupTests.d.ts +1 -0
- package/lib/setupTests.js +4 -0
- package/lib/setupTests.js.map +1 -0
- package/lib/types.d.ts +10 -10
- package/lib/utils.d.ts +4 -1
- package/lib/utils.js +9 -2
- package/lib/utils.js.map +1 -1
- package/package.json +4 -5
- package/src/components.tsx +12 -12
- package/src/converter/__tests__/fce.test.ts +224 -0
- package/src/converter/__tests__/resources/questionnaire_fce/allergies.json +405 -0
- package/src/converter/__tests__/resources/questionnaire_fce/beverages.json +72 -0
- package/src/converter/__tests__/resources/questionnaire_fce/choice_answer_option.json +53 -0
- package/src/converter/__tests__/resources/questionnaire_fce/consent.json +86 -0
- package/src/converter/__tests__/resources/questionnaire_fce/enable_when.json +103 -0
- package/src/converter/__tests__/resources/questionnaire_fce/encounter_create.json +126 -0
- package/src/converter/__tests__/resources/questionnaire_fce/gad_7.json +459 -0
- package/src/converter/__tests__/resources/questionnaire_fce/immunization.json +182 -0
- package/src/converter/__tests__/resources/questionnaire_fce/medication.json +189 -0
- package/src/converter/__tests__/resources/questionnaire_fce/multiple_type_launch_context.json +406 -0
- package/src/converter/__tests__/resources/questionnaire_fce/patient_create.json +84 -0
- package/src/converter/__tests__/resources/questionnaire_fce/patient_edit.json +125 -0
- package/src/converter/__tests__/resources/questionnaire_fce/phq_2_phq_9.json +552 -0
- package/src/converter/__tests__/resources/questionnaire_fce/physicalexam.json +385 -0
- package/src/converter/__tests__/resources/questionnaire_fce/practitioner_create.json +90 -0
- package/src/converter/__tests__/resources/questionnaire_fce/practitioner_create_structure_map.json +91 -0
- package/src/converter/__tests__/resources/questionnaire_fce/practitioner_edit.json +144 -0
- package/src/converter/__tests__/resources/questionnaire_fce/practitioner_role_create.json +37 -0
- package/src/converter/__tests__/resources/questionnaire_fce/public_appointment.json +91 -0
- package/src/converter/__tests__/resources/questionnaire_fce/review_of_systems.json +389 -0
- package/src/converter/__tests__/resources/questionnaire_fce/source_queries.json +34 -0
- package/src/converter/__tests__/resources/questionnaire_fce/vitals.json +234 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/allergies.json +433 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/beverages.json +99 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/choice_answer_option.json +49 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/consent.json +119 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/enable_when.json +87 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/encounter_create.json +171 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/gad_7.json +489 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/immunization.json +215 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/medication.json +226 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/multiple_type_launch_context.json +416 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/patient_create.json +97 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/patient_edit.json +183 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/phq_2_phq_9.json +580 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/physicalexam.json +544 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create.json +87 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create_structure_map.json +91 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_edit.json +193 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_role_create.json +44 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/public_appointment.json +116 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/review_of_systems.json +368 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/source_queries.json +37 -0
- package/src/converter/__tests__/resources/questionnaire_fhir/vitals.json +317 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/allergies_inprogress.json +78 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/cardiology.json +96 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/few_answers.json +48 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/gad_7.json +165 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/immunization.json +86 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/medication.json +116 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/new_appointment.json +96 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/patient.json +87 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/phq_2_phq_9.json +193 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/physicalexam.json +187 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/practitioner.json +57 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/reference_answer_with_assoc.json +147 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/review_of_systems.json +129 -0
- package/src/converter/__tests__/resources/questionnaire_response_fce/vitals.json +168 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/allergies_inprogress.json +73 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/cardiology.json +87 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/few_answers.json +46 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/gad_7.json +146 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/immunization.json +77 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/medication.json +101 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/new_appointment.json +86 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/patient.json +78 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/phq_2_phq_9.json +170 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/physicalexam.json +158 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/practitioner.json +54 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/reference_answer_with_assoc.json +86 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/review_of_systems.json +118 -0
- package/src/converter/__tests__/resources/questionnaire_response_fhir/vitals.json +145 -0
- package/src/converter/extensions.ts +149 -0
- package/src/converter/fceToFhir/index.ts +27 -0
- package/src/converter/fceToFhir/questionnaire/index.ts +15 -0
- package/src/converter/fceToFhir/questionnaire/processExtensions.ts +75 -0
- package/src/converter/fceToFhir/questionnaire/processItems.ts +194 -0
- package/src/converter/fceToFhir/questionnaire/processMeta.ts +19 -0
- package/src/converter/fceToFhir/questionnaireResponse/index.ts +21 -0
- package/src/converter/fceToFhir/questionnaireResponse/processAnswers.ts +53 -0
- package/src/converter/fceToFhir/questionnaireResponse/processMeta.ts +16 -0
- package/src/converter/fceToFhir/questionnaireResponse/processReference.ts +24 -0
- package/src/converter/fhirToFce/index.ts +27 -0
- package/src/converter/fhirToFce/questionnaire/index.ts +25 -0
- package/src/converter/fhirToFce/questionnaire/processExtensions.ts +113 -0
- package/src/converter/fhirToFce/questionnaire/processItems.ts +159 -0
- package/src/converter/fhirToFce/questionnaire/processMeta.ts +17 -0
- package/src/converter/fhirToFce/questionnaireResponse/index.ts +21 -0
- package/src/converter/fhirToFce/questionnaireResponse/processAnswers.ts +53 -0
- package/src/converter/fhirToFce/questionnaireResponse/processMeta.ts +14 -0
- package/src/converter/fhirToFce/questionnaireResponse/processReference.ts +20 -0
- package/src/converter/fhirToFce/utils.ts +36 -0
- package/src/converter/index.ts +106 -0
- package/src/index.ts +1 -0
- package/src/setupTests.ts +1 -0
- package/src/utils.ts +13 -2
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QuestionnaireResponse as FHIRQuestionnaireResponse,
|
|
3
|
+
Questionnaire as FHIRQuestionnaire,
|
|
4
|
+
} from 'fhir/r4b';
|
|
5
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
QuestionnaireResponse as FCEQuestionnaireResponse,
|
|
9
|
+
Questionnaire as FCEQuestionnaire,
|
|
10
|
+
} from 'shared/src/contrib/aidbox';
|
|
11
|
+
|
|
12
|
+
// fce questionnaire
|
|
13
|
+
import fce_allergies from './resources/questionnaire_fce/allergies.json';
|
|
14
|
+
import fce_beverages from './resources/questionnaire_fce/beverages.json';
|
|
15
|
+
import fce_choice_answer_option from './resources/questionnaire_fce/choice_answer_option.json';
|
|
16
|
+
import fce_consent from './resources/questionnaire_fce/consent.json';
|
|
17
|
+
import fce_enable_when from './resources/questionnaire_fce/enable_when.json';
|
|
18
|
+
import fce_encounter_create from './resources/questionnaire_fce/encounter_create.json';
|
|
19
|
+
import fce_gad_7 from './resources/questionnaire_fce/gad_7.json';
|
|
20
|
+
import fce_immunization from './resources/questionnaire_fce/immunization.json';
|
|
21
|
+
import fce_medication from './resources/questionnaire_fce/medication.json';
|
|
22
|
+
import fce_multiple_type_launch_context from './resources/questionnaire_fce/multiple_type_launch_context.json';
|
|
23
|
+
import fce_patient_create from './resources/questionnaire_fce/patient_create.json';
|
|
24
|
+
import fce_patient_edit from './resources/questionnaire_fce/patient_edit.json';
|
|
25
|
+
import fce_phq_2_phq_9 from './resources/questionnaire_fce/phq_2_phq_9.json';
|
|
26
|
+
import fce_physicalexam from './resources/questionnaire_fce/physicalexam.json';
|
|
27
|
+
import fce_practitioner_create from './resources/questionnaire_fce/practitioner_create.json';
|
|
28
|
+
import fce_practitioner_create_structure_map from './resources/questionnaire_fce/practitioner_create_structure_map.json';
|
|
29
|
+
import fce_practitioner_edit from './resources/questionnaire_fce/practitioner_edit.json';
|
|
30
|
+
import fce_practitioner_role_create from './resources/questionnaire_fce/practitioner_role_create.json';
|
|
31
|
+
import fce_public_appointment from './resources/questionnaire_fce/public_appointment.json';
|
|
32
|
+
import fce_review_of_systems from './resources/questionnaire_fce/review_of_systems.json';
|
|
33
|
+
import fce_source_queries from './resources/questionnaire_fce/source_queries.json';
|
|
34
|
+
import fce_vitals from './resources/questionnaire_fce/vitals.json';
|
|
35
|
+
// fhir questionnaire
|
|
36
|
+
import fhir_allergies from './resources/questionnaire_fhir/allergies.json';
|
|
37
|
+
import fhir_beverages from './resources/questionnaire_fhir/beverages.json';
|
|
38
|
+
import fhir_choice_answer_option from './resources/questionnaire_fhir/choice_answer_option.json';
|
|
39
|
+
import fhir_consent from './resources/questionnaire_fhir/consent.json';
|
|
40
|
+
import fhir_enable_when from './resources/questionnaire_fhir/enable_when.json';
|
|
41
|
+
import fhir_encounter_create from './resources/questionnaire_fhir/encounter_create.json';
|
|
42
|
+
import fhir_gad_7 from './resources/questionnaire_fhir/gad_7.json';
|
|
43
|
+
import fhir_immunization from './resources/questionnaire_fhir/immunization.json';
|
|
44
|
+
import fhir_medication from './resources/questionnaire_fhir/medication.json';
|
|
45
|
+
import fhir_multiple_type_launch_context from './resources/questionnaire_fhir/multiple_type_launch_context.json';
|
|
46
|
+
import fhir_patient_create from './resources/questionnaire_fhir/patient_create.json';
|
|
47
|
+
import fhir_patient_edit from './resources/questionnaire_fhir/patient_edit.json';
|
|
48
|
+
import fhir_phq_2_phq_9 from './resources/questionnaire_fhir/phq_2_phq_9.json';
|
|
49
|
+
import fhir_physicalexam from './resources/questionnaire_fhir/physicalexam.json';
|
|
50
|
+
import fhir_practitioner_create from './resources/questionnaire_fhir/practitioner_create.json';
|
|
51
|
+
import fhir_practitioner_create_structure_map from './resources/questionnaire_fhir/practitioner_create_structure_map.json';
|
|
52
|
+
import fhir_practitioner_edit from './resources/questionnaire_fhir/practitioner_edit.json';
|
|
53
|
+
import fhir_practitioner_role_create from './resources/questionnaire_fhir/practitioner_role_create.json';
|
|
54
|
+
import fhir_public_appointment from './resources/questionnaire_fhir/public_appointment.json';
|
|
55
|
+
import fhir_review_of_systems from './resources/questionnaire_fhir/review_of_systems.json';
|
|
56
|
+
import fhir_source_queries from './resources/questionnaire_fhir/source_queries.json';
|
|
57
|
+
import fhir_vitals from './resources/questionnaire_fhir/vitals.json';
|
|
58
|
+
// fce questionnaire response
|
|
59
|
+
import fce_allergies_inprogress_qr from './resources/questionnaire_response_fce/allergies_inprogress.json';
|
|
60
|
+
import fce_cardiology_qr from './resources/questionnaire_response_fce/cardiology.json';
|
|
61
|
+
import fce_few_answers_qr from './resources/questionnaire_response_fce/few_answers.json';
|
|
62
|
+
import fce_gad_7_qr from './resources/questionnaire_response_fce/gad_7.json';
|
|
63
|
+
import fce_immunization_qr from './resources/questionnaire_response_fce/immunization.json';
|
|
64
|
+
import fce_medication_qr from './resources/questionnaire_response_fce/medication.json';
|
|
65
|
+
import fce_new_appointment_qr from './resources/questionnaire_response_fce/new_appointment.json';
|
|
66
|
+
import fce_patient_qr from './resources/questionnaire_response_fce/patient.json';
|
|
67
|
+
import fce_phq_2_phq_9_qr from './resources/questionnaire_response_fce/phq_2_phq_9.json';
|
|
68
|
+
import fce_physicalexam_qr from './resources/questionnaire_response_fce/physicalexam.json';
|
|
69
|
+
import fce_practitioner_qr from './resources/questionnaire_response_fce/practitioner.json';
|
|
70
|
+
import fce_reference_answer_with_assoc from './resources/questionnaire_response_fce/reference_answer_with_assoc.json';
|
|
71
|
+
import fce_review_of_systems_qr from './resources/questionnaire_response_fce/review_of_systems.json';
|
|
72
|
+
import fce_vitals_qr from './resources/questionnaire_response_fce/vitals.json';
|
|
73
|
+
// fhir questionnaire response
|
|
74
|
+
import fhir_allergies_inprogress_qr from './resources/questionnaire_response_fhir/allergies_inprogress.json';
|
|
75
|
+
import fhir_cardiology_qr from './resources/questionnaire_response_fhir/cardiology.json';
|
|
76
|
+
import fhir_few_answers_qr from './resources/questionnaire_response_fhir/few_answers.json';
|
|
77
|
+
import fhir_gad_7_qr from './resources/questionnaire_response_fhir/gad_7.json';
|
|
78
|
+
import fhir_immunization_qr from './resources/questionnaire_response_fhir/immunization.json';
|
|
79
|
+
import fhir_medication_qr from './resources/questionnaire_response_fhir/medication.json';
|
|
80
|
+
import fhir_new_appointment_qr from './resources/questionnaire_response_fhir/new_appointment.json';
|
|
81
|
+
import fhir_patient_qr from './resources/questionnaire_response_fhir/patient.json';
|
|
82
|
+
import fhir_phq_2_phq_9_qr from './resources/questionnaire_response_fhir/phq_2_phq_9.json';
|
|
83
|
+
import fhir_physicalexam_qr from './resources/questionnaire_response_fhir/physicalexam.json';
|
|
84
|
+
import fhir_practitioner_qr from './resources/questionnaire_response_fhir/practitioner.json';
|
|
85
|
+
import fhir_reference_answer_with_assoc from './resources/questionnaire_response_fhir/reference_answer_with_assoc.json';
|
|
86
|
+
import fhir_review_of_systems_qr from './resources/questionnaire_response_fhir/review_of_systems.json';
|
|
87
|
+
import fhir_vitals_qr from './resources/questionnaire_response_fhir/vitals.json';
|
|
88
|
+
import { toFirstClassExtension, fromFirstClassExtension } from '../../converter';
|
|
89
|
+
|
|
90
|
+
function sortExtensionsRecursive(object: any) {
|
|
91
|
+
if (typeof object !== 'object' || object === null) {
|
|
92
|
+
return object;
|
|
93
|
+
}
|
|
94
|
+
for (const [key, property] of Object.entries(object)) {
|
|
95
|
+
if (Array.isArray(property)) {
|
|
96
|
+
if (key === 'extension') {
|
|
97
|
+
property.sort((a, b) => (a.url === b.url ? 0 : a.url < b.url ? -1 : 1));
|
|
98
|
+
}
|
|
99
|
+
for (const nestedProperty of property) {
|
|
100
|
+
sortExtensionsRecursive(nestedProperty);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
sortExtensionsRecursive(property);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return object;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function sortExtensionsList(object: any) {
|
|
110
|
+
return sortExtensionsRecursive(cloneDeep(object));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
describe('Questionanire and QuestionnaireResponses transformation', () => {
|
|
114
|
+
test.each([
|
|
115
|
+
[fhir_allergies, fce_allergies],
|
|
116
|
+
[fhir_beverages, fce_beverages],
|
|
117
|
+
[fhir_choice_answer_option, fce_choice_answer_option],
|
|
118
|
+
[fhir_encounter_create, fce_encounter_create],
|
|
119
|
+
[fhir_gad_7, fce_gad_7],
|
|
120
|
+
[fhir_immunization, fce_immunization],
|
|
121
|
+
[fhir_medication, fce_medication],
|
|
122
|
+
[fhir_multiple_type_launch_context, fce_multiple_type_launch_context],
|
|
123
|
+
[fhir_patient_create, fce_patient_create],
|
|
124
|
+
[fhir_patient_edit, fce_patient_edit],
|
|
125
|
+
[fhir_phq_2_phq_9, fce_phq_2_phq_9],
|
|
126
|
+
[fhir_physicalexam, fce_physicalexam],
|
|
127
|
+
[fhir_practitioner_create, fce_practitioner_create],
|
|
128
|
+
[fhir_practitioner_edit, fce_practitioner_edit],
|
|
129
|
+
[fhir_practitioner_role_create, fce_practitioner_role_create],
|
|
130
|
+
[fhir_public_appointment, fce_public_appointment],
|
|
131
|
+
[fhir_review_of_systems, fce_review_of_systems],
|
|
132
|
+
[fhir_source_queries, fce_source_queries],
|
|
133
|
+
[fhir_vitals, fce_vitals],
|
|
134
|
+
[fhir_practitioner_create_structure_map, fce_practitioner_create_structure_map],
|
|
135
|
+
[fhir_consent, fce_consent],
|
|
136
|
+
[fhir_enable_when, fce_enable_when],
|
|
137
|
+
])(
|
|
138
|
+
'Each FHIR Questionnaire should convert to FCE',
|
|
139
|
+
async (fhir_questionnaire, fce_questionnaire) => {
|
|
140
|
+
expect(toFirstClassExtension(fhir_questionnaire as FHIRQuestionnaire)).toStrictEqual(
|
|
141
|
+
fce_questionnaire,
|
|
142
|
+
);
|
|
143
|
+
},
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
test.each([
|
|
147
|
+
[fce_allergies, fhir_allergies],
|
|
148
|
+
[fce_beverages, fhir_beverages],
|
|
149
|
+
[fce_choice_answer_option, fhir_choice_answer_option],
|
|
150
|
+
[fce_encounter_create, fhir_encounter_create],
|
|
151
|
+
[fce_gad_7, fhir_gad_7],
|
|
152
|
+
[fce_immunization, fhir_immunization],
|
|
153
|
+
[fce_medication, fhir_medication],
|
|
154
|
+
[fce_multiple_type_launch_context, fhir_multiple_type_launch_context],
|
|
155
|
+
[fce_patient_create, fhir_patient_create],
|
|
156
|
+
[fce_patient_edit, fhir_patient_edit],
|
|
157
|
+
[fce_phq_2_phq_9, fhir_phq_2_phq_9],
|
|
158
|
+
[fce_physicalexam, fhir_physicalexam],
|
|
159
|
+
[fce_practitioner_create, fhir_practitioner_create],
|
|
160
|
+
[fce_practitioner_edit, fhir_practitioner_edit],
|
|
161
|
+
[fce_practitioner_role_create, fhir_practitioner_role_create],
|
|
162
|
+
[fce_public_appointment, fhir_public_appointment],
|
|
163
|
+
[fce_review_of_systems, fhir_review_of_systems],
|
|
164
|
+
[fce_source_queries, fhir_source_queries],
|
|
165
|
+
[fce_vitals, fhir_vitals],
|
|
166
|
+
[fce_practitioner_create_structure_map, fhir_practitioner_create_structure_map],
|
|
167
|
+
[fce_consent, fhir_consent],
|
|
168
|
+
[fce_enable_when, fhir_enable_when],
|
|
169
|
+
])(
|
|
170
|
+
'Each FCE Questionnaire should convert to FHIR',
|
|
171
|
+
async (fce_questionnaire, fhir_questionnaire) => {
|
|
172
|
+
expect(
|
|
173
|
+
sortExtensionsList(fromFirstClassExtension(fce_questionnaire as FCEQuestionnaire)),
|
|
174
|
+
).toStrictEqual(sortExtensionsList(fhir_questionnaire));
|
|
175
|
+
},
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
test.each([
|
|
179
|
+
[fhir_allergies_inprogress_qr, fce_allergies_inprogress_qr],
|
|
180
|
+
[fhir_cardiology_qr, fce_cardiology_qr],
|
|
181
|
+
[fhir_few_answers_qr, fce_few_answers_qr],
|
|
182
|
+
[fhir_gad_7_qr, fce_gad_7_qr],
|
|
183
|
+
[fhir_immunization_qr, fce_immunization_qr],
|
|
184
|
+
[fhir_medication_qr, fce_medication_qr],
|
|
185
|
+
[fhir_new_appointment_qr, fce_new_appointment_qr],
|
|
186
|
+
[fhir_patient_qr, fce_patient_qr],
|
|
187
|
+
[fhir_phq_2_phq_9_qr, fce_phq_2_phq_9_qr],
|
|
188
|
+
[fhir_physicalexam_qr, fce_physicalexam_qr],
|
|
189
|
+
[fhir_practitioner_qr, fce_practitioner_qr],
|
|
190
|
+
[fhir_review_of_systems_qr, fce_review_of_systems_qr],
|
|
191
|
+
[fhir_vitals_qr, fce_vitals_qr],
|
|
192
|
+
])(
|
|
193
|
+
'Each FHIR QuestionnaireResponse should convert to FCE',
|
|
194
|
+
async (fhirQuestionnaireResponse, expectedFCE) => {
|
|
195
|
+
expect(
|
|
196
|
+
toFirstClassExtension(fhirQuestionnaireResponse as FHIRQuestionnaireResponse),
|
|
197
|
+
).toStrictEqual(expectedFCE);
|
|
198
|
+
},
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
test.each([
|
|
202
|
+
[fce_allergies_inprogress_qr, fhir_allergies_inprogress_qr],
|
|
203
|
+
[fce_cardiology_qr, fhir_cardiology_qr],
|
|
204
|
+
[fce_few_answers_qr, fhir_few_answers_qr],
|
|
205
|
+
[fce_gad_7_qr, fhir_gad_7_qr],
|
|
206
|
+
[fce_immunization_qr, fhir_immunization_qr],
|
|
207
|
+
[fce_medication_qr, fhir_medication_qr],
|
|
208
|
+
[fce_new_appointment_qr, fhir_new_appointment_qr],
|
|
209
|
+
[fce_patient_qr, fhir_patient_qr],
|
|
210
|
+
[fce_phq_2_phq_9_qr, fhir_phq_2_phq_9_qr],
|
|
211
|
+
[fce_physicalexam_qr, fhir_physicalexam_qr],
|
|
212
|
+
[fce_practitioner_qr, fhir_practitioner_qr],
|
|
213
|
+
[fce_review_of_systems_qr, fhir_review_of_systems_qr],
|
|
214
|
+
[fce_vitals_qr, fhir_vitals_qr],
|
|
215
|
+
[fce_reference_answer_with_assoc, fhir_reference_answer_with_assoc],
|
|
216
|
+
])(
|
|
217
|
+
'Each FCE QuestionnaireResponse should convert to FHIR',
|
|
218
|
+
async (fceQuestionnaireResponse, expectedFHIR) => {
|
|
219
|
+
expect(
|
|
220
|
+
fromFirstClassExtension(fceQuestionnaireResponse as FCEQuestionnaireResponse),
|
|
221
|
+
).toStrictEqual(expectedFHIR);
|
|
222
|
+
},
|
|
223
|
+
);
|
|
224
|
+
});
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
{
|
|
2
|
+
"subjectType": ["Encounter", "Patient"],
|
|
3
|
+
"meta": {
|
|
4
|
+
"profile": ["https://beda.software/beda-emr-questionnaire"],
|
|
5
|
+
"lastUpdated": "2023-04-10T03:43:34.792167Z",
|
|
6
|
+
"createdAt": "2023-04-05T05:22:35.752466Z",
|
|
7
|
+
"versionId": "694"
|
|
8
|
+
},
|
|
9
|
+
"launchContext": [
|
|
10
|
+
{
|
|
11
|
+
"name": {
|
|
12
|
+
"code": "LaunchPatient",
|
|
13
|
+
"system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext"
|
|
14
|
+
},
|
|
15
|
+
"type": ["Patient"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": {
|
|
19
|
+
"code": "Author",
|
|
20
|
+
"system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext"
|
|
21
|
+
},
|
|
22
|
+
"type": ["Resource"]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"name": "Allergies",
|
|
26
|
+
"item": [
|
|
27
|
+
{
|
|
28
|
+
"text": "DateTime",
|
|
29
|
+
"type": "dateTime",
|
|
30
|
+
"hidden": true,
|
|
31
|
+
"linkId": "dateTime",
|
|
32
|
+
"initialExpression": {
|
|
33
|
+
"language": "text/fhirpath",
|
|
34
|
+
"expression": "now()"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"text": "PatientId",
|
|
39
|
+
"type": "string",
|
|
40
|
+
"hidden": true,
|
|
41
|
+
"linkId": "patientId",
|
|
42
|
+
"initialExpression": {
|
|
43
|
+
"language": "text/fhirpath",
|
|
44
|
+
"expression": "%Patient.id"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"text": "PatientName",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"hidden": true,
|
|
51
|
+
"linkId": "patientName",
|
|
52
|
+
"initialExpression": {
|
|
53
|
+
"language": "text/fhirpath",
|
|
54
|
+
"expression": "%Patient.name.given[0] + ' ' + %Patient.name.family"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"text": "Type",
|
|
59
|
+
"type": "choice",
|
|
60
|
+
"linkId": "type",
|
|
61
|
+
"required": true,
|
|
62
|
+
"itemControl": {
|
|
63
|
+
"coding": [
|
|
64
|
+
{
|
|
65
|
+
"code": "inline-choice"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"answerOption": [
|
|
70
|
+
{
|
|
71
|
+
"value": {
|
|
72
|
+
"Coding": {
|
|
73
|
+
"code": "418634005",
|
|
74
|
+
"system": "http://hl7.org/fhir/allergy-intolerance-category",
|
|
75
|
+
"display": "Drug"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"value": {
|
|
81
|
+
"Coding": {
|
|
82
|
+
"code": "414285001",
|
|
83
|
+
"system": "http://hl7.org/fhir/allergy-intolerance-category",
|
|
84
|
+
"display": "Food"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"value": {
|
|
90
|
+
"Coding": {
|
|
91
|
+
"code": "426232007",
|
|
92
|
+
"system": "http://hl7.org/fhir/allergy-intolerance-category",
|
|
93
|
+
"display": "Environmental"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"text": "Reaction",
|
|
101
|
+
"type": "choice",
|
|
102
|
+
"linkId": "reaction",
|
|
103
|
+
"repeats": true,
|
|
104
|
+
"itemControl": {
|
|
105
|
+
"coding": [
|
|
106
|
+
{
|
|
107
|
+
"code": "inline-choice"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"answerOption": [
|
|
112
|
+
{
|
|
113
|
+
"value": {
|
|
114
|
+
"Coding": {
|
|
115
|
+
"code": "39579001",
|
|
116
|
+
"system": "http://snomed.ct",
|
|
117
|
+
"display": "Anaphylaxis"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"value": {
|
|
123
|
+
"Coding": {
|
|
124
|
+
"code": "25064002",
|
|
125
|
+
"system": "http://snomed.ct",
|
|
126
|
+
"display": "Headache"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"value": {
|
|
132
|
+
"Coding": {
|
|
133
|
+
"code": "247472004",
|
|
134
|
+
"system": "http://snomed.ct",
|
|
135
|
+
"display": "Hives (Wheal)"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"value": {
|
|
141
|
+
"Coding": {
|
|
142
|
+
"code": "422587007",
|
|
143
|
+
"system": "http://snomed.ct",
|
|
144
|
+
"display": "Nausea"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"value": {
|
|
150
|
+
"Coding": {
|
|
151
|
+
"code": "422400008",
|
|
152
|
+
"system": "http://snomed.ct",
|
|
153
|
+
"display": "Vomiting"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"text": "Substance",
|
|
161
|
+
"type": "choice",
|
|
162
|
+
"linkId": "substance-drug",
|
|
163
|
+
"enableWhen": [
|
|
164
|
+
{
|
|
165
|
+
"answer": {
|
|
166
|
+
"Coding": {
|
|
167
|
+
"code": "418634005",
|
|
168
|
+
"system": "http://snomed.ct"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"operator": "=",
|
|
172
|
+
"question": "type"
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
"itemControl": {
|
|
176
|
+
"coding": [
|
|
177
|
+
{
|
|
178
|
+
"code": "inline-choice"
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
"answerOption": [
|
|
183
|
+
{
|
|
184
|
+
"value": {
|
|
185
|
+
"Coding": {
|
|
186
|
+
"code": "LA26702-3",
|
|
187
|
+
"system": "http://loinc.org",
|
|
188
|
+
"display": "Aspirin"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"value": {
|
|
194
|
+
"Coding": {
|
|
195
|
+
"code": "LA30119-4",
|
|
196
|
+
"system": "http://loinc.org",
|
|
197
|
+
"display": "Iodine"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"value": {
|
|
203
|
+
"Coding": {
|
|
204
|
+
"code": "LA14348-9",
|
|
205
|
+
"system": "http://loinc.org",
|
|
206
|
+
"display": "Naproxen, ketoprofen or other non-steroidal"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"value": {
|
|
212
|
+
"Coding": {
|
|
213
|
+
"code": "LA28487-9",
|
|
214
|
+
"system": "http://loinc.org",
|
|
215
|
+
"display": "Penicillin"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"value": {
|
|
221
|
+
"Coding": {
|
|
222
|
+
"code": "LA30118-6",
|
|
223
|
+
"system": "http://loinc.org",
|
|
224
|
+
"display": "Sulfa drugs"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"text": "Substance",
|
|
232
|
+
"type": "choice",
|
|
233
|
+
"linkId": "substance-food",
|
|
234
|
+
"enableWhen": [
|
|
235
|
+
{
|
|
236
|
+
"answer": {
|
|
237
|
+
"Coding": {
|
|
238
|
+
"code": "414285001",
|
|
239
|
+
"system": "http://snomed.ct"
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"operator": "=",
|
|
243
|
+
"question": "type"
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"itemControl": {
|
|
247
|
+
"coding": [
|
|
248
|
+
{
|
|
249
|
+
"code": "inline-choice"
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
"answerOption": [
|
|
254
|
+
{
|
|
255
|
+
"value": {
|
|
256
|
+
"Coding": {
|
|
257
|
+
"code": "102259006",
|
|
258
|
+
"system": "http://snomed.ct",
|
|
259
|
+
"display": "Citrus fruit"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"value": {
|
|
265
|
+
"Coding": {
|
|
266
|
+
"code": "102260001",
|
|
267
|
+
"system": "http://snomed.ct",
|
|
268
|
+
"display": "Peanut butter"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"value": {
|
|
274
|
+
"Coding": {
|
|
275
|
+
"code": "102261002",
|
|
276
|
+
"system": "http://snomed.ct",
|
|
277
|
+
"display": "Strawberry"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"value": {
|
|
283
|
+
"Coding": {
|
|
284
|
+
"code": "102262009",
|
|
285
|
+
"system": "http://snomed.ct",
|
|
286
|
+
"display": "Chocolate"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"value": {
|
|
292
|
+
"Coding": {
|
|
293
|
+
"code": "102263004",
|
|
294
|
+
"system": "http://snomed.ct",
|
|
295
|
+
"display": "Eggs"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"value": {
|
|
301
|
+
"Coding": {
|
|
302
|
+
"code": "102264005",
|
|
303
|
+
"system": "http://snomed.ct",
|
|
304
|
+
"display": "Cheese"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
]
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"text": "Substance",
|
|
312
|
+
"type": "choice",
|
|
313
|
+
"linkId": "substance-environmental",
|
|
314
|
+
"enableWhen": [
|
|
315
|
+
{
|
|
316
|
+
"answer": {
|
|
317
|
+
"Coding": {
|
|
318
|
+
"code": "426232007",
|
|
319
|
+
"system": "http://snomed.ct"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"operator": "=",
|
|
323
|
+
"question": "type"
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
"itemControl": {
|
|
327
|
+
"coding": [
|
|
328
|
+
{
|
|
329
|
+
"code": "inline-choice"
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
"answerOption": [
|
|
334
|
+
{
|
|
335
|
+
"value": {
|
|
336
|
+
"Coding": {
|
|
337
|
+
"code": "111088007",
|
|
338
|
+
"system": "http://snomed.ct",
|
|
339
|
+
"display": "Latex"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"value": {
|
|
345
|
+
"Coding": {
|
|
346
|
+
"code": "256259004",
|
|
347
|
+
"system": "http://snomed.ct",
|
|
348
|
+
"display": "Pollen"
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"value": {
|
|
354
|
+
"Coding": {
|
|
355
|
+
"code": "256277009",
|
|
356
|
+
"system": "http://snomed.ct",
|
|
357
|
+
"display": "Grass pollen"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"value": {
|
|
363
|
+
"Coding": {
|
|
364
|
+
"code": "256417003",
|
|
365
|
+
"system": "http://snomed.ct",
|
|
366
|
+
"display": "Horse dander"
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"text": "Notes",
|
|
374
|
+
"type": "string",
|
|
375
|
+
"linkId": "notes"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"text": "Active",
|
|
379
|
+
"type": "string",
|
|
380
|
+
"hidden": true,
|
|
381
|
+
"linkId": "status",
|
|
382
|
+
"initial": [
|
|
383
|
+
{
|
|
384
|
+
"value": {
|
|
385
|
+
"Coding": {
|
|
386
|
+
"code": "active",
|
|
387
|
+
"system": "http://terminology.hl7.org/ValueSet/allergyintolerance-clinical",
|
|
388
|
+
"display": "Active"
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
],
|
|
395
|
+
"mapping": [
|
|
396
|
+
{
|
|
397
|
+
"id": "allergy-extract",
|
|
398
|
+
"resourceType": "Mapping"
|
|
399
|
+
}
|
|
400
|
+
],
|
|
401
|
+
"resourceType": "Questionnaire",
|
|
402
|
+
"status": "active",
|
|
403
|
+
"id": "allergies",
|
|
404
|
+
"url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/allergies"
|
|
405
|
+
}
|