sdc-qrf 0.3.17 → 0.3.19

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 (102) hide show
  1. package/dist/components.js +20 -64
  2. package/dist/components.js.map +1 -1
  3. package/dist/converter/extensions.js +8 -6
  4. package/dist/converter/extensions.js.map +1 -1
  5. package/dist/converter/fceToFhir/questionnaire/index.js +4 -5
  6. package/dist/converter/fceToFhir/questionnaire/index.js.map +1 -1
  7. package/dist/converter/fceToFhir/questionnaire/processExtensions.d.ts.map +1 -1
  8. package/dist/converter/fceToFhir/questionnaire/processExtensions.js +11 -3
  9. package/dist/converter/fceToFhir/questionnaire/processExtensions.js.map +1 -1
  10. package/dist/converter/fceToFhir/questionnaire/processItems.js +9 -13
  11. package/dist/converter/fceToFhir/questionnaire/processItems.js.map +1 -1
  12. package/dist/converter/fceToFhir/questionnaire/processMeta.js +4 -2
  13. package/dist/converter/fceToFhir/questionnaire/processMeta.js.map +1 -1
  14. package/dist/converter/fceToFhir/questionnaireResponse/index.js +2 -4
  15. package/dist/converter/fceToFhir/questionnaireResponse/index.js.map +1 -1
  16. package/dist/converter/fceToFhir/questionnaireResponse/processAnswers.js +3 -5
  17. package/dist/converter/fceToFhir/questionnaireResponse/processAnswers.js.map +1 -1
  18. package/dist/converter/fceToFhir/questionnaireResponse/processMeta.js +2 -1
  19. package/dist/converter/fceToFhir/questionnaireResponse/processMeta.js.map +1 -1
  20. package/dist/converter/fceToFhir/questionnaireResponse/processReference.js +8 -16
  21. package/dist/converter/fceToFhir/questionnaireResponse/processReference.js.map +1 -1
  22. package/dist/converter/fhirToFce/questionnaire/index.js +4 -11
  23. package/dist/converter/fhirToFce/questionnaire/index.js.map +1 -1
  24. package/dist/converter/fhirToFce/questionnaire/processExtensions.d.ts +1 -0
  25. package/dist/converter/fhirToFce/questionnaire/processExtensions.d.ts.map +1 -1
  26. package/dist/converter/fhirToFce/questionnaire/processExtensions.js +45 -28
  27. package/dist/converter/fhirToFce/questionnaire/processExtensions.js.map +1 -1
  28. package/dist/converter/fhirToFce/questionnaire/processItems.js +15 -20
  29. package/dist/converter/fhirToFce/questionnaire/processItems.js.map +1 -1
  30. package/dist/converter/fhirToFce/questionnaire/processMeta.js +3 -6
  31. package/dist/converter/fhirToFce/questionnaire/processMeta.js.map +1 -1
  32. package/dist/converter/fhirToFce/questionnaireResponse/index.js +2 -4
  33. package/dist/converter/fhirToFce/questionnaireResponse/index.js.map +1 -1
  34. package/dist/converter/fhirToFce/questionnaireResponse/processAnswers.js +5 -6
  35. package/dist/converter/fhirToFce/questionnaireResponse/processAnswers.js.map +1 -1
  36. package/dist/converter/fhirToFce/questionnaireResponse/processMeta.js +4 -3
  37. package/dist/converter/fhirToFce/questionnaireResponse/processMeta.js.map +1 -1
  38. package/dist/converter/fhirToFce/questionnaireResponse/processReference.js +5 -4
  39. package/dist/converter/fhirToFce/questionnaireResponse/processReference.js.map +1 -1
  40. package/dist/converter/fhirToFce/utils.js +4 -3
  41. package/dist/converter/fhirToFce/utils.js.map +1 -1
  42. package/dist/converter/index.js +11 -33
  43. package/dist/converter/index.js.map +1 -1
  44. package/dist/converter/utils.js +2 -4
  45. package/dist/converter/utils.js.map +1 -1
  46. package/dist/index.js +6 -19
  47. package/dist/index.js.map +1 -1
  48. package/dist/utils.js +74 -103
  49. package/dist/utils.js.map +1 -1
  50. package/package.json +2 -2
  51. package/src/converter/__tests__/resources/questionnaire_fce/allergies.json +1 -0
  52. package/src/converter/__tests__/resources/questionnaire_fce/beverages.json +67 -66
  53. package/src/converter/__tests__/resources/questionnaire_fce/choice_answer_option.json +49 -48
  54. package/src/converter/__tests__/resources/questionnaire_fce/consent.json +1 -0
  55. package/src/converter/__tests__/resources/questionnaire_fce/constraint.json +2 -2
  56. package/src/converter/__tests__/resources/questionnaire_fce/cqf-examples.json +59 -63
  57. package/src/converter/__tests__/resources/questionnaire_fce/enable_when.json +1 -0
  58. package/src/converter/__tests__/resources/questionnaire_fce/encounter_create.json +1 -0
  59. package/src/converter/__tests__/resources/questionnaire_fce/gad_7.json +6 -14
  60. package/src/converter/__tests__/resources/questionnaire_fce/immunization.json +6 -14
  61. package/src/converter/__tests__/resources/questionnaire_fce/medication.json +165 -164
  62. package/src/converter/__tests__/resources/questionnaire_fce/multiple_type_launch_context.json +5 -12
  63. package/src/converter/__tests__/resources/questionnaire_fce/patient_create.json +78 -77
  64. package/src/converter/__tests__/resources/questionnaire_fce/patient_edit.json +1 -0
  65. package/src/converter/__tests__/resources/questionnaire_fce/phq_2_phq_9.json +1 -0
  66. package/src/converter/__tests__/resources/questionnaire_fce/physicalexam.json +381 -380
  67. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_create.json +79 -78
  68. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_create_structure_map.json +1 -0
  69. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_edit.json +127 -126
  70. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_role_create.json +35 -34
  71. package/src/converter/__tests__/resources/questionnaire_fce/public_appointment.json +3 -4
  72. package/src/converter/__tests__/resources/questionnaire_fce/review_of_systems.json +384 -383
  73. package/src/converter/__tests__/resources/questionnaire_fce/source_queries.json +31 -30
  74. package/src/converter/__tests__/resources/questionnaire_fce/unit-option.json +1 -0
  75. package/src/converter/__tests__/resources/questionnaire_fce/vitals.json +1 -0
  76. package/src/converter/__tests__/resources/questionnaire_fhir/allergies.json +7 -8
  77. package/src/converter/__tests__/resources/questionnaire_fhir/beverages.json +96 -90
  78. package/src/converter/__tests__/resources/questionnaire_fhir/choice_answer_option.json +49 -43
  79. package/src/converter/__tests__/resources/questionnaire_fhir/consent.json +4 -0
  80. package/src/converter/__tests__/resources/questionnaire_fhir/constraint.json +6 -0
  81. package/src/converter/__tests__/resources/questionnaire_fhir/cqf-examples.json +87 -86
  82. package/src/converter/__tests__/resources/questionnaire_fhir/enable_when.json +6 -0
  83. package/src/converter/__tests__/resources/questionnaire_fhir/encounter_create.json +4 -0
  84. package/src/converter/__tests__/resources/questionnaire_fhir/gad_7.json +7 -8
  85. package/src/converter/__tests__/resources/questionnaire_fhir/immunization.json +7 -8
  86. package/src/converter/__tests__/resources/questionnaire_fhir/medication.json +203 -199
  87. package/src/converter/__tests__/resources/questionnaire_fhir/multiple_type_launch_context.json +387 -383
  88. package/src/converter/__tests__/resources/questionnaire_fhir/patient_create.json +92 -88
  89. package/src/converter/__tests__/resources/questionnaire_fhir/patient_edit.json +6 -4
  90. package/src/converter/__tests__/resources/questionnaire_fhir/phq_2_phq_9.json +565 -561
  91. package/src/converter/__tests__/resources/questionnaire_fhir/physicalexam.json +540 -536
  92. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create.json +78 -74
  93. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create_structure_map.json +4 -0
  94. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_edit.json +176 -172
  95. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_role_create.json +45 -41
  96. package/src/converter/__tests__/resources/questionnaire_fhir/public_appointment.json +6 -4
  97. package/src/converter/__tests__/resources/questionnaire_fhir/review_of_systems.json +364 -358
  98. package/src/converter/__tests__/resources/questionnaire_fhir/source_queries.json +37 -33
  99. package/src/converter/__tests__/resources/questionnaire_fhir/unit-option.json +6 -0
  100. package/src/converter/__tests__/resources/questionnaire_fhir/vitals.json +4 -0
  101. package/src/converter/fceToFhir/questionnaire/processExtensions.ts +8 -1
  102. package/src/converter/fhirToFce/questionnaire/processExtensions.ts +21 -15
