This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# Copyright (C) 2014 Luis Falcon <lfalcon@gnusolidario.org>
# Copyright (C) 2014 GNU Solidario <health@gnusolidario.org>
# Copyright (C) 2014 Chris Zimmerman <siv@riseup.net>

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http: www.gnu.org="" licenses=""/>.


About the FHIR Python Package
------------------------------

The FHIR goal is to implement the HL7 FHIR[1] Reference in Python

The project was born to provide the backend to the GNU Health[2] FHIR modules, but it should work in other EMRs and clients.

You can get the latest development version at the Mercurial server in Savannah[3]

1.- http://www.hl7.org/fhir
2.- http://health.gnu.org
3.- http://hg.savannah.gnu.org/hgweb/health/

Sample uses :

1) Search Interaction
2) Read Interaction
3) Create Interaction


1) #### Search interactions ####

>>> from fhir import *

>>> rest = RestfulFHIR('http://fhir.healthintersections.com.au/open' 'xml')
>>> params = {'identifier': 55567890}
>>> query = rest.search('Patient', params)
>>> print query
<response [200]="">
>>> print query.text

<feed xmlns="http://www.w3.org/2005/Atom">
<title>Search results for resource type Patient</title>
<id>urn:uuid:8b018fb9-7df4-4e1b-9f4b-8a34955d86</id>
<link href="http://fhir.healthintersections.com.au/open/" rel="fhir-base"/>
<link href="http://fhir.healthintersections.com.au/open/Patient/_search?search-id=49f23df4-3b9a-4117-9726-41d2aa3256&amp;identifier=55567890&amp;search-sort=_id" rel="self"/>
<updated>2014-03-30T03:51:25Z</updated>
<totalresults xmlns="http://a9.com/-/spec/opensearch/1.1/">1</totalresults>
<entry xmlns="http://www.w3.org/2005/Atom">
<title>Patient "1046" Version "1"</title>
<id>http://fhir.healthintersections.com.au/open/Patient/1046</id>
<link href="http://fhir.healthintersections.com.au/open/Patient/1046/_history/1" rel="self"/>
<updated>2014-03-30T03:47:37Z</updated>
<author>
<name>190.195.19.13</name>
</author>
<published>2014-03-30T03:51:25Z</published>
<content type="text/xml">
<patient xmlns="http://hl7.org/fhir">
<identifier>
<use value="usual"/>
<label value="SSN"/>
<value value="55567890"/>
</identifier>
<name>
<use value="official"/>
<family value="Ana"/>
<given value="Betz"/>
</name>
<gender>
<coding>
<system value="http://hl7.org/fhir/v3/AdministrativeGender"/>
<code value="F"/>
<display value="Female"/>
</coding>
</gender>
<birthdate value="1985-10-04"/>
<deceasedboolean value="false"/>
<active value="true"/>
</patient>
</content>
<summary type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">--No Summary for this resource--</div>
</summary>
</entry>
</feed>

######################################################################

2) ###### Read interaction ##############

>>> from fhir import *

>>> rest = RestfulFHIR('http://fhir.healthintersections.com.au/open' 'xml')
>>> query = rest.read('Patient', 1046)
>>> print query
<response [200]="">
>>> print query.text

<patient xmlns="http://hl7.org/fhir">
<identifier>
<use value="usual"/>
<label value="SSN"/>
<value value="55567890"/>
</identifier>
<name>
<use value="official"/>
<family value="Ana"/>
<given value="Betz"/>
</name>
<gender>
<coding>
<system value="http://hl7.org/fhir/v3/AdministrativeGender"/>
<code value="F"/>
<display value="Female"/>
</coding>
</gender>
<birthdate value="1985-10-04"/>
<deceasedboolean value="false"/>
<active value="true"/>
</patient>

If the resource ID does not exist, a 404 Response will be generated

Say we try to access the non-existant ID 210834

>>> rest = RestfulFHIR('http://fhir.healthintersections.com.au/open' 'xml')
>>> query = rest.read('Patient', 210834)
>>> print query
<response [404]="">
>>> print query.text

<operationoutcome xmlns="http://hl7.org/fhir">
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Resource Id "Patient/210834" does not exist</p>
</div>
</text>
<issue>
<severity value="error"/>
<details value="Resource Id "Patient/210834" does not exist"/>
</issue>
</operationoutcome>


#### CREATE INTERACTION on the Patient Profile #######

>>> from fhir import *
>>> import json

# XML data elements for the Patient resource
#>>> rest = RestfulFHIR('http://fhir.healthintersections.com.au/open' 'xml')
#>>> body = "<patient xmlns="\"http://hl7.org/fhir\"">" \
# "<name><family>John</family></name></patient>"

# JSON data elements for the Patient resource
>>> body = json.dumps({"resourceType":"Patient",
"name":[{"use":"official", "family":["Doe"], "given":["John"]}]})

>>> rest = RestfulFHIR('http://fhir.healthintersections.com.au/open')
>>> query = rest.create('Patient', body)
>>> print query
<response [201]="">
>>> print query.text
{
"resourceType" : "OperationOutcome",
"text" : {
"status" : "generated",
"div" : "\r\n<div xmlns="\"http://www.w3.org/1999/xhtml\"">The operation was succesful</div>"
}
}


########################################################################
Release History

Release History

0.0.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
fhir-0.0.4.tar.gz (18.1 kB) Copy SHA256 Checksum SHA256 Source Apr 17, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting