forked from atomic-ehr/codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.ts
More file actions
42 lines (36 loc) · 1.38 KB
/
generate.ts
File metadata and controls
42 lines (36 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { APIBuilder, mkCodegenLogger, prettyReport } from "../../src";
console.log("📦 Generating FHIR R4 Core Types...");
const logger = mkCodegenLogger({
prefix: "API",
suppressTags: ["#fieldTypeNotFound", "#largeValueSet"],
});
const builder = new APIBuilder({ logger })
.throwException()
.fromPackage("hl7.fhir.r4.core", "4.0.1")
.python({
allowExtraFields: false,
primitiveTypeExtension: true,
fhirpyClient: false,
fieldFormat: "snake_case",
})
.typeSchema({
treeShake: {
"hl7.fhir.r4.core": {
"http://hl7.org/fhir/StructureDefinition/Bundle": {},
"http://hl7.org/fhir/StructureDefinition/OperationOutcome": {},
"http://hl7.org/fhir/StructureDefinition/DomainResource": {},
"http://hl7.org/fhir/StructureDefinition/BackboneElement": {},
"http://hl7.org/fhir/StructureDefinition/Element": {},
"http://hl7.org/fhir/StructureDefinition/Patient": {},
"http://hl7.org/fhir/StructureDefinition/Observation": {},
"http://hl7.org/fhir/StructureDefinition/bodyweight": {},
},
},
})
.outputTo("./examples/python/fhir_types")
.cleanOutput(true);
const report = await builder.generate();
console.log(prettyReport(report));
if (!report.success) {
process.exit(1);
}