Š 2012 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
StructureDefinition 101
Ewout Kramer, Furore Health Informatics
Š 2012 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
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Context...
3
StructureDefinition is one of
the “conformance” resources
They contain (meta)data about
FHIR itself, not patient data
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
StructureDefinition basics
 It’s a resource
 It describes the definition (structure+validation rules) for
 The core resources and datatypes in the spec
 Logical models
 It describes constraints on an existing StructureDefinition
 Profiles
 Extensions
 Constrained logical models
4
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Where to find them?
 For the core spec: under the “tree” of any single resource
 For the core spec: all of them combined
 http://hl7.org/fhir/downloads.html - “FHIR Definitions”
 profiles-types.xml, profiles-resources.xml
 On simplifier.net / registry.fhir.org
5
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
What’s in a StructureDefinition?
Metadata
(author, version, etc)
Differential
Constraints on the base -
only the differences - as
authored by the creator
Snapshot
Constraints on the base
+
Unconstrained parts - filled
out from the (unchanged)
base elements
When describing constraints**:
** Contents for definition of resources/datatypes/logical models are slightly different
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Metadata + differential
7
Unique URI for identification
and referencing (“canonical”)
Constrains “Patient”
Just the differential –
only the parts that the author
wants to change!
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
A view of the snapshot...
 490kb versus 1kb
 All elements from Patient +
DomainResource +
Resource
 All constraints info for each
element
 Definitions, comments
 Min/max
 Invariants, fixed values
 Note: Hierarchy is flattened
8
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
This was the base...
 Note how Patient originally just
had Patient.identifier (of type
Identifier)
 The differential has “walked
into” Patient.identifier.use”
 The whole Identifier type
becomes expanded in the
snapshot (previous slide)
9
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Combine type profile +
constraint
10
Quiz question: How will the snapshot be composed?
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Schematic representation...
11
StructureDefinition “Patient”
Patient.identifier : Identifier
StructureDefinition “PatientEK”
Patient.identifier : IdentifierNL
constraints on:
Identifier.use
StructureDefinition “IdentifierNL”
constraints on:
Identifier.use
Identifier.system
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
So, why a snapshot?
 Snapshot can be derived from base
snap = gen_snap(
gen_snap(
gen_snap(core,differental1) , differential2), differential3) ....
 All elements my refer to other types and walk into types
 Possibly requires reaching out to core spec, registries –
need access to all StructureDefinitions you depend on
 Might not be accessible at all times!
 Has “all you need” to render, validate, ... in 1 place
 ... or pack everything with your app!12
Š 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
 Differential/Snapshot are collections of ElementDefinitions (a
datatype)
 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) invariants13
Š 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
14
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
value[x] and references
15
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
typeRef details
16
In R4, this will change!
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Quiz
17
profile + targetProfile combined..... what does that do?
1. “targetProfile” Profiles what the refence may point to
2. “profile” Profiles what the reference itself looks like
(e.g. must have reference.display)
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Summary of references
18
StructureDefinition “Patient”
http://hl7.org/fhir/StructureDefinitio
n/Patient
StructureDefinition “PatientEK”
http://example.org/fhir/StructureDefin
ition/PatientEK
StructureDefinition “WeightQuantity”
http://example.org/fhir/StructureDefiniti
on/WeightQuantity
StructureDefinition for “nl-core-
patient”
http://fhir.nl/fhir/StructureDefinitio
n/nl-core-patient
ValueSet “observation-status”
http://hl7.org/fhir/ValueSet/observati
on-status
baseDefinition
binding.valueSet[x]
typeRef.profile
ElementDefinition typeRef.targetProfile
All of them use the
canonical url
(StructureDefinition/ValueSet.url)
Š 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!
19
Fix this URL to the extension’s url
Limit to just “Boolean” [1..1]
Don’t allow nested extensions
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
20
Š 2012 HL7 Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Finally....slices (only a bit)
 So, is every path unique within a StructureDefinition?
 Yes, in the core types. No (not necessarily), within a profile
 If you see more than one element with the same path => it’s
a slice
21
A slicing group
• 1x slice intro (info about the whole slice:
cardinalities, open/closed/ordered etc)
• Followed by one repeat for each slice
Š 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?
22

Structure definition 101 (ewout)

  • 1.
    Š 2012 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 StructureDefinition 101 Ewout Kramer, Furore Health Informatics
  • 2.
    Š 2012 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.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Context... 3 StructureDefinition is one of the “conformance” resources They contain (meta)data about FHIR itself, not patient data
  • 4.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. StructureDefinition basics  It’s a resource  It describes the definition (structure+validation rules) for  The core resources and datatypes in the spec  Logical models  It describes constraints on an existing StructureDefinition  Profiles  Extensions  Constrained logical models 4
  • 5.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Where to find them?  For the core spec: under the “tree” of any single resource  For the core spec: all of them combined  http://hl7.org/fhir/downloads.html - “FHIR Definitions”  profiles-types.xml, profiles-resources.xml  On simplifier.net / registry.fhir.org 5
  • 6.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. What’s in a StructureDefinition? Metadata (author, version, etc) Differential Constraints on the base - only the differences - as authored by the creator Snapshot Constraints on the base + Unconstrained parts - filled out from the (unchanged) base elements When describing constraints**: ** Contents for definition of resources/datatypes/logical models are slightly different
  • 7.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Metadata + differential 7 Unique URI for identification and referencing (“canonical”) Constrains “Patient” Just the differential – only the parts that the author wants to change!
  • 8.
    Š 2012 HL7Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. A view of the snapshot...  490kb versus 1kb  All elements from Patient + DomainResource + Resource  All constraints info for each element  Definitions, comments  Min/max  Invariants, fixed values  Note: Hierarchy is flattened 8
  • 9.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. This was the base...  Note how Patient originally just had Patient.identifier (of type Identifier)  The differential has “walked into” Patient.identifier.use”  The whole Identifier type becomes expanded in the snapshot (previous slide) 9
  • 10.
    Š 2012 HL7Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Combine type profile + constraint 10 Quiz question: How will the snapshot be composed?
  • 11.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Schematic representation... 11 StructureDefinition “Patient” Patient.identifier : Identifier StructureDefinition “PatientEK” Patient.identifier : IdentifierNL constraints on: Identifier.use StructureDefinition “IdentifierNL” constraints on: Identifier.use Identifier.system
  • 12.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. So, why a snapshot?  Snapshot can be derived from base snap = gen_snap( gen_snap( gen_snap(core,differental1) , differential2), differential3) ....  All elements my refer to other types and walk into types  Possibly requires reaching out to core spec, registries – need access to all StructureDefinitions you depend on  Might not be accessible at all times!  Has “all you need” to render, validate, ... in 1 place  ... or pack everything with your app!12
  • 13.
    © 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  Differential/Snapshot are collections of ElementDefinitions (a datatype)  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) invariants13
  • 14.
    Š 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 14
  • 15.
    Š 2012 HL7Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. value[x] and references 15
  • 16.
    Š 2012 HL7Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. typeRef details 16 In R4, this will change!
  • 17.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Quiz 17 profile + targetProfile combined..... what does that do? 1. “targetProfile” Profiles what the refence may point to 2. “profile” Profiles what the reference itself looks like (e.g. must have reference.display)
  • 18.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Summary of references 18 StructureDefinition “Patient” http://hl7.org/fhir/StructureDefinitio n/Patient StructureDefinition “PatientEK” http://example.org/fhir/StructureDefin ition/PatientEK StructureDefinition “WeightQuantity” http://example.org/fhir/StructureDefiniti on/WeightQuantity StructureDefinition for “nl-core- patient” http://fhir.nl/fhir/StructureDefinitio n/nl-core-patient ValueSet “observation-status” http://hl7.org/fhir/ValueSet/observati on-status baseDefinition binding.valueSet[x] typeRef.profile ElementDefinition typeRef.targetProfile All of them use the canonical url (StructureDefinition/ValueSet.url)
  • 19.
    © 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! 19 Fix this URL to the extension’s url Limit to just “Boolean” [1..1] Don’t allow nested extensions
  • 20.
    Š 2012 HL7Ž International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. 20
  • 21.
    © 2012 HL7® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office. Finally....slices (only a bit)  So, is every path unique within a StructureDefinition?  Yes, in the core types. No (not necessarily), within a profile  If you see more than one element with the same path => it’s a slice 21 A slicing group • 1x slice intro (info about the whole slice: cardinalities, open/closed/ordered etc) • Followed by one repeat for each slice
  • 22.
    Š 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? 22