Database Homework

profilecyberdreams
introductiontofhirfordevelopers.pptx

Introduction to FHIR for Developers

Rik Smithies

May 13, 2015

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

1

This presentation

Can be downloaded here:

http:// gforge.hl7.org/svn/fhir/trunk/presentations/2015-05 Tutorials/Introduction to FHIR for Developers.pptx

Use “anonymous” and email address to logon

Is licensed for use under the Creative Commons, specifically:

Creative Commons Attribution 3.0 Unported License

(Do with it as you wish, but give credit)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Introduction

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

3

Time start-10:00 (10 minutes)

Who am I?

Name: Rik Smithies

Company: Independent Consultant (NProgram Ltd., UK)

Background:

Technical Committee Chair, HL7 UK (and former Chair)

HL7 International Co-Chair (Clinical Statement), Help Desk moderator, eLearning course tutor

Architect, analyst and software developer. 20 years in healthcare IT

Contact:

[email protected]

www.nprogram.co.uk

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Introduce ourselves

Show of hands:

HL7 (v2/v3) background?

How did you hear about FHIR?

Platform of choice (.NET, Java, Ruby, …)?

Familiar with HTTP, XML, JSON, REST?

Persistence technologies used?

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

5

Contents of this tutorial

Deconstructing FHIR

FHIR RESTful service interface

Resources in code

Break

Bundles, Search

Beyond REST

Inside the FHIR Distribution

This course uses FHIR version DSTU 1

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] This modified to match the actual section (also note here that the brochure Sept 2014 is wrong)

(RS – actual sections below. TODO update this slide.)

Introduction

Deconstructing FHIR

REST Interface

Resources in code

Break

Bundles

Search

Beyond REST

Inside the FHIR distro

Profiles and validation

Building a FHIR server

The End… is near

6

DSTU?

It’s a release/publication status

Draft Standard For Trial Use

Current version is DSTU1

Also called v0.0.82, Sept 2014

This course is based on DSTU1

Next version (unfinished) is DSTU2

v0.5.0, for review starting May 2015

Wont be final until September or later

So will this be all changed by DSTU2?

Not really…

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] This modified to match the actual section (also note here that the brochure Sept 2014 is wrong)

(RS – actual sections below. TODO update this slide.)

Introduction

Deconstructing FHIR

REST Interface

Resources in code

Break

Bundles

Search

Beyond REST

Inside the FHIR distro

Profiles and validation

Building a FHIR server

The End… is near

7

DSTU2 changes

Unfinished, can’t be used as a basis for training

But what has changed?

Principles unchanged

Mostly backwards compatible (non breaking)

LOTS of additions (that are beyond the core parts in scope of this course)

40+ new resources (think classes), some split, some combined, new attributes in existing resources

New operations (e.g. added merge patient, subscriptions to replace polling)

Renamed a few things (e.g. zip to postalCode), swapped an XML attribute to be an element (id), and…

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] This modified to match the actual section (also note here that the brochure Sept 2014 is wrong)

(RS – actual sections below. TODO update this slide.)

Introduction

Deconstructing FHIR

REST Interface

Resources in code

Break

Bundles

Search

Beyond REST

Inside the FHIR distro

Profiles and validation

Building a FHIR server

The End… is near

8

DSTU2 changes

Change from “Atom” to “Bundle”

that’s the one the we will mention more about today

It’s about how things are grouped

full list of changes:

http:// www.hl7.org/implement/standards/fhir/2015May/history.html

Includes list of breaking changes

Caveat! DSTU2 is not final, and may change

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] This modified to match the actual section (also note here that the brochure Sept 2014 is wrong)

(RS – actual sections below. TODO update this slide.)

Introduction

Deconstructing FHIR

REST Interface

Resources in code

Break

Bundles

Search

Beyond REST

Inside the FHIR distro

Profiles and validation

Building a FHIR server

The End… is near

9

What perspective?

FHIR

Broker

v3

v2

PHR

FHIR

App

Comm.

Interface

DB

FHIR

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

You’re a message broker routing and translating between v2, v3 and FHIR

Your app interfaces with a PHR using FHIR natively

Your application can communicate using FHIR, but your software uses a proprietary RDBMS

[Use FHIR as the common language for a Vendor Neutral Archive – this is not pictured here but is ] [RS]

…Or a combination….

You might see data as a nested structure of XML, a series of tables with keys, class-diagrams….

10

Deconstructing FHIR

Looking at FHIR data modeling concepts from a software engineering perspective

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

11

Time: 10:00-40:00 (30 minutes) [33 slides, 8 to 40]

Resources (review!)

“Resources” are:

Small logically discrete units of exchange

Defined behaviour and meaning

Known identity / location

Smallest unit of transaction

“of interest” to healthcare

V2: Sort of like Segments

V3: Sort of like CMETs

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Resource

Narrative

Elements

Extensions

Extensions

Structure of a Resource

Metadata

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Composition versus reference

FHIR makes composition and references explicit:

References are in between Resources. No context conduction across references – safe retrieval as individual resources.

Composition is within a Resource: Components have no meaning outside resource, no identity, no separate access path except through resource

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

No context conduction: if a Condition resource references a particular Patient as it's subject, and it links to a Procedure resource as it's cause, there is no automatic rule or implication that the procedure has the same patient as it's subject.

14

Composition of a Resource

Resource Root

Resource Component

Simple & Complex elements (may be repeating)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

15

Medication Dispense – the Resource root

Dispense & Substitution are components within Medication Dispense

Use of non-primitive “datatypes” / “value types”

[RS] Black diamond signifies Composition – these don’t have a life outside of the associated class.

Composition

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

It’s all about combining resources . . .

Diagnostic

Report

Patient

Practitioner

Observation

Organization

http://pat.registry.org/Patient/223

http://hospitalA.org/Practitioner/87

http://lab.hospitalA.org/DiagRep/4445

http://lab.hospitalA.org/Observation/3ff27

http://hospitalA.org/Organization/1

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Diagnostic Report is the central resource here, that references the others, see next slide [RS]

17

Diagnostic

Report

Practitioner

Patient

Observation

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

References between resources are not by “business key”, it is *not* the patient id, it’s a REST URI!

18

Resource Reference

Example: part of DiagnosticReport

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

References between resources are not by “business key”, it is *not* the patient id, it’s a REST URI! [RS]

19

Resource Aggregate

“How do we know where an object

made up of other objects begins

and ends?”

“In any system with persistent storage

of data, there must be a scope for a

transaction that changes data and a way of maintaining the consistency of the data”

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Very important concept, comparable with the “Aggregate” notion of Domain Driven Design, for which many useful implementation strategies have been documented on the internet.

[RS] Aggregates are the basic element of transfer of data storage - you request to load or save whole aggregates. Transactions should not cross aggregate boundaries.

20

“Business” identifiers

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Resource Id’s (=URLs) are infrastructural id’s, they differ from “business” identifier.

Many Resources also have business identifiers, they are explicitly modeled, like Patient.identifier (even more than one identifier possible!)

Business identifiers are completely separate from technical resource id’s

The URL is the position of the resource and isn’t shown in the resource itself (metadata, see next slide) [RS]

Good to use words “Id” or “identifier” (even though those words are actually the same thing in most other contexts) [RS]

21

A Resource’s identity

In fact: an URL

http://server.org/fhir/Patient/1

endpoint

resource type

identifier

Note: This URL resolves to the current version of a resource

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

This is not only the URL you use to retrieve the resource, it’s also its id.

All URL’s in FHIR are case-sensitive (and so is the id)

It is *metadata*, you won’t find this in the Resource’s definition

22

Patient

MRN 22234

“Ewout Kramer”

30-11-1972

Amsterdam

Resource metadata

Metadata

Resource Identities

http://fhir.hl7.org/Patient/23E455A3B

http://fhir.hl7.org/Patient/23E455A3B/_history/4

Last updated

2013-12-23T23:33:01+01:00

http://hl7.org/fhir/tag/profile http://hl7.org/fhir/Profile/us-core

http://hl7.org/fhir/tag http://example.org/fhir/Status#Test

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

The FHIR Elements

Resource

Narrative

Extensions

Metadata

Elements

Extensions

Primitives (integer, boolean,

string, instant)

Derived Primitives

(oid, uuid, code, id)

Complex

Datatypes (HumanName, Quantity, Period, Address, Identifier )

Constrained Types (Quantity: Distance, Count, Duration, Money)

use

use

use

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] changed composite to complex

[RS – resources are user definable?] Only the Resources are user-definable, other types are “built-in”

Derived primitives are patterns -> validation consists of regexp matching

Constrained types are defined using invariants (OCL, Xpath, prose) -> validation using schematron, code

[RS] Narrative and Extension are both ONLY used in Resources

Resources can use both (derived) primitives and complex composite datatypes in its definitions

[RS] Infrastructural types need special handling, not general-purpose types

24

Start at the bottom: Primitives

boolean xs:boolean Values can be either true or false
integer xs:int A signed 32-bit integer
decimal xs:decimal A rational number. A true decimal, with inbuilt precision (e.g. Java BigDecimal)
base64Binary xs:base64Binary A stream of bytes, base64 encoded
instant xs:dateTime An instant in time - known at least to the second and always includes a timezone.
string xs:string A sequence of Unicode characters.
uri xs:anyURI A Uniform Resource Identifier Reference.
date union of xs:date, xs:gYearMonth, xs:gYear A date, or partial date as used in human communication. No time zone.
dateTime union of xs:dateTime, xs:date, xs:gYearMonth, xs:gYear A date, date-time or partial date as used in human communication. If hours and minutes are specified, a time zone must be populated.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Now we will look at FHIR definitions from the bottom up, from datatype primitives, in several steps up to resources [RS]

The lexical rendering for these primitives in Xml is the same as in JSON (maybe this should go in the serialization section)

Expressing the allowed values in terms of XSD primitives brings in more variability then we would like. E.g. “0” and “1” are valid for xs:boolean. “+000004”, “4”, “+4” are all valid decimals.

25

Derived primitives

Using the ISO date/time with timezone

“1951”, “1951-06” and “1951-06-04”

“1951-06-04T10:57:34.0321+01”

“1951-06-04T10:57:34.0321Z”

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

TODO: Search on timestamps (lower, upper bound), converting to zulu, user-timezone, sorting of times etc.

* Old-school types built on classis logic and math from the Greek, we have new stuff too…types based on urls!

26

Derived primitives

Based on uri(!): OID and UUID

urn:oid:1.2.3.4.5

urn:uuid:a5afddf4-e880-459b-876e-e4591b0acc11

Based on string:

code (string of characters, may contain single spaces) - “4548-4”, “active”, “not known”

id ([a-z0-9\-\.]{1,36})

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

TODO: Search on timestamps (lower, upper bound), converting to zulu, user-timezone, sorting of times etc.

* Old-school types built on classis logic and math from the Greek, we have new stuff too…types based on urls!

27

Level up: Complex Datatypes

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

The content of a primitive is not rendered in XML as a text node but as an attribute

Notice how the “system” of a code is now a uri, so unlike in v3 an OID is now ALSO a uri (urn:oid:1.2.3.4.5)

28

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Datatypes use both primitives and other datatypes.

Some datatypes use attributes with cardinality > 1

CodeableConcept.primary is actually refers to a coding in CodeableConcept.coding, so is not a code itself.

Quantity has constrained variations Distance, Count, Duration, Money. They introduce constraints on useable units, but do not add attributes, so not shown here.

Note that HumanId.assigner refers to a Resource

29

Coded types

Codes are defined in code systems

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

CodeableConcept builds on Coding, which uses code [RS]

[Rik - This slide redone, CodeableConcept had extra attribute, also swapped the classes around. XML was using Problem which no longer exists]

Examples is from http://www.hl7.org/implement/standards/fhir/observation.htm

[RS] [removed bindings part, next slide]

30

Coded types

When used in a Resource, the modelers include Bindings

Bindings specify which codes can be used

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Rik - Bindings are to value sets, as indicated by the “/vs/” in that path.

31

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Bindings use ValueSets to define what codes are allowed.

Patient.administrativeGender has a binding using the valueset “http://hl7.org/fhir/vs/administrative-gender”

This valueset includes codes from two code systems http://hl7.org/fhir/v3/AdministrativeGender and http://hl7.org/fhir/v3/NullFlavor

So yes, FHIR reused code systems from v3 (and v2), and has some defined specifically for FHIR.

32

Goto Some interesting valuesets to look at them

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS value set are at home->documentation->using terminologies -> value set list]

[RS value set resource is home->infrastructural resources->value sets]

[RS – probably skip this part, readers can browse on their own]

33

34

Publication meta-data

Concepts from 1 or more existing systems

Additional concepts

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Level up: resources

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

The element “identifier” is of type Identifier

The element “telecom” repeats, there is no notion of a “list” in Xml.

Empty elements are left out

Rik – Both Identifier and Contact are datatypes, of identifier and telecom respectively

Rik – somewhat confusing that Organization.telecom has a type of Contact, and there is also a component class in Organization called Contact.

35

“Choice” properties

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* value[x] means: An element with a name that starts with “value”. The [x] is replaced by the (capitalized) name of the actual datatype

36

References

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

There are references that can reference more than one type of resource! In this example: Resource(Patient | Group | Device)

The reference has a “type” element to indicate the kind of Resource that is referenced

References may be: Relative (on the same server), absolute URL (somewhere external) and internal (not treated here)

37

Quick look at extensions

Resource

Narrative

Extensions

Metadata

Elements

Extensions

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS think these notes are copied from slide 20]

Only the Resources are user-definable, other types are “built-in”

Derived primitives are patterns -> validation consists of regexp matching

Constrained types are defined using invariants (OCL, Xpath, prose) -> validation using schematron, code

Narrative and Extension are both ONLY used in Resources

Resources can use both (derived) primitives and composite datatypes in its definitions

Infrastructural types need special handling, not general-purpose types

38

Extensions

Organization “ACME Hospital”

National Drive 322

Orlando, FL

Patient

MRN 22234

“Ewout Kramer”

30-11-1972

Amsterdam

+ Haircolor BROWN

+ Taxoffice Id NLOB33233

You can extend:

Resources

Elements of Resources

FHIR Datatypes

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Extending a multiple birth

Key = location of formal definition

Value = value according to definition

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Really any FHIR element (Resource, Datatype, Primitive) can be extended. Just nest an <extension> element under the thing you want to extend

You should be able to go to the formal definition endpoint and get the definition of the extension.

Note: birth order is already provided for in FHIR through the multipleBirthInteger

40

Complex extensions

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Quick look at narrative

Resource

Narrative

Extensions

Metadata

Elements

Extensions

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

42

Narrative

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Resources SHOULD always contain narrative to support human-consumption as a fallback. However, in a strictly managed trading systems where all systems share a common data model and additional text is unnecessary or even a clinical safety risk, the narrative may be omitted. 

43

REST service interface

How FHIR uses RESTful principles to communicate Resources

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

44

Time: 0:50:00-1:30:00 (40 minutes) [26 slides, 41 to 66]

Rik - start at 14:20

Paradigms

FHIR supports 4 interoperability paradigms

REST

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* Content is the same

25-6-2010

45

REST

Documents

Messages

Services

REST?

“REpresentational State Transfer”

Represent your data as “resources”

Make “Resources” URI addressable

Use HTTP to do CRUD operations

Resources may be exchanged using different representations

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Possibly distributed…

FHIR server @ hospitalA.org

Practitioner

Practitioner/87

Organization

Organization/1

FHIR server @ lab.hospitalA.org

Diagnostic

Report

DiagnosticReport/4445

Observation

Observation/3ff27

result

FHIR server @ pat.registry.org

Patient

Patient/223

managing

subject

performer

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Rik – Start at the top right with the report

47

http://fhirblog.com/2014/01/24/modelling-encounters-with-fhir/

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

“Repository” model of healthcare

FHIR server

Patient

Observation

Organization

Patient

Patient

Observation

Observation

Diagnostic

Report

Create

Update

Query

Lab System

Create

Update

Hospital System

Create

Update

Query

Subscribe

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Just a quick GET

GET /fhir/Patient/1 HTTP/1.1

HTTP/1.1 200 OK

Content-Type: application/xml+fhir;charset=utf-8

Content-Length: 787

Content-Location:

http://fhir.furore.com/fhir/Patient/1/_history/1

Last-Modified: Tue, 29 May 2012 23:45:32 GMT

<?xml version="1.0" encoding="UTF-8"?>

<Patient xmlns="http://hl7.org/fhir"><identifier><label>SSN</label><identifier><system>

http://hl7.org/fhir/sid/usssn</system><id>444222222</id></identifier></identifier><name><use>official</use><family>Everywoman</family><given>Eve</given></name><telecom><system>phone</system><value>555-555 2003</value><use>work</use></telecom><gender><system>http://hl7.org/fhir/sid/v2-0001</system>

<code>F</code></gender><birthDate>1973-05-31</birthDate><address><use>home</use><line>2222 Home Street</line></address><text><status>generated</status><div xmlns="http://www.w3.org/1999/xhtml">Everywoman, Eve. SSN:444222222</div></text></Patient>

UTF-8 encoded

HTTP Verb + path

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

You can retrieve any person using a GET on the person’s id, which is just an url on the server: /fhir/Patient/<id>

We have our own MIME-type: “text/xml+fhir”

Note that FHIR always uses UTF-8. Since this is not the default for HTTP, the server explicitly mentions this

But should mean the xml encoding mentions “utf-8” and that the payload is really encoded in utf-8

There can be a Byte Order Mark, but hopefully your framework handles all that ;-) [RS this is an optional character string preceding a UTF-8 set of bytes, to say if little endian or big endian – which is actually irrelevant to UTF-8]

The response returns a Content-Location header with a version-specific location….see next slide 52 [RS]

50

A Resource’s REST identity

In fact: an URL

http://server.org/fhir/Patient/1

endpoint

resource type

identifier

Note: This URL resolves to the current version of a resource

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

This is not only the URL you use to retrieve the resource, it’s also its id.

All URL’s in FHIR are case-sensitive (and so is the id)

51

Patient

MRN 22234

“Ewout Kramer”

30-11-1972

Amsterdam

Remember metadata?

Metadata

Resource Identities

http://fhir.hl7.org/Patient/23E455A3B

http://fhir.hl7.org/Patient/23E455A3B/_history/4

Last updated

2013-12-23T23:33:01+01:00

http://hl7.org/fhir/tag/profile http://hl7.org/fhir/Profile/us-core

http://hl7.org/fhir/tag http://example.org/fhir/Status#Test

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Tag metadata

GET /fhir/Patient/1 HTTP/1.1

HTTP/1.1 200 OK

Content-Location: http://sever.om/fhir/Patient/1/_history/12

Last-Modified: Tue, 29 May 2012 23:45:32 GMT

Category: http://example.org/fhir/Status#Test; scheme=" http://hl7.org/fhir/tag"; label="Our test tag"

http://hl7.org/fhir/tag A general tag
http://hl7.org/fhir/tag/profile A profile tag - a claim that the Resource conforms to the profile identified in the term
http://hl7.org/fhir/tag/security A security label

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Just a quick look at tags, so the term had been mentioned

53

Mapping (meta)data to HTTP

Resource data

Resource id

Resource version

Last update date

Tags

http body

Url

Content-Location header

Last-Modified header

Category header

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] bullets on the right are the locations of the items on the left

Rik – tags are mapped to “category” headers

54

One more look at the header

GET /fhir/Patient/1 HTTP/1.1

HTTP/1.1 200 OK

Content-Type: application/xml+fhir;charset=utf-8

Content-Length: 787

Content-Location: http://fhir.furore.com/fhir/Patient/1/_history/12

Last-Modified: Tue, 29 May 2012 23:45:32 GMT

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

You can retrieve any person using a GET on the person’s id, which is just an url on the server: /fhir/person/@<id>

We have our own MIME-type: “text/xml+fhir”

Note that FHIR always uses UTF-8. Since this is not the default for HTTP, the server explicitly mentions this

But should mean the xml encoding mentions “utf-8” and that the payload is really encoded in utf-8

There can be a Byte Order Mark, but hopefully your framework handles all that ;-)

The response returns a Content-Location header with a version-specific location….see next slide

55

For a specific version…

We have the version-specific URL

http://server.org/fhir/ (continued)

Patient/1/_history/4

base path

resource type

identifier

version id

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Both the Resource id URL and the version-specific URL are used on many places of the REST spec and resource content (References!). They are always used consistently in this form.

56

Support for versions

33, v12 – 2012-12-04

33, v13 – 2012-12-05

33, v14 – 2012-12-08

33, v15 – 2012-12-09

/server.org/fhir/Patient/33/_history/12

/server.org/fhir/Patient/33

/server.org/fhir/Patient/33/_history/13

/server.org/fhir/Patient/33/_history/14

/server.org/fhir/Patient/33/_history/15

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* Note that you have two ways (at one moment) to reach version 15 [RS - What are these two?]

57

REST “representations”

GET /fhir/Patient/1?_format=json HTTP/1.1

HTTP/1.1 200 OK

Content-Type: application/json+fhir;charset=utf-8

Content-Length: 787

GET /fhir/Patient/1 HTTP/1.1

Accept: application/json+fhir

HTTP/1.1 200 OK

Content-Type: application/json+fhir;charset=utf-8

Content-Length: 787

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

You can retrieve any patient using a GET on the patient’s id, which is just an url on the server: /fhir/Patient/<id>

We have our own MIME-type: “application/xml+fhir” and “application/json+fhir”

58

Question

DO I REALLY HAVE TO IMPLEMENT VERSIONS?

DO I REALLY NEED TO SUPPORT THAT PRE-HISTORIC XML STUFF?

NO, You are not required to keep history, and may return 410 (Gone) on a “vread” for any request for an older version than the current one!

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

59

Conformance

Which FHIR version?

Which Resources?

What search operations?

What formats?

Is this a test server?

Who can I contact?

What’s the name of the software?

DO YOU SUPPORT HISTORY?

DO YOU SUPPORT XML/JSON?

http:// www.hl7.org/fhir/conformance.htm

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

REST in the spec

Let’s look at these operations in the specification….

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Mapping to verbs

create 2.1.10

The create interaction creates a new resource in a server assigned location. The create interaction is performed by an HTTP POST operation as shown:

POST [service-url]/[resourcetype] (?_format=mimeType)

read 2.1.6

The read interaction accesses the current contents of a resource. The interaction is performed by an HTTP GET operation as shown:

GET [service-url]/[resourcetype]/{id} (?_format=mimeType)

update 2.1.8

The update interaction creates a new current version for an existing resource or creates a new resource if no resource already exists for the given id. The update interaction is performed by an HTTP PUT operation as shown:

PUT [service-url]/[resourcetype]/{id} (?_format=mimeType)

delete 2.1.9

The delete interaction removes an existing resource. The interaction is performed by an HTTP DELETE operation as shown:

DELETE [service-url]/[resourcetype]/{id}

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Rik – these are section numbers from FHIR spec

62

To create a resource

You POST the contents to an url which indicates the resource type:

E.g. http://server.org/fhir/Patient

Supply body’s format in Content-Type header

Server returns 201 (Created).

Returns only the newly assigned version id URL in the Location header.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

To update a resource

Use PUT on the resource’s URL, with the new contents in the body

Tell server the body’s format (xml/json) in the Content-Type header

Server returns 200 and the URL to new version in the Content-Location header.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Using PUT to create

Server might/might not allow you to PUT to an id that does not yet exist.

If it does: Server returns 201 and resource gets created at that location  client determines resource’s id!

If it does not: server returns 405 (Method not allowed)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

- Whether server allows this depends on the level of trust between server and client: e.g. in-house scenario versus nation-wide network.

65

Version-aware updates

Server requires client to send Content-Location header with a version-specific URL

Server uses this to check whether you are updating the latest version.

Server will then return 409 (Conflict) if it has been updated by someone else in the meantime

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Behaviour depends on server configuration (and made public in a conformance statement).

66

What’s a ‘deleted’ Resource?

Trying read operations will return in a 410 (Gone) result instead of 404 (Not Found)

The resource will not be returned by the search operation.

You can “undelete” by doing an update with fresh content

Just a “marker” in a resource’s history

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* the deletion operation should be understood as deleting the record of the resource, with nothing about the state of the real-world corresponding resource implied.

67

Version history - deletions

33, v12 – 2012-12-04

33, v13 – 2012-12-05

33, v14 – 2012-12-08

/server.org/fhir/Patient/33/_history/12

/server.org/fhir/Patient/33/_history/14

/server.org/fhir/Patient/33/_history/13

/server.org/fhir/Patient/33/_history/15

/server.org/fhir/Patient/33

33, v15 – 2012-12-09

33, v16 – 2012-12-10

DELETION

/server.org/fhir/Patient/33/_history/16

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* Now, if you query for /server.org/fhir/patient/33, you get a 410 [RS corrected note from @33, no longer using @]

68

Version history - revival

33, v13 – 2012-12-05

33, v14 – 2012-12-08

/server.org/fhir/Patient/33/_history/14

/server.org/fhir/Patient/33/_history/13

/server.org/fhir/Patient/33/_history/15

/server.org/fhir/Patient/33

33, v15 – 2012-12-09

33, v16 – 2012-12-10

/server.org/fhir/Patient/33/_history/16

33, v17 – 2012-12-11

/server.org/fhir/Patient/33/_history/17

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* The resource returns back to life!

69

Resources in code

How resources are made into classes in the supplied reference implementations

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

70

Time: 40:00-50:00 (10 minutes) [7 slides, 67 to 73]

Rik - should start at 14:50, with break at 15:00

Reference implementations

Contents

Model – classes generated from the spec

Parsers – Parsers generated from the spec

Serializers – Serializers generated from the spec

FhirClient

Validation (currently Java only)

Java – Everything on the downloads page

.NET – NuGet “FHIR”, or GitHub “fhir-net-api”

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS]

NuGet syntax: Install-Package Hl7.Fhir –Pre

http://ewoutkramer.github.io/fhir-net-api/whats-new.html

71

Object Model

72

[FhirResource("DiagnosticReport")]

public partial class DiagnosticReport : Resource

{

public Code<ObservationStatus> Status {…}

public Instant Issued {…}

public ResourceReference Subject {…}

public ResourceReference Performer {…}

public Identifier ReportId {… }

public

List<DiagnosticReportRequestDetailComponent> RequestDetail { …}

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Parsing/Serializing using C#

// Create a file-based reader for Xml

XmlReader xr = XmlReader.Create(

new StreamReader(@"publish\observation-example.xml"));

// Parse the Observation from the stream

var obs = (Observation)FhirParser.ParseResource(xr);

// Modify some fields of the observation

obs.Status = Observation.ObservationStatus.Amended;

obs.Value = new Quantity() { Value = 40, Units = "g" };

// Serialize the in-memory observation to Json

var jsonText = FhirSerializer.SerializeResourceToJson(obs);

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Parsing/Serializing using Java

XmlParser xml = new XmlParser();

Observation obs = (Observation)xml.parse(new FileInputStream(“observation.xml"));

obs.setStatusSimple(ObservationStatus.amended);

Quantity newValue = new Quantity();

newValue.setValueSimple(new BigDecimal(40)); newValue.setUnitsSimple("g");

obs.setValue( newValue );

ByteArrayOutputStream bos = new ByteArrayOutputStream();

JsonComposer comp = new JsonComposer();

comp.compose(bos, obs, true);

String json = bos.toString("UTF8");

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Using FHIR Client in C#

var client = new FhirClient(

new Uri("http://fhir.com/svc/fhir"));

var patEntry = client.Read<Patient>("1");

var pat = patEntry.Resource;

var restId = patEntry.Id;

var tags = patEntry.Tags;

pat.Name.Add(HumanName.ForFamily("Kramer")

.WithGiven("Ewout"));

client.Update<Patient>(patEntry);

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Using FHIR Client in Java

FHIRClient client = new FHIRSimpleClient();

client.initialize("http://spark.furore.com/fhir");

AtomEntry<Patient> pe = client.read(Patient.class, "1");

Patient p = pe.getResource();

HumanName hn = new HumanName();

hn.getFamily().add(Factory.newString_("Kramer"));

hn.getGiven().add(Factory.newString_("Ewout"));

p.getName().add(hn);

client.update(Patient.class, p, "1");

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

BUNDLES

How FHIR uses Atom to communicate sets of resources

Also covers FHIR DSTU2 proposals

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

77

Time: 0:50:00-1:30:00 (40 minutes, 16 slides 74 to 89)

Rik - Start after break at 15:30

Communicating lists

We need to communicate lists of Resources

Search result

History

Documents or messages

Multiple-resource inserts (“batches”)

So, we need a way to represent lists, and a place to put our metadata

The container used is always called a “bundle” (DSTU1 and 2), but the actual format changes

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Resource

Narrative

Elements

Extensions

Extensions

Metadata

Bundle

Metadata

Resource

Resource

Bundles of Resources

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Bundles (DSTU1)

Use Atom RFC 4287 + Tombstones RFC 6721

Nice to use a pre-existing standard

Poll-based protocol for keeping up-to-date with newsfeeds (RSS and Atom)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

- In our previous section on REST we saw how we mapped this metadata to HTTP headers, but in a query result, we need to find a way to map this to a list, Atom

80

Bundles (DSTU2)

Atom was eventually found to not be ideal

Being replaced by the FHIR specific Bundle resource (Bundles used to be Atom, but Bundles are now Bundles)

Very similar concept, same principles apply

Bundle is a FHIR resource, has advantages for consistency

Atom is a standard, but was not very familiar to many developers anyway

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

- In our previous section on REST we saw how we mapped this metadata to HTTP headers, but in a query result, we need to find a way to map this to a list, Atom

81

New reports in the mail

82

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

An example Bundle (in atom format, DSTU1)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Note that the id of the resource is kept outside the resource itself

Atom has many other meta-data items (not shown), which we will discuss later.

Rik – entries contain the resources, but first there is metadata at the entry level e.g. title, then there is “<content>” element, which has the actual resource in

83

An example Bundle (in Bundle format – DSTU2)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

84

Patient

MRN 22234

“Ewout Kramer”

30-11-1972

Amsterdam

Resource metadata

Metadata

Resource Identity

http://fhir.hl7.org/Patient/23E455A3B

Last updated

2013-12-23T23:33:01+01:00

http://hl7.org/fhir/tag/profile http://hl7.org/fhir/Profile/us-core

http://hl7.org/fhir/tag http://example.org/fhir/Status#Test

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Resource Entry

Version-specific id

Resource id

Last modified

Resource content

Human-readable form,

just like Resource.text

Tags

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

See how the resource meta-data is mapped to equivalent Atom members

Author is required by atom, so you’ll have to keep track who authored the resource, which might well be the user that POSTed it to your RESTful endpoint

Summary is optional, but it is easy to fill it with the Resource’s <text> (human readable narrative), so Feed readers have a way to display the contents of a resource. Yes, this means the summary is present twice in the entry.

All elements you see here are Atom spec, not FHIR

86

Multiple versions of entries

Same

id!

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Multiple versions are supported explicitly by Atom by having multiple entries with the same id, but a different ‘updated’ date

Notice how the ‘self’ links do differ, these are different versions after all.

87

Atom Tombstones - Deletions

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Brand-new RFC, probably not much support in frameworks (yet).

Note the additional namespace

Updated Timestamp is still present, but is now called “when”.

88

Atom in JSON

There’s not yet a way to render Atom in JSON, though there are initiatives, all ugly.

So, we had to create a format….

Atom JSON solution

Note: MIME type is still application/json+fhir! (compare to xml, which has application/xml+fhir for resources but application/atom+fhir for bundles)

Note: this gets simpler in DSTU2, Bundles are normal resources, have JSON

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] correction here from application/json to application/json+fhir, and added the not

89

Json Atom - Example

{

"title": "Search result",

"updated": "2012-09-20T12:04:45Z",

"id": "urn:uuid:50ea3e5e-b6a7-4f55-956c-caef491bbc08",

"link": [ { "rel": "self", "href": "http://server.org/fhir/Patient?format=json" } ],

"entry": [

{ "title": "Resource of type Patient, with id = 1 and version = 1",

"link": [ { "rel": "self", "href": "http://server.org/fhir/Patient/1/_history/1" } ],

"id": "http://fhir.furore.com/fhir/Patient/1",

"updated": "2012-05-29T23:45:32Z",

"published": "2012-09-20T12:04:47Z",

"author": [ { "name": "Grahame Grieve / HL7 publishing committee" } ],

"content":

{ "Patient": { } }

}

]

}

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Just take a quick glimpse, it’s a pretty trivial translation of the Xml form to JSON, removing all needs for namespaces and attributes, and turning repeating elements into JSON arrays.

90

Bundles

For both Java and C#, reference has custom-built Atom parser

For .NET, you could use the framework’s SyndicationFeed

A bit more low-level

No support for deleted-entries (even parse problems)

Incompatible with WinRT (Win8 mobile apps)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* You might wonder: Since bundles are Atom, why not use standard Atom parsers?

91

Bundles in C#

Abstraction on top of Atom parser

Bundle = feed, BundleEntry = entry.

Bundle result = new Bundle() { Title = "Demo bundle" };

result.Entries.Add(new ResourceEntry<Patient>()

{ LastUpdated=DateTimeOffset.Now, Content = new Patient() });

result.Entries.Add(new DeletedEntry()

{ Id = new Uri("http://..."), When = DateTime.Now });

var bundleXml = FhirSerializer.SerializeBundleToXml(result);

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Bundles in Java

AtomFeed feed = new AtomFeed();

feed.setTitle("Demo bundle");

AtomEntry pat = new AtomEntry();

pat.setUpdated(Calendar.getInstance());

pat.setResource(new Patient());

feed.getEntryList().add(pat);

AtomEntry del = new AtomEntry();

del.setUpdated(Calendar.getInstance());

del.setDeleted(true); del.setId("http://nu.nl/fhir");

feed.getEntryList().add(del);

ByteArrayOutputStream bos = new ByteArrayOutputStream();

AtomComposer comp = new AtomComposer();

comp.compose(bos, feed, true);

String xml = bos.toString("UTF8");

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Example: Keeping in sync

History of all resources on server

http://server.org/fhir/_history

History of all patient resources on server

http://server.org/fhir/Patient/_history

History of specific patient on server

http://server.org/fhir/Patient/1/_history

A history of all changes: updates and deletions, ordered by newest first

Limit with _since and _count

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS _since is used with _history]

94

SEARCH FUNCTIONALITY

And finally, the last REST operation (for now):

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

95

Time: 1:30:00-1:50:00 (20 minutes) [9 slides, 90 to 98]

Rik – Start at 16:05

Getting “all” patients

http://server.org/fhir/Patient

Always returns a paged feed

Use _count to indicate number of results per page

Special case of the “real” search operation: http://server.org/fhir/Patient/_search?name=eve http://server.org/fhir/Patient?name=eve

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] _search version is an alternative, and is documented in 2.1.11, under RESTful API