@@ -1,37 +1,41 @@
1
1
  {
2
- "meta": {
3
- "profile": ["https://beda.software/beda-emr-questionnaire"]
4
- },
5
- "item": [
6
- {
7
- "linkId": "question-1",
8
- "type": "string",
9
- "text": "Question"
10
- }
11
- ],
12
- "status": "active",
13
- "resourceType": "Questionnaire",
14
- "contained": [
15
- {
16
- "id": "PrePopQuery",
17
- "type": "batch",
18
- "entry": [
2
+ "meta": {
3
+ "profile": ["https://beda.software/beda-emr-questionnaire"]
4
+ },
5
+ "item": [
19
6
  {
20
- "request": {
21
- "url": "Patient?_id={{%LaunchPatient.id}}",
22
- "method": "GET"
23
- }
7
+ "linkId": "question-1",
8
+ "type": "string",
9
+ "text": "Question"
24
10
  }
25
- ],
26
- "resourceType": "Bundle"
27
- }
28
- ],
29
- "extension": [
30
- {
31
- "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-sourceQueries",
32
- "valueReference": {
33
- "reference": "#Bundle#PrePopQuery"
34
- }
35
- }
36
- ]
11
+ ],
12
+ "status": "active",
13
+ "resourceType": "Questionnaire",
14
+ "contained": [
15
+ {
16
+ "id": "PrePopQuery",
17
+ "type": "batch",
18
+ "entry": [
19
+ {
20
+ "request": {
21
+ "url": "Patient?_id={{%LaunchPatient.id}}",
22
+ "method": "GET"
23
+ }
24
+ }
25
+ ],
26
+ "resourceType": "Bundle"
27
+ }
28
+ ],
29
+ "extension": [
30
+ {
31
+ "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-sourceQueries",
32
+ "valueReference": {
33
+ "reference": "#Bundle#PrePopQuery"
34
+ }
35
+ },
36
+ {
37
+ "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-assembledFrom",
38
+ "valueCanonical": "source-queries"
39
+ }
40
+ ]
37
41
  }
