Skip to content

Instantly share code, notes, and snippets.

View KevinMayfield's full-sized avatar

Kevin Mayfield KevinMayfield

  • Leeds, West Riding, UK
View GitHub Profile
@KevinMayfield
KevinMayfield / Patient Search Server XML Resource.xml
Created June 16, 2017 15:39
Patient Search Server - XML Resource
<Patient xmlns="http://hl7.org/fhir">
<meta>
<profile value="https://fhir.hl7.org.uk/StructureDefinition/CareConnect-Patient-1"/>
</meta>
<extension url="https://fhir.hl7.org.uk/StructureDefinition/Extension-CareConnect-EthnicCategory-1">
<valueCodeableConcept>
<coding>
<system value="https://fhir.hl7.org.uk/CareConnect-EthnicCategory-1"/>
<code value="01"/>
<display value="British - Mixed British"/>
@KevinMayfield
KevinMayfield / Patient Search Server Java Example Class.java
Created June 16, 2017 15:42
Patient Search Server - Java Example Class
public class ExamplePatientCSV {
public static Patient buildCareConnectFHIRPatient()
{
String csvLine ="British - Mixed British,01,9876543210,Number present and verified,01,Kanfeld,Bernie,Miss,10 Field Jardin,Long Eaton,Nottingham,NG10 1ZZ,1,1998-03-19";
String[] csvArray = csvLine.split(",");
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
@KevinMayfield
KevinMayfield / Patient Search Server Java Client Code.java
Created June 16, 2017 15:43
Patient Search Server - Java Client Code
FhirContext ctxFHIR = FhirContext.forDstu2();
IParser parser = ctxFHIR.newXmlParser();
Patient patient = ExamplePatientCSV.buildCareConnectFHIRPatient();
System.out.println(parser.setPrettyPrint(true).encodeResourceToString(patient));
@KevinMayfield
KevinMayfield / Patient Search Client - AngularJS.js
Created June 18, 2017 07:33
Patient Search Client - AngularJS
angular.module('App').controller('PatientController', function ($scope, $http) {
$scope.search = function()
{
$http({
method : 'GET',
url : 'http://127.0.0.1:8181/Dstu2/Patient?family=jones&gender=female'
})
.success(function (bundleddata) {
$scope.bundle = bundleddata;
}).error(function (err) {
@KevinMayfield
KevinMayfield / Patient Search Results.xml
Last active March 8, 2018 14:00
Patient Search Results
<Bundle xmlns="http://hl7.org/fhir">
<id value="818662fd-363a-480b-9c1c-37fe618b834a"/>
<meta>
<lastUpdated value="2018-03-08T13:54:29.849+00:00"/>
</meta>
<type value="searchset"/>
<total value="1"/>
<link>
<relation value="self"/>
<url value="http://yellow.testlab.nhs.uk/careconnect-ri/STU3/Patient?_format=xml&amp;_id=1&amp;_pretty=true"/>
@KevinMayfield
KevinMayfield / Organisation Example.xml
Last active March 8, 2018 14:05
Organisation Example
<Organization xmlns="http://hl7.org/fhir">
<id value="1"/>
<meta>
<profile value="https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-Organization-1"/>
</meta>
<identifier>
<system value="https://fhir.nhs.uk/Id/ods-organization-code"/>
<value value="C81010"/>
</identifier>
<active value="true"/>
// Create a FHIR Context
FhirContext ctx = FhirContext.forDstu2();
IParser parser = ctx.newXmlParser();
// Create a client and post the transaction to the server
IGenericClient client = ctx.newRestfulGenericClient("http://127.0.0.1:8181/Dstu2/");
System.out.println("GET http://127.0.0.1:8181/Dstu2/Patient?birthdate=1998-03-19&given=bernie&family=kanfeld");
Bundle results = client
.search()
@KevinMayfield
KevinMayfield / Practitioner and Organisation Search.java
Last active June 22, 2017 14:38
Practitioner and Organisation Search Java
public void run(String... args) throws Exception {
if (args.length > 0 && args[0].equals("exitcode")) {
throw new Exception();
}
// Create a FHIR Context
FhirContext ctx = FhirContext.forDstu2();
IParser parser = ctx.newXmlParser();
<Bundle xmlns="http://hl7.org/fhir">
<id value="531b67b1-7307-4daf-a32d-67fb42c3f742"/>
<meta>
<lastUpdated value="2017-09-23T18:28:18.276+01:00"/>
</meta>
<type value="searchset"/>
<total value="1"/>
<link>
<relation value="self"/>
<url value="http://127.0.0.1:8080/careconnect-ri/DSTU2/Patient?_pretty=true&amp;identifier=https%3A%2F%2Ffhir.nhs.uk%2FId%2Fnhs-number%7C9876543210"/>
<Bundle xmlns="http://hl7.org/fhir">
<id value="19d78778-5e6e-4866-9bd3-6376f863f307"/>
<meta>
<lastUpdated value="2017-06-02T09:29:08.195+01:00"/>
</meta>
<type value="searchset"/>
<total value="1"/>
<link>
<relation value="self"/>
<url value="[baseUrl]/Organization?identifier=C81010"/>