babelfhir-ts 1.0.28 → 1.0.30
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/LICENSE +15 -15
- package/README.md +226 -210
- package/bin/babelfhir-ts.js +28 -28
- package/out/generator/classGenerator.js +132 -216
- package/out/generator/fhirR4Rules.js +174 -0
- package/out/generator/importManager.js +64 -12
- package/out/generator/index.js +257 -70
- package/out/generator/interfaceGenerator.js +266 -540
- package/out/generator/packageManager.js +257 -0
- package/out/generator/packageParser.js +4 -3
- package/out/generator/postProcessExtensions.js +338 -0
- package/out/generator/randomSupportGenerator.js +279 -0
- package/out/generator/sdParser.js +213 -69
- package/out/generator/testGenerator.js +33 -32
- package/out/generator/utils.js +11 -4
- package/out/generator/validatorGenerator.js +621 -50
- package/out/main.js +64 -9
- package/package.json +96 -96
- package/out/generator/fhir-r4.d.ts +0 -676
- package/out/generator/fhirTypes.js +0 -12
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/AdmissionAppointment.ts +0 -94
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/AdmissionAppointmentClass.ts +0 -194
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/AdmissionCheckIn.ts +0 -29
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/AdmissionCheckInClass.ts +0 -194
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/AdmissionCheckInNoCode.ts +0 -29
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/AdmissionCheckInNoCodeClass.ts +0 -194
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/RandomSupport.ts +0 -26
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/valuesets/ValueSet-AdmissionFlowIds.ts +0 -38
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/valuesets/ValueSet-AdmissionReasonCodeGroup.ts +0 -42
- package/out/generator/temp/1761563744855-kptdikzwryj/generated/valuesets/index.ts +0 -18
- package/out/generator/temp/1761563744855-kptdikzwryj/package/.index.db +0 -0
- package/out/generator/temp/1761563744855-kptdikzwryj/package/.index.json +0 -234
- package/out/generator/temp/1761563744855-kptdikzwryj/package/CodeSystem-admission-flow-ids.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/CodeSystem-admission-reason-codes.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/ImplementationGuide-pink.admission.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/SearchParameter-SearchParameter-Appointment-AdmissionCheckIn.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/SearchParameter-SearchParameter-Appointment-AdmissionCheckInNoCode.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/SearchParameter-SearchParameter-Appointment-AdmissionUrl.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/SearchParameter-SearchParameter-Appointment-AdmissionUuid.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionAppointment.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionCheckIn.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionCheckInNoCode.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionDataFlow.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionDevice.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionDocumentMetadata.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionFormData.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionFormUrl.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionFormUuid.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionIntegrationPoints.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionPatient.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionPatientData.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-AdmissionRoutingRule.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-LocationTomlConfiguration.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-Pink-Location-With-Toml.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/StructureDefinition-PinkLocation.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/ValueSet-AdmissionFlowIdsValueSet.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/ValueSet-AdmissionReasonCodeGroup.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/example/AllergyIntolerance-Example-PenicillinAllergy.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/example/Appointment-Example-AdmissionAppointment.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/example/Condition-Example-DiabetesCondition.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/example/Device-Example-Surgery-Room.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/example/DocumentReference-Example-PreOperativeEvaluation.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/example/Location-Example-Location-With-Toml.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/example/Patient-Example-Patient.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/example/QuestionnaireResponse-Example-AdmissionFormResponse.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/other/spec.internals +0 -313
- package/out/generator/temp/1761563744855-kptdikzwryj/package/other/validation-oo.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/other/validation-summary.json +0 -1
- package/out/generator/temp/1761563744855-kptdikzwryj/package/package.json +0 -23
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-AdmissionAppointment.sch +0 -22
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-AdmissionCheckIn.sch +0 -18
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-AdmissionCheckInNoCode.sch +0 -18
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-AdmissionDevice.sch +0 -12
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-AdmissionFormUrl.sch +0 -18
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-AdmissionFormUuid.sch +0 -18
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-AdmissionPatient.sch +0 -12
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-Pink-Location-With-Toml.sch +0 -26
- package/out/generator/temp/1761563744855-kptdikzwryj/package/xml/StructureDefinition-PinkLocation.sch +0 -12
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionAppointment.ts +0 -94
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionAppointmentClass.ts +0 -194
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionCheckIn.ts +0 -29
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionCheckInClass.ts +0 -194
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionCheckInNoCode.ts +0 -29
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionCheckInNoCodeClass.ts +0 -194
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionDataFlow.ts +0 -51
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionDataFlowClass.ts +0 -194
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionDevice.ts +0 -67
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/AdmissionDeviceClass.ts +0 -199
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/RandomSupport.ts +0 -26
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/valuesets/ValueSet-AdmissionFlowIds.ts +0 -38
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/valuesets/ValueSet-AdmissionReasonCodeGroup.ts +0 -42
- package/out/generator/temp/1761673242558-4u3in1qziv2/generated/valuesets/index.ts +0 -18
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/.index.db +0 -0
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/.index.json +0 -234
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/CodeSystem-admission-flow-ids.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/CodeSystem-admission-reason-codes.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/ImplementationGuide-pink.admission.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/SearchParameter-SearchParameter-Appointment-AdmissionCheckIn.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/SearchParameter-SearchParameter-Appointment-AdmissionCheckInNoCode.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/SearchParameter-SearchParameter-Appointment-AdmissionUrl.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/SearchParameter-SearchParameter-Appointment-AdmissionUuid.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionAppointment.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionCheckIn.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionCheckInNoCode.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionDataFlow.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionDevice.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionDocumentMetadata.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionFormData.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionFormUrl.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionFormUuid.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionIntegrationPoints.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionPatient.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionPatientData.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-AdmissionRoutingRule.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-LocationTomlConfiguration.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-Pink-Location-With-Toml.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/StructureDefinition-PinkLocation.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/ValueSet-AdmissionFlowIdsValueSet.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/ValueSet-AdmissionReasonCodeGroup.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/example/AllergyIntolerance-Example-PenicillinAllergy.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/example/Appointment-Example-AdmissionAppointment.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/example/Condition-Example-DiabetesCondition.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/example/Device-Example-Surgery-Room.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/example/DocumentReference-Example-PreOperativeEvaluation.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/example/Location-Example-Location-With-Toml.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/example/Patient-Example-Patient.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/example/QuestionnaireResponse-Example-AdmissionFormResponse.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/other/spec.internals +0 -313
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/other/validation-oo.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/other/validation-summary.json +0 -1
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/package.json +0 -23
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-AdmissionAppointment.sch +0 -22
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-AdmissionCheckIn.sch +0 -18
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-AdmissionCheckInNoCode.sch +0 -18
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-AdmissionDevice.sch +0 -12
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-AdmissionFormUrl.sch +0 -18
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-AdmissionFormUuid.sch +0 -18
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-AdmissionPatient.sch +0 -12
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-Pink-Location-With-Toml.sch +0 -26
- package/out/generator/temp/1761673242558-4u3in1qziv2/package/xml/StructureDefinition-PinkLocation.sch +0 -12
package/LICENSE
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
ISC License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Maximilian Nussbaumer
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
copyright notice and this permission notice appear in all copies.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Maximilian Nussbaumer
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,210 +1,226 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- **
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Install
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
| `--
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
##
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
BabelFHIR-TS
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- **
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
- **
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
- **
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="./logo.png" alt="BabelFHIR-TS Logo" width="200"/>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
# BabelFHIR-TS
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/babelfhir-ts)
|
|
8
|
+
[](https://opensource.org/licenses/ISC)
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
[](https://nodejs.org/)
|
|
11
|
+
|
|
12
|
+
**BabelFHIR-TS** transforms FHIR® StructureDefinitions into production-ready TypeScript code with full type safety and built-in validation. Unlike generic FHIR type definitions, BabelFHIR-TS generates **profile-aware** interfaces that understand your Implementation Guide's constraints, extensions, and slicing rules.
|
|
13
|
+
|
|
14
|
+
### What you get
|
|
15
|
+
|
|
16
|
+
- **Strongly typed interfaces** that merge profile constraints with base FHIR types (types come from `@types/fhir`)
|
|
17
|
+
- **Compiled output by default** — packages ship JavaScript (`.js`) plus TypeScript declarations (`.d.ts`)
|
|
18
|
+
- **Runtime validation** using FHIRPath expressions from the profile—no external validator required for basic checks
|
|
19
|
+
- **Type-safe extension handling** with proper slicing and nested extension support
|
|
20
|
+
- **Random data builders** for testing and development (when class generation is enabled)
|
|
21
|
+
- **Zero manual mapping**—consume any FHIR package or Implementation Guide directly from registries
|
|
22
|
+
- **Fast and lightweight**—minimal runtime deps; only `fhirpath` is required for validators
|
|
23
|
+
- **Install any FHIR profile as a node module**—use `babelfhir-ts install` to add Implementation Guides directly to your project
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Install globally (recommended when using the CLI frequently):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g babelfhir-ts
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or invoke on-demand without a global install:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx babelfhir-ts --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> **Requirements:** Node.js 18+ (ESM support) and an internet connection when downloading packages from remote registries.
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
Generate code from a local folder that contains FHIR packages:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
babelfhir-ts input/ output/
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Process a single package archive and write the generated interfaces back into a new `.tgz` file:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
babelfhir-ts hl7.fhir.us.core-8.0.0.tgz us-core-generated.tgz
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Download and process a package directly from a registry (defaults to `https://packages.simplifier.net`):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
babelfhir-ts --package hl7.fhir.us.core@8.0.0
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Download, pocess and install a processed package into your current project:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
babelfhir-ts install hl7.fhir.us.core@8.0.0
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
After generation you can import the emitted classes:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { USCorePatientClass } from "./output/USCorePatientClass";
|
|
71
|
+
|
|
72
|
+
const patient = USCorePatientClass.random();
|
|
73
|
+
const { errors, warnings } = await patient.validate();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Using the generated code in your project
|
|
77
|
+
|
|
78
|
+
Generated profile packages installed via `babelfhir-ts install` are published as **compiled JavaScript with TypeScript declarations**:
|
|
79
|
+
|
|
80
|
+
- JavaScript for runtime: `index.js`, `*.js`
|
|
81
|
+
- Type declarations for IDE/TS: `index.d.ts`, `*.d.ts`
|
|
82
|
+
- Dependencies:
|
|
83
|
+
- `@types/fhir` is included as a dependency of the generated package (no extra setup in your app)
|
|
84
|
+
- `fhirpath` is a peer dependency (required only if you use the generated validators/classes)
|
|
85
|
+
|
|
86
|
+
Install `fhirpath` in your app if you plan to call `.validate()` or use the generated classes.
|
|
87
|
+
|
|
88
|
+
### Module resolution
|
|
89
|
+
|
|
90
|
+
Generated packages work with all modern TypeScript setups:
|
|
91
|
+
|
|
92
|
+
- **Node.js 18+** with `"type": "module"` in `package.json`
|
|
93
|
+
- **Bundlers** (Vite, esbuild, Webpack) with ESM output
|
|
94
|
+
- **TypeScript 5.0+** with any module resolution (`node16`, `nodenext`, or `bundler`)
|
|
95
|
+
|
|
96
|
+
#### FHIR type imports
|
|
97
|
+
|
|
98
|
+
Generated code imports base FHIR types from `"fhir/r4"`:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { Appointment, Extension, CodeableConcept } from "fhir/r4";
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Since `@types/fhir` doesn't provide a `package.json` `exports` field, BabelFHIR-TS includes an **ambient module declaration** (`fhir-r4.d.ts`) in every generated package. The generated `index.d.ts` references this file:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
/// <reference path="./fhir-r4.d.ts" />
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This ensures TypeScript can resolve `fhir/r4` imports automatically without any configuration in your project's `tsconfig.json`.
|
|
111
|
+
|
|
112
|
+
## CLI reference
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
babelfhir-ts [options] [<input> [output]]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
| Argument / option | Description |
|
|
119
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
120
|
+
| `<input>` | Directory of FHIR packages/StructureDefinitions, single package (`.tgz`/`.zip`), or single StructureDefinition `.json`. Defaults to `./input` when omitted. |
|
|
121
|
+
| `<output>` | Destination directory or archive. Defaults to `./output` when omitted. |
|
|
122
|
+
| `install` | Downloads, processes, and installs a package as a project dependency. |
|
|
123
|
+
| `--package <pkg@version>` | Fetch a package from a registry and process it without manual download. |
|
|
124
|
+
| `--registry <url>` | Custom registry base URL (default:`https://packages.simplifier.net`). |
|
|
125
|
+
| `--log <level>` | Control logging output:`none` (default), `console`, or `file`. |
|
|
126
|
+
| `--no-cache` | Remove the `.cache` directory once generation completes. |
|
|
127
|
+
| `--no-classes` | Skip emitting helper classes (interfaces & validators only). |
|
|
128
|
+
| `-h, --help` | Print usage help. |
|
|
129
|
+
| `-v, --version` | Print the BabelFHIR-TS version. |
|
|
130
|
+
|
|
131
|
+
### Supported inputs
|
|
132
|
+
|
|
133
|
+
- **Directory** – scan all `.tgz`, `.zip`, or `.json` files inside the folder
|
|
134
|
+
- **Archive** – process a FHIR NPM package in `.tgz` or `.zip` format
|
|
135
|
+
- **StructureDefinition JSON** – generate code for a single profile definitio
|
|
136
|
+
|
|
137
|
+
## Scripts for contributors
|
|
138
|
+
|
|
139
|
+
| Script | Purpose |
|
|
140
|
+
| ------------------------------ | ---------------------------------------------------------------------------- |
|
|
141
|
+
| `npm run generate` | Execute the CLI against the local `input/` folder and refresh `output/`. |
|
|
142
|
+
| `npm run generate:check` | End-to-end check: generate, type-check, and lint the emitted output. |
|
|
143
|
+
| `npm test` | Type-check and run all Vitest suites (coverage enabled). |
|
|
144
|
+
| `npm run download-validator` | Fetch the official HL7 validation jar used for parity testing. |
|
|
145
|
+
|
|
146
|
+
## Caching notes
|
|
147
|
+
|
|
148
|
+
The generator caches downloaded StructureDefinitions and packages inside `.cache/`. When you need a clean run, pass `--no-cache` or manually remove the folder. Temporary downloads land in `.temp-*` directories and are cleaned up automatically.
|
|
149
|
+
|
|
150
|
+
## Why BabelFHIR-TS?
|
|
151
|
+
|
|
152
|
+
**The FHIR Challenge**: Implementation Guides define strict profiles that constrain base FHIR resources with required or must-support elements, custom extensions, value set bindings, and cardinality rules. Existing TypeScript libraries can't capture these requirements when you need profile-specific types, leading to an overhead when using TypeScript to build apps that interact with FHIR servers.
|
|
153
|
+
|
|
154
|
+
**The BabelFHIR-TS Solution**: Automatically generates TypeScript interfaces and validation logic directly from StructureDefinition JSON. Your IDE autocompletes required fields, flags missing extensions at compile-time, and validates FHIRPath invariants at runtime.
|
|
155
|
+
|
|
156
|
+
## Limitations
|
|
157
|
+
|
|
158
|
+
BabelFHIR-TS is a code generation tool that parses FHIR StructureDefinitions and produces TypeScript interfaces and validators. While it handles many common FHIR profiling patterns, there are important limitations to be aware of:
|
|
159
|
+
|
|
160
|
+
### Profile Mapping Accuracy
|
|
161
|
+
|
|
162
|
+
- **Not guaranteed for all IGs**: The generator uses heuristics to interpret StructureDefinition constraints, slicing rules, and extensions. Complex or unusual profiling patterns may not map correctly to TypeScript.
|
|
163
|
+
- **Test before production**: Always validate the generated code against your specific Implementation Guide's examples and test cases. We recommend running the official FHIR validator alongside BabelFHIR-TS in your QA pipeline.
|
|
164
|
+
- **Edge cases**: Rare profiling constructs (deeply nested slicing, conditional constraints, complex discriminators) may generate suboptimal or incomplete types.
|
|
165
|
+
|
|
166
|
+
### Validation Scope
|
|
167
|
+
|
|
168
|
+
- **High-level checks only**: The generated `validate()` functions execute FHIRPath expressions from profile invariants but do **not** perform:
|
|
169
|
+
- Terminology expansion or ValueSet validation
|
|
170
|
+
- Reference resolution (checking that referenced resources exist)
|
|
171
|
+
- Full cardinality enforcement for complex slicing scenarios
|
|
172
|
+
- Server-side business logic or workflow rules
|
|
173
|
+
- **Use the official validator**: For production conformance testing, use the [HL7 FHIR Validator](https://github.com/hapifhir/org.hl7.fhir.core) alongside BabelFHIR-TS.
|
|
174
|
+
|
|
175
|
+
### TypeScript Limitations
|
|
176
|
+
|
|
177
|
+
- **Runtime type checking is limited**: TypeScript types are erased at compile time. The generated interfaces provide compile-time safety but cannot enforce constraints at runtime without the validator functions.
|
|
178
|
+
- **Extension slicing**: While the generator creates typed extension interfaces, TypeScript cannot enforce that extension arrays contain exactly the required slices at compile time (this is validated at runtime).
|
|
179
|
+
- **Choice types**: FHIR's `[x]` choice types (e.g., `value[x]`) are represented as union types in TypeScript, which may require runtime type narrowing.
|
|
180
|
+
|
|
181
|
+
### Generated Helper Methods
|
|
182
|
+
|
|
183
|
+
- **`random()` is not fully conformant**: The generated `.random()` methods create test data that satisfies TypeScript types and basic cardinality, but **do not guarantee** fully valid FHIR resources. Random data may violate:
|
|
184
|
+
- Complex FHIRPath invariants
|
|
185
|
+
- ValueSet bindings (codes are randomly chosen from required bindings but not guaranteed to be semantically correct)
|
|
186
|
+
- Profile-specific business rules
|
|
187
|
+
- Reference integrity constraints
|
|
188
|
+
|
|
189
|
+
Use `random()` for development, testing, and prototyping, but always validate production data on the FHIR server side.
|
|
190
|
+
|
|
191
|
+
- **`validate()` parity**: The generated validation methods execute FHIRPath expressions and check constraints from StructureDefinitions, but are **only guaranteed to match** the Firely .NET SDK validator for scenarios covered by our test suite (see GitHub actions). Edge cases, complex slicing patterns, or profiles not in our test pipeline may produce different results. For production conformance testing, use the [HL7 FHIR Validator](https://github.com/hapifhir/org.hl7.fhir.core) or [Firely .NET SDK](https://fire.ly/products/firely-net-sdk/) as the source of truth.
|
|
192
|
+
|
|
193
|
+
### FHIR Version Support
|
|
194
|
+
|
|
195
|
+
- **R4 only**: The current version targets FHIR R4. Support for R5, DSTU2, or STU3 is not yet available.
|
|
196
|
+
- **Dependencies**: Generated code depends on `@types/fhir` (R4 definitions) and `fhirpath` (R4 compatible).
|
|
197
|
+
|
|
198
|
+
### Reporting Issues
|
|
199
|
+
|
|
200
|
+
If you encounter an Implementation Guide that doesn't generate correctly, please [open an issue](https://github.com/quotentiroler/BabelFHIR-ts/issues) with:
|
|
201
|
+
|
|
202
|
+
- The package name and version
|
|
203
|
+
- The specific StructureDefinition URL
|
|
204
|
+
- Expected vs. actual generated output
|
|
205
|
+
- Any validation errors or type mismatches
|
|
206
|
+
|
|
207
|
+
We continuously improve the generator based on real-world IG usage, and your feedback helps make BabelFHIR-TS more robust.
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
ISC © Maximilian Nussbaumer
|
|
212
|
+
|
|
213
|
+
## Contributing
|
|
214
|
+
|
|
215
|
+
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to this project.
|
|
216
|
+
|
|
217
|
+
## Security
|
|
218
|
+
|
|
219
|
+
For security issues, please see [SECURITY.md](SECURITY.md) for our security policy and how to report vulnerabilities.
|
|
220
|
+
|
|
221
|
+
## Links
|
|
222
|
+
|
|
223
|
+
- [npm package](https://www.npmjs.com/package/babelfhir-ts)
|
|
224
|
+
- [GitHub repository](https://github.com/quotentiroler/BabelFHIR-ts)
|
|
225
|
+
- [Issue tracker](https://github.com/quotentiroler/BabelFHIR-ts/issues)
|
|
226
|
+
- [Changelog](CHANGELOG.md)
|
package/bin/babelfhir-ts.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { spawn } from 'child_process';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import { dirname, join } from 'path';
|
|
6
|
-
import process from 'process';
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = dirname(__filename);
|
|
11
|
-
|
|
12
|
-
// Use node directly to run the compiled JavaScript
|
|
13
|
-
const mainJsPath = join(__dirname, '..', 'out', 'main.js');
|
|
14
|
-
|
|
15
|
-
// Check if the compiled file exists
|
|
16
|
-
if (!fs.existsSync(mainJsPath)) {
|
|
17
|
-
console.error('Compiled main.js not found. Please ensure the package was built correctly.');
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const child = spawn('node', [mainJsPath, ...process.argv.slice(2)], {
|
|
22
|
-
stdio: 'inherit',
|
|
23
|
-
cwd: process.cwd(), // Use the current working directory where the command was invoked
|
|
24
|
-
shell: process.platform === 'win32'
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
child.on('exit', (code) => {
|
|
28
|
-
process.exit(code || 0);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
import process from 'process';
|
|
7
|
+
import fs from 'fs';
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
|
|
12
|
+
// Use node directly to run the compiled JavaScript
|
|
13
|
+
const mainJsPath = join(__dirname, '..', 'out', 'main.js');
|
|
14
|
+
|
|
15
|
+
// Check if the compiled file exists
|
|
16
|
+
if (!fs.existsSync(mainJsPath)) {
|
|
17
|
+
console.error('Compiled main.js not found. Please ensure the package was built correctly.');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const child = spawn('node', [mainJsPath, ...process.argv.slice(2)], {
|
|
22
|
+
stdio: 'inherit',
|
|
23
|
+
cwd: process.cwd(), // Use the current working directory where the command was invoked
|
|
24
|
+
shell: process.platform === 'win32'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
child.on('exit', (code) => {
|
|
28
|
+
process.exit(code || 0);
|
|
29
29
|
});
|