![Page 1: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/1.jpg)
HL7®, FHIR® and the flame Design mark are the registered trademarks of Health Level Seven International and are used with permission.
Amsterdam, 14-16 November | @HL7 @FirelyTeam | #fhirdevdays18 | www.fhirdevdays.com
Validating FHIR data
Ewout Kramer
![Page 2: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/2.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/3.jpg)
© 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
CodeSystemValidator
Packages
• HL7 International (“core”)
• National
• Your own
Results
OperationOutcome
![Page 4: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/4.jpg)
© 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) invariants4
![Page 5: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/5.jpg)
© 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
DocumentBundleSD on Bundle
DocumentCompositionSD on Composition
WeightHeightObservationSD on Observation
SectionTitlesValueSet
WeightQuantitySD on Quantity
HeightQuantitySD on Quantity
constrain document sections (“slicing”)
constrain Quantity.value[x]
![Page 6: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/6.jpg)
© 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 200comparator: 0..0unit: unchangedsystem: 1..1, fixed to ‘http://unitsofmeasure.org’code: 1..1, fixed to ‘kg’
![Page 7: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/7.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/8.jpg)
© 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
DocumentBundleSD on Bundle
DocumentCompositionSD on Composition
WeightHeightObservationSD on Observation
SectionTitlesValueSet
WeightQuantitySD on Quantity
HeightQuantitySD on Quantity
constrain document sections (“slicing”)
constrain Quantity.value[x]
Determines possible section codes
√ √
![Page 9: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/9.jpg)
© 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 orHeightQuantity
Note: We are using a canonical reference to point to WeightQuantity and HeightQuantity.
![Page 10: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/10.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/11.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/12.jpg)
© 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
DocumentBundleSD on Bundle
DocumentCompositionSD on Composition
WeightHeightObservationSD on Observation
SectionTitlesValueSet
WeightQuantitySD on Quantity
HeightQuantitySD on Quantity
constrain document sections (“slicing”)
constrain Quantity.value[x]
Determines possible section codes
√ √
√
![Page 13: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/13.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/14.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/15.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/16.jpg)
© 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 <text> element. Take the first coding, add a <version> element. Take the first coding, change the code.
16
![Page 17: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/17.jpg)
© 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 longcode: 1..1, Must come from ValueSet
“SectionTitles”emptyReason: 0..0entry: Must be Observationssection: 0..0 (no subsections)
For sections where code = 8716-3 (1..1)vitalSignscode: 1..1, 8716-3entry: Must be a WeightHeightObservation
For sections where code = 10154-3 (0..1)chiefComplaintscode: 1..1, 10154-3
Other sections are allowed, no additional rules apply.
![Page 18: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/18.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/19.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/20.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/21.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/22.jpg)
© 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
DocumentBundleSD on Bundle
DocumentCompositionSD on Composition
WeightHeightObservationSD on Observation
SectionTitlesValueSet
WeightQuantitySD on Quantity
HeightQuantitySD on Quantity
constrain document sections (“slicing”)
constrain Quantity.value[x]
Determines possible section codes
√ √
√
√
![Page 23: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/23.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/24.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/25.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/26.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/27.jpg)
© 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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/28.jpg)
© 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
CodeSystemValidator
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: Validating FHIR data - FHIR DevDays · © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health LevSeven International](https://reader036.vdocuments.us/reader036/viewer/2022062612/613bd3e6f8f21c0c826937e6/html5/thumbnails/29.jpg)
© 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
CodeSystemValidator
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