29
HL7®, FHIR® and the flame Design mark are the registered trademarks of Health Level Seven International and are used with per mission. Redmond, June 10 12 | @HL7 @FirelyTeam | #fhirdevdays | www.devdays.com/us Validation of FHIR data Ewout Kramer, Firely

Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

  • Upload
    others

  • View
    4

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

HL7®, FHIR® and the flame Design mark are the registered trademarks of Health Level Seven International and are used with per mission.

Redmond, June 10 – 12 | @HL7 @FirelyTeam | #fhirdevdays | www.devdays.com/us

Validation of FHIR data

Ewout Kramer, Firely

Page 2: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Goal....

Take away some of the “black magic” of FHIR validation

We can use a tool to create profiles, but what happens under

the hood?

Will show StructureDefinition + validation tools

2

Page 3: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Validation inputs

3

Conformance

Resources

StructureDefinition

ValueSet

CodeSystem Validator

Packages

• HL7 International

(“core”)

• National

• Your own

Results

OperationOutcome

Page 4: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

ElementDefinition

Whever a tool reads or writes profiles, it reads

StructureDefinitions, itself collections of ElementDefinitions

Most important parts:

path (the dotted part expressing hierarchy: “Patient.identifier.use”) short/definition

min/max (cardinality)

fixed/pattern

typeRef (base data type of element)

binding

(fhirpath) invariants 4

Page 5: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Pet project for this session

5

DocumentBundle

SD on Bundle

DocumentComposition

SD on Composition

WeightHeightObservation

SD on Observation

SectionTitles

ValueSet

WeightQuantity

SD on Quantity

HeightQuantity

SD on Quantity

constrain document

sections (“slicing”)

constrain

Quantity.value[x]

Page 6: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

WeightQuantity

6

value: 1..1, between 0 and 200

comparator: 0..0

unit: unchanged

system: 1..1, fixed to ‘http://unitsofmeasure.org’ code: 1..1, fixed to ‘kg’

Page 7: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Forge XML

7

Page 8: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Pet project for this session

8

DocumentBundle

SD on Bundle

DocumentComposition

SD on Composition

WeightHeightObservation

SD on Observation

SectionTitles

ValueSet

WeightQuantity

SD on Quantity

HeightQuantity

SD on Quantity

constrain document

sections (“slicing”)

constrain

Quantity.value[x]

Determines

possible section

codes

√ √

Page 9: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

WeightHeightObservation

9

value: 1..1,

string OR Quantity

If Quantity, either:

WeightQuantity or HeightQuantity

Note: We are using a canonical reference to

point to WeightQuantity and HeightQuantity.

Page 10: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Forge XML

10

How is that canonical reference resolved?

?

Page 11: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Try it out in a validator!

Try remove ‘status’ (core: 1..1) Try valueBoolean

Change a unit (Quantity.code) to ‘kgs’ Why multiple errors? Try looking at the informational message!

11

Page 12: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Pet project for this session

12

DocumentBundle

SD on Bundle

DocumentComposition

SD on Composition

WeightHeightObservation

SD on Observation

SectionTitles

ValueSet

WeightQuantity

SD on Quantity

HeightQuantity

SD on Quantity

constrain document

sections (“slicing”)

constrain

Quantity.value[x]

Determines

possible section

codes

√ √

Page 13: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

DocumentComposition – Easy bits

13

type: a CodeableConcept with at least one

LOINC code 18842-5. May optionally

specify other elements like text,

version, display...

subject: limit to type Patient

author: limit to type Practitioner

Page 14: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Forge XML

14

Page 15: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Pattern...the unloved feature

15

Can even make this ‘*’!

Page 16: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Try it out in a validator!

Make a reference to another type for Composition.subject

Composition.type:

Add another coding. Add <display> element.

Take the first coding, add a <version> element.

Take the first coding, change the code.

16

Page 17: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

DocumentComposition - Slicing

17

For all sections (1..*)

title: 1..1, max. 20 characters long

code: 1..1, Must come from ValueSet

“SectionTitles” emptyReason: 0..0

entry: Must be Observations

section: 0..0 (no subsections)

For sections where code = 8716-3 (1..1)

vitalSigns

code: 1..1, 8716-3

entry: Must be a WeightHeightObservation

For sections where code = 10154-3 (0..1)

chiefComplaints

code: 1..1, 10154-3

Other sections are allowed, no additional rules apply.

Page 18: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Forge XML

18

Page 19: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Forge XML

19

Page 20: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Try it out in a validator!

Many any section.title > 20

Duplicate the vital signs section

give the first duplicate a section.code of

<system value="http://loinc.org"/>

<code value="8716-3"/>

Change the slice’s <ordered> to “true”

20

Page 21: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

FhirPath integration

In the slice intro add:

21

Page 22: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Pet project for this session

22

DocumentBundle

SD on Bundle

DocumentComposition

SD on Composition

WeightHeightObservation

SD on Observation

SectionTitles

ValueSet

WeightQuantity

SD on Quantity

HeightQuantity

SD on Quantity

constrain document

sections (“slicing”)

constrain

Quantity.value[x]

Determines

possible section

codes

√ √

Page 23: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Other validation tools

Java validator: https://www.hl7.org/fhir/validation.html

.NET Core cross-platform (“Torinox”): https://simplifier.net/downloads/torinox

In your Simplifier projects, integrated Validation:

https://simplifier.net/validate

23

Page 24: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Questions?

24

Page 25: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Play along...

Example data, StructureDefinitions & Validator (Windows) can

be found at:

https://github.com/ewoutkramer/Furore.Fhir.ValidationDemo/releases

Includes and executable + examples shown in this tutorial.

25

Page 26: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Extensions and StructureDefs

Extensions are defined using StructureDefinitions

In fact, they are constraints on the Extension datatype!

26

Fix this URL to the extension’s url

Limit to just “Boolean” [1..1]

Don’t allow nested extensions

Page 27: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

27

Page 28: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Validation inputs

28

Conformance

Resources

StructureDefinition

ValueSet

CodeSystem Validator

Validator-libraries

Java

• JAR

• Stand-alone cmdline • Integrated in HAPI

• Touchstone

Delphi

• Notepad++ • Grahame’s server

.NET

• NuGet package

• Torinox (cmdline) • Simplifier

• Windows-tool

Packages

• HL7 International

(“core”)

• National

• Your own

Results

OperationOutcome

Page 29: Validation of FHIR data - DevDays · Licensed under Creative Commons. HL7 & Health Level Seven are registered t rademarks of Health Level Seven International. Reg. U.S. TM Office

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

Validation inputs

29

Conformance

Resources

StructureDefinition

ValueSet

CodeSystem Validator

Validator-libraries

Java

• JAR

• Stand-alone cmdline • Integrated in HAPI

• Touchstone

Delphi

• Notepad++ • Grahame’s server

.NET

• NuGet package

• Torinox (cmdline) • Simplifier

• Windows-tool

Packages

• HL7 International

(“core”)

• National

• Your own

Results

OperationOutcome