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

Mar 29, 2018 - HAPI FHIR 3.3.0 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This release brings logs of fixes and some significant enhancements.See the changelog for a full list of changes. Notable changes include:

  • A schema change to the JPA server has been made which will result in significantly less storage space being used and better write performance for repositories which contain a large number of resource, or larger resource bodies. Prior to this change, resource bodies were stored in duplicate in two places in the database and this has now been corrected.

    Note that a database migration script must be run for this upgrade, see the changelog for details.
  • The validator has been refactored to use a single codebase across DSTU3/R4 validation which means that any fixes and enhancements will now affect both. This makes the DSTU3 validator much more complete in terms of support for advanced validation as well.
  • Several significant features were contributed by the community, including native OSGi support (several HAPI FHIR JARs now have OSGi metadata included) as well as initial experimental support for ElasticSearch instead of Raw Lucene for the JPA server.
  • Several enhancements and bugfixes have been made to the interceptor framework.
  • Many other bugfixes and enhancements have been made as well

Note also that we are hiring! If you have an interest in helping us develop HAPI FHIR or work on implementation projects, please get in touch!

Thanks to everyone who contributed to this release! The HAPI FHIR community continues to get bigger and bigger. Together we are transforming healthcare.

- James Agnew



Jan 13, 2018 - HAPI FHIR 3.2.0 Released - The next release of HAPI has now been uploaded to the Maven repos and GitHub's releases section.

This is a fairly light release, with only a small number of new features, and a few bugfixes. See the changelog for a full list of changes.

  • Support for using SearchParameter resources to define custom parameters in the JPA server has been backported to DSTU2, meaning that DSTU2 servers can now user this functionality (previously only DSTU3/R4 supported this)
  • Several tweaks and enhancements to the server interceptor framework have been added
  • Multitenancy support has been added to the server framework (note that this is only the plain server framework at this point, not the JPA server)
  • The R4 structures have been synced to the latest definitions in anticipation of the January FHIR Connecathon (see Downloads for version details)
  • Several bugfixes have been made

Thanks to everyone who contributed to this release!

- 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.