FHIR® Document production from Resource Composition

FHIRAs FHIR documentation says “FHIR resources can be used to build documents that represent a composition: a set of coherent information that is a statement of healthcare information, particularly including clinical observations and services. A document is an immutable set of resources with a fixed presentation that is authored and/or attested by humans, organizations and devices. Documents built in this fashion may be exchanged between systems and also persisted in document storage and management systems, including systems such as IHE XDS. Applications claiming conformance to this framework claim to be conformant to FHIR documents”

The FHIR Document Operator produces a document from a given composition.

In order to keep this example simple we will use the FHIR CLI (Command line interface) to build the resources and to interact with the FHIR server.

Use of document operator

Start FHIR CLI typing in a python interpreter…

from client import *
cli = init_client()

Create a document from a Composition Resource…

resp = document(cli, "Composition/example")
# resp is a bundle to decode
bu = Bundle(resp.obj())
# Now loop over bundle entries
for ent in bu.entry:

Tying the “resp” variable you can see the executed command

GET Url: http://fhir3.healthintersections.com.au/open/Composition/example/$document?persist=false
Output code: 200

if you want to make the document persistent, set “persist” attribute to True

resp = document(cli, "Composition/example", persist=True)

If you inspect the returned resp variable, you will see something like this

GET Url: http://fhir3.healthintersections.com.au/open/Composition/example/$document?persist=true
Output code: 201

The document was produced and the output code is 201 (OK)


Pierfrancesco Ghedini

Licenza Creative Commons
Quest’opera è distribuita con Licenza Creative Commons Attribuzione 3.0 Italia.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *