minor refactoring

This commit is contained in:
Gered 2014-09-08 15:12:58 -04:00
parent ed4d571cf5
commit 048557d4d1
2 changed files with 11 additions and 12 deletions

View file

@ -461,10 +461,7 @@
(apply join-paths url-components)
:params (merge
{:_id id}
(apply hash-map (if (and (seq? params)
(= 1 (count params)))
(first params)
params))))))
(build-params-map params)))))
(defn history
"returns a bundle containing the history of a single FHIR resource. note that this history can
@ -484,10 +481,7 @@
(fhir-request :get
base-url
(apply join-paths url-components)
:params (apply hash-map (if (and (seq? params)
(= 1 (count params)))
(first params)
params)))))
:params (build-params-map params))))
(defn 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 (merge
(search-params->query-map where)
(apply hash-map (if (and (seq? params)
(= 1 (count params)))
(first params)
params))))))
(build-params-map params)))))
(defn search-and-fetch
"same as search, but automatically fetches all pages of resources returning a single bundle

View file

@ -73,6 +73,14 @@
(flatten)
(apply str)))
(defn build-params-map [m]
(apply
hash-map
(if (and (seq? m)
(= 1 (count m)))
(first m)
m)))
(defn join-paths [& paths]
(as-> paths x
(remove nil? x)