From 189201df8ee1f78af66441a41b63b55a48dea2b6 Mon Sep 17 00:00:00 2001 From: gered Date: Tue, 5 Aug 2014 14:42:31 -0400 Subject: [PATCH] added bit about retrieving resources via relative urls --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index bca4cdf..e2012dd 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,29 @@ retrieve. a FHIR [bundle](http://www.hl7.org/implement/standards/fhir/extras.html#bundle) instead of a resource. +##### Reading via Relative URLs + +Many FHIR resources will link to other resources using relative URLs. For example, +an Encounter resource is associated with a Patient resource and the link is +specified like so: + +```clojure +{:resourceType "Encounter" + + ; ... + + :subject {:resource "Patient/1234"} + + ; ... + + } +``` + +Where `Patient/1234` is a [relative URL](http://www.hl7.org/implement/standards/fhir/references.html#atom-rel). +`get-resource` can also accept a relative URL instead of the resource type and ID arguments. +This can sometimes be more convenient when reading resources related to a parent resource +that has already been retrieved. + ##### Examples ```clojure @@ -113,6 +136,13 @@ instead of a resource. ; ... similar to the above example resource return value ... } +; reading a resource via relative URL (this was taken from the +; patient resource retrieved above) +(get-resource server-url "Organization/1.3.6.1.4.1.12201") +=> {:resourceType "Organization" + ; ... full resource contents ommitted ... + } + ; trying to read an invalid resource (get-resource server-url :foobar 42) => ExceptionInfo FHIR request failed: HTTP 400