minor refactoring
This commit is contained in:
parent
ed4d571cf5
commit
048557d4d1
|
@ -461,10 +461,7 @@
|
||||||
(apply join-paths url-components)
|
(apply join-paths url-components)
|
||||||
:params (merge
|
:params (merge
|
||||||
{:_id id}
|
{:_id id}
|
||||||
(apply hash-map (if (and (seq? params)
|
(build-params-map params)))))
|
||||||
(= 1 (count params)))
|
|
||||||
(first params)
|
|
||||||
params))))))
|
|
||||||
|
|
||||||
(defn history
|
(defn history
|
||||||
"returns a bundle containing the history of a single FHIR resource. note that this history can
|
"returns a bundle containing the history of a single FHIR resource. note that this history can
|
||||||
|
@ -484,10 +481,7 @@
|
||||||
(fhir-request :get
|
(fhir-request :get
|
||||||
base-url
|
base-url
|
||||||
(apply join-paths url-components)
|
(apply join-paths url-components)
|
||||||
:params (apply hash-map (if (and (seq? params)
|
:params (build-params-map params))))
|
||||||
(= 1 (count params)))
|
|
||||||
(first params)
|
|
||||||
params)))))
|
|
||||||
|
|
||||||
(defn search
|
(defn search
|
||||||
"searches for resources on a FHIR server. multiple parameters are ANDed together. use of the search
|
"searches for resources on a FHIR server. multiple parameters are ANDed together. use of the search
|
||||||
|
@ -510,10 +504,7 @@
|
||||||
:params-as-body? true
|
:params-as-body? true
|
||||||
:params (merge
|
:params (merge
|
||||||
(search-params->query-map where)
|
(search-params->query-map where)
|
||||||
(apply hash-map (if (and (seq? params)
|
(build-params-map params)))))
|
||||||
(= 1 (count params)))
|
|
||||||
(first params)
|
|
||||||
params))))))
|
|
||||||
|
|
||||||
(defn search-and-fetch
|
(defn search-and-fetch
|
||||||
"same as search, but automatically fetches all pages of resources returning a single bundle
|
"same as search, but automatically fetches all pages of resources returning a single bundle
|
||||||
|
|
|
@ -73,6 +73,14 @@
|
||||||
(flatten)
|
(flatten)
|
||||||
(apply str)))
|
(apply str)))
|
||||||
|
|
||||||
|
(defn build-params-map [m]
|
||||||
|
(apply
|
||||||
|
hash-map
|
||||||
|
(if (and (seq? m)
|
||||||
|
(= 1 (count m)))
|
||||||
|
(first m)
|
||||||
|
m)))
|
||||||
|
|
||||||
(defn join-paths [& paths]
|
(defn join-paths [& paths]
|
||||||
(as-> paths x
|
(as-> paths x
|
||||||
(remove nil? x)
|
(remove nil? x)
|
||||||
|
|
Reference in a new issue