[RS] note search is case and accent insensitive (unless :exact is specified), and are “partial”. 2.2.2.4

96

Search (patient)

Each resource has a set of “standard” search operations, so not every element can be searched!:

Our last search used this one

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Combining parameters

Specifying multiple parameters finds resources matching all params  “AND”

Parameters may list multiple values  “OR”

http://server.org/fhir /Patient/search?

birthdate=1972-11-30

&language=NL,FR

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Search (Patient)

Each search parameter has a ‘type’

Parameter

Type

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Ok I get it…or not?

http://server.org/fhir/Patient/ 406 hits

http://server.org/fhir/Patient?gender=M 234 hits

http://server.org/fhir/Patient?gender=F 167 hits

Total: 234 + 167 = 401

http://server.org/fhir/Patient/ 406 hits

http://server.org/fhir/Patient?gender=M 234 hits

http://server.org/fhir/Patient?gender=F 167 hits

http://server.org/fhir/Patient?gender:missing=true 5 hits

Total: 234 + 167 + 5 = 406

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] key here is that some are neither M nor F

[RS] Look at For more info see modifiers on the HL7 FHIR site (:exact, :missing, etc.) Search, 2.2.2.1

100

Chained searches

Patient has a search for “name”.

Observation has a search for “subject” (the id of the Patient, Group or Device)

How do I find Observations for a patient, searching using his name?

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

2 queries in 1

You (as a client) don’t need to do separate operations, just one:

http://server.com/fhir/Observation/_search?

subject.name=jim

But note: this still only works on the predefined search parameters. You cannot just use any property of the resource.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

More optimizations

Say we do:

http://fhir.com/fhir/Observation?date=2014-01-20

We get back: a Bundle with 0..* “Observations”

Now, usually, wouldn’t we want the Patient information too? => Need to do “N” queries for the Observation’s “subject”

Quicker:

?_include=Observation.subject

Returns both Observations + Patients

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Beyond REST

How FHIR supports messages and documents

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

104

Time: 1:50:00-2:00:00 (10 minutes) [18 slides, 99 to 116]

Rik - Start 16:25

Paradigms

FHIR supports 4 interoperability paradigms

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

REST

Documents

Messages

Services

FHIR

Repository

Regardless of paradigm

the content is the same

Lab System

Receive a lab result in a message…

FHIR Message

FHIR Document

…Package it in a discharge summary document

National

Exchange

REST

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

107

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

The Document resource

A single Resource, very often a List

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] All documents have the same structure: a bundle of resources identified by the tag "http://hl7.org/fhir/tag/document" (see slide coming up)

that has a Composition resource as the first resource in the bundle, followed by a series of other resources referenced from the Composition resource that provides guidance on how they fit together. 

108

FHIR Document

Dr. Bernard Practitioner

Patient Mary Patient

Discharge Meds list

Vital Signs list

Pulse Observation

BP Observation

Dyclofenac MedicationPrescription

Tamsulosin MedicationPrescription

Kidney Stones Condition

Discharge

Summary Composition

Chief Complaint section

Physical section

Medications section

subject

author

content

content

content

entry

entry

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

25-6-2010

109

Documents – are bundles

Observation Resource

Composition Resource

Section

Section

Device Resource

Patient Resource

Prescription Resource

<feed>

<entry>

<Composition />

</entry>

<entry>

<Observation />

</entry>

<entry>

<Device />

</entry>

<entry>

<Prescription />

</entry>

<entry>

<Patient />

</entry>

</feed>

Attester

Metadata

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

A Document, no matter how nested, is flattened to a list of entries, the Document’s header being the first.

The document header (and any other the other resources) refer to each other using normal references to reflect the document’s nesting.

Of course, there may be a digital signature (on the whole Bundle) to attest to the content of the document.

110

Tag as “Document”

This Bundle is a Document

Same principle in DSTU 2, still

a bundle “tagged” as a document,

but will have an explicit Bundle type.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] Tags are http header “category”s

111

Communicating documents

You can “drop” your document on

http://server.org/fhir/Mailbox

No storage or disassembly is implied, your just posting a document in its entirety.

Servers can implement any specific functionality as required between trading partners when receiving such a document.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] re first bullet, REST is not necessary for documents, but… you can drop…

* But of course, some server could have functions to disassemble documents on reception. Since the contents of documents are resources, each of the contained resources (including the Document header) can be stored using the normal REST interface. But they are no longer the document anymore!

112

Communicating documents

You can store your document using

http://server.org/fhir/Document

Storage, NO disassembly is implied, document (and signature) stays intact

Search is supported (you search on it’s Message header – Composition)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* But of course, some server could have functions to disassemble documents on reception. Since the contents of documents are resources, each of the contained resources (including the Document header) can be stored using the normal REST interface. But they are no longer the document anymore!

113

CDA to FHIR Document bridge

Hospital System A

FHIR

Documents

Note: Documents are compositions,

No update semantics

Context?

Wholeness?

V3 CDA Documents

FHIR

Repository

FHIR

REST

FHIR Document processor

V3 and FHIR

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

MessageHeader Resource

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Messages – are bundles

Observation Resource

Message Resource

source

destination

Device Resource

Patient Resource

<feed>

<entry>

<MessageHeader />

</entry>

<entry>

<Observation />

</entry>

<entry>

<Patient />

</entry>

<entry>

<Device />

</entry>

</feed>

event

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

A Message is similar, refers (amongst others) to its author, and contains information about the source, destination and the event that triggered it.

A message contains 1 “data” resource, which is the root of the payload of the message. This is just a normal resource, which in its turn can refer to other related resources.

116

Tag as “Message”

This Bundle is a Message

Same principle in DSTU 2, still

a bundle “tagged” as a message,

but will have an explicit Bundle type.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Sending messages

Again, REST not necessary, but…

There is an explicit REST endpoint:

http://server.org/fhir/Mailbox

No storage implied. Might be a router, converted to v2, etc. etc.

The server can process them based on the event code and return the response as another message (again a bundle).

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

* It’s the same drop-off point as for documents!

118

V2 to FHIR bridge

Hospital System

FHIR

Messages

Note: Messages are events,

REST exposes a “repository”

Model of data…

V2 Messages

FHIR

Repository

FHIR

REST

FHIR Message processor

V2 and FHIR

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

The Binary Endpoint

http://server.org/fhir/Binary/

Accepts any kind of content

Stores the content as is, along with the content type provided by the HTTP headers.

Acts just like the normal Resource endpoints (but there is no search)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Useful for Attachments

/Binary/23344

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

INSIDE THE FHIR DISTRIBUTION

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

122

Time: 2:25:00-2:35:00 (10 minutes) [9 slides, 117 to 125]

Rik – 16:35

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Browsing the site

REST API

Data Types

XML & JSON

Codes / Terminologies

Resource List

Stack Overflow

Public Test servers

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

The FHIR distribution

Under Implementation-Support-Downloads:

The XSD schemas / schematrons

The Java / C# / Delphi zips (model, serializers, parsers, etc, both code & binary)

All xml + json examples

Full spec for offline reading (always have your FHIR with you)

Note! .NET implementation has moved to GitHub, distribution by NuGet (.NET) and Maven (Java)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

In the FHIR SVN

All you need to build FHIR (/build)

All presentations (/presentations)

Source of the publication process (/build/tools, we use Eclipse + Java 1.6)

Archived older versions of FHIR (/archive)

You can download only the /build

Then run publish.bat & wait

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS]

You do need ANT installed, for windows at least.

Publish = build. It builds what gets published.

126

The FHIR SVN

The “build” SVN tree, the “full” SVN tree

http://gforge.hl7.org/svn/fhir

User ‘anonymous’, blank password

Note: you have to run the publisher to be able to build the C# and Delphi source. Without that…they won’t compile!

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

“Source” of FHIR

Straight from the HL7 SVN “code” repository

at gforge.hl7.org

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Publication process

.INI

Publication tool

(org.hl7.fhir.tools.jar)

Java, C#,

Delphi

eCoreDefinitions.xml

Website

Validation

Schemas

Examples

DictXml

Resource profiles

Resource

UML

examples

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Generator writers!

There’s a file called eCoreDefinitions.xml that the C# generator runs of. It has all details from the definitions

There are Profiles for each resource, basically describing the “unconstrained” resources

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Profiles and validation

Short introduction to

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

131

Time: 40:00-50:00 (10 minutes) [9 slides, 126 to 134]

Rik – 16:45

The need for Profiles

Many different contexts in healthcare, but a single set of Resources

Need to be able to describe restrictions based on use and context

Allow for these usage statements to be:

Authored in a structured manner

Published in a repository

Used as the basis for validation, code, report and UI generation.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

[RS] added “to be:” on third bullet

132

Constraining cardinality

Limit cardinality to 1..2

(e.g. to at maximum your organizations’ identifier + the national one)

1..2

1..1

Limit names to just 1 (instead of 0..*)

Forbid any telecom elements

0..0

Note: something that’s mandatory in the core definition cannot be made optional in a profile

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

133

Limit value domains

Fix value: Only allow “active” Patients

=“true”

If deceased is given, it must be a dateTime, not a boolean

Use our national codes for MaritalStatus

Use another profiled Resource

OrganizationNL

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Tagging a Resource

Patient

MRN 22234

“Ewout Kramer”

30-11-1972

Amsterdam

http://hl7.org/fhir/tag/security

“I’m a VIP - My information cannot yet be disclosed”

http://hl7.org/fhir/tag “This is TEST data! Don’t use!”

http://hl7.org/fhir/tag/profile “I’m a Patient as defined in the Norwegian Profile – see http://hl7.no/Profiles/patient-no”

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Validation

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Validation

When receiving an XML resource

1. Validate using schema

2. Run schematrons

When receiving JSON

1. Parse the JSON

2. Serialize to XML

3. Validate using schema

4. Run schematrons

There’s a validation pack for Java

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

(Distributed) validation

App’s server

Store &

Validate

Country validation server

Validate Y

Profile X

Profile Y

Profile Y

Download & Validate

Profile X

Profile Y

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

A server might defer validation to another server (because it doesn’t know the profile)

A server may fetch the “unknown” profile and validate it itself

There may be several servers sharing the work

138

Operation Outcome

When something goes wrong….return the OperationOutcome Resource!

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Building a fhir server

FHIR in practice

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

140

Time: 2:35:00-2:55:00 (20 minutes)

Some possible uses

FHIR

Broker

v3

v2

PHR

FHIR

App

Comm.

Interface

DB

FHIR

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

You’re a message broker routing and translating between v2, v3 and FHIR

Your app interfaces with a PHR using FHIR natively

Your application can communicate using FHIR, but your software uses a proprietary RDBMS

Use FHIR as the common language for a Vendor Neutral Archive

…Or a combination….

