Build Status
Coverage Status
Maven Central
VersionEye
Apache 2.0 Licensed

This is the homepage for the HAPI-FHIR library. We are developing an open-source implementation of the FHIR specification in Java. FHIR (Fast Healthcare Interoperability Resources) is a specification for exchanging healthcare data in a modern and developer friendly way.

Note that this is the home for the FHIR version of HAPI. If you are looking for HL7 v2 support, click here.

Demonstration/Test Page

A public test server is now operating at http://fhirtest.uhn.ca. This server is built entirely using components of HAPI-FHIR and demonstrates all of its capabilities. This server is also entirely open source. You can host your own copy by following instructions on our JPA Server documentation.

Commercial Support

Commercial support for HAPI FHIR is available through Smile CDR.

Announcements

June 8, 2017 - HAPI FHIR 2.5 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release brings number of bugfixes and improvements. Most importantly for many users, this release brings a significant performance enhacement to the JPA server for searches. Essentially our search module has been rewritten to stream results back to the client as soon as they become available, and to reuse previous cached search results for a period of time. This cacheing behaviour in the JPA server is important to consider, since it does mean that your clients can see stale search results for a short period of time under some circumstances. The default cache period is 1 minute, but this can be changed or even disabled through configuration.

As always, the changelog has the full list of changes in this release. Thanks to everyone who contributed to this release, either by submitting pull requests, suggesting new features, or filing bug requests!

- James Agnew



April 19, 2017 - HAPI FHIR 2.4 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release brings the STU3 definitions up to the final R3 (aka STU3) definitions (FHIR 3.0.1)! Happy R3 everybody!

As always, the changelog has the full list of changes in this release. Thanks to everyone who contributed to this release, either by submitting pull requests, suggesting new features, or filing bug requests!

We were later than we would have liked in delivering this release, as we are focusing heavily on performance improvements in the JPA module. We were hoping to have our performance branch merged in time for this release, but it needs a bit more time to stabilize. We will be releasing the initial snapshot builds of HAPI FHIR 2.5-SNAPSHOT immediately following this release. Please try these out if you want to test the JPA module with significant performance improvements when searching large datasets, or under heavy load.

- James Agnew



March 17, 2017 - HAPI FHIR 2.3 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release brings the STU3 definitions up to the latest definitions (FHIR 1.9.0 - SVN 11501). It also brings in the latest validator fixes, as well as a number of other useful enhancements and fixes, including:

As always, the changelog has the full list of changes in this release. Thanks to everyone who contributed to this release, either by submitting pull requests, suggesting new features, or filing bug requests!

- James Agnew



What is HAPI FHIR?

HAPI FHIR is a simple-but-powerful library for adding FHIR messaging to your application. It is pure Java (1.6+ compatible), and licensed under the business-friendly Apache Software License, version 2.0.

Some Ways You Can Use HAPI FHIR

HAPI is designed with one main intent: providing a flexible way of adding FHIR capability to applications. We at University Health Network developed HAPI-FHIR to allow us to build up our own unified FHIR RESTful server which exposes data backed by a number of systems and repositories, so it is designed to be flexible above all else.

The library is designed to support several main usage patterns:

Fluent Interface

The HAPI API is designed to allow interaction with FHIR model objects using a convenient Fluent Interface.

Patient patient = new Patient();
patient.addIdentifier().setUse(OFFICIAL).setSystem("urn:fake:mrns").setValue("7000135");
patient.addIdentifier().setUse(SECONDARY).setSystem("urn:fake:otherids").setValue("3287486");

patient.addName().addFamily("Smith").addGiven("John").addGiven("Q").addSuffix("Junior");

patient.setGender(AdministrativeGenderEnum.MALE);

Encoding Support

Both XML and JSON encoding are suported natively using a simple API to pick between them. XML support is built on top of the lightning-fast STaX/JSR 173 API, and JSON support is provided using Google Gson.

FhirContext ctx = FhirContext.forDstu2();
String xmlEncoded = ctx.newXmlParser().encodeResourceToString(patient);
String jsonEncoded = ctx.newJsonParser().encodeResourceToString(patient);

Easy RESTful Client and Servers

Creating clients is simple and uses an annotation based format that will be familiar to users of JAX-WS.

public interface MyClientInterface extends IRestfulClient
{
  /** A FHIR search */
  @Search
  public List<Patient> findPatientsByIdentifier(@RequiredParam(name="identifier") IdentifierDt theIdentifier);
	
  /** A FHIR create */
  @Create
  public MethodOutcome createPatient(@ResourceParam Patient thePatient);
}

Using this client is as simple as:

MyClientInterface client = ctx.newRestfulClient(MyClientInterface.class, "http://foo/fhir");
IdentifierDt searchParam = new IdentifierDt("urn:someidentifiers", "7000135");
List<Patient> clients = client.findPatientsByIdentifier(searchParam);

Back to top

Reflow Maven skin by Andrius Velykis.