diff --git a/src/clj_hl7_fhir/core.clj b/src/clj_hl7_fhir/core.clj index 5569164..23e2b0c 100644 --- a/src/clj_hl7_fhir/core.clj +++ b/src/clj_hl7_fhir/core.clj @@ -271,13 +271,27 @@ (map :content) (remove nil?))) -(defn- get-bundle-next-page-url [bundle] +(defn get-bundle-next-page-url + "returns the 'next' bundle URL from the given FHIR bundle. useful for paged + search results. throws an exception if the value passed is not a valid FHIR + bundle." + [bundle] (validate-bundle! bundle) (->> (:link bundle) (filter #(= "next" (:rel %))) (first) :href)) +(defn get-base-url-from-bundle + "returns the base-url from the given FHIR bundle. throws an exception if the + value passed is not a valid FHIR bundle." + [bundle] + (validate-bundle!) + (->> (:link bundle) + (filter #(= "fhir-base" (:rel %))) + (first) + :href)) + (defn fetch-next-page "for resources that are returned over more then one page, this will fetch the next page of resources as indicated by the link information contained in the