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.
Files changed (176) hide show
  1. package/lib/components.d.ts +3 -3
  2. package/lib/components.js +12 -12
  3. package/lib/components.js.map +1 -1
  4. package/lib/context.d.ts +0 -1
  5. package/lib/converter/extensions.d.ts +35 -0
  6. package/lib/converter/extensions.js +128 -0
  7. package/lib/converter/extensions.js.map +1 -0
  8. package/lib/converter/fceToFhir/index.d.ts +4 -0
  9. package/lib/converter/fceToFhir/index.js +15 -0
  10. package/lib/converter/fceToFhir/index.js.map +1 -0
  11. package/lib/converter/fceToFhir/questionnaire/index.d.ts +3 -0
  12. package/lib/converter/fceToFhir/questionnaire/index.js +17 -0
  13. package/lib/converter/fceToFhir/questionnaire/index.js.map +1 -0
  14. package/lib/converter/fceToFhir/questionnaire/processExtensions.d.ts +3 -0
  15. package/lib/converter/fceToFhir/questionnaire/processExtensions.js +61 -0
  16. package/lib/converter/fceToFhir/questionnaire/processExtensions.js.map +1 -0
  17. package/lib/converter/fceToFhir/questionnaire/processItems.d.ts +3 -0
  18. package/lib/converter/fceToFhir/questionnaire/processItems.js +144 -0
  19. package/lib/converter/fceToFhir/questionnaire/processItems.js.map +1 -0
  20. package/lib/converter/fceToFhir/questionnaire/processMeta.d.ts +3 -0
  21. package/lib/converter/fceToFhir/questionnaire/processMeta.js +20 -0
  22. package/lib/converter/fceToFhir/questionnaire/processMeta.js.map +1 -0
  23. package/lib/converter/fceToFhir/questionnaireResponse/index.d.ts +3 -0
  24. package/lib/converter/fceToFhir/questionnaireResponse/index.js +20 -0
  25. package/lib/converter/fceToFhir/questionnaireResponse/index.js.map +1 -0
  26. package/lib/converter/fceToFhir/questionnaireResponse/processAnswers.d.ts +2 -0
  27. package/lib/converter/fceToFhir/questionnaireResponse/processAnswers.js +48 -0
  28. package/lib/converter/fceToFhir/questionnaireResponse/processAnswers.js.map +1 -0
  29. package/lib/converter/fceToFhir/questionnaireResponse/processMeta.d.ts +3 -0
  30. package/lib/converter/fceToFhir/questionnaireResponse/processMeta.js +18 -0
  31. package/lib/converter/fceToFhir/questionnaireResponse/processMeta.js.map +1 -0
  32. package/lib/converter/fceToFhir/questionnaireResponse/processReference.d.ts +3 -0
  33. package/lib/converter/fceToFhir/questionnaireResponse/processReference.js +19 -0
  34. package/lib/converter/fceToFhir/questionnaireResponse/processReference.js.map +1 -0
  35. package/lib/converter/fhirToFce/index.d.ts +4 -0
  36. package/lib/converter/fhirToFce/index.js +15 -0
  37. package/lib/converter/fhirToFce/index.js.map +1 -0
  38. package/lib/converter/fhirToFce/questionnaire/index.d.ts +3 -0
  39. package/lib/converter/fhirToFce/questionnaire/index.js +21 -0
  40. package/lib/converter/fhirToFce/questionnaire/index.js.map +1 -0
  41. package/lib/converter/fhirToFce/questionnaire/processExtensions.d.ts +8 -0
  42. package/lib/converter/fhirToFce/questionnaire/processExtensions.js +89 -0
  43. package/lib/converter/fhirToFce/questionnaire/processExtensions.js.map +1 -0
  44. package/lib/converter/fhirToFce/questionnaire/processItems.d.ts +3 -0
  45. package/lib/converter/fhirToFce/questionnaire/processItems.js +131 -0
  46. package/lib/converter/fhirToFce/questionnaire/processItems.js.map +1 -0
  47. package/lib/converter/fhirToFce/questionnaire/processMeta.d.ts +32 -0
  48. package/lib/converter/fhirToFce/questionnaire/processMeta.js +14 -0
  49. package/lib/converter/fhirToFce/questionnaire/processMeta.js.map +1 -0
  50. package/lib/converter/fhirToFce/questionnaireResponse/index.d.ts +3 -0
  51. package/lib/converter/fhirToFce/questionnaireResponse/index.js +20 -0
  52. package/lib/converter/fhirToFce/questionnaireResponse/index.js.map +1 -0
  53. package/lib/converter/fhirToFce/questionnaireResponse/processAnswers.d.ts +2 -0
  54. package/lib/converter/fhirToFce/questionnaireResponse/processAnswers.js +46 -0
  55. package/lib/converter/fhirToFce/questionnaireResponse/processAnswers.js.map +1 -0
  56. package/lib/converter/fhirToFce/questionnaireResponse/processMeta.d.ts +3 -0
  57. package/lib/converter/fhirToFce/questionnaireResponse/processMeta.js +15 -0
  58. package/lib/converter/fhirToFce/questionnaireResponse/processMeta.js.map +1 -0
  59. package/lib/converter/fhirToFce/questionnaireResponse/processReference.d.ts +3 -0
  60. package/lib/converter/fhirToFce/questionnaireResponse/processReference.js +18 -0
  61. package/lib/converter/fhirToFce/questionnaireResponse/processReference.js.map +1 -0
  62. package/lib/converter/fhirToFce/utils.d.ts +3 -0
  63. package/lib/converter/fhirToFce/utils.js +37 -0
  64. package/lib/converter/fhirToFce/utils.js.map +1 -0
  65. package/lib/converter/index.d.ts +12 -0
  66. package/lib/converter/index.js +84 -0
  67. package/lib/converter/index.js.map +1 -0
  68. package/lib/index.d.ts +1 -0
  69. package/lib/index.js +1 -0
  70. package/lib/index.js.map +1 -1
  71. package/lib/setupTests.d.ts +1 -0
  72. package/lib/setupTests.js +4 -0
  73. package/lib/setupTests.js.map +1 -0
  74. package/lib/types.d.ts +10 -10
  75. package/lib/utils.d.ts +4 -1
  76. package/lib/utils.js +9 -2
  77. package/lib/utils.js.map +1 -1
  78. package/package.json +4 -5
  79. package/src/components.tsx +12 -12
  80. package/src/converter/__tests__/fce.test.ts +224 -0
  81. package/src/converter/__tests__/resources/questionnaire_fce/allergies.json +405 -0
  82. package/src/converter/__tests__/resources/questionnaire_fce/beverages.json +72 -0
  83. package/src/converter/__tests__/resources/questionnaire_fce/choice_answer_option.json +53 -0
  84. package/src/converter/__tests__/resources/questionnaire_fce/consent.json +86 -0
  85. package/src/converter/__tests__/resources/questionnaire_fce/enable_when.json +103 -0
  86. package/src/converter/__tests__/resources/questionnaire_fce/encounter_create.json +126 -0
  87. package/src/converter/__tests__/resources/questionnaire_fce/gad_7.json +459 -0
  88. package/src/converter/__tests__/resources/questionnaire_fce/immunization.json +182 -0
  89. package/src/converter/__tests__/resources/questionnaire_fce/medication.json +189 -0
  90. package/src/converter/__tests__/resources/questionnaire_fce/multiple_type_launch_context.json +406 -0
  91. package/src/converter/__tests__/resources/questionnaire_fce/patient_create.json +84 -0
  92. package/src/converter/__tests__/resources/questionnaire_fce/patient_edit.json +125 -0
  93. package/src/converter/__tests__/resources/questionnaire_fce/phq_2_phq_9.json +552 -0
  94. package/src/converter/__tests__/resources/questionnaire_fce/physicalexam.json +385 -0
  95. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_create.json +90 -0
  96. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_create_structure_map.json +91 -0
  97. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_edit.json +144 -0
  98. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_role_create.json +37 -0
  99. package/src/converter/__tests__/resources/questionnaire_fce/public_appointment.json +91 -0
  100. package/src/converter/__tests__/resources/questionnaire_fce/review_of_systems.json +389 -0
  101. package/src/converter/__tests__/resources/questionnaire_fce/source_queries.json +34 -0
  102. package/src/converter/__tests__/resources/questionnaire_fce/vitals.json +234 -0
  103. package/src/converter/__tests__/resources/questionnaire_fhir/allergies.json +433 -0
  104. package/src/converter/__tests__/resources/questionnaire_fhir/beverages.json +99 -0
  105. package/src/converter/__tests__/resources/questionnaire_fhir/choice_answer_option.json +49 -0
  106. package/src/converter/__tests__/resources/questionnaire_fhir/consent.json +119 -0
  107. package/src/converter/__tests__/resources/questionnaire_fhir/enable_when.json +87 -0
  108. package/src/converter/__tests__/resources/questionnaire_fhir/encounter_create.json +171 -0
  109. package/src/converter/__tests__/resources/questionnaire_fhir/gad_7.json +489 -0
  110. package/src/converter/__tests__/resources/questionnaire_fhir/immunization.json +215 -0
  111. package/src/converter/__tests__/resources/questionnaire_fhir/medication.json +226 -0
  112. package/src/converter/__tests__/resources/questionnaire_fhir/multiple_type_launch_context.json +416 -0
  113. package/src/converter/__tests__/resources/questionnaire_fhir/patient_create.json +97 -0
  114. package/src/converter/__tests__/resources/questionnaire_fhir/patient_edit.json +183 -0
  115. package/src/converter/__tests__/resources/questionnaire_fhir/phq_2_phq_9.json +580 -0
  116. package/src/converter/__tests__/resources/questionnaire_fhir/physicalexam.json +544 -0
  117. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create.json +87 -0
  118. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create_structure_map.json +91 -0
  119. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_edit.json +193 -0
  120. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_role_create.json +44 -0
  121. package/src/converter/__tests__/resources/questionnaire_fhir/public_appointment.json +116 -0
  122. package/src/converter/__tests__/resources/questionnaire_fhir/review_of_systems.json +368 -0
  123. package/src/converter/__tests__/resources/questionnaire_fhir/source_queries.json +37 -0
  124. package/src/converter/__tests__/resources/questionnaire_fhir/vitals.json +317 -0
  125. package/src/converter/__tests__/resources/questionnaire_response_fce/allergies_inprogress.json +78 -0
  126. package/src/converter/__tests__/resources/questionnaire_response_fce/cardiology.json +96 -0
  127. package/src/converter/__tests__/resources/questionnaire_response_fce/few_answers.json +48 -0
  128. package/src/converter/__tests__/resources/questionnaire_response_fce/gad_7.json +165 -0
  129. package/src/converter/__tests__/resources/questionnaire_response_fce/immunization.json +86 -0
  130. package/src/converter/__tests__/resources/questionnaire_response_fce/medication.json +116 -0
  131. package/src/converter/__tests__/resources/questionnaire_response_fce/new_appointment.json +96 -0
  132. package/src/converter/__tests__/resources/questionnaire_response_fce/patient.json +87 -0
  133. package/src/converter/__tests__/resources/questionnaire_response_fce/phq_2_phq_9.json +193 -0
  134. package/src/converter/__tests__/resources/questionnaire_response_fce/physicalexam.json +187 -0
  135. package/src/converter/__tests__/resources/questionnaire_response_fce/practitioner.json +57 -0
  136. package/src/converter/__tests__/resources/questionnaire_response_fce/reference_answer_with_assoc.json +147 -0
  137. package/src/converter/__tests__/resources/questionnaire_response_fce/review_of_systems.json +129 -0
  138. package/src/converter/__tests__/resources/questionnaire_response_fce/vitals.json +168 -0
  139. package/src/converter/__tests__/resources/questionnaire_response_fhir/allergies_inprogress.json +73 -0
  140. package/src/converter/__tests__/resources/questionnaire_response_fhir/cardiology.json +87 -0
  141. package/src/converter/__tests__/resources/questionnaire_response_fhir/few_answers.json +46 -0
  142. package/src/converter/__tests__/resources/questionnaire_response_fhir/gad_7.json +146 -0
  143. package/src/converter/__tests__/resources/questionnaire_response_fhir/immunization.json +77 -0
  144. package/src/converter/__tests__/resources/questionnaire_response_fhir/medication.json +101 -0
  145. package/src/converter/__tests__/resources/questionnaire_response_fhir/new_appointment.json +86 -0
  146. package/src/converter/__tests__/resources/questionnaire_response_fhir/patient.json +78 -0
  147. package/src/converter/__tests__/resources/questionnaire_response_fhir/phq_2_phq_9.json +170 -0
  148. package/src/converter/__tests__/resources/questionnaire_response_fhir/physicalexam.json +158 -0
  149. package/src/converter/__tests__/resources/questionnaire_response_fhir/practitioner.json +54 -0
  150. package/src/converter/__tests__/resources/questionnaire_response_fhir/reference_answer_with_assoc.json +86 -0
  151. package/src/converter/__tests__/resources/questionnaire_response_fhir/review_of_systems.json +118 -0
  152. package/src/converter/__tests__/resources/questionnaire_response_fhir/vitals.json +145 -0
  153. package/src/converter/extensions.ts +149 -0
  154. package/src/converter/fceToFhir/index.ts +27 -0
  155. package/src/converter/fceToFhir/questionnaire/index.ts +15 -0
  156. package/src/converter/fceToFhir/questionnaire/processExtensions.ts +75 -0
  157. package/src/converter/fceToFhir/questionnaire/processItems.ts +194 -0
  158. package/src/converter/fceToFhir/questionnaire/processMeta.ts +19 -0
  159. package/src/converter/fceToFhir/questionnaireResponse/index.ts +21 -0
  160. package/src/converter/fceToFhir/questionnaireResponse/processAnswers.ts +53 -0
  161. package/src/converter/fceToFhir/questionnaireResponse/processMeta.ts +16 -0
  162. package/src/converter/fceToFhir/questionnaireResponse/processReference.ts +24 -0
  163. package/src/converter/fhirToFce/index.ts +27 -0
  164. package/src/converter/fhirToFce/questionnaire/index.ts +25 -0
  165. package/src/converter/fhirToFce/questionnaire/processExtensions.ts +113 -0
  166. package/src/converter/fhirToFce/questionnaire/processItems.ts +159 -0
  167. package/src/converter/fhirToFce/questionnaire/processMeta.ts +17 -0
  168. package/src/converter/fhirToFce/questionnaireResponse/index.ts +21 -0
  169. package/src/converter/fhirToFce/questionnaireResponse/processAnswers.ts +53 -0
  170. package/src/converter/fhirToFce/questionnaireResponse/processMeta.ts +14 -0
  171. package/src/converter/fhirToFce/questionnaireResponse/processReference.ts +20 -0
  172. package/src/converter/fhirToFce/utils.ts +36 -0
  173. package/src/converter/index.ts +106 -0
  174. package/src/index.ts +1 -0
  175. package/src/setupTests.ts +1 -0
  176. 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
+ }