SlideShare a Scribd company logo
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Advanced
.NET API
Ewout Kramer
FHIR Developer Days
November 17, 2016
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Who am I?
 Name: Ewout Kramer
 Company: Furore
 Background:
 Computer Science (operating systems)
 In Health IT since 1999
 FHIR Core team
 Lead dev on the .NET API
 e.kramer@furore.com, @ewoutkramer
 http://thefhirplace.com2
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
BEYOND THE POCO
3
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Why?
 No need to parse whole POCO’s in memory
 Generic clients/servers not needing pre-
compiled model classes
 Tools that can parse (partly) invalid FHIR
data
 Accessing DSTU2 and STU3 data
4
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
“Logical” structure of
FHIR data
5
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
IElementNavigator
6
 Represents a position in a tree of FHIR data
 Has all the aspects of a node (from last slide)
 Path: Patient.name[1].family[0]
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
INavigator<T>
7
GetChildrenByName(this IElementNavigator navigator,
string name)
IEnumerable<object> Values(this IElementNavigator navigator)
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Caveat
 We are showing you work in progress
 Interfaces may change
 Will be implemented for DSTU2 and STU3
 Currently prackaged as part of the
FluentPath .NET Core library
(HL7.FluentPath)
 Use the latest 0.4.x (alpha) releases
 Only available implementation is the
PocoNavigator8
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
GETTING TO METADATA
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Conformance Resources
 Provide “metadata” about
 Model Definitions (StructureDefinition)
 Operations (OperationDefinition)
 Search parameters (SearchParameter)
 List of codes (ValueSet)
 Identified by a “canonical url” that SHOULD
resolve, e.g.
“http://hl7.org/fhir/StructureDef
inition/Patient”
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Resolution
 Directly using a FHIR REST call to the url
 More likely:
 As part of a “snapshot”/zip of files delivered with
your app
 Compiled into your app
 In a database
11
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
IResourceResolver
 Concrete implementations in API:
 DirectorySource, ZipSource
 WebSource
 CachedResolver (wraps another resolver)
 MultiResolver (tries a list of resolvers)12
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Combine at will
13
MyDbResolver
ZipSource WebResolver
MultiResolver
CachedResolverMultiResolver
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Practicalities
 Packaged in Hl7.Fhir.Specification assembly
 Namespace Hl7.Fhir.Specification.Source
 Includes useful extension methods like:
 FindStructureDefinition(this IResourceResolver resolver, string uri,
bool requireSnapshot = false)
 FindStructureDefinitionForCoreType(this IResourceResolver
resolver, FHIRDefinedType type)
 FindExtensionDefinition(this IResourceResolver resolver, string
uri, bool requireSnapshot = false)
 Data for base spec is in “specification.zip”, easy to get
to using ZipSource.CreateValidationSource()
14
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
TERMINOLOGY
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
FHIR Resources
 CodingSystem resource (STU3)
 A dictionary of concepts (possibly huge!)
 ValueSet (DSTU2, STU3)
 A (use-case specific) selection of concepts from
1..* CodingSystems
 May be directly enumerated (‘extensional’)
 May be composed using filters (‘intensional’)
 “all the LOINC codes in LOINC Part Concept Cholesterol |
Bld-Ser-Plas (LP43571-6), except for 5932-9 Cholesterol
[Presence] in Blood by Test strip”
 May be composed from other ValueSets
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Main functionality
 Expand an intensional ValueSet
 Determine whether some code is member of
a ValueSet
 Do a code-lookup
 Find details like alternative designation
 Could be done “in-memory” (i.e. using an
expanded ValueSet)
 By calling the FHIR terminology operations17
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
In-memory
 Expand using the ValueSetExpander
class in
Hl7.Fhir.Specification.Terminology
 Set limits on expansion size
 Uses IResourceResolver to locate
ValueSets
 Current limitations:
 No filters
 No imports of whole CodeSystems
18
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Working with the
expansion
 Useful extension methods on ValueSet
 HasExpansion()
 ExpansionSize()
 FindInExpansion(String code, string system)
 bool CodeInExpansion(String code, string system)
 Note: no automatic expansion, use
ValueSetExpander
19
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Terminology operations
 https://www.hl7.org/FHIR/valueset-
operations.html
 $expand, $lookup, $validate-code
 class FhirClient
 ExpandValueSet()
 ConceptLookup()
 ValidateCode()
20
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
ITerminologyService
 Currently available: LocalTerminologyServer
 Does an in-memory expand & lookup
 Planned: try cache - then the
LocalTerminologyServer - then the operations on
a “real” terminology server.
 Note: returns OperationOutcome
21
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
FHIRPATH SUPPORT
22
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
FhirPath in .NET
 First, the name
 FhirPath -> FluentPath -> FhirPath
 Available as a .NET Core library
Hl7.FluentPath on NuGet (0.4.x)
 Is built on top of IElementNavigator – so
it could work on *any* object model
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Compiling FhirPath
 Advantage: Compile once, run many (fast)
 class FluentPathCompiler
 public CompiledExpression
Compile(string expression)
 CompiledExpression is a native Lambda that
will run the statement against an
IElementNavigator
 You can also compile to an Expression tree
(for debug/display purposes)
24
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Using
CompiledExpression
 First, compile the statement
 var ce =
compiler.Compile(“Patient.name”);
 Then:
 var result = ce(…)
 result is a set of IElementNavigators
 Or:
 object s = ce.Scalar(…);
 bool p = ce.Predicate(…);
 bool b = ce.IsBoolean(true, …);
25
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Convenience methods
 Comparable methods exist on
IElementNavigator so you can directly
query a source of data
 Example:
IElementNavigator nav =
new PocoNavigator(myPatient);
object cnt =
nav.Scalar(“Patient.name.count()”);
 Compiles & caches last 500 expressions for
you26
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
On POCO’s directly…
 The Hl7.Fhir.Core assembly has extension
methods in Hl7.Fhir.FluentPath for working
directly on FHIR POCO’s
Patient p = …;
object cnt = p.Scalar(“Patient.name.count()”);
27
© 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
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
The Big Picture
FHIR Data
<Patient>
</Patient>
IElementNavigator FHIR Definitions
StructureDefinition
OperationDefinition
ValueSet
IResource
Resolver
FindStructure
Definition()
ValueSetExpander
LocalTerminology
Server
ITerminologyService
Validator
FluentPathCompiler
FHIR Poco
OperationOutcome
(with IssueComponents)
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Practicalities
 class Validator in Hl7.Fhir.Validation namespace
(Hl7.Fhir.Specification assembly)
 Configure: new Validator(settings)
 Resolver, terminology service to use
 Validate: call one of the overloads:
 Validate(IElementNavigator)
 Validate(Base)
 Validate(XmlReader)
 Result is an OperationOutcome
30
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Caveats
 Validator is still being developed as we
speak
 Support most features already, except for
slicing – only discriminator-less slicing is
supported
 Other improvements: e.g. loop-detection
 Almost daily updates with more functionality
31
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
OperationOutcome
- on steroids
 Lots of helper methods
 Properties:
 Success (!information,!warning)
 Fatals, Errors, Warnings properties
 Extension methods (in Hl7.Fhir.Support)
 ErrorsAt(string path)
 Where(severity, type, …)
 Set/GetHierachyLevel()
 Include(outcome), Add(outcome)
32
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
QUESTIONS?
33
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
HANDS-ON TRACK
Suggestions for a pleasurable afternoon
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
IResourceResolver
 Try to use the ZipSource with the
specification.zip to get some core resource
definitions
 Write your own IResourceResolver that
resolves from a .NET compiled-in resource
(not a FHIR resource ;-)
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
ITerminologyService
 Use your new IResourceResolver to resolve
a ValueSet & expand it.
 Use ValueSet’s FindInExpansion to verify
whether you succeeded
 Look at the C# implementation of
LocalTerminologyService. Could you make
one that calls the FhirClient.ValidateCode()
instead?36
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Play with the validator
 Check out
https://github.com/ewoutkramer/Furore.Fhir.ValidationDe
mo & compile
 Try to incorporate your resolver and terminology service
(if any)
 Try running the examples at
https://github.com/ewoutkramer/fhir-net-
api/tree/develop/src/Hl7.Fhir.Specification.Tests/TestData
/validation
 Alter the examples so they trigger your code (change a
binding…)
37
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
HIDDEN GEMS
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
ResourceIdentity
 class ResoureIdentity : Uri
 Builds FHIR RESTful Uri’s
 Factory methods Build():
 .Build(“Patient”, “4E75”, vid: “4”)
 “/Patient/4E75/_history/4”
 StructureDefinition URLs for core types
 .Core(FHIRDefinedType.HumanName)
 “http://hl7.org/fhir/StructureDefiniti
