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.
FHIR® is the registered trademark of HL7 and is used with the permission of HL7. The Flame Design mark is the registered trademark of HL7 and is used with the permission of HL7.
Amsterdam, 15-17 November | @fhir_furore | #fhirdevdays17 | www.fhirdevdays.com
Advanced .NET API
Ewout Kramer, Furore Health Informatics
© 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 Health Informatics
 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.
Structure of packages
3
Hl7.Fhir.Support
(Net4, Net4.5, Net1.0, Net1.3)
• Utility methods
• ElementModel
Hl7.FhirPath
(Net4, Net4.5, Net1.0)
• FhirPath compilation
• FhirPath evaluation
Hl7.Fhir.Core
(Net4.5, Net1.1, Net1.3)
• Model classes
• Serialization
• Http client
Hl7.Fhir.Specification
(Net4.5, Net1.3)
• Access to definitions
• Terminology services
• 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.
ELEMENTMODEL
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?
 In Hl7.Fhir.Support
 Lowest-level access to FHIR instance data
 No POCO’s involved
 Applications:
 Access to parts of FHIR data - no need to parse whole POCO’s in
memory
 Generic clients/servers not needing pre-compiled model classes
 Tools that can parse (partially) invalid FHIR data
 Accessing DSTU2 and STU3 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.
“Logical” structure of FHIR data
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
7
 Represents a position in
a tree of FHIR data
 Has all the aspects of a
node (from last slide)
 Location:
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.
IElementNavigator extension
methods
8
LINQ to ElementModel extension methods go beyond the
basic MoveToNext() and MoveToFirstChild() methods
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Central connecting concept
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.
From xml to POCO and back
10
Xml text
XmlDomFhirNavigator
FhirParser
POCO
Xml text
NavigatorXmlWriter
XmlDomFhirNavigator
POCO
Xml text
NavigatorXmlWriter
XmlDomFhirNavigator
POCO
SummaryNavigator
© 2014 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Parsing huge bundles
11
• Bundle scanned sequentially
• Parses only one entry at a time
• Low memory footprint, even with huge bundels
• Efficient Seek()
© 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.
Specification data
 All the definitions of the core resources, types, search
parameters, operations, etc. are available through the
Hl7.Specification.[STU3/DSTU2] package on NuGet
 The package contains a zip (specification.zip) with meta data
produced by the FHIR publication process
 profiles-resources.xml, profiles-types.xml, extension-definitions.xml
 search-parameters.xml
 v2-tables.xml, v3-codesystems.xml, valuesets.xml
 xsd schemas, schematrons, others....
© 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)
 All are identified and referenced by a “canonical url” that
SHOULD resolve, e.g.
“http://hl7.org/fhir/StructureDefinition/Pati
ent”
© 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 packaged in specification.zip
 As part of a “snapshot”/zip of files delivered with your app
 Compiled into your app
 In a database
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.
IResourceResolver
 Concrete implementations in API:
 DirectorySource, ZipSource
 WebSource
 CachedResolver (wraps another resolver)
 MultiResolver (tries a list of resolvers)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.
Combine at will
17
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()
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.
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 operations
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.
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
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.
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
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.
Terminology operations
 https://www.hl7.org/FHIR/valueset-operations.html
 $expand, $lookup, $validate-code
 class FhirClient
 ExpandValueSet()
 ConceptLookup()
 ValidateCode()
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.
ITerminologyService
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.
ITerminologyService (2)
 Current implementations:
 LocalTerminologyService
Does an in-memory expand & lookup
 ExternalTerminologyService
Uses the FhirClient calls to validate a code (possibly even
sending your valueset across!)
 FallbackTerminologyService
First tries LocalTerminologyService, if that fails (too
complex!), invoke an external service
 Note: returns OperationOutcome
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.
FHIRPATH SUPPORT
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.
FhirPath in .NET
 Available as a .NET Core library Hl7.FhirPath on NuGet
 Is built on top of IElementNavigator – so it could work on
*any* object model
 Advantage: Compile once, run many (fast)
 class FhirPathCompiler
 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)
© 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, …);
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.
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 you
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.
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()”);
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.
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/StructureDefinition/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”
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.
Extension Manipulations
 IEnumerable<Extension> AllExtensions()
 returns extensions + modifier extensions
 Extension GetExtension(string url)
 searches both extensions + modifier extensions
 bool GetBoolExtension(string url), string
GetStringExtension(...), integer GetIntegerExtension(...)
 Also setters, adders, removers, ....
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.
Annotations
 POCO’s and IElementNavigator also implement IAnnotated
and IAnnotatable
 You can set transient annotations on such instances. Useful
to keep in-memory state on FHIR Poco objects
 e.g. url where you got the POCO from, resolved references, etc.
 these are not serialized nor parsed!
 Create a class for each type of annotation
 Set or retrieve them using SetAnnotation<A>(A yourAnnotation)
 Get them using A GetAnnotation<A>()
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.
Annotations (2)
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.
TransactionBuilder
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.
QUESTIONS?
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.
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
 Now create an implementation of IResourceResolver that
contains a List<ValueSet>, so it will resolve a list of in-
memory 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.
ITerminologyService
 Use the new IResourceResolver you wrote in the previous
exercise to resolve a ValueSet. Then use the
ValuesetExpander to expand it.
 Use ValueSet’s FindInExpansion() to verify whether you
succeeded.
 Look at the C# implementation of LocalTerminologyService.
Could you make an implementation of ITerminologyService
that calls the FhirClient.ValidateCode() instead, so it will use
an external terminology service?
42

More Related Content

PPTX
Furore devdays2017 general-introtofhir
PPTX
20171116 rene spronk_profiling_governance
PPTX
Fhir foundation (grahame)
PPTX
Devdays 2017 implementation guide authoring - ardon toonstra
PPTX
Furore devdays 2017- continua implementing fhir
PPTX
Security overview (grahame)
PPTX
2017 11-ccda-on-fhir
PDF
Integrating with the epic platform fhir dev days 17
Furore devdays2017 general-introtofhir
20171116 rene spronk_profiling_governance
Fhir foundation (grahame)
Devdays 2017 implementation guide authoring - ardon toonstra
Furore devdays 2017- continua implementing fhir
Security overview (grahame)
2017 11-ccda-on-fhir
Integrating with the epic platform fhir dev days 17

What's hot (20)

PPTX
Furore devdays 2017-sdc (lloyd)
PPTX
Discover the new face of HL7 FHIR v4 - Ideas2IT
PPTX
fhir-documents
PPTX
Dev days 2017 referrals (brian postlethwaite)
PPTX
Dev days 2017 advanced directories (brian postlethwaite)
PPTX
Dev days 2017 questionnaires (brian postlethwaite)
PPTX
Building bridges devdays 2017- powerpoint template
PPTX
Furore devdays 2017- rdf2(solbrig)
PPTX
Validation in net and java (ewout james)
PPTX
Furore devdays2017 tdd-1-intro
PPTX
Furore devdays 2017 - workflow
PPTX
Furore devdays 2017- fhir and devices - cooper thc2
PPTX
Building a Scenario using clinFHIR
PPTX
final Keynote (grahame)
PPTX
Beginners .net api dev days2017
PPTX
Whats new (grahame)
PPTX
IHE on FHIR and DICOMweb 2017
PPTX
Fhir path (ewout)
PPTX
Fhir tooling (grahame)
PPTX
Structure definition 101 (ewout)
Furore devdays 2017-sdc (lloyd)
Discover the new face of HL7 FHIR v4 - Ideas2IT
fhir-documents
Dev days 2017 referrals (brian postlethwaite)
Dev days 2017 advanced directories (brian postlethwaite)
Dev days 2017 questionnaires (brian postlethwaite)
Building bridges devdays 2017- powerpoint template
Furore devdays 2017- rdf2(solbrig)
Validation in net and java (ewout james)
Furore devdays2017 tdd-1-intro
Furore devdays 2017 - workflow
Furore devdays 2017- fhir and devices - cooper thc2
Building a Scenario using clinFHIR
final Keynote (grahame)
Beginners .net api dev days2017
Whats new (grahame)
IHE on FHIR and DICOMweb 2017
Fhir path (ewout)
Fhir tooling (grahame)
Structure definition 101 (ewout)
Ad

Similar to Advanced .net api (ewout) (20)

PPTX
Advanced .NET API (Ewout)
PPTX
Getting started with FHIR by Ewout Kramer
PPTX
Profile and validation by Grahame Grieve
PPTX
FHIR architecture overview for non-programmers by René Spronk
PPTX
FHIR architecture overview for non-programmers by René Spronk
PPTX
Authoring profiles by Michel Rutten
PPTX
FHIR API for Java programmers by James Agnew
PPTX
Rolling out FHIR - architecture and implementation considerations by Lloyd Mc...
PPTX
Terminology, value-sets, codesystems by Lloyd McKenzie
PPTX
Introduction to FHIR™
PPTX
Terminology, value-sets, codesystems by Lloyd McKenzie
PPTX
FHIR API for .Net programmers by Mirjam Baltus
PPTX
FHIR tutorial - Afternoon
PPTX
Authoring Profiles in FHIR
PPTX
HL7 Fhir for Developers
PPTX
The FHIR burns brighter (what's new in DSTU2)
PPTX
FHIR Tutorial - Morning
PPTX
FHIR Search for client developers by Mirjam Baltus
PPTX
FHIR and DICOM by Marten Smits
PPTX
SMART on FHIR by Scot Post van der Burg
Advanced .NET API (Ewout)
Getting started with FHIR by Ewout Kramer
Profile and validation by Grahame Grieve
FHIR architecture overview for non-programmers by René Spronk
FHIR architecture overview for non-programmers by René Spronk
Authoring profiles by Michel Rutten
FHIR API for Java programmers by James Agnew
Rolling out FHIR - architecture and implementation considerations by Lloyd Mc...
Terminology, value-sets, codesystems by Lloyd McKenzie
Introduction to FHIR™
Terminology, value-sets, codesystems by Lloyd McKenzie
FHIR API for .Net programmers by Mirjam Baltus
FHIR tutorial - Afternoon
Authoring Profiles in FHIR
HL7 Fhir for Developers
The FHIR burns brighter (what's new in DSTU2)
FHIR Tutorial - Morning
FHIR Search for client developers by Mirjam Baltus
FHIR and DICOM by Marten Smits
SMART on FHIR by Scot Post van der Burg
Ad

More from DevDays (17)

PPTX
Consent dev days
PPTX
Mohannad hussain dicom and imaging tools
PPTX
Mohannad hussain community track - siim dataset & dico mweb proxy
PPTX
Fhir dev days 2017 fhir profiling - overview and introduction v07
PPTX
Transforming other content (grahame)
PPTX
Quality improvement dev days-2017
PPTX
Furore devdays 2017- rdf1(solbrig)
PPTX
Furore devdays 2017- oai
PPTX
Furore devdays 2017 - implementation guides (lloyd)
PPTX
Connectathon opening 2017
PPTX
20171127 rene spronk_messaging_the_unloved_paradigm
PPTX
Vonk fhir facade (christiaan)
PPTX
Profiling with clin fhir
PPTX
Opening student track
PPTX
Furore devdays2017 tdd-2-advanced
PPTX
Fhir dev days_basic_fhir_terminology_services
PPTX
Fhir dev days_advanced_fhir_terminology_services
Consent dev days
Mohannad hussain dicom and imaging tools
Mohannad hussain community track - siim dataset & dico mweb proxy
Fhir dev days 2017 fhir profiling - overview and introduction v07
Transforming other content (grahame)
Quality improvement dev days-2017
Furore devdays 2017- rdf1(solbrig)
Furore devdays 2017- oai
Furore devdays 2017 - implementation guides (lloyd)
Connectathon opening 2017
20171127 rene spronk_messaging_the_unloved_paradigm
Vonk fhir facade (christiaan)
Profiling with clin fhir
Opening student track
Furore devdays2017 tdd-2-advanced
Fhir dev days_basic_fhir_terminology_services
Fhir dev days_advanced_fhir_terminology_services

Recently uploaded (20)

PDF
Complications of Minimal Access Surgery at WLH
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Computing-Curriculum for Schools in Ghana
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Classroom Observation Tools for Teachers
PPTX
Cell Structure & Organelles in detailed.
PPTX
Lesson notes of climatology university.
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Institutional Correction lecture only . . .
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
RMMM.pdf make it easy to upload and study
Complications of Minimal Access Surgery at WLH
GDM (1) (1).pptx small presentation for students
Anesthesia in Laparoscopic Surgery in India
PPH.pptx obstetrics and gynecology in nursing
Sports Quiz easy sports quiz sports quiz
human mycosis Human fungal infections are called human mycosis..pptx
Computing-Curriculum for Schools in Ghana
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Basic Mud Logging Guide for educational purpose
2.FourierTransform-ShortQuestionswithAnswers.pdf
Classroom Observation Tools for Teachers
Cell Structure & Organelles in detailed.
Lesson notes of climatology university.
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Institutional Correction lecture only . . .
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Microbial diseases, their pathogenesis and prophylaxis
FourierSeries-QuestionsWithAnswers(Part-A).pdf
RMMM.pdf make it easy to upload and study

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. FHIR® is the registered trademark of HL7 and is used with the permission of HL7. The Flame Design mark is the registered trademark of HL7 and is used with the permission of HL7. Amsterdam, 15-17 November | @fhir_furore | #fhirdevdays17 | www.fhirdevdays.com Advanced .NET API Ewout Kramer, Furore Health Informatics
  • 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 Health Informatics  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. Structure of packages 3 Hl7.Fhir.Support (Net4, Net4.5, Net1.0, Net1.3) • Utility methods • ElementModel Hl7.FhirPath (Net4, Net4.5, Net1.0) • FhirPath compilation • FhirPath evaluation Hl7.Fhir.Core (Net4.5, Net1.1, Net1.3) • Model classes • Serialization • Http client Hl7.Fhir.Specification (Net4.5, Net1.3) • Access to definitions • Terminology services • Validation
  • 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. ELEMENTMODEL 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. Why?  In Hl7.Fhir.Support  Lowest-level access to FHIR instance data  No POCO’s involved  Applications:  Access to parts of FHIR data - no need to parse whole POCO’s in memory  Generic clients/servers not needing pre-compiled model classes  Tools that can parse (partially) invalid FHIR data  Accessing DSTU2 and STU3 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. “Logical” structure of FHIR data 6
  • 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. IElementNavigator 7  Represents a position in a tree of FHIR data  Has all the aspects of a node (from last slide)  Location: Patient.name[1] .family[0]
  • 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. IElementNavigator extension methods 8 LINQ to ElementModel extension methods go beyond the basic MoveToNext() and MoveToFirstChild() methods
  • 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. Central connecting concept 9
  • 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. From xml to POCO and back 10 Xml text XmlDomFhirNavigator FhirParser POCO Xml text NavigatorXmlWriter XmlDomFhirNavigator POCO Xml text NavigatorXmlWriter XmlDomFhirNavigator POCO SummaryNavigator
  • 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. Parsing huge bundles 11 • Bundle scanned sequentially • Parses only one entry at a time • Low memory footprint, even with huge bundels • Efficient Seek()
  • 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. GETTING TO METADATA
  • 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. Specification data  All the definitions of the core resources, types, search parameters, operations, etc. are available through the Hl7.Specification.[STU3/DSTU2] package on NuGet  The package contains a zip (specification.zip) with meta data produced by the FHIR publication process  profiles-resources.xml, profiles-types.xml, extension-definitions.xml  search-parameters.xml  v2-tables.xml, v3-codesystems.xml, valuesets.xml  xsd schemas, schematrons, others....
  • 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. Conformance Resources  Provide “metadata” about  Model Definitions (StructureDefinition)  Operations (OperationDefinition)  Search parameters (SearchParameter)  List of codes (ValueSet)  All are identified and referenced by a “canonical url” that SHOULD resolve, e.g. “http://hl7.org/fhir/StructureDefinition/Pati ent”
  • 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. Resolution  Directly using a FHIR REST call to the url  More likely:  As packaged in specification.zip  As part of a “snapshot”/zip of files delivered with your app  Compiled into your app  In a database 15
  • 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. IResourceResolver  Concrete implementations in API:  DirectorySource, ZipSource  WebSource  CachedResolver (wraps another resolver)  MultiResolver (tries a list of resolvers)16
  • 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. Combine at will 17 MyDbResolver ZipSource WebResolver MultiResolver CachedResolverMultiResolver
  • 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. 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() 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. TERMINOLOGY
  • 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. 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
  • 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. 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 operations 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. 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 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. 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 23
  • 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. Terminology operations  https://www.hl7.org/FHIR/valueset-operations.html  $expand, $lookup, $validate-code  class FhirClient  ExpandValueSet()  ConceptLookup()  ValidateCode() 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. ITerminologyService 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. ITerminologyService (2)  Current implementations:  LocalTerminologyService Does an in-memory expand & lookup  ExternalTerminologyService Uses the FhirClient calls to validate a code (possibly even sending your valueset across!)  FallbackTerminologyService First tries LocalTerminologyService, if that fails (too complex!), invoke an external service  Note: returns OperationOutcome 26
  • 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. FHIRPATH SUPPORT 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. FhirPath in .NET  Available as a .NET Core library Hl7.FhirPath on NuGet  Is built on top of IElementNavigator – so it could work on *any* object model  Advantage: Compile once, run many (fast)  class FhirPathCompiler  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)
  • 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. 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, …); 29
  • 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. 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 you 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. 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()”); 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. HIDDEN GEMS
  • 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. 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/StructureDefinition/HumanName”
  • 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. 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” 34
  • 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. Extension Manipulations  IEnumerable<Extension> AllExtensions()  returns extensions + modifier extensions  Extension GetExtension(string url)  searches both extensions + modifier extensions  bool GetBoolExtension(string url), string GetStringExtension(...), integer GetIntegerExtension(...)  Also setters, adders, removers, .... 35
  • 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. Annotations  POCO’s and IElementNavigator also implement IAnnotated and IAnnotatable  You can set transient annotations on such instances. Useful to keep in-memory state on FHIR Poco objects  e.g. url where you got the POCO from, resolved references, etc.  these are not serialized nor parsed!  Create a class for each type of annotation  Set or retrieve them using SetAnnotation<A>(A yourAnnotation)  Get them using A GetAnnotation<A>() 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. Annotations (2) 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. TransactionBuilder 38
  • 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. QUESTIONS? 39
  • 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. HANDS-ON TRACK Suggestions for a pleasurable afternoon
  • 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. IResourceResolver  Try to use the ZipSource with the specification.zip to get some core resource definitions  Now create an implementation of IResourceResolver that contains a List<ValueSet>, so it will resolve a list of in- memory ValueSets.
  • 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. ITerminologyService  Use the new IResourceResolver you wrote in the previous exercise to resolve a ValueSet. Then use the ValuesetExpander to expand it.  Use ValueSet’s FindInExpansion() to verify whether you succeeded.  Look at the C# implementation of LocalTerminologyService. Could you make an implementation of ITerminologyService that calls the FhirClient.ValidateCode() instead, so it will use an external terminology service? 42