You might see data as a nested structure of XML, a series of tables with keys, class-diagrams….

141

Repository model

Vendor Neutral Repository

FHIR

HIS

LIMS

PACS

SystemX

Gateway

FHIR

FHIR

FHIR

FHIR

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Overview of a server

HTTP / REST interface

Encoding/decoding, param validation, syntax validation

Fhir Service

Indexer / Search

Storage

Implement service operations as described in spec

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

From wire to store

Storage

Fhir Service

REST interface

JSON/XML

POCO/POJO

DBMS

O-R Map

FHIR Parser

JSON/XML

POCO/POJO

Serialize

FHIR Parser

NoSql (Xml/Json)

JSON/XML

POCO/POJO

DBMS

Serialize

FHIR Parser

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

First scenario is most common for existing databases: you have to map the FHIR structure (as POCO’s) onto your (existing) databases tables. Lot’s of mappings to support our nesting, cardinalities, datatypes

Second scenario uses the parsers to create POCO’s then use a NoSql driver’s serialization possibilities to store the structure-as-is in NoSql

Third scenario uses POCO’s and DBMS, but instead of mapping FHIR to tables, stores the data as-is into blob storage in a DBMS

144

Briefest intro to JSON

JSON (“JavaScript Object Notation”): it’s JavaScript, not markup!

{ “Country" : { “name" : “the Netherlands", “population" : 16696000,

“popDensity” : 447.9

}

}

var report = eval(“({…})”); alert(report.LabReport.status);

Very easy parsing for JavaScript clients. But actually, use JSON.parse() instead ;-)

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

145

Xml and JSON are different

Xml

<XXX xmlns=“urn:foo”>

<B a=“c” />

<C>One</C>

<C>Two</C>

<D>One</D>

<div>Not <b>so</b> easy</div>

</XXX>

JSON

{ “B”: { “a” : “c” },

“C”: [ “One”, “Two” ],

“D” : “One”,

“div” : {

“text-before”:“Not ”,

b:“so”,

“tekst-after”:“easy”}

}

146

How to retain namespaces?

How do you identify attributes?

Bridge difference in datatypes?

Distinguish single elements from lists with one element?

Mixed content?

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

We tried to find a way to automatically convert between the two so you could round-trip…

But discovered you’d need additional metadata to do that, or vendor-specific solutions

Decided not to introduce these: result was weird Xml or weird Json

Reference platform contains tools to interconvert (these use model definition metadata)

146

Xml and JSON in FHIR

code.coding is 0..*

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

147

Xml and JSON in FHIR

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

148

Handling both

You need “meta” knowledge of the definition to distinguish lists / attributes

The Java/C# API’s can easily interconvert

Digital Signatures (in json?) are a problem when converting  store the original

JAXB / XmlSerializer / DataContract would need extensive customization / additional @annotation / [attributes]. Contact us!

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Document-oriented store

A document-oriented store can store Resources as a “whole” document.

E.g. MongoDb stores documents in JSON:

post = { author: “mike”,

text: “my blog post...”,

tags: [“mongodb”,“intro”] };

db.posts.save( post );

db.posts.find( { author: “mike” } );

db.posts.find().sort({date: -1}).limit(10);

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

150

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

No (sql) transactions

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Batch: needs transactions

Transaction

The transaction interaction submits a set of resources to be updated, created or deleted on the server. This interaction allows multiple resources to be updated/created in a single transaction. The interaction is performed by an HTTP POST command as shown:

POST [service-url] (?_format=mimeType)

The content of the post submission is a resource bundle.

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Amazon S3

Storing resources

FHIR POCO Model

Mongo

Patient

Observation

Binary

Binary

Original

(json or xml)

Metadata

Atom Entry

(stored json)

Resource

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

You might have to keep the original (as you received it on the service interface), for attestation/digital signatures

Store the binaries in another location (e.g. Amazon S3, filesystem) and just keep the URL here.

154

RDBMS: BLOB + Index

Id ResourceId VersionId LastUpdate Contents
1 1 1 2012-12-19 <Patient …>
2 1 2 2012-12-20 <Patient …>
3 2 1 2012-12-20 <Observation …>
Id Param Value System
2 Patient.Name “Ewout”
2 Patient.DoB “1972-11-30”
3 Obs.Code “234332” SNOMED
Type VersionIdHigh
Patient 2
Lab 3

Need to index only latest version!

Separate tables for current and history?

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Both implementations use a separately maintained index for search?

Yes, here’s why…

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Predictable search

Each resource has a fixed set of search parameters:

Parameter

Type

Searched element

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

157

Types of parameters

integer Search parameter must be a simple whole number.
string Search parameter is a simple string, like a name part. Search is case-insensitive and accent-insensitive. May match just the start of a string.
date Search for an exact match on a date (parameters look like 1956-05-27T12:34:12+04:00 or shorter)
token Search parameter on a coded element or identifier. May be used to search through the text, displayname, code and code/codesystem (for codes) and label, system and key (for identifier).
reference A pair of resource type and resource id, separated by "/". Matches when the resource reference resolves to a resource of the given type and id.

Note: you need to escape the query-string!!

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

158

Partial/combined match

Name / Type Description
address : string an address in any kind of address/part of the patient
family : string a portion of the family name of the patient
given : string a portion of the given name of the patient
name : string a portion of either family or given name of the patient
phonetic : string a portion of either family or given name using some kind of phonetic matching algorithm
telecom : string the value in any kind of telecom details of the patient

The search parameter description shows that the match certainly isn’t always exact, and can even combine the contents of several elements:

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Prepare your data!

patient/search? name=johan& name=grafin& telecom=5552004

“Groom” – prepare for searching

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

The end is near…

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

161

Time: 10:00-35:00 (25 minutes)

Balloting plans

First Draft Standard for Trial Use ballot (DSTU) complete

FHIR is now published as a DSTU

Will provide a semi-stable platform for implementers while still allowing non-backward-compatible change for Normative version if implementation experience dictates

Additional DSTU versions every 1.5-2 years to make fixes, introduce new resources

Normative is around 2 years out

We want *lots* of implementation experience before committing to backward compatibility

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Next Steps for you

Read the spec: http://hl7.org/fhir

Try implementing it

Come to a Connectathon!

[email protected]

#FHIR

Implementor’s Skype Channel

StackOverflow: hl7 fhir tag

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

164

International HL7 FHIR Developer Days November 24-26, 2014 in Amsterdam

Education

14 tutorials

pick & choose

Connectathon

Meet fellow developers

Put FHIR to the test

Networking

FHIR experts and authors on hand

http://fhir.furore.com/devdays

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Thank You - QUESTIONS?

© 2015 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

165

[RS – added thank you]