FHIR client implementation in clojure.
(require '[fhir.core :as fhir])
;; create profile index
(def idx
(fc/index
"profiles/profiles-resources.json"
"profiles/profiles-types.json"))
(def pt
(fhir/parse idx "
{\"resourceType\": \"Patient\",
\"name\": [{\"text\":\"Smith\"}],
\"active\": true}
"))
(fhir/validate idx pt)
;;=> collection of OperationOutcome.issue
(fhir/generate idx pt :xml)
;;=> <Patient> <name><text value="Smith"/></name><active value="true"></Patient>
(fhir/resource idx {:resourceType "Patient" :name {:text "Smith" :family "Eric"}})
;;=> {:resourceType "Patient" :name [{:text "Smith" :family ["Eric"]}]}
fhir.clj is not very strict about arity of attributes, so you can assign single value where collection is expected and this will be fixed using metadata from profile.
Copyright © 2014 HealthSamurai
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close