A Clojure library for declarative, data-driven EHR integrations.
Add the following dependency to your deps.edn:
io.github.samuelcarriles/ehr-adapter {:mvn/version "1.0.0"}
Or to your project.clj:
[io.github.samuelcarriles/ehr-adapter "1.0.0"]
:ref/ keywords to create reusable templates. Static values resolve at initialization; dynamic values resolve at runtime.This is how explicit, robust, and readable an adapter configuration looks using Babashka's HTTP client as the core transportation layer:
(require '[ehr-adapter.core :as ehr]
'[babashka.http-client :as http]
'[ehr-adapter.middleware.bb-http-client :as bb-middleware])
(def eclinicalworks-adapter-config
{:domain :eclinicalworks/tenant-beta
:base-url "https://staging-fhir.ecw.com/fhir/r4"
:middlewares [bb-middleware/wrap-request-handler]
:network-config {:request-handler http/request}
:auth {:initial [{:type :oauth2
:token-url "https://staging-fhir.ecw.com/fhir/oauth2/token"
:grant-type "client_credentials"
:client-id "prod-client-id-xyz"
:scopes ["patient/*.read"]
:client-secret "super-secure-secret"}]}
:operations [{:name :get-patient-by-id
:method :get
:path ["Patient" :ref/patientId]
:description "Retrieve a patient by their unique identifier."}]})
;; Initialize the engine
(def adapter (ehr/initialize eclinicalworks-adapter-config))
;; Invoke the operation
(ehr/invoke adapter :get-patient-by-id {:patientId "12345"
:request {:as :json}})
;; => {:status 200, :body {:resourceType "Patient", ...}}
To understand the exact structure of the configuration map, the data types supported by the validator, the behavior of the network resiliency engine, and the exhaustive breakdown of each authentication strategy (including advanced usage of :bindings), please check the official technical reference guide at: Configuration Reference Guide
Copyright © 2024 Samuel Carriles
Distributed under the MIT License.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |