fhir for architects and developers - new zealand seminar, june 2014

107
FHIR for Architects and Developers Acknowledgements Lloyd McKenzie Ewout Kramer Grahame Grieve Agenda Architectures Paradigms Resources Bundles Profiles & Extensions Server Notes Workflow Security Tools and Help Next steps in New Zealand

Upload: david-hay

Post on 24-May-2015

1.692 views

Category:

Healthcare


4 download

DESCRIPTION

An more advanced demonstartion of FHIR presented by HL7 New Zealand to a local audience

TRANSCRIPT

Page 1: FHIR for Architects and Developers - New Zealand Seminar, June 2014

FHIR for Architects and Developers

Acknowledgements• Lloyd McKenzie• Ewout Kramer• Grahame Grieve

Agenda

• Architectures• Paradigms• Resources• Bundles• Profiles & Extensions• Server Notes• Workflow• Security• Tools and Help• Next steps in New Zealand

Page 2: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 2 • HL7 New Zealand

The Spec: Hl7.org/fhir

2

Page 3: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Architectures

Page 4: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 4 • HL7 New Zealand

Architectures

• FHIR makes no assumptions about the architectural design of systems

• You can use it for– Light or heavy clients– Central server or peer-to-peer sharing– Push or pull– Query or publish/subscribe– Loosely coupled or tightly coupled environments With history tracking (versions) or without

4

Page 5: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 5 • HL7 New Zealand

5

Some possibilities

FHIR

Broker

v3

v2

PHR

FHIR

App

Comm.Interface

DB

FHIR

Page 6: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 6 • HL7 New Zealand

Repository model

Vendor Neutral Repository

FHIR

HIS GP PACS SystemX Gateway

FHIR FHIRFHIRFHIR

Page 7: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 7 • HL7 New Zealand

7

Beyond exchange

v3

v2

Other

X12

Broker

v3

v2

FHIR

Repository

Decision Support

FHIR

FHIR

Other

Page 8: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 8 • HL7 New Zealand

Bottom Line

• FHIR is a set of tools– Defined resources– Extensibility mechanism– Versioning– Multi-paradigm– Set of standard interfaces– Support for complex services

• Primary purpose is interoperable data exchange• However, it can be leveraged in many ways

– Many we haven’t even thought of yet . . .

8

Page 9: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Paradigms revisited

Page 10: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 10 • HL7 New Zealand

Paradigms

• FHIR supports 4 interoperability paradigms

10

REST Documents

Messages Services

What should you use when?

Page 11: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Paradigms: REST

Page 12: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 12 • HL7 New Zealand

REST

• Simple, out-of-the-box interoperability• Leverage HTTP: GET, POST, etc.• Pre-defined operations

– Create, Read, Update, Delete– Also: History, Read Version, Search, Updates, Validate, Conformance &

Batch (Transaction)

• HTTP Headers for various options– Like resource format or location

• Response codes to indicate outcome– OperationOutcome Resource

• Works best in environments where control resides on client side and trust relationship exists

12

Rest

Page 13: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 13 • HL7 New Zealand

Creating & Updating

• POST vs PUT• Headers

– Request• Content-type• Location (for version aware)

– Response• Content-type• Others...

• Status messages– Standard HTTP

• OperationOutcome• Version aware updates

Page 14: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 14 • HL7 New Zealand

Querying by REST

• Base queries– Simple GET against a resource type– GET [base]/Patient?name=eve

• Defined rules for query parameters

• More complex– _include– Tags

• Queries across reference– Eg conditions for a patient– GET [base]/Condition?subject=84238862– Chained queries

• Compartments– Syntactic sugar– GET [base]/Patient/84238862/Condition

Page 15: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 15 • HL7 New Zealand

Synchronizing

• History of all resources on server– GET [base]/fhir/_history

• History of all patient resources on server– GET [base]/Patient/_history

• History of specific patient on server– GET [base]/Patient/1/_history

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

• Limit with _since and _count

Page 16: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 16 • HL7 New Zealand

What’s a ‘deleted’ Resource?

• Delete using DELETE verb• Trying read operations will return in a 410 (Gone) result in

stead of 404 (Not Found)• The resource will not be returned by the search operation.• You can “undelete” by doing an update (PUT) with fresh

content• Just a “marker” in a resource’s history

Page 17: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 17 • HL7 New Zealand

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

Page 18: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 18 • HL7 New Zealand

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

Page 19: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 19 • HL7 New Zealand

Batch

• POST a bundle to server root• Processed as a transaction

– All succeed, or all fail

• All operations supported• Different to /message endpoint

– /message allows custom server processing– Batch is a sequence processed as a transaction

Page 20: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Playing with FHIR

Page 21: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 21 • HL7 New Zealand

Test Servers

• Servers– At least 4 to choose from– http://spark.furore.com/fhir/Patient/nz100– http://fhir.healthintersections.com.au/open/Patient/100– fhir.orionhealth.com/blaze/fhir/Patient– https://his-medicomp-gateway.orionhealth.com/blaze/fhir/metadata

• Tools– XML Editor (Oxygen) – REST Client (POSTMan)

21

Script• Search patient on name • GET single patient from list

• XML & JSON • Update and PUT back • repeat REST Search • Show error

Page 22: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 22 • HL7 New Zealand

When to use REST?

• Want low coupling between systems– In theory, very little up-front negotiation required

• Small, light-weight exchanges• Focus is CRUD operations

– Also for publish/subscribe

• Client-driven client-server orchestration• Server endpoint has fixed location• Well-suited for Mobile, PHR, Registries

22

Rest

Page 23: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 23 • HL7 New Zealand

When to avoid REST?

• Complex or server-driven orchestration– Order of operations matters (e.g. complex decision support)

• Unit of work != resource– “Transaction” may be an option

• Lack of trust in the client for audit, etc.

23

Rest

Page 24: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Paradigms: Documents

Page 25: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 25 • HL7 New Zealand

Documents

• Similar to CDA• Collection of resources bound together

– Root is a “Composition” resource– Just like CDA header

• Sent as an ATOM feed– Usually stored as binary blob– Can be separate resource with Composition as ‘entry’ point

• One context– Not propagated

• Can be signed, authenticated, etc.• Working on conversion between FHIR Doc & CDA

25

Documents

Page 26: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 26 • HL7 New Zealand

Documents – are bundles

26

Observation Resource

Composition Resource

SectionSection

Device Resource

Patient Resource

Prescription Resource

<feed> <entry> <Composition /> </entry> <entry> <Observation /> </entry> <entry> <Device /> </entry> <entry> <Prescription /> </entry> <entry> <Patient /> </entry></feed>

AttesterMetadata

Page 27: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 27 • HL7 New Zealand

The Composition resource

27

Page 28: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 28 • HL7 New Zealand

Document Management

• The DocumentReference resource– Enables ‘XDS-like’ services

• The ‘registry’ is just a FHIR server– Same query capabilities

• Point to document– Any document (FHIR Doc, CDA, PDF etc).

Page 29: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 30 • HL7 New Zealand

XDS FHIR Style (MDS)

Page 30: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 31 • HL7 New Zealand

When to use Documents?

• No different to CDA• Focus is on persistence• No workflow involved

– other than post/retrieve document

• Need tight rules over authenticated content• Want to communicate multiple resources with control over

how data is presented• Data spans multiple resources

31

Documents

Page 31: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 32 • HL7 New Zealand

When to avoid Documents?

• Need for workflow– Request/response, decision support

• Data is dynamic– I.e. want view of data now, not at time of authorship– Multiple contributors over time

• Resources need to be accessed/manipulated independently

32

Documents

Page 32: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Paradigms: Messages

Page 33: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 34 • HL7 New Zealand

Messages

• Similar to v2 and v3 messaging• Also a collection of resources as an ATOM feed• Allows request/response behavior with bundles for both

request and response– /message endpoint on REST server

• Event-driven– E.g. Send lab order, get back result

• Can be asynchronous

34

Messages

Page 34: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 35 • HL7 New Zealand

Messages – are bundles

35

Observation Resource

MessageHeadersource destination

Device Resource

Patient Resource

<feed> <entry> <MessageHeader /> </entry> <entry> <Observation /> </entry> <entry> <Patient /> </entry> <entry> <Device /> </entry></feed>

event

Page 35: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 36 • HL7 New Zealand

MessageHeader Resource

36

Resource used in both request & response

Page 36: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 37 • HL7 New Zealand

FHIR messages

• No storage of the “Message” resource implied. Might be used in a router, converted to v2, etc.

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

37

Page 37: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 38 • HL7 New Zealand

Communicating messages

• Message Exchange Pattern• Synchronous in standard• Async supported• Reliability

• Transport• REST supported but, you can send FHIR Messages over mail, MLLP,

TCP, IPoAC (or Healthlink!)

• FHIR defines an HTTP end-point for messages• http://server.org/fhir/Mailbox

• Response comes back in the acknowledgment payload

38

Page 38: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 39 • HL7 New Zealand

Revisiting the Immunization Forecast

TCH Forecaster FHIR ServerFHIR Client

TCH Forecasterwith FHIR Message InterfaceFHIR Client

Page 39: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 40 • HL7 New Zealand

When to use Messaging?

• Request/response workflow• Need to drive behaviors more complex than CRUD on a

single resource– E.g. merge, complex queries

• Need for asynchronous communications• Need to communicate information about many resources

but want to minimize exchanges• No “identity” for many resources

40

Messages

Page 40: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 41 • HL7 New Zealand

When to avoid Messaging?

• Precise control required on how data gets persisted/displayed to humans

• Need for lightweight communications• Want to avoid pre-negotiations on behavior

41

Messages

Page 41: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Paradigms: Services

Page 42: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 43 • HL7 New Zealand

Service Oriented Architecture (SOA)

• Do whatever you like – (based on SOA principles)– Ultra complex workflows– Ultra simple workflows– Individual resources or collections (in Atom or other formats)– Use HTTP or use something else– Only constraint is that you’re passing around FHIR resources in some

shape or manner

43

Services

Page 43: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 44 • HL7 New Zealand

When to use Services?

• All previous paradigms are a type of services interface• Use a custom service when capabilities of other paradigms

don’t fit requirement– Operations other than CRUD on a resource (e.g. decision support)– Workflow more complex than simple request/response– Need to mix document persistence with

behavior

44

Services

Page 44: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 45 • HL7 New Zealand

When not to use services?

• When something else will do the job as well– I.e. Don’t define a custom service for something that already naturally

is handled by REST, messaging, etc.

45

Services

Page 45: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 46 • HL7 New Zealand

Paradigm guidance

• No absolutes– Consider a “when to avoid” as a note of caution– Capabilities/architecture of legacy will often drive approach,

particularly initially• E.g. If v2 back end, messaging

– Architectures will be driven by legacy requirements, architectural preferences, enterprise architecture commitments, etc.

46

Page 46: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 47 • HL7 New Zealand

Combining paradigms

• No requirement for a system to only support one paradigm– E.g. hospital may be primarily messaging, but use documents for

discharge summaries and reports and expose registries and appointments via REST with a few custom services for decision support or specialized workflow

• Data (generally) shared easily across paradigm boundaries• Caveats:

– If updates come in via document, message or service, RESTful version id still needs to increment

– Documents should typically be persisted whole, not reconstituted from parts

• Ensures signature validity– Legacy messaging systems may not provide the metadata to easily

expose or manipulate discrete resources via REST

47

Page 47: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Resources in more detail

Page 48: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 49 • HL7 New Zealand

Resource Definition

• Every resource definition has:– Scope and use– ‘UML’ representtaion– XML representation– Bindings– Constraints– Resource specific notes– Examples

• And computable– XSD Schema– schematron

Page 49: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 50 • HL7 New Zealand

XML & JSON

<Patient xmlns="http://hl7.org/fhir"> <text> <status value="generated" /> <div xmlns="http://www.w3.org/1999/xhtml">Doe, John</div> </text> <identifier> <label value="NI" /> <system value="http://moh.govt.nz/fhir/patient/nhi" /> <value value="PRP1660" /> </identifier> <name> <use value="official" /> <family value="Garrett" /> <given value="Gordon" /> </name></Patient>

{ "resourceType": "Patient", "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">Doe, John</div>" }, "identifier": [ { "label": "NI", "system": "http://moh.govt.nz/fhir/patient/nhi", "value": "PRP1660" } ], "name": [ { "use": "official", "family": [ "Garrett" ], "given": [ "Gordon" ] } ]}

Page 50: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 51 • HL7 New Zealand

Specify format using REST

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

HTTP/1.1 200 OKContent-Type: application/json+fhir;charset=utf-8Content-Length: 787

GET /fhir/Patient/1 HTTP/1.1

Accept: application/json+fhir

HTTP/1.1 200 OKContent-Type: application/json+fhir;charset=utf-8Content-Length: 787

Same for Create/Update

Page 51: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 52 • HL7 New Zealand

Resource metadata

Patient

MRN 22234“Ewout Kramer”30-11-1972Amsterdam

Metadata

Resource Identitieshttp://fhir.hl7.org/Patient/23E455A3Bhttp://fhir.hl7.org/Patient/23E455A3B/_history/4

Last updated2013-12-23T23:33:01+01:00

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

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

Page 52: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 54 • HL7 New Zealand

Identity

• 2 different ‘sorts’ of identity– ID identifies a resource on a server

• Is metadata• Will change between servers

– Identifier• Business identifier• Is an element in the resource

Page 53: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 55 • HL7 New Zealand

A Resource’s ID

• In fact: an URL

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

endpoint

resource type

identifier

Note: This URL resolves to the current version of a resourceIt’s also specific to a server

Page 54: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 56 • HL7 New Zealand

“Business” identifiers

Page 55: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 58 • HL7 New Zealand

Narrative

Page 56: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 59 • HL7 New Zealand

Tags

• Contain metadata about resources– Beyond ID, version & date

• Used for different purposes:– Compliance to Profile – Security – e.g. sensitivity of resource– Indicate Document/Message– User defined

• Transported in different ways:– REST – as an HTTP header– In a bundle (document, message, transaction) - in the feed.category

element

Page 57: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 60 • HL7 New Zealand

Versioning

• Most recent version– http://server.org/fhir/Patient/1– Returns single resource

• All versions– http://server.org/fhir/Patient/1/_history– Returns bundle of versions

• Specific version– http://server.org/fhir/Patient/1/_history/_1– Returns single resource

• Version support is optional• Works at instance and type level

Page 58: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 61 • HL7 New Zealand

Resource Reference

Example: part of DiagnosticReport

Page 59: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 62 • HL7 New Zealand

Coded values: the ValueSet resource

• Most coded elements have a set of possible values– Large or small – Static

• (change slowly)

• Can use ValueSet resource to define set of possibilities– A “true” FHIR ValueSet resource (may be version specific)

• Can contain:– References to a terminology (like SNOMED)– A list of specific codes

• Examples– International examples

• All the HL7 version 2 ‘tables’– NZ Examples

• Iwi & Hapu• DHB’s

62

Page 60: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 63 • HL7 New Zealand

Example of ValueSet<?xml version="1.0" encoding="UTF-8"?><ValueSet xmlns="http://hl7.org/fhir"> <text> <status value="additional"/> <div xmlns="http://www.w3.org/1999/xhtml">The value set for confidentiality codes in the elbonian document sharing project. The codes are defined directly by the valueset, rather than references to an external terminology</div> </text> <name value="ConfidentialityOptions"/> <description value="ConfidentialityOptions"/> <status value="draft"/> <!-- Define the options in the resource rather than an external terminology--> <define> <system value="http://fhir.moh.elbonia.com/confidentiality"/> <concept> <code value='N'/> <display value="Normal"/> <definition value="That the document is of normal confidentiality "/> </concept> <concept> <code value='H'/> <display value="High"/> <definition value=”That the document is Highly confidential - eg Mental health "/> </concept> </define></ValueSet>

Page 61: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 64 • HL7 New Zealand

Contained resources

• When the contained resource has no separate identity

• Has quite a few limitations• Use sparingly

– Bundle always better if possible

<Composition xmlns="http://hl7.org/fhir"> <extension>...</extension> <text>...</text> <contained> <Organization id="org1"> <!– other data --> </Organization> </contained> <information> <!-- other attributes --> <custodian> <reference value="#org1" /> </custodian> <!-- other attributes --> <information> </Document>

Page 62: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Bundles in more detail

Page 63: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 66 • HL7 New Zealand

Review

• Atom as the bundling mechanism– Query results– Document– Message

• Request & Response– Batch/Transactions

• XML or JSON– Conversion routines available– (Can’t use ordinary ones)

• Use tags to identify Documents & Messages– First resource significant

Page 64: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 67 • HL7 New Zealand

Page 65: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 68 • HL7 New Zealand

Resource Entry

Version-specific id

Resource id

Last modified

Resource content

Human-readable form,just like Resource.text

Tags

Page 66: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 69 • HL7 New Zealand

Bundle as a serialized Object Graph

Page 67: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Profiles and Extensions:Profiles

Page 68: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 71 • HL7 New Zealand

The need for Profiles

• Many different contexts in healthcare, but a single set of Resources– A desire to keep the resources manageable– Most elements in base resources optional

• Need to be able to:– Describe restrictions based on use and context– Support elements not in the core resource

• Allow for these usage statements to:– Authored in a structured manner– Published in a repository– Discoverable at Design and Run-time– Used as the basis for validation, code, report and UI generation.

71

Page 69: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 72 • HL7 New Zealand

Profiling a resource. For example...

72

Require that the identifier uses the NHI – and is required

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

Limit maritalStatus to another set of codes that extends the one from HL7 international

Add an extension to support “Iwi”

Note: hardly any mandatory elements in the core spec!

Page 70: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 73 • HL7 New Zealand

Capabilities of Profiles

• Descriptive– Information about the Profile (what, why, who)

• Extending a resource– Adding new elements– Same capabilities/datatypes as existing ones

• Constraining a resource– Specifying datatypes for an element– Modifying datatypes (eg translations)– Defining terminology bindings– Specifying multiplicity (eg make an element required)– Further refining repeating values (‘Slicing’)

• Example of Composition.section (Document)– Cannot specify default values for resource instances

• Everything explicit in an instance

Page 71: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 74 • HL7 New Zealand

Structured & published

• A Profile is just a “normal” Resource• Any FHIR server could serve Profiles (just like Patients, Observations,

etc…)• So, any FHIR server is a profile repository!• A profile is simply referred to by its URI:

– Like any other resource• e.g. http://hl7.org/fhir/Profile/iso-21090

– Extensions in an ‘instance’ of a resource refer to the profile that defined them using the URI

– Need to think about re-usability when designing profiles

74

Page 72: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 75 • HL7 New Zealand

Who publishes a Profile?

http://www.hl7.org/fhir/Profile/iso-21090

http://www.hl7org.nz/fhir/Profile/patient

http://www.health4all.org/fhir/Profile/

Page 73: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 76 • HL7 New Zealand

Using profiles

• If we are a server then a client can read our conformance resource, which will list the profiles we support, and provide a link to them.– Conformance also has other functions like specifying supported resources,

operations on those resources & interoperability paradigms

• If we are a client, we can tell a server that we conform to a profile using a tag (the server will probably still check).– We could also ask a server just to validate– Could set up ‘distributed’ validation with (eg) National Validation servers

used by local/regional servers

• If we receive a resource with an extension we don’t recognize, it will point to the profile in which it is described so we can decide what to do with it.– Note that a single resource can reference different profiles

76

Page 74: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 77 • HL7 New Zealand

What’s in a profile, and its relationships?

77

Descriptive

IdentifierName, VersionPublisherDescription, CodeStatusDate (of publication)

Resource and Datatype Constraints

Extension Definition

Conformance(server)

Resource (via Tag)

ValueSetValueSet

Extension in Resource

Tag

Page 75: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 78 • HL7 New Zealand

Scale / design

• Make a profile with just extensions• Make a profile with just 1 resource + extensions on that

resource• Make a profile with all (say national) resources + extensions.

78

Page 76: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 79 • HL7 New Zealand

Profile Descriptive information

• To describe the purpose of the Profile• To help with location• Details

– Identifier: Universally unique identifier, assigned by author value=“urn:hl7.org:extensions:iso-21090“ or “2.16.840.1.113883.10.20.2.1”

– Version: Version of the profile, manually maintained by author. Suggested format: a timestamp (e.g. 2013-01-01T12:34:45)

– Name: Free natural text name (e.g. “Extensions to support Orion Medications”)– Publisher: organization or individual responsible for publishing. Should be populated (e.g. “FHIR

Project Team“)– Telecom: one or more contact points of the publisher (telephone, email, website etc)– Description: longer description of the contents of the profile– Code: one or more coded descriptions to help with finding the profile– Status (fixed choice of draft, active, retired) + experimental Y/N– Requirements: scope & usage (the “need” or “why” of the profile)– Date (of publication), e.g. “2013-07-07"

79

Page 77: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 80 • HL7 New Zealand

Constraining Structures (elements)

• Defining terminology bindings– ValueSet is useful

• Specify element datatypes• Further refining repeating values (‘Slicing’)• Specifying multiplicity

From the spec

Possibilities

Page 78: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 81 • HL7 New Zealand

Profile example

Medication.code with a defined valueset

Page 79: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 82 • HL7 New Zealand

Profile Example

• MedicationPrescription.asNeeded required, and must be boolean

Page 80: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 83 • HL7 New Zealand

Slicing

• Constraining an element with 0..* , 1..*• FHIR Document as an example• Composition resource is the CDA Header equivalent

– Composition.section is 0..*– A CCDA equivalent profile might specify the sections allowed

• Different document types would have a profile

Page 81: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Profiles and Extensions: Extensions

Page 82: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 85 • HL7 New Zealand

Extensions

• Resources design for the 80% - Allow easy extension for the remaining 20% of elements

• Note - You’re not extending a resource per se, but you specify its characteristics and where an extension may occur:– A specific element within a resource – A specific element within a datatype– All elements referencing a datatype– All elements mapping to a specific mapping target– An extension

85

(c) 2012 HL7 International

04/12/2023

Page 83: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 86 • HL7 New Zealand

Extensions

• In FHIR, extensions are “normal”– Consequence of the 80% rule – keep the simple stuff simple– Extensions can exist anywhere

• Yes, even inside boolean or date– Conformant systems can’t reject instances just because they contain

unrecognized extensions– They could:

• Display them– Should be in resource narrative

• Store as a ‘Blob’• Make a conscious decision to ignore (unless ModifierExtension)

– (Could lookup profile)

86

Page 84: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 87 • HL7 New Zealand

Extension definition

87

Note: multiplecontexts!

Page 85: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 88 • HL7 New Zealand

An Extension in a resource

88

Page 86: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 89 • HL7 New Zealand

Extending a multiple birth

Key = location of formal definition

Value = value according to definition

Page 87: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 90 • HL7 New Zealand

Modifier Extensions

• Also a core part of FHIR– Needed because some extensions can’t be safely ignored– Can’t compute on an element containing an unrecognized modifier

extension. However, can:• Reject instance• Just display narrative• Retrieve definition & seek human review

90

Page 88: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 91 • HL7 New Zealand

Modifier Extension decisions

• When should you introduce them?– modifierExtension breaks interoperability so:

• If you can accomplish your objective without one, do that– Consider a new resource or Other– Could requirement be met by an element that doesn’t change other

element interpretations?– Best used when already part of existing practice, but in too narrow an

area to justify being part of core

91

Page 89: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 92 • HL7 New Zealand

‘Other’ resource

• When there’s no way to extend an existing one• Has:

– Identifier– Code– Subject– Author– Created

• Rest is extensions• Should discuss with community first

Page 90: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 93 • HL7 New Zealand

Designing a Profile

• Define Use Case • Choose resources

– ‘Other’ if you have to

• Constrain base elements– Remove– Make required– Define ValueSets and bindings

• Define extensions– Try to re-use existing if possible– Note ‘hierarchy’ of extensions:

• HL7• National• Local

• Build profile• Publish

Page 91: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 94 • HL7 New Zealand

The need for Governance

• Profiles & extensions allow a user to customize their use of FHIR

• HL7 is establishing publically available registries– For reference purposes

• With great power...

Page 92: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 95 • HL7 New Zealand

Profile editors

• Forge (FHIR.furore.com/forge)

Page 93: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Server specific notes

Page 94: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 97 • HL7 New Zealand

Overview of a server

97

HTTP / REST interface Encoding/decoding, param validation, syntax validation

Fhir Service

Indexer / Search Storage

Implement service operations as described in spec

Page 95: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 98 • HL7 New Zealand

From wire to store

Storage

Fhir Service

REST interface

JSON/XML

POCO/POJO

DBMS

O-R Map

FHIR Parser

98

JSON/XML

POCO/POJO

Serialize

FHIR Parser

NoSql(Xml/Json)

JSON/XML

POCO/POJO

DBMS

Serialize

FHIR Parser

Page 96: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 99 • HL7 New Zealand

Conformance resource

• Allows a server to indicate:– Metadata about the server– The resources they support

• The queries against those resources– The paradigms they support

• REST, messaging, services– Specific (custom) queries– The profiles it supports

• Is a normal resource– Supports discoverability (think UDDI for SOAP)

Page 97: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 100 • HL7 New Zealand

Conformance

• Which FHIR version?• Which resources?• Which paradigms ?• What search operations?• What formats?• What profiles?• Is this a test server?

• Who can I contact?

• Do you support History?• Do you support JSON/XML?

• Is a normal resource• Supports discoverability (think

UDDI for SOAP)

Page 98: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 101 • HL7 New Zealand

Operation Outcome

• When something goes wrong….return the OperationOutcome Resource!

Page 99: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 102 • HL7 New Zealand

Special endpoints

• Binary– Store/retrieve a blob.– No query

• Document– Works at ‘document’ level– Query on composition

• Mailbox– Processing endpoint– Exact actions depending on Trading Partner Agreement

• Note MessageHeader properties – eg event, reason

Page 100: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Workflow

Page 101: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 104 • HL7 New Zealand

Workflow

• Resource describe ‘things’ • Workflow says what to do with those things• Eg

– ePresciption– Lab order– Referral

• Order resources– Order– OrderResponse

• Combination of Order(for workflow) and specific resource– Eg Order + MedicationPrescription

Page 102: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 105 • HL7 New Zealand

Referrals workflow

105

Page 103: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Security and Privacy

(Coming to the end…)

Page 104: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 107 • HL7 New Zealand

Overview

• Signatures– On bundles

• Tags used to ‘annotate’ resources– Eg private resource, ‘Special

Patient’– Application applies policy

• Resources are atomic level• Some ‘security-related’

resources– SecurityEvent– Provenance

• Philosophically FHIR delegates security to infrastructure– Others do that better– But does have comments

Page 105: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 108 • HL7 New Zealand

Wrapping Up: Tools for Developers

• Specification– The full specification (included build tools) can be downloaded from the CVS at:

http://gforge.hl7.org/gf/project/fhir • (Free to download, need account to update)

• Examples• Validation files

– XSD, Schematron

• Test Servers– Open source

• Reference Implementations– Java, .net, Objective-C, javascript– Open source– Reference Implementations from www.hl7.org/fhir

• Tooling– XML/JSON editor– REST client

108

Page 106: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Page 109 • HL7 New Zealand

Further Information & Help

• Information:– Specification: www.hl7.org/fhir

• Fully hyper-linked• Includes many sample files and links to codesets & terminologies

– Wiki pages: http://wiki.hl7.org/index.php?title=FHIR– HL7 Lists server: from HL7.org– Blogs (listed on spec)

• Assistance– ‘Stack Overflow’ – tag hl7-FHIR– Skpe conversations (email me – [email protected] to be

included)

Page 107: FHIR for Architects and Developers - New Zealand Seminar, June 2014

Whew! Next Steps in New Zealand?

A group discussion