on/HumanName”
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
ResourceIdentity (2)
 Even more useful: parsing RESTful Urls
 var ep = “http://server.org/fhir/Patient/4”
var u = new ResourceIdentity(ep);
 u.ResourceType
 “Patient”
 u.Id
 “4”
40
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Extension Manipulations
41
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
TransactionBuilder
42
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
SnapshotGenerator
43

More Related Content

PPTX
Terminology, value-sets, codesystems by Lloyd McKenzie
PPTX
Profile and validation by Grahame Grieve
PPTX
FHIR Profiling tutorial
PPTX
FHIR tutorial - Afternoon
PPTX
FHIR API for .Net programmers by Mirjam Baltus
PPTX
FHIR Search for server developers by Martijn Harthoorn
PPTX
FHIR Search for client developers by Mirjam Baltus
PPTX
Vitalis 2016 FHIR Introduction
Terminology, value-sets, codesystems by Lloyd McKenzie
Profile and validation by Grahame Grieve
FHIR Profiling tutorial
FHIR tutorial - Afternoon
FHIR API for .Net programmers by Mirjam Baltus
FHIR Search for server developers by Martijn Harthoorn
FHIR Search for client developers by Mirjam Baltus
Vitalis 2016 FHIR Introduction

What's hot (20)

PPTX
FHIR Documents by Lloyd McKenzie
PPTX
FHIR and DICOM by Marten Smits
PPTX
Authoring profiles by Michel Rutten
PPTX
The FHIR burns brighter (what's new in DSTU2)
PPTX
Authoring FHIR Profiles - extended version
PPTX
FHIR overview at EHiN 2014, Oslo
PPTX
Patient matching in FHIR
PPTX
Nhs trusts meeting at salford
PPTX
Authoring Profiles in FHIR
PPTX
FHIR architecture overview for non-programmers by René Spronk
PPTX
IHE France on FHIR
PPTX
Security in FHIR with OAuth by Grahame Grieve
PPTX
Introduction to FHIR™
PPTX
Hl7 uk fhir the basics
PPTX
FHIR Tutorial - Morning
PPTX
Getting started with FHIR by Ewout Kramer
PPTX
Vitalis 2016 FHIR App Development
PPTX
FHIR DevDays 2015 - introduction to FHIR
PPTX
FHIR - Feel the Fire - 1
PPTX
FHIR - more than the basics
FHIR Documents by Lloyd McKenzie
FHIR and DICOM by Marten Smits
Authoring profiles by Michel Rutten
The FHIR burns brighter (what's new in DSTU2)
Authoring FHIR Profiles - extended version
FHIR overview at EHiN 2014, Oslo
Patient matching in FHIR
Nhs trusts meeting at salford
Authoring Profiles in FHIR
FHIR architecture overview for non-programmers by René Spronk
IHE France on FHIR
Security in FHIR with OAuth by Grahame Grieve
Introduction to FHIR™
Hl7 uk fhir the basics
FHIR Tutorial - Morning
Getting started with FHIR by Ewout Kramer
Vitalis 2016 FHIR App Development
FHIR DevDays 2015 - introduction to FHIR
FHIR - Feel the Fire - 1
FHIR - more than the basics
Ad

Viewers also liked (10)

PPTX
HL7 Fhir for Developers
PPTX
FHIR Client Development with .NET
PPTX
A whistlestop tour of FHIR API authentication and authorization
PPTX
FHIR Server internals - sqlonfhir
PPTX
HL7 FHIR - Out-of-the-box eHealth interoperability
PDF
Дмитрий Кремер, МИА «Россия сегодня» (РИА Новости). «Построение новостного we...
PPTX
Smart on FHIR
PPTX
Using FHIR standard interfaces to access GP records
PPTX
FHIR API for Java programmers by James Agnew
PPTX
Wado and FHIR
HL7 Fhir for Developers
FHIR Client Development with .NET
A whistlestop tour of FHIR API authentication and authorization
FHIR Server internals - sqlonfhir
HL7 FHIR - Out-of-the-box eHealth interoperability
Дмитрий Кремер, МИА «Россия сегодня» (РИА Новости). «Построение новостного we...
Smart on FHIR
Using FHIR standard interfaces to access GP records
FHIR API for Java programmers by James Agnew
Wado and FHIR
Ad

Similar to Advanced .NET API (Ewout) (13)

PPTX
Advanced .net api (ewout)
PPTX
Validation in net and java (ewout james)
PPTX
Fhir path (ewout)
PPTX
Rolling out FHIR - architecture and implementation considerations by Lloyd Mc...
PPTX
Terminology, value-sets, codesystems by Lloyd McKenzie
PPTX
Structure definition 101 (ewout)
PPTX
FHIR architecture overview for non-programmers by René Spronk
PPTX
FHIR: What's it All About?
PPTX
SMART on FHIR by Scot Post van der Burg
PPTX
SMART on FHIR by Scot Post van der Burg
PPT
Php mysql training-in-mumbai
PPTX
Advanced .net api (ewout)
Validation in net and java (ewout james)
Fhir path (ewout)
Rolling out FHIR - architecture and implementation considerations by Lloyd Mc...
Terminology, value-sets, codesystems by Lloyd McKenzie
Structure definition 101 (ewout)
FHIR architecture overview for non-programmers by René Spronk
FHIR: What's it All About?
SMART on FHIR by Scot Post van der Burg
SMART on FHIR by Scot Post van der Burg
Php mysql training-in-mumbai

Recently uploaded (20)

PPTX
COMMUNICATION SKILSS IN NURSING PRACTICE
PPTX
Nursing Care Aspects for High Risk newborn.pptx
PPTX
AI_in_Pharmaceutical_Technology_Presentation.pptx
PPTX
Rheumatic heart diseases with Type 2 Diabetes Mellitus
PPTX
Genaralised anxiety disorder presentation
PDF
NUTRITION THROUGHOUT THE LIFE CYCLE CHILDHOOD -AGEING
PPTX
community services team project 2(4).pptx
PPTX
NUTRITIONAL PROBLEMS, CHANGES NEEDED TO PREVENT MALNUTRITION
PPTX
Trichuris trichiura infection
PPTX
3. Adherance Complianace.pptx pharmacy pci
PPTX
Basics of pharmacology (Pharmacology I).pptx
PPTX
General Pharmacology by Nandini Ratne, Nagpur College of Pharmacy, Hingna Roa...
PPTX
Galactosemia pathophysiology, clinical features, investigation and treatment ...
PPT
Microscope is an instrument that makes an enlarged image of a small object, t...
PPT
KULIAH UG WANITA Prof Endang 121110 (1).ppt
PDF
Priorities Critical Care Nursing 7th Edition by Urden Stacy Lough Test Bank.pdf
PDF
Assessment of Complications in Patients Maltreated with Fixed Self Cure Acryl...
PDF
Dr. Jasvant Modi - Passionate About Philanthropy
PPTX
ABG advance Arterial Blood Gases Analysis
PPTX
Immunity....(shweta).................pptx
COMMUNICATION SKILSS IN NURSING PRACTICE
Nursing Care Aspects for High Risk newborn.pptx
AI_in_Pharmaceutical_Technology_Presentation.pptx
Rheumatic heart diseases with Type 2 Diabetes Mellitus
Genaralised anxiety disorder presentation
NUTRITION THROUGHOUT THE LIFE CYCLE CHILDHOOD -AGEING
community services team project 2(4).pptx
NUTRITIONAL PROBLEMS, CHANGES NEEDED TO PREVENT MALNUTRITION
Trichuris trichiura infection
3. Adherance Complianace.pptx pharmacy pci
Basics of pharmacology (Pharmacology I).pptx
General Pharmacology by Nandini Ratne, Nagpur College of Pharmacy, Hingna Roa...
Galactosemia pathophysiology, clinical features, investigation and treatment ...
Microscope is an instrument that makes an enlarged image of a small object, t...
KULIAH UG WANITA Prof Endang 121110 (1).ppt
Priorities Critical Care Nursing 7th Edition by Urden Stacy Lough Test Bank.pdf
Assessment of Complications in Patients Maltreated with Fixed Self Cure Acryl...
Dr. Jasvant Modi - Passionate About Philanthropy
ABG advance Arterial Blood Gases Analysis
Immunity....(shweta).................pptx

Advanced .NET API (Ewout)

  • 1. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Advanced .NET API Ewout Kramer FHIR Developer Days November 17, 2016
  • 2. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Who am I?  Name: Ewout Kramer  Company: Furore  Background:  Computer Science (operating systems)  In Health IT since 1999  FHIR Core team  Lead dev on the .NET API  e.kramer@furore.com, @ewoutkramer  http://thefhirplace.com2
  • 3. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. BEYOND THE POCO 3
  • 4. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Why?  No need to parse whole POCO’s in memory  Generic clients/servers not needing pre- compiled model classes  Tools that can parse (partly) invalid FHIR data  Accessing DSTU2 and STU3 data 4
  • 5. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. “Logical” structure of FHIR data 5
  • 6. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. IElementNavigator 6  Represents a position in a tree of FHIR data  Has all the aspects of a node (from last slide)  Path: Patient.name[1].family[0]
  • 7. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. INavigator<T> 7 GetChildrenByName(this IElementNavigator navigator, string name) IEnumerable<object> Values(this IElementNavigator navigator)
  • 8. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Caveat  We are showing you work in progress  Interfaces may change  Will be implemented for DSTU2 and STU3  Currently prackaged as part of the FluentPath .NET Core library (HL7.FluentPath)  Use the latest 0.4.x (alpha) releases  Only available implementation is the PocoNavigator8
  • 9. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. GETTING TO METADATA
  • 10. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Conformance Resources  Provide “metadata” about  Model Definitions (StructureDefinition)  Operations (OperationDefinition)  Search parameters (SearchParameter)  List of codes (ValueSet)  Identified by a “canonical url” that SHOULD resolve, e.g. “http://hl7.org/fhir/StructureDef inition/Patient”
  • 11. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Resolution  Directly using a FHIR REST call to the url  More likely:  As part of a “snapshot”/zip of files delivered with your app  Compiled into your app  In a database 11
  • 12. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. IResourceResolver  Concrete implementations in API:  DirectorySource, ZipSource  WebSource  CachedResolver (wraps another resolver)  MultiResolver (tries a list of resolvers)12
  • 13. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Combine at will 13 MyDbResolver ZipSource WebResolver MultiResolver CachedResolverMultiResolver
  • 14. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Practicalities  Packaged in Hl7.Fhir.Specification assembly  Namespace Hl7.Fhir.Specification.Source  Includes useful extension methods like:  FindStructureDefinition(this IResourceResolver resolver, string uri, bool requireSnapshot = false)  FindStructureDefinitionForCoreType(this IResourceResolver resolver, FHIRDefinedType type)  FindExtensionDefinition(this IResourceResolver resolver, string uri, bool requireSnapshot = false)  Data for base spec is in “specification.zip”, easy to get to using ZipSource.CreateValidationSource() 14
  • 15. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. TERMINOLOGY
  • 16. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. FHIR Resources  CodingSystem resource (STU3)  A dictionary of concepts (possibly huge!)  ValueSet (DSTU2, STU3)  A (use-case specific) selection of concepts from 1..* CodingSystems  May be directly enumerated (‘extensional’)  May be composed using filters (‘intensional’)  “all the LOINC codes in LOINC Part Concept Cholesterol | Bld-Ser-Plas (LP43571-6), except for 5932-9 Cholesterol [Presence] in Blood by Test strip”  May be composed from other ValueSets
  • 17. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Main functionality  Expand an intensional ValueSet  Determine whether some code is member of a ValueSet  Do a code-lookup  Find details like alternative designation  Could be done “in-memory” (i.e. using an expanded ValueSet)  By calling the FHIR terminology operations17
  • 18. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. In-memory  Expand using the ValueSetExpander class in Hl7.Fhir.Specification.Terminology  Set limits on expansion size  Uses IResourceResolver to locate ValueSets  Current limitations:  No filters  No imports of whole CodeSystems 18
  • 19. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Working with the expansion  Useful extension methods on ValueSet  HasExpansion()  ExpansionSize()  FindInExpansion(String code, string system)  bool CodeInExpansion(String code, string system)  Note: no automatic expansion, use ValueSetExpander 19
  • 20. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Terminology operations  https://www.hl7.org/FHIR/valueset- operations.html  $expand, $lookup, $validate-code  class FhirClient  ExpandValueSet()  ConceptLookup()  ValidateCode() 20
  • 21. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. ITerminologyService  Currently available: LocalTerminologyServer  Does an in-memory expand & lookup  Planned: try cache - then the LocalTerminologyServer - then the operations on a “real” terminology server.  Note: returns OperationOutcome 21
  • 22. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. FHIRPATH SUPPORT 22
  • 23. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. FhirPath in .NET  First, the name  FhirPath -> FluentPath -> FhirPath  Available as a .NET Core library Hl7.FluentPath on NuGet (0.4.x)  Is built on top of IElementNavigator – so it could work on *any* object model
  • 24. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Compiling FhirPath  Advantage: Compile once, run many (fast)  class FluentPathCompiler  public CompiledExpression Compile(string expression)  CompiledExpression is a native Lambda that will run the statement against an IElementNavigator  You can also compile to an Expression tree (for debug/display purposes) 24
  • 25. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Using CompiledExpression  First, compile the statement  var ce = compiler.Compile(“Patient.name”);  Then:  var result = ce(…)  result is a set of IElementNavigators  Or:  object s = ce.Scalar(…);  bool p = ce.Predicate(…);  bool b = ce.IsBoolean(true, …); 25
  • 26. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Convenience methods  Comparable methods exist on IElementNavigator so you can directly query a source of data  Example: IElementNavigator nav = new PocoNavigator(myPatient); object cnt = nav.Scalar(“Patient.name.count()”);  Compiles & caches last 500 expressions for you26
  • 27. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. On POCO’s directly…  The Hl7.Fhir.Core assembly has extension methods in Hl7.Fhir.FluentPath for working directly on FHIR POCO’s Patient p = …; object cnt = p.Scalar(“Patient.name.count()”); 27
  • 28. © 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
  • 29. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. The Big Picture FHIR Data <Patient> </Patient> IElementNavigator FHIR Definitions StructureDefinition OperationDefinition ValueSet IResource Resolver FindStructure Definition() ValueSetExpander LocalTerminology Server ITerminologyService Validator FluentPathCompiler FHIR Poco OperationOutcome (with IssueComponents)
  • 30. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Practicalities  class Validator in Hl7.Fhir.Validation namespace (Hl7.Fhir.Specification assembly)  Configure: new Validator(settings)  Resolver, terminology service to use  Validate: call one of the overloads:  Validate(IElementNavigator)  Validate(Base)  Validate(XmlReader)  Result is an OperationOutcome 30
  • 31. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Caveats  Validator is still being developed as we speak  Support most features already, except for slicing – only discriminator-less slicing is supported  Other improvements: e.g. loop-detection  Almost daily updates with more functionality 31
  • 32. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. OperationOutcome - on steroids  Lots of helper methods  Properties:  Success (!information,!warning)  Fatals, Errors, Warnings properties  Extension methods (in Hl7.Fhir.Support)  ErrorsAt(string path)  Where(severity, type, …)  Set/GetHierachyLevel()  Include(outcome), Add(outcome) 32
  • 33. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. QUESTIONS? 33
  • 34. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. HANDS-ON TRACK Suggestions for a pleasurable afternoon
  • 35. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. IResourceResolver  Try to use the ZipSource with the specification.zip to get some core resource definitions  Write your own IResourceResolver that resolves from a .NET compiled-in resource (not a FHIR resource ;-)
  • 36. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. ITerminologyService  Use your new IResourceResolver to resolve a ValueSet & expand it.  Use ValueSet’s FindInExpansion to verify whether you succeeded  Look at the C# implementation of LocalTerminologyService. Could you make one that calls the FhirClient.ValidateCode() instead?36
  • 37. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Play with the validator  Check out https://github.com/ewoutkramer/Furore.Fhir.ValidationDe mo & compile  Try to incorporate your resolver and terminology service (if any)  Try running the examples at https://github.com/ewoutkramer/fhir-net- api/tree/develop/src/Hl7.Fhir.Specification.Tests/TestData /validation  Alter the examples so they trigger your code (change a binding…) 37
  • 38. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. HIDDEN GEMS
  • 39. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. ResourceIdentity  class ResoureIdentity : Uri  Builds FHIR RESTful Uri’s  Factory methods Build():  .Build(“Patient”, “4E75”, vid: “4”)  “/Patient/4E75/_history/4”  StructureDefinition URLs for core types  .Core(FHIRDefinedType.HumanName)  “http://hl7.org/fhir/StructureDefiniti on/HumanName”
  • 40. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. ResourceIdentity (2)  Even more useful: parsing RESTful Urls  var ep = “http://server.org/fhir/Patient/4” var u = new ResourceIdentity(ep);  u.ResourceType  “Patient”  u.Id  “4” 40
  • 41. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Extension Manipulations 41
  • 42. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. TransactionBuilder 42
  • 43. © 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. SnapshotGenerator 43