some formatting fixes
This commit is contained in:
parent
3600f7435d
commit
c21d7bc62d
39
README.md
39
README.md
|
@ -115,7 +115,7 @@ instead of a resource.
|
||||||
|
|
||||||
; trying to read an invalid resource
|
; trying to read an invalid resource
|
||||||
(get-resource server-url :foobar 42)
|
(get-resource server-url :foobar 42)
|
||||||
ExceptionInfo FHIR request failed: HTTP 400 clojure.core/ex-info (core.clj:4403)
|
ExceptionInfo FHIR request failed: HTTP 400
|
||||||
```
|
```
|
||||||
|
|
||||||
### search
|
### search
|
||||||
|
@ -195,17 +195,17 @@ Some helper functions are available to make working with paged search results ea
|
||||||
(search server-url :patient [(eq :gender "M")
|
(search server-url :patient [(eq :gender "M")
|
||||||
(lt :birthdate "1980-01-01")])
|
(lt :birthdate "1980-01-01")])
|
||||||
|
|
||||||
; find all encounter (visit) resources for a patient specified by identifier (MRN in this case)
|
; find all encounter (visit) resources for a patient specified by
|
||||||
|
; identifier (MRN in this case)
|
||||||
; (http://server-url/Encounter?subject.identifier=7007482)
|
; (http://server-url/Encounter?subject.identifier=7007482)
|
||||||
(search server-url :encounter [(eq :subject.identifier "7007482")])
|
(search server-url :encounter [(eq :subject.identifier "7007482")])
|
||||||
|
|
||||||
; search using an invalid parameter (unrecognized by the server)
|
; search using an invalid parameter (unrecognized by the server)
|
||||||
; (http://server-url/Patient?foobar=baz)
|
; (http://server-url/Patient?foobar=baz)
|
||||||
(search server-url :patient [(eq :foobar "baz")])
|
(search server-url :patient [(eq :foobar "baz")])
|
||||||
ExceptionInfo FHIR request failed: HTTP 400 clojure.core/ex-info (core.clj:4403)
|
ExceptionInfo FHIR request failed: HTTP 400
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### create
|
### create
|
||||||
|
|
||||||
Adding new resources is a simple matter once you have a FHIR resource represented as a Clojure map.
|
Adding new resources is a simple matter once you have a FHIR resource represented as a Clojure map.
|
||||||
|
@ -245,9 +245,9 @@ a `:resourceType` key with a value that is anything other then `"Bundle"`).
|
||||||
:code "F"}]}
|
:code "F"}]}
|
||||||
:text {:div "<div/>"}}
|
:text {:div "<div/>"}}
|
||||||
|
|
||||||
; create a new resource. will return a map that should look almost identical to the above
|
; create a new resource. will return a map that should look almost identical to the
|
||||||
; (some servers may autogenerate the :text :div value, if so that value will be included
|
; above (some servers may autogenerate the :text :div value, if so that value will
|
||||||
; in the returned map of course)
|
; be included in the returned map of course)
|
||||||
(create server-url :patient new-patient)
|
(create server-url :patient new-patient)
|
||||||
=> {
|
=> {
|
||||||
; resource
|
; resource
|
||||||
|
@ -255,19 +255,19 @@ a `:resourceType` key with a value that is anything other then `"Bundle"`).
|
||||||
|
|
||||||
; create a new resource, but only return the URL to the created resource
|
; create a new resource, but only return the URL to the created resource
|
||||||
(create server-url :patient new-patient :return-resource? false)
|
(create server-url :patient new-patient :return-resource? false)
|
||||||
=> http://server-url/Patient/1234/_history/1
|
=> "http://server-url/Patient/1234/_history/1"
|
||||||
|
|
||||||
; trying to create a resource with an invalid resource map
|
; trying to create a resource with an invalid resource map
|
||||||
(create server-url :patient {:foo "bar"})
|
(create server-url :patient {:foo "bar"})
|
||||||
Exception Not a valid FHIR resource clj-hl7-fhir.core/create (core.clj:321)
|
Exception Not a valid FHIR resource
|
||||||
|
|
||||||
; trying to create a resource that the server rejects
|
; trying to create a resource that the server rejects
|
||||||
; (exact HTTP status returned may vary from server to server unfortunately! some servers do validation
|
; (exact HTTP status returned may vary from server to server unfortunately! some
|
||||||
; better then others and may return an HTTP 400 instead. HTTP 422 is another result defined in the spec
|
; servers do validation better then others and may return an HTTP 400 instead.
|
||||||
; for an invalid/unusable resource)
|
; HTTP 422 is another result defined in the spec for an invalid/unusable resource)
|
||||||
(create server-url :patient {:resourceType "foobar"
|
(create server-url :patient {:resourceType "foobar"
|
||||||
:foo "bar"})
|
:foo "bar"})
|
||||||
ExceptionInfo FHIR request failed: HTTP 500 clojure.core/ex-info (core.clj:4403)
|
ExceptionInfo FHIR request failed: HTTP 500
|
||||||
```
|
```
|
||||||
|
|
||||||
### update
|
### update
|
||||||
|
@ -291,6 +291,8 @@ is thrown.
|
||||||
`update` will throw an exception if the resource you pass in is not a Clojure map that
|
`update` will throw an exception if the resource you pass in is not a Clojure map that
|
||||||
contains a `:resourceType` key with a value that is anything other then `"Bundle"`).
|
contains a `:resourceType` key with a value that is anything other then `"Bundle"`).
|
||||||
|
|
||||||
|
##### Examples
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
(def updated-patient
|
(def updated-patient
|
||||||
{:managingOrganization {:resource "Organization/1.3.6.1.4.1.12201"}
|
{:managingOrganization {:resource "Organization/1.3.6.1.4.1.12201"}
|
||||||
|
@ -315,9 +317,9 @@ contains a `:resourceType` key with a value that is anything other then `"Bundle
|
||||||
:code "F"}]}
|
:code "F"}]}
|
||||||
:text {:div "<div/>"}}
|
:text {:div "<div/>"}}
|
||||||
|
|
||||||
; updates an existing resource. will return a map that should look almost identical to the above
|
; updates an existing resource. will return a map that should look almost identical to the
|
||||||
; (some servers may autogenerate the :text :div value, if so that value will be included
|
; above (some servers may autogenerate the :text :div value, if so that value will be
|
||||||
; in the returned map of course)
|
; included in the returned map of course)
|
||||||
(update server-url :patient 1234 updated-patient)
|
(update server-url :patient 1234 updated-patient)
|
||||||
=> {
|
=> {
|
||||||
; resource
|
; resource
|
||||||
|
@ -325,7 +327,7 @@ contains a `:resourceType` key with a value that is anything other then `"Bundle
|
||||||
|
|
||||||
; updates an existing resource, but only return the URL to the updated resource
|
; updates an existing resource, but only return the URL to the updated resource
|
||||||
(update server-url :patient 1234 updated-patient)
|
(update server-url :patient 1234 updated-patient)
|
||||||
=> http://server-url/Patient/1234/_history/2
|
=> "http://server-url/Patient/1234/_history/2"
|
||||||
|
|
||||||
; update an existing resource only if the version matches
|
; update an existing resource only if the version matches
|
||||||
(update server-url :patient 1234 updated-patient :version 1)
|
(update server-url :patient 1234 updated-patient :version 1)
|
||||||
|
@ -338,9 +340,6 @@ contains a `:resourceType` key with a value that is anything other then `"Bundle
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
##### Examples
|
|
||||||
|
|
||||||
|
|
||||||
### Error Handling
|
### Error Handling
|
||||||
|
|
||||||
All API functions throw exceptions via `ex-info` when an unexpected error response is
|
All API functions throw exceptions via `ex-info` when an unexpected error response is
|
||||||
|
|
Reference in a new issue