|
13 | 13 | [clojure.spec.alpha :as s]
|
14 | 14 | [clojure.data]
|
15 | 15 | [clojure.java.io :as io]
|
16 |
| - [aidbox-sdk.generator.typescript :as gen.typescript])) |
| 16 | + [aidbox-sdk.generator.typescript :as gen.typescript] |
| 17 | + [clojure.data.json :as json])) |
17 | 18 |
|
18 | 19 | (defonce aidbox-schemas (atom nil))
|
19 | 20 |
|
20 | 21 | (defn load-aidbox-schemas []
|
21 | 22 | (reset! aidbox-schemas
|
22 | 23 | (import/retrieve
|
23 |
| - (import/resource "http://localhost:8765/api/sdk/fhir-packages") {:auth "YmFzaWM6c2VjcmV0"})) |
| 24 | + (import/resource "http://localhost:3333/r4/fhir-packages") {:auth "YmFzaWM6c2VjcmV0"})) |
24 | 25 | nil)
|
25 | 26 |
|
26 | 27 | (comment
|
27 | 28 | (load-aidbox-schemas)
|
28 | 29 |
|
29 | 30 | (defonce r4-schemas (import/retrieve (import/resource "resources/r4") {}))
|
30 | 31 | (defonce r4b-schemas (import/retrieve (import/resource "resources/r4b") {}))
|
31 |
| - (defonce r5-schemas (import/retrieve (import/resource "resources/schemas/r5") {})) |
32 |
| - |
33 |
| - ) |
34 |
| - |
| 32 | + (defonce r5-schemas (import/retrieve (import/resource "resources/schemas/r5") {}))) |
35 | 33 |
|
36 | 34 | (defn kinds [schemas] (distinct (map :kind schemas)))
|
37 | 35 | (defn resource-types [schemas] (distinct (map :resourceType schemas)))
|
38 | 36 | (defn packages [schemas] (distinct (map :package schemas)))
|
39 | 37 |
|
40 |
| -(defn exclude-keys [m keys] |
41 |
| - (apply dissoc m keys)) |
| 38 | +(defn exclude-keys [m keys] (apply dissoc m keys)) |
42 | 39 |
|
43 | 40 | (defn filter-by-url [url schemas]
|
44 | 41 | (filter #(= url (:url %)) schemas))
|
|
100 | 97 | constraint-ir-schemas (converter/convert-constraints constraint-schemas
|
101 | 98 | (remove fhir/constraint? ir-schemas))]
|
102 | 99 |
|
103 |
| - ir-schemas |
104 |
| - ) |
| 100 | + (map models/validate-fhir-schema fhir-schemas) |
105 | 101 |
|
106 |
| - :rcf) |
| 102 | + #_(filter-by-url "http://hl7.org/fhir/StructureDefinition/Resource" fhir-schemas)) |
| 103 | + |
| 104 | +; |
| 105 | + ) |
107 | 106 |
|
108 | 107 | (comment
|
| 108 | + ;; Mock Server |
| 109 | + |
| 110 | + ;; run server |
| 111 | + (do (require '[mock-server.main :as server]) |
| 112 | + (def mock-server (server/run))) |
| 113 | + |
| 114 | + ;; stop server |
| 115 | + (mock-server) |
| 116 | + |
| 117 | + ; |
| 118 | + ) |
| 119 | + |
| 120 | + |
| 121 | +(comment |
| 122 | + (sdk/generate! :dotnet |
| 123 | + "http://localhost:3333/r4/fhir-packages" |
| 124 | + {:output-dir "dist/dotnet" |
| 125 | + :auth-token "YmFzaWM6c2VjcmV0" |
| 126 | + :exit (fn [_] nil)}) |
| 127 | + |
| 128 | + (sdk/generate! :typescript |
| 129 | + "http://localhost:3333/r4/fhir-packages" |
| 130 | + {:output-dir "dist/typescript" |
| 131 | + :auth-token "YmFzaWM6c2VjcmV0" |
| 132 | + :exit (fn [_] nil)}) |
| 133 | + |
109 | 134 | (sdk/generate! :python
|
110 |
| - "http://localhost:8765/api/sdk/fhir-packages" |
111 |
| - {:output-dir "out" |
| 135 | + "http://localhost:3333/r4/fhir-packages" |
| 136 | + {:output-dir "dist/python" |
112 | 137 | :auth-token "YmFzaWM6c2VjcmV0"
|
113 | 138 | :exit (fn [_] nil)})
|
114 | 139 |
|
115 |
| - :rcf) |
| 140 | +; |
| 141 | + ) |
0 commit comments