@@ -34,6 +34,12 @@
34
34
  "meta": {
35
35
  "profile": ["https://beda.software/beda-emr-questionnaire"]
36
36
  },
37
+ "extension": [
38
+ {
39
+ "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-assembledFrom",
40
+ "valueCanonical": "unit-option"
41
+ }
42
+ ],
37
43
  "status": "active",
38
44
  "id": "unit-option",
39
45
  "resourceType": "Questionnaire"
@@ -309,6 +309,10 @@
309
309
  "valueReference": {
310
310
  "reference": "Mapping/vitals"
311
311
  }
312
+ },
313
+ {
314
+ "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-assembledFrom",
315
+ "valueCanonical": "vitals"
312
316
  }
313
317
  ],
314
318
  "status": "active",
@@ -3,7 +3,7 @@ import { Extension as FHIRExtension, Questionnaire as FHIRQuestionnaire } from '
3
3
  import { Questionnaire as FCEQuestionnaire } from '@beda.software/aidbox-types';
4
4
 
5
5
  export function processExtensions(questionnaire: FCEQuestionnaire): FHIRQuestionnaire {
6
- const { launchContext, mapping, sourceQueries, targetStructureMap, ...fhirQuestionnaire } =
6
+ const { launchContext, mapping, sourceQueries, targetStructureMap, assembledFrom, ...fhirQuestionnaire } =
7
7
  questionnaire;
8
8
 
9
9
  let extensions: FHIRExtension[] = [];
@@ -68,6 +68,13 @@ export function processExtensions(questionnaire: FCEQuestionnaire): FHIRQuestion
68
68
  );
69
69
  }
70
70
 
71
+ if (assembledFrom) {
72
+ extensions.push({
73
+ url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-assembledFrom',
74
+ valueCanonical: assembledFrom,
75
+ });
76
+ }
77
+
71
78
  if (extensions.length) {
72
79
  fhirQuestionnaire.extension = (fhirQuestionnaire.extension ?? []).concat(extensions);
73
80
  }
@@ -1,3 +1,4 @@
1
+ import { canonical } from '@beda.software/aidbox-types';
1
2
  import { Questionnaire as FHIRQuestionnaire } from 'fhir/r4b';
2
3
 
3
4
  export function processExtensions(fhirQuestionnaire: FHIRQuestionnaire): {
@@ -5,17 +6,20 @@ export function processExtensions(fhirQuestionnaire: FHIRQuestionnaire): {
5
6
  mapping?: any[];
6
7
  sourceQueries?: any[];
7
8
  targetStructureMap?: any[];
9
+ assembledFrom?: any;
8
10
  } {
9
11
  const launchContext = processLaunchContext(fhirQuestionnaire);
10
12
  const mapping = processMapping(fhirQuestionnaire);
11
13
  const sourceQueries = processSourceQueries(fhirQuestionnaire);
12
14
  const targetStructureMap = processTargetStructureMap(fhirQuestionnaire);
15
+ const assembledFrom = processAssembledFrom(fhirQuestionnaire);
13
16
 
14
17
  return {
15
18
  launchContext: launchContext?.length ? launchContext : undefined,
16
19
  mapping: mapping?.length ? mapping : undefined,
17
20
  sourceQueries: sourceQueries?.length ? sourceQueries : undefined,
18
21
  targetStructureMap: targetStructureMap?.length ? targetStructureMap : undefined,
22
+ assembledFrom: assembledFrom ? assembledFrom : undefined,
19
23
  };
20
24
  }
21
25
 
@@ -23,9 +27,7 @@ export function processLaunchContext(fhirQuestionnaire: FHIRQuestionnaire): any[
23
27
  let launchContextExtensions = fhirQuestionnaire.extension ?? [];
24
28
 
25
29
  launchContextExtensions = launchContextExtensions.filter(
26
- (ext) =>
27
- ext.url ===
28
- 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext',
30
+ (ext) => ext.url === 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext',
29
31
  );
30
32
 
31
33
  if (launchContextExtensions.length === 0) {
@@ -35,12 +37,8 @@ export function processLaunchContext(fhirQuestionnaire: FHIRQuestionnaire): any[
35
37
  const launchContextArray = [];
36
38
  for (const launchContextExtension of launchContextExtensions) {
37
39
  const nameExtension = launchContextExtension.extension?.find((ext) => ext.url === 'name');
38
- const typeExtensions = launchContextExtension.extension?.filter(
39
- (ext) => ext.url === 'type',
40
- );
41
- const descriptionExtension = launchContextExtension.extension?.find(
42
- (ext) => ext.url === 'description',
43
- );
40
+ const typeExtensions = launchContextExtension.extension?.filter((ext) => ext.url === 'type');
41
+ const descriptionExtension = launchContextExtension.extension?.find((ext) => ext.url === 'description');
44
42
 
45
43
  const nameCode = nameExtension?.valueCoding?.code;
46
44
  const typeCodes = typeExtensions?.map((typeExtension) => typeExtension.valueCode!);
@@ -90,9 +88,7 @@ function processMapping(fhirQuestionnaire: FHIRQuestionnaire): any[] | undefined
90
88
  function processSourceQueries(fhirQuestionnaire: FHIRQuestionnaire): any[] {
91
89
  const extensions =
92
90
  fhirQuestionnaire.extension?.filter(
93
- (ext) =>
94
- ext.url ===
95
- 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-sourceQueries',
91
+ (ext) => ext.url === 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-sourceQueries',
96
92
  ) ?? [];
97
93
 
98
94
  return extensions.map((ext) => ({
@@ -102,9 +98,7 @@ function processSourceQueries(fhirQuestionnaire: FHIRQuestionnaire): any[] {
102
98
 
103
99
  function processTargetStructureMap(fhirQuestionnaire: FHIRQuestionnaire): string[] | undefined {
104
100
  const extensions = fhirQuestionnaire.extension?.filter(
105
- (ext) =>
106
- ext.url ===
107
- 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-targetStructureMap',
101
+ (ext) => ext.url === 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-targetStructureMap',
108
102
  );
109
103
 
110
104
  if (!extensions) {
@@ -113,3 +107,15 @@ function processTargetStructureMap(fhirQuestionnaire: FHIRQuestionnaire): string
113
107
 
114
108
  return extensions.map((extension) => extension.valueCanonical!);
115
109
  }
110
+
111
+ function processAssembledFrom(fhirQuestionnaire: FHIRQuestionnaire): canonical | undefined {
112
+ const extension = fhirQuestionnaire.extension?.find(
113
+ (ext) => ext.url === 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-assembledFrom',
114
+ );
115
+
116
+ if (!extension) {
117
+ return undefined;
118
+ }
119
+
120
+ return extension.valueCanonical;
121
+ }