@atomic-ehr/codegen 0.0.1-canary.20250821160126.c552195 → 0.0.1-canary.20250822150706.c3b8669
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/dist/api/builder.d.ts +3 -3
- package/dist/api/builder.d.ts.map +1 -1
- package/dist/api/builder.js +374 -0
- package/dist/api/generators/base/BaseGenerator.d.ts +4 -4
- package/dist/api/generators/base/BaseGenerator.d.ts.map +1 -1
- package/dist/api/generators/base/BaseGenerator.js +572 -0
- package/dist/api/generators/base/FileManager.d.ts +2 -2
- package/dist/api/generators/base/FileManager.d.ts.map +1 -1
- package/dist/api/generators/base/FileManager.js +204 -0
- package/dist/api/generators/base/PythonTypeMapper.d.ts +2 -2
- package/dist/api/generators/base/PythonTypeMapper.d.ts.map +1 -1
- package/dist/api/generators/base/PythonTypeMapper.js +71 -0
- package/dist/api/generators/base/TemplateEngine.d.ts +1 -1
- package/dist/api/generators/base/TemplateEngine.d.ts.map +1 -1
- package/dist/api/generators/base/TemplateEngine.js +133 -0
- package/dist/api/generators/base/TypeMapper.js +153 -0
- package/dist/api/generators/base/TypeScriptTypeMapper.d.ts +1 -1
- package/dist/api/generators/base/TypeScriptTypeMapper.d.ts.map +1 -1
- package/dist/api/generators/base/TypeScriptTypeMapper.js +232 -0
- package/dist/api/generators/base/builders/DirectoryBuilder.d.ts +4 -4
- package/dist/api/generators/base/builders/DirectoryBuilder.d.ts.map +1 -1
- package/dist/api/generators/base/builders/DirectoryBuilder.js +215 -0
- package/dist/api/generators/base/builders/FileBuilder.d.ts +2 -2
- package/dist/api/generators/base/builders/FileBuilder.d.ts.map +1 -1
- package/dist/api/generators/base/builders/FileBuilder.js +408 -0
- package/dist/api/generators/base/builders/IndexBuilder.d.ts +2 -2
- package/dist/api/generators/base/builders/IndexBuilder.d.ts.map +1 -1
- package/dist/api/generators/base/builders/IndexBuilder.js +290 -0
- package/dist/api/generators/base/enhanced-errors.d.ts +2 -2
- package/dist/api/generators/base/enhanced-errors.d.ts.map +1 -1
- package/dist/api/generators/base/enhanced-errors.js +259 -0
- package/dist/api/generators/base/error-handler.d.ts +1 -1
- package/dist/api/generators/base/error-handler.d.ts.map +1 -1
- package/dist/api/generators/base/error-handler.js +243 -0
- package/dist/api/generators/base/errors.d.ts +2 -2
- package/dist/api/generators/base/errors.d.ts.map +1 -1
- package/dist/api/generators/base/errors.js +694 -0
- package/dist/api/generators/base/index.d.ts +22 -22
- package/dist/api/generators/base/index.d.ts.map +1 -1
- package/dist/api/generators/base/index.js +161 -0
- package/dist/api/generators/base/types.d.ts +2 -2
- package/dist/api/generators/base/types.d.ts.map +1 -1
- package/dist/api/generators/base/types.js +12 -0
- package/dist/api/generators/rest-client.d.ts +2 -2
- package/dist/api/generators/rest-client.d.ts.map +1 -1
- package/dist/api/generators/rest-client.js +847 -0
- package/dist/api/generators/search-parameter-enhancer.d.ts +1 -1
- package/dist/api/generators/search-parameter-enhancer.d.ts.map +1 -1
- package/dist/api/generators/search-parameter-enhancer.js +801 -0
- package/dist/api/generators/types.js +4 -0
- package/dist/api/generators/typescript.d.ts +3 -3
- package/dist/api/generators/typescript.d.ts.map +1 -1
- package/dist/api/generators/typescript.js +537 -0
- package/dist/api/generators/validation-generator.js +632 -0
- package/dist/api/index.d.ts +10 -10
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +51 -0
- package/dist/cli/commands/generate/typescript.d.ts +1 -1
- package/dist/cli/commands/generate/typescript.d.ts.map +1 -1
- package/dist/cli/commands/generate/typescript.js +52 -0
- package/dist/cli/commands/generate.d.ts +5 -12
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +158 -0
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +100 -0
- package/dist/cli/commands/typeschema/generate.js +130 -0
- package/dist/cli/commands/typeschema.js +48 -0
- package/dist/cli/index.js +12 -8664
- package/dist/cli/utils/log.d.ts +2 -2
- package/dist/cli/utils/log.d.ts.map +1 -1
- package/dist/cli/utils/log.js +23 -0
- package/dist/cli/utils/prompts.js +224 -0
- package/dist/cli/utils/spinner.js +270 -0
- package/dist/config.d.ts +22 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +703 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +84 -38
- package/dist/logger.js +290 -0
- package/dist/typeschema/cache.d.ts +2 -2
- package/dist/typeschema/cache.d.ts.map +1 -1
- package/dist/typeschema/cache.js +285 -0
- package/dist/typeschema/core/binding.d.ts +1 -1
- package/dist/typeschema/core/binding.d.ts.map +1 -1
- package/dist/typeschema/core/binding.js +187 -0
- package/dist/typeschema/core/field-builder.d.ts +1 -1
- package/dist/typeschema/core/field-builder.d.ts.map +1 -1
- package/dist/typeschema/core/field-builder.js +259 -0
- package/dist/typeschema/core/identifier.js +117 -0
- package/dist/typeschema/core/nested-types.d.ts +1 -1
- package/dist/typeschema/core/nested-types.d.ts.map +1 -1
- package/dist/typeschema/core/nested-types.js +111 -0
- package/dist/typeschema/core/transformer.d.ts +2 -2
- package/dist/typeschema/core/transformer.d.ts.map +1 -1
- package/dist/typeschema/core/transformer.js +345 -0
- package/dist/typeschema/generator.d.ts +3 -3
- package/dist/typeschema/generator.d.ts.map +1 -1
- package/dist/typeschema/generator.js +352 -0
- package/dist/typeschema/index.d.ts +14 -14
- package/dist/typeschema/index.d.ts.map +1 -1
- package/dist/typeschema/index.js +92 -0
- package/dist/typeschema/parser.d.ts +2 -2
- package/dist/typeschema/parser.d.ts.map +1 -1
- package/dist/typeschema/parser.js +310 -0
- package/dist/typeschema/profile/processor.d.ts +1 -1
- package/dist/typeschema/profile/processor.d.ts.map +1 -1
- package/dist/typeschema/profile/processor.js +268 -0
- package/dist/typeschema/schema.js +456 -0
- package/dist/typeschema/type-schema.types.js +39 -0
- package/dist/typeschema/types.js +4 -0
- package/dist/typeschema/utils.d.ts +1 -1
- package/dist/typeschema/utils.d.ts.map +1 -1
- package/dist/typeschema/utils.js +13 -0
- package/dist/typeschema/value-set/processor.d.ts +1 -1
- package/dist/typeschema/value-set/processor.d.ts.map +1 -1
- package/dist/typeschema/value-set/processor.js +168 -0
- package/dist/utils/codegen-logger.js +204 -0
- package/dist/utils.js +42 -0
- package/package.json +15 -4
- package/dist/index-e7pfye24.js +0 -8532
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
export const validationSchema = {
|
|
2
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
$id: "https://fhir-clj.github.io/type-schema/json-schema/type-schema.json",
|
|
4
|
+
$comment: "Maturity Level: Draft",
|
|
5
|
+
title: "Type Schema",
|
|
6
|
+
description: "A code generation friendly representation of FHIR StructureDefinition and FHIR Schema designed to simplify SDK resource classes/types generation.",
|
|
7
|
+
type: "object",
|
|
8
|
+
definitions: {
|
|
9
|
+
"type-schema-identifier": {
|
|
10
|
+
type: "object",
|
|
11
|
+
oneOf: [
|
|
12
|
+
{ $ref: "#/definitions/with-primitive-type-kind" },
|
|
13
|
+
{ $ref: "#/definitions/with-valueset-kind" },
|
|
14
|
+
{ $ref: "#/definitions/with-complex-type-kind" },
|
|
15
|
+
{ $ref: "#/definitions/with-resource-kind" },
|
|
16
|
+
{ $ref: "#/definitions/with-nested-kind" },
|
|
17
|
+
{ $ref: "#/definitions/with-logical-kind" },
|
|
18
|
+
{ $ref: "#/definitions/with-binding-kind" },
|
|
19
|
+
],
|
|
20
|
+
properties: {
|
|
21
|
+
kind: {
|
|
22
|
+
type: "string",
|
|
23
|
+
},
|
|
24
|
+
package: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "The FHIR package identifier (e.g., hl7.fhir.r4.core)",
|
|
27
|
+
},
|
|
28
|
+
version: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "The version of the package",
|
|
31
|
+
},
|
|
32
|
+
name: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Computer friendly identifier for the element",
|
|
35
|
+
},
|
|
36
|
+
url: {
|
|
37
|
+
type: "string",
|
|
38
|
+
pattern: "^(https?://|urn:)[^\\s]+$",
|
|
39
|
+
description: "A canonical URL identifying this resource uniquely in the FHIR ecosystem",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
required: ["kind", "package", "version", "name", "url"],
|
|
43
|
+
additionalProperties: false,
|
|
44
|
+
},
|
|
45
|
+
"with-primitive-type-kind": {
|
|
46
|
+
type: "object",
|
|
47
|
+
description: "Constraint helper to ensure the kind is primitive-type",
|
|
48
|
+
properties: {
|
|
49
|
+
kind: { const: "primitive-type" },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
"with-valueset-kind": {
|
|
53
|
+
type: "object",
|
|
54
|
+
description: "Constraint helper to ensure the kind is value-set",
|
|
55
|
+
properties: {
|
|
56
|
+
kind: { const: "value-set" },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
"with-binding-kind": {
|
|
60
|
+
type: "object",
|
|
61
|
+
description: "Constraint helper to ensure the kind is value-set",
|
|
62
|
+
properties: {
|
|
63
|
+
kind: { const: "binding" },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
"with-complex-type-kind": {
|
|
67
|
+
type: "object",
|
|
68
|
+
description: "Constraint helper to ensure the kind is complex-type",
|
|
69
|
+
properties: {
|
|
70
|
+
kind: { const: "complex-type" },
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
"with-resource-kind": {
|
|
74
|
+
type: "object",
|
|
75
|
+
description: "Constraint helper to ensure the kind is resource",
|
|
76
|
+
properties: {
|
|
77
|
+
kind: { const: "resource" },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
"with-nested-kind": {
|
|
81
|
+
type: "object",
|
|
82
|
+
description: "Constraint helper to ensure the kind is nested",
|
|
83
|
+
properties: {
|
|
84
|
+
kind: { const: "nested" },
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
"with-logical-kind": {
|
|
88
|
+
type: "object",
|
|
89
|
+
description: "Constraint helper to ensure the kind is logical",
|
|
90
|
+
properties: {
|
|
91
|
+
kind: { const: "logical" },
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
"field.regular": {
|
|
95
|
+
title: "Regular field",
|
|
96
|
+
description: "A standard field with a single type",
|
|
97
|
+
type: "object",
|
|
98
|
+
properties: {
|
|
99
|
+
type: {
|
|
100
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
101
|
+
description: "The data type of this field",
|
|
102
|
+
},
|
|
103
|
+
reference: {
|
|
104
|
+
type: "array",
|
|
105
|
+
description: "Reference to other types that this field can point to",
|
|
106
|
+
items: {
|
|
107
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
required: {
|
|
111
|
+
type: "boolean",
|
|
112
|
+
default: false,
|
|
113
|
+
description: "Whether this field must be provided in valid instances",
|
|
114
|
+
},
|
|
115
|
+
excluded: {
|
|
116
|
+
type: "boolean",
|
|
117
|
+
default: false,
|
|
118
|
+
description: "Whether this field is prohibited in valid instances",
|
|
119
|
+
},
|
|
120
|
+
array: {
|
|
121
|
+
type: "boolean",
|
|
122
|
+
default: false,
|
|
123
|
+
description: "Whether this field can contain multiple values (cardinality > 1)",
|
|
124
|
+
},
|
|
125
|
+
binding: {
|
|
126
|
+
allOf: [
|
|
127
|
+
{ $ref: "#/definitions/type-schema-identifier" },
|
|
128
|
+
{ $ref: "#/definitions/with-binding-kind" },
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
enum: {
|
|
132
|
+
type: "array",
|
|
133
|
+
items: { type: "string" },
|
|
134
|
+
description: "For code fields, the set of valid values when bound to a required value set",
|
|
135
|
+
},
|
|
136
|
+
min: {
|
|
137
|
+
type: "number",
|
|
138
|
+
description: "Minimum limit of items for an array",
|
|
139
|
+
},
|
|
140
|
+
max: {
|
|
141
|
+
type: "number",
|
|
142
|
+
description: "Maximum limit of items for an array",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
required: ["type"],
|
|
146
|
+
additionalProperties: false,
|
|
147
|
+
},
|
|
148
|
+
"field.polymorphic-declaration": {
|
|
149
|
+
title: "Polymorphic value[x] field declaration",
|
|
150
|
+
description: "The base declaration for a FHIR choice type (e.g., value[x])",
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
choices: {
|
|
154
|
+
type: "array",
|
|
155
|
+
items: { type: "string" },
|
|
156
|
+
description: "The names of all concrete type options for this choice field",
|
|
157
|
+
},
|
|
158
|
+
required: {
|
|
159
|
+
type: "boolean",
|
|
160
|
+
default: false,
|
|
161
|
+
description: "Whether at least one choice must be provided",
|
|
162
|
+
},
|
|
163
|
+
excluded: {
|
|
164
|
+
type: "boolean",
|
|
165
|
+
default: false,
|
|
166
|
+
description: "Whether all choices are prohibited",
|
|
167
|
+
},
|
|
168
|
+
array: {
|
|
169
|
+
type: "boolean",
|
|
170
|
+
default: false,
|
|
171
|
+
description: "Whether the selected choice can contain multiple values",
|
|
172
|
+
},
|
|
173
|
+
min: {
|
|
174
|
+
type: "number",
|
|
175
|
+
description: "Minimum limit of items for an array",
|
|
176
|
+
},
|
|
177
|
+
max: {
|
|
178
|
+
type: "number",
|
|
179
|
+
description: "Maximum limit of items for an array",
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
required: ["choices"],
|
|
183
|
+
additionalProperties: false,
|
|
184
|
+
},
|
|
185
|
+
"field.polymorphic-instance": {
|
|
186
|
+
title: "Polymorphic value[x] field instance",
|
|
187
|
+
description: "A specific type option for a FHIR choice type (e.g., valueString, valueInteger)",
|
|
188
|
+
type: "object",
|
|
189
|
+
properties: {
|
|
190
|
+
choiceOf: {
|
|
191
|
+
type: "string",
|
|
192
|
+
description: "The name of the choice field this instance belongs to (e.g., 'value' for valueString)",
|
|
193
|
+
},
|
|
194
|
+
type: {
|
|
195
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
196
|
+
description: "The data type of this choice option",
|
|
197
|
+
},
|
|
198
|
+
required: {
|
|
199
|
+
type: "boolean",
|
|
200
|
+
default: false,
|
|
201
|
+
description: "Whether this specific choice must be provided",
|
|
202
|
+
},
|
|
203
|
+
excluded: {
|
|
204
|
+
type: "boolean",
|
|
205
|
+
default: false,
|
|
206
|
+
description: "Whether this specific choice is prohibited",
|
|
207
|
+
},
|
|
208
|
+
array: {
|
|
209
|
+
type: "boolean",
|
|
210
|
+
default: false,
|
|
211
|
+
description: "Whether this choice can contain multiple values",
|
|
212
|
+
},
|
|
213
|
+
reference: {
|
|
214
|
+
type: "array",
|
|
215
|
+
description: "Reference to other types that this field can point to",
|
|
216
|
+
items: {
|
|
217
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
binding: {
|
|
221
|
+
allOf: [
|
|
222
|
+
{ $ref: "#/definitions/type-schema-identifier" },
|
|
223
|
+
{ $ref: "#/definitions/with-binding-kind" },
|
|
224
|
+
],
|
|
225
|
+
description: "For coded choices, information about the value set binding",
|
|
226
|
+
},
|
|
227
|
+
enum: {
|
|
228
|
+
type: "array",
|
|
229
|
+
items: { type: "string" },
|
|
230
|
+
description: "For code fields, the set of valid values when bound to a required value set",
|
|
231
|
+
},
|
|
232
|
+
min: {
|
|
233
|
+
type: "number",
|
|
234
|
+
description: "Minimum limit of items for an array",
|
|
235
|
+
},
|
|
236
|
+
max: {
|
|
237
|
+
type: "number",
|
|
238
|
+
description: "Maximum limit of items for an array",
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
required: ["type", "choiceOf"],
|
|
242
|
+
additionalProperties: false,
|
|
243
|
+
},
|
|
244
|
+
dependencies: {
|
|
245
|
+
type: "array",
|
|
246
|
+
description: "Other types that this type depends on",
|
|
247
|
+
items: {
|
|
248
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
oneOf: [
|
|
253
|
+
{
|
|
254
|
+
title: "Type Schema for Primitive Type",
|
|
255
|
+
description: "Schema for basic FHIR data types like string, boolean, decimal",
|
|
256
|
+
type: "object",
|
|
257
|
+
properties: {
|
|
258
|
+
identifier: {
|
|
259
|
+
allOf: [
|
|
260
|
+
{ $ref: "#/definitions/type-schema-identifier" },
|
|
261
|
+
{ $ref: "#/definitions/with-primitive-type-kind" },
|
|
262
|
+
],
|
|
263
|
+
description: "The unique identifier for this primitive type",
|
|
264
|
+
},
|
|
265
|
+
description: {
|
|
266
|
+
type: "string",
|
|
267
|
+
description: "Human-readable description of the primitive type",
|
|
268
|
+
},
|
|
269
|
+
base: {
|
|
270
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
271
|
+
description: "The base type this primitive type extends (typically Element)",
|
|
272
|
+
},
|
|
273
|
+
dependencies: {
|
|
274
|
+
$ref: "#/definitions/dependencies",
|
|
275
|
+
description: "Other types that this primitive type depends on",
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
required: ["identifier", "base"],
|
|
279
|
+
additionalProperties: false,
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
title: "Type Schema for Resource, Complex Type, Logical",
|
|
283
|
+
description: "Schema for FHIR resources, complex types, and logical types",
|
|
284
|
+
type: "object",
|
|
285
|
+
properties: {
|
|
286
|
+
identifier: {
|
|
287
|
+
allOf: [
|
|
288
|
+
{ $ref: "#/definitions/type-schema-identifier" },
|
|
289
|
+
{
|
|
290
|
+
oneOf: [
|
|
291
|
+
{ $ref: "#/definitions/with-resource-kind" },
|
|
292
|
+
{ $ref: "#/definitions/with-complex-type-kind" },
|
|
293
|
+
{ $ref: "#/definitions/with-logical-kind" },
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
description: "The unique identifier for this resource or type",
|
|
298
|
+
},
|
|
299
|
+
base: {
|
|
300
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
301
|
+
description: "The base type this resource or type extends",
|
|
302
|
+
},
|
|
303
|
+
description: {
|
|
304
|
+
type: "string",
|
|
305
|
+
description: "Human-readable description of the resource or type",
|
|
306
|
+
},
|
|
307
|
+
fields: {
|
|
308
|
+
type: "object",
|
|
309
|
+
description: "The fields contained in this resource or type",
|
|
310
|
+
additionalProperties: {
|
|
311
|
+
anyOf: [
|
|
312
|
+
{ $ref: "#/definitions/field.regular" },
|
|
313
|
+
{ $ref: "#/definitions/field.polymorphic-declaration" },
|
|
314
|
+
{ $ref: "#/definitions/field.polymorphic-instance" },
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
nested: {
|
|
319
|
+
type: "array",
|
|
320
|
+
description: "BackboneElement types nested within this resource or type",
|
|
321
|
+
items: {
|
|
322
|
+
type: "object",
|
|
323
|
+
properties: {
|
|
324
|
+
identifier: {
|
|
325
|
+
allOf: [
|
|
326
|
+
{ $ref: "#/definitions/type-schema-identifier" },
|
|
327
|
+
{ $ref: "#/definitions/with-nested-kind" },
|
|
328
|
+
],
|
|
329
|
+
description: "The unique identifier for this nested type",
|
|
330
|
+
},
|
|
331
|
+
base: {
|
|
332
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
333
|
+
description: "The base type this nested type extends (typically BackboneElement)",
|
|
334
|
+
},
|
|
335
|
+
fields: {
|
|
336
|
+
type: "object",
|
|
337
|
+
description: "The fields contained in this nested type",
|
|
338
|
+
additionalProperties: {
|
|
339
|
+
anyOf: [
|
|
340
|
+
{ $ref: "#/definitions/field.regular" },
|
|
341
|
+
{ $ref: "#/definitions/field.polymorphic-declaration" },
|
|
342
|
+
{ $ref: "#/definitions/field.polymorphic-instance" },
|
|
343
|
+
],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
required: ["identifier", "base"],
|
|
348
|
+
additionalProperties: false,
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
dependencies: {
|
|
352
|
+
type: "array",
|
|
353
|
+
description: "Other types that this resource or type depends on",
|
|
354
|
+
items: {
|
|
355
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
required: ["identifier"],
|
|
360
|
+
additionalProperties: false,
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
title: "Type Schema for ValueSet",
|
|
364
|
+
description: "Schema for FHIR value sets that define terminology bindings",
|
|
365
|
+
type: "object",
|
|
366
|
+
properties: {
|
|
367
|
+
identifier: {
|
|
368
|
+
allOf: [
|
|
369
|
+
{ $ref: "#/definitions/type-schema-identifier" },
|
|
370
|
+
{ $ref: "#/definitions/with-valueset-kind" },
|
|
371
|
+
],
|
|
372
|
+
description: "The unique identifier for this value set",
|
|
373
|
+
},
|
|
374
|
+
description: {
|
|
375
|
+
type: "string",
|
|
376
|
+
description: "Human-readable description of the value set",
|
|
377
|
+
},
|
|
378
|
+
concept: {
|
|
379
|
+
type: "array",
|
|
380
|
+
description: "The list of coded concepts contained in this value set",
|
|
381
|
+
items: {
|
|
382
|
+
type: "object",
|
|
383
|
+
properties: {
|
|
384
|
+
code: {
|
|
385
|
+
type: "string",
|
|
386
|
+
description: "The code value",
|
|
387
|
+
},
|
|
388
|
+
display: {
|
|
389
|
+
type: "string",
|
|
390
|
+
description: "The human-readable display text for this code",
|
|
391
|
+
},
|
|
392
|
+
system: {
|
|
393
|
+
type: "string",
|
|
394
|
+
description: "The code system URL that defines this code",
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
required: ["code"],
|
|
398
|
+
additionalProperties: false,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
compose: {
|
|
402
|
+
type: "object",
|
|
403
|
+
description: "Complex value set composition rules when the value set is defined as a composition of other value sets",
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
required: ["identifier"],
|
|
407
|
+
additionalProperties: false,
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
title: "Type Schema for Binding",
|
|
411
|
+
type: "object",
|
|
412
|
+
properties: {
|
|
413
|
+
identifier: {
|
|
414
|
+
allOf: [
|
|
415
|
+
{ $ref: "#/definitions/type-schema-identifier" },
|
|
416
|
+
{ $ref: "#/definitions/with-binding-kind" },
|
|
417
|
+
],
|
|
418
|
+
description: "The unique identifier for this value set",
|
|
419
|
+
},
|
|
420
|
+
description: {
|
|
421
|
+
type: "string",
|
|
422
|
+
description: "Human-readable description of the value set",
|
|
423
|
+
},
|
|
424
|
+
type: {
|
|
425
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
426
|
+
},
|
|
427
|
+
strength: {
|
|
428
|
+
type: "string",
|
|
429
|
+
description: "The strength of the binding",
|
|
430
|
+
},
|
|
431
|
+
enum: {
|
|
432
|
+
type: "array",
|
|
433
|
+
items: {
|
|
434
|
+
type: "string",
|
|
435
|
+
},
|
|
436
|
+
description: "The enumeration of values for the binding",
|
|
437
|
+
},
|
|
438
|
+
valueset: {
|
|
439
|
+
allOf: [
|
|
440
|
+
{ $ref: "#/definitions/type-schema-identifier" },
|
|
441
|
+
{ $ref: "#/definitions/with-valueset-kind" },
|
|
442
|
+
],
|
|
443
|
+
},
|
|
444
|
+
dependencies: {
|
|
445
|
+
type: "array",
|
|
446
|
+
description: "Other types that this resource or type depends on",
|
|
447
|
+
items: {
|
|
448
|
+
$ref: "#/definitions/type-schema-identifier",
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
required: ["identifier"],
|
|
453
|
+
additionalProperties: false,
|
|
454
|
+
},
|
|
455
|
+
],
|
|
456
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript type definitions for Type Schema
|
|
3
|
+
*
|
|
4
|
+
* Generated based on type-schema.schema.json
|
|
5
|
+
* A code generation friendly representation of FHIR StructureDefinition
|
|
6
|
+
* and FHIR Schema designed to simplify SDK resource classes/types generation.
|
|
7
|
+
*/
|
|
8
|
+
// Type guards for discriminating between different schema types
|
|
9
|
+
export function isPrimitiveTypeSchema(schema) {
|
|
10
|
+
return schema.identifier.kind === "primitive-type";
|
|
11
|
+
}
|
|
12
|
+
export function isResourceSchema(schema) {
|
|
13
|
+
return schema.identifier.kind === "resource";
|
|
14
|
+
}
|
|
15
|
+
export function isComplexTypeSchema(schema) {
|
|
16
|
+
return schema.identifier.kind === "complex-type";
|
|
17
|
+
}
|
|
18
|
+
export function isLogicalSchema(schema) {
|
|
19
|
+
return schema.identifier.kind === "logical";
|
|
20
|
+
}
|
|
21
|
+
export function isValueSetSchema(schema) {
|
|
22
|
+
return schema.identifier.kind === "value-set";
|
|
23
|
+
}
|
|
24
|
+
export function isBindingSchema(schema) {
|
|
25
|
+
return schema.identifier.kind === "binding";
|
|
26
|
+
}
|
|
27
|
+
export function isNestedTypeSchema(identifier) {
|
|
28
|
+
return identifier.kind === "nested";
|
|
29
|
+
}
|
|
30
|
+
// Field type guards
|
|
31
|
+
export function isRegularField(field) {
|
|
32
|
+
return "type" in field && !("choiceOf" in field) && !("choices" in field);
|
|
33
|
+
}
|
|
34
|
+
export function isPolymorphicDeclarationField(field) {
|
|
35
|
+
return "choices" in field;
|
|
36
|
+
}
|
|
37
|
+
export function isPolymorphicInstanceField(field) {
|
|
38
|
+
return "choiceOf" in field && "type" in field;
|
|
39
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PolymorphicValueXFieldInstance, RegularField, TypeSchema, TypeSchemaField, TypeSchemaForResourceComplexTypeLogical } from "./types";
|
|
1
|
+
import type { PolymorphicValueXFieldInstance, RegularField, TypeSchema, TypeSchemaField, TypeSchemaForResourceComplexTypeLogical } from "./types.js";
|
|
2
2
|
export declare const isPolymorphicInstanceField: (field: TypeSchemaField) => field is PolymorphicValueXFieldInstance;
|
|
3
3
|
export declare const isTypeSchemaValueSet: () => void;
|
|
4
4
|
export declare const isRegularField: (field: TypeSchemaField) => field is RegularField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/typeschema/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,8BAA8B,EAC9B,YAAY,EACZ,UAAU,EACV,eAAe,EACf,uCAAuC,EACvC,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/typeschema/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,8BAA8B,EAC9B,YAAY,EACZ,UAAU,EACV,eAAe,EACf,uCAAuC,EACvC,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,0BAA0B,GACtC,OAAO,eAAe,KACpB,KAAK,IAAI,8BAEX,CAAC;AAEF,eAAO,MAAM,oBAAoB,YAAW,CAAC;AAC7C,eAAO,MAAM,cAAc,GAC1B,OAAO,eAAe,KACpB,KAAK,IAAI,YAEX,CAAC;AAEF,eAAO,MAAM,mBAAmB,YAAW,CAAC;AAE5C,eAAO,MAAM,yCAAyC,GACrD,QAAQ,UAAU,KAChB,MAAM,IAAI,uCAMZ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const isPolymorphicInstanceField = (field) => {
|
|
2
|
+
return "choiceOf" in field;
|
|
3
|
+
};
|
|
4
|
+
export const isTypeSchemaValueSet = () => { };
|
|
5
|
+
export const isRegularField = (field) => {
|
|
6
|
+
return !("choices" in field);
|
|
7
|
+
};
|
|
8
|
+
export const isTypeSchemaBinding = () => { };
|
|
9
|
+
export const isTypeSchemaForResourceComplexTypeLogical = (schema) => {
|
|
10
|
+
return (schema.identifier.kind === "resource" ||
|
|
11
|
+
schema.identifier.kind === "complex-type" ||
|
|
12
|
+
schema.identifier.kind === "logical");
|
|
13
|
+
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Functions for transforming FHIR ValueSets into TypeSchema format
|
|
5
5
|
*/
|
|
6
6
|
import type { CanonicalManager } from "@atomic-ehr/fhir-canonical-manager";
|
|
7
|
-
import type { PackageInfo, TypeSchemaForValueSet } from "../types";
|
|
7
|
+
import type { PackageInfo, TypeSchemaForValueSet } from "../types.js";
|
|
8
8
|
/**
|
|
9
9
|
* Extract all concepts from a ValueSet
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../../src/typeschema/value-set/processor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,KAAK,EACX,WAAW,EACX,qBAAqB,EAErB,MAAM,
|
|
1
|
+
{"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../../src/typeschema/value-set/processor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,OAAO,KAAK,EACX,WAAW,EACX,qBAAqB,EAErB,MAAM,aAAa,CAAC;AAgGrB;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC1C,OAAO,CACT,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CACrE,CAqCA;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACtC,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC5C,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,qBAAqB,CAAC,CA4DhC"}
|