Care Connect API Implementation Guide - Java (code) Examples


(Kev Mayfield) #1

Version 1.0.0-alpha of the API was released yesterday (the webex will be available soon).

We had a few questions on test servers and JSON versions of the examples.

Test Server

We used a local version of the public HAPI server (http://fhirtest.uhn.ca/home?serverId=hapi_dev&pretty=false) for testing out the search parameters. The easiest way to explore CareConnectAPI/FHIR is to use the public site but this supports all the FHIR Search parameters not just the common core listed in the CareConnectAPI IG.

The code for the local version is based on this post (HOWTO Build a health database and FHIR API Server in 15 mins using open source - current github https://github.com/KevinMayfield/Jorvik/tree/master/hapi-fhir-jpaserverDstu2) but is configured to run using maven and springboot. This can be found here: https://github.com/nhsconnect/careconnect-java-examples/tree/master/careconnect-hapi-jpa-dstu2-springboot
This uses a embedded Apache Derby database but doesn’t include the HAPI overlay which the main version uses but is useful for a developer.

CareConnect Profiles Examples

The XML examples were again built using HAPI (java libraries) the code can be found here https://github.com/nhsconnect/careconnect-java-examples/tree/master/ImplementationGuideExplore
This is also a springboot app.

When run the code will output FHIR resources in XML format to the console and post the resources to the standalone HAPI server.

To change output to JSON and where the resources are sent, your will need to use a JSON parser and alter the serverBase string. These can be found in IGExplore.java

`	
     IParser parser = ctxFHIR.newXmlParser();
// This is to base HAPI server not the CareConnectAPI
     String serverBase = "http://127.0.0.1:8080/FHIRServer/DSTU2/";`

In the example below this line of code has been changed to use the public HAPI server and JSON Parser

`	
     IParser parser = ctxFHIR.newJsonParser();
// This is to base HAPI server not the CareConnectAPI
     String serverBase = "http://fhirtest.uhn.ca/baseDstu2/";`

(Kev Mayfield) #2

Recording of webex https://contattafiles.s3-us-west-1.amazonaws.com/tnt373/cl_YDi32QUpswgS/CareConnect%20Phase%201%20Update-20170712%200958-1.mp4