sdc-qrf 0.3.17 → 0.3.18

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 (60) hide show
  1. package/dist/converter/fceToFhir/questionnaire/processExtensions.d.ts.map +1 -1
  2. package/dist/converter/fceToFhir/questionnaire/processExtensions.js +7 -1
  3. package/dist/converter/fceToFhir/questionnaire/processExtensions.js.map +1 -1
  4. package/dist/converter/fhirToFce/questionnaire/processExtensions.d.ts +1 -0
  5. package/dist/converter/fhirToFce/questionnaire/processExtensions.d.ts.map +1 -1
  6. package/dist/converter/fhirToFce/questionnaire/processExtensions.js +12 -6
  7. package/dist/converter/fhirToFce/questionnaire/processExtensions.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/converter/__tests__/resources/questionnaire_fce/allergies.json +1 -0
  10. package/src/converter/__tests__/resources/questionnaire_fce/beverages.json +67 -66
  11. package/src/converter/__tests__/resources/questionnaire_fce/choice_answer_option.json +49 -48
  12. package/src/converter/__tests__/resources/questionnaire_fce/consent.json +1 -0
  13. package/src/converter/__tests__/resources/questionnaire_fce/constraint.json +2 -2
  14. package/src/converter/__tests__/resources/questionnaire_fce/cqf-examples.json +59 -63
  15. package/src/converter/__tests__/resources/questionnaire_fce/enable_when.json +1 -0
  16. package/src/converter/__tests__/resources/questionnaire_fce/encounter_create.json +1 -0
  17. package/src/converter/__tests__/resources/questionnaire_fce/gad_7.json +6 -14
  18. package/src/converter/__tests__/resources/questionnaire_fce/immunization.json +6 -14
  19. package/src/converter/__tests__/resources/questionnaire_fce/medication.json +165 -164
  20. package/src/converter/__tests__/resources/questionnaire_fce/multiple_type_launch_context.json +5 -12
  21. package/src/converter/__tests__/resources/questionnaire_fce/patient_create.json +78 -77
  22. package/src/converter/__tests__/resources/questionnaire_fce/patient_edit.json +1 -0
  23. package/src/converter/__tests__/resources/questionnaire_fce/phq_2_phq_9.json +1 -0
  24. package/src/converter/__tests__/resources/questionnaire_fce/physicalexam.json +381 -380
  25. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_create.json +79 -78
  26. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_create_structure_map.json +1 -0
  27. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_edit.json +127 -126
  28. package/src/converter/__tests__/resources/questionnaire_fce/practitioner_role_create.json +35 -34
  29. package/src/converter/__tests__/resources/questionnaire_fce/public_appointment.json +3 -4
  30. package/src/converter/__tests__/resources/questionnaire_fce/review_of_systems.json +384 -383
  31. package/src/converter/__tests__/resources/questionnaire_fce/source_queries.json +31 -30
  32. package/src/converter/__tests__/resources/questionnaire_fce/unit-option.json +1 -0
  33. package/src/converter/__tests__/resources/questionnaire_fce/vitals.json +1 -0
  34. package/src/converter/__tests__/resources/questionnaire_fhir/allergies.json +7 -8
  35. package/src/converter/__tests__/resources/questionnaire_fhir/beverages.json +96 -90
  36. package/src/converter/__tests__/resources/questionnaire_fhir/choice_answer_option.json +49 -43
  37. package/src/converter/__tests__/resources/questionnaire_fhir/consent.json +4 -0
  38. package/src/converter/__tests__/resources/questionnaire_fhir/constraint.json +6 -0
  39. package/src/converter/__tests__/resources/questionnaire_fhir/cqf-examples.json +87 -86
  40. package/src/converter/__tests__/resources/questionnaire_fhir/enable_when.json +6 -0
  41. package/src/converter/__tests__/resources/questionnaire_fhir/encounter_create.json +4 -0
  42. package/src/converter/__tests__/resources/questionnaire_fhir/gad_7.json +7 -8
  43. package/src/converter/__tests__/resources/questionnaire_fhir/immunization.json +7 -8
  44. package/src/converter/__tests__/resources/questionnaire_fhir/medication.json +203 -199
  45. package/src/converter/__tests__/resources/questionnaire_fhir/multiple_type_launch_context.json +387 -383
  46. package/src/converter/__tests__/resources/questionnaire_fhir/patient_create.json +92 -88
  47. package/src/converter/__tests__/resources/questionnaire_fhir/patient_edit.json +6 -4
  48. package/src/converter/__tests__/resources/questionnaire_fhir/phq_2_phq_9.json +565 -561
  49. package/src/converter/__tests__/resources/questionnaire_fhir/physicalexam.json +540 -536
  50. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create.json +78 -74
  51. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create_structure_map.json +4 -0
  52. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_edit.json +176 -172
  53. package/src/converter/__tests__/resources/questionnaire_fhir/practitioner_role_create.json +45 -41
  54. package/src/converter/__tests__/resources/questionnaire_fhir/public_appointment.json +6 -4
  55. package/src/converter/__tests__/resources/questionnaire_fhir/review_of_systems.json +364 -358
  56. package/src/converter/__tests__/resources/questionnaire_fhir/source_queries.json +37 -33
  57. package/src/converter/__tests__/resources/questionnaire_fhir/unit-option.json +6 -0
  58. package/src/converter/__tests__/resources/questionnaire_fhir/vitals.json +4 -0
  59. package/src/converter/fceToFhir/questionnaire/processExtensions.ts +8 -1
  60. 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
+ }