SlideShare a Scribd company logo
1 of 25
FHIR API 
for .Net programmers 
Mirjam Baltus 
FHIR Developer Days 
November 24, 2014 
© 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: Mirjam Baltus-Bakker 
 Company: Furore, Amsterdam 
 Background: 
 ICT trainer 
 Furore FHIR team 
 Contact: 
 m.baltus@furore.com 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Using the Reference Implementations 
HL7.FHIR SUPPORT API 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Hl7.Fhir 
- Core contents 
- Model – classes generated from the spec 
- Parsers and Serializers 
- REST functionality – FhirClient 
- Validation 
- Specification 
 NuGet “FHIR”, or GitHub “fhir-net-api” 
© 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 FHIR Resource 
© 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 FHIR Resource in C# 
public partial class Observation : Hl7.Fhir.Model.Resource 
{ 
// Codes that provides reliability information about an observation 
public enum ObservationReliability {Ok, Ongoing, …} 
// Codes identifying interpretations of observations 
public enum ObservationInterpretation {N, A, L, H } 
public partial class ObservationReferenceRangeComponent : Hl7.Fhir.Model.Element 
{ … } 
public CodeableConcept Name { get; set; } 
public List<ObservationReferenceRangeComponent> ReferenceRange { get; set;} 
public List<ResourceReference> Performer { get; set; } 
} 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Primitives are not really 
primitive… 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Primitives are not really 
primitive… 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Resource example 
using Hl7.Fhir.Model; 
var pat = new Patient(); 
pat.Name = new List<HumanName>(); 
pat.Name.Add(HumanName.ForFamily("Baltus") 
.WithGiven("Mirjam")); 
pat.MaritalStatus = new 
CodeableConcept("http://acme.org/MStat", "M"); 
pat.BirthDate = "1974-01-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.
Choice elements [x] 
public 
Hl7.Fhir.Model.CodeableConcept 
MaritalStatus { set; get; } 
public Hl7.Fhir.Model.Element 
Deceased { set; get; } 
pat.Deceased = 
new FhirBoolean(true); 
pat.Deceased = new 
FhirDateTime("2012-01-30"); 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Hl7.Fhir Core 
 Model – Resources and Datatypes in the API 
 
 Parsers and Serializers 
 REST functionality – FhirClient 
 Validation 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Parsing example 
using Hl7.Fhir.Serialization; 
// Suppose we have a JSON string 
string str = "{"resourceType":"Patient","name":" + 
"[{"family":["Baltus"],"given":["Mirjam"]}]}"; 
// Parse the Patient from the string 
var pat = (Patient)FhirParser.ParseResourceFromJson(str); 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Parsing example 2 
// Create a file-based reader for Xml 
XmlReader xr = XmlReader.Create( 
new StreamReader(@"publishobservation-example.xml")); 
// Parse the Observation from the stream 
var obs = (Observation)FhirParser.ParseResource(xr); 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Serializing example 
// Here’s our Observation again 
var obs = (Observation)FhirParser.ParseResource(xr); 
// Modify some fields of the observation 
obs.Status = Observation.ObservationStatus.Amended; 
obs.Value = new Quantity() { Value = 40, Units = "g" }; 
// Serialize the in-memory observation to Json 
var jsonText = FhirSerializer.SerializeResourceToJson(obs); 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Hl7.Fhir Core 
 Model – Resources and Datatypes in the API 
 
 
 Parsers and Serializers 
 REST functionality – FhirClient 
 Validation 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
REST functionality 
 REST operations done with FhirClient 
using Hl7.Fhir.Rest; 
var client = new FhirClient( 
new Uri("http://acme.org/fhir")); 
 Operations throw a FhirOperationException 
 Outcome property with OperationOutcome 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Using the FhirClient 
var patEntry = client.Read<Patient>("Patient/1"); 
var pat = patEntry.Resource; 
var restId = patEntry.Id; 
var tags = patEntry.Tags; 
pat.Name.Add(HumanName.ForFamily("Kramer") 
.WithGiven("Ewout")); 
client.Update<Patient>(patEntry); 
var myId = ResourceIdentity.Build("Patient","31"); 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Using the FhirClient 
var pat = new Patient() { /* set up data */ }; 
var patEntry = client.Create(pat); 
var restId = patEntry.Id; 
var newEntry = client.Refresh(patEntry); 
client.Delete(patEntry); 
var location = 
new Uri("http://acme.org/fhir/Patient/34"); 
client.Delete(location); 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Bundles in C# 
 Abstraction on top of Atom parser 
 Bundle = feed, BundleEntry = entry. 
Bundle result = new Bundle() { Title = "Demo bundle" }; 
result.Entries.Add(new ResourceEntry<Patient>() 
{ LastUpdated=DateTimeOffset.Now, Resource = new Patient() }); 
result.Entries.Add(new DeletedEntry() 
{ Id = new Uri("http://..."), When = DateTime.Now }); 
var bundleXml = FhirSerializer.SerializeBundleToXml(result); 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Search 
var criteria = new string[] { "family=Eve" }; 
Bundle result = client.Search<Patient>(criteria); 
while (result != null) 
{ 
// Do something useful 
result = client.Continue(results); 
} 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
More about search 
 Please attend one of the presentations in the 
next quarter: 
 Search for Server developers 
by Martijn Harthoorn 
 Search for Client developers 
by myself 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Validation 
 DotNetAttributeValidation validates: 
 Cardinality of an element 
 Regex patterns of the primitives code, date, 
dateTime, id, instant, oid, uri, uuid 
 Allowed types for a choice element (value[x]) 
pat.Deceased = new FhirString("Died on 2012-01-30"); 
 Does not validate: 
 Conformance to ValueSet bindings 
 Profile conformance 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Validation example 
using Hl7.Fhir.Validation; 
var pat = new Patient() { /* set up data */ }; 
// Will throw a ValidationException when an error is encountered 
DotNetAttributeValidation.Validate(pat); 
// Alternatively, use the TryXXXX pattern 
var errors = new List<ValidationResult>(); 
var success = DotNetAttributeValidation.TryValidate(pat, errors); 
if(!success) { /* handle errors */ } 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
Hl7.Fhir Core 
 Model – Resources and Datatypes in the API 
 
 
 Parsers and Serializers 
 REST functionality – FhirClient 
 
 
 Validation 
© 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? 
 http://hl7.org/fhir m.baltus@furore.com 
© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

More Related Content

What's hot

What's hot (20)

FHIR Documents by Lloyd McKenzie
FHIR Documents by Lloyd McKenzieFHIR Documents by Lloyd McKenzie
FHIR Documents by Lloyd McKenzie
 
FHIR Tutorial - Morning
FHIR Tutorial - MorningFHIR Tutorial - Morning
FHIR Tutorial - Morning
 
FHIR tutorial - Afternoon
FHIR tutorial - AfternoonFHIR tutorial - Afternoon
FHIR tutorial - Afternoon
 
FHIR Profiling tutorial
FHIR Profiling tutorialFHIR Profiling tutorial
FHIR Profiling tutorial
 
FHIR architecture overview for non-programmers by René Spronk
FHIR architecture overview for non-programmers by René SpronkFHIR architecture overview for non-programmers by René Spronk
FHIR architecture overview for non-programmers by René Spronk
 
Introduction to FHIR™
Introduction to FHIR™Introduction to FHIR™
Introduction to FHIR™
 
An Introduction to HL7 FHIR
An Introduction to HL7 FHIRAn Introduction to HL7 FHIR
An Introduction to HL7 FHIR
 
Terminology, value-sets, codesystems by Lloyd McKenzie
Terminology, value-sets, codesystems by Lloyd McKenzieTerminology, value-sets, codesystems by Lloyd McKenzie
Terminology, value-sets, codesystems by Lloyd McKenzie
 
Patient matching in FHIR
Patient matching in FHIRPatient matching in FHIR
Patient matching in FHIR
 
Rolling out FHIR - architecture and implementation considerations by Lloyd Mc...
Rolling out FHIR - architecture and implementation considerations by Lloyd Mc...Rolling out FHIR - architecture and implementation considerations by Lloyd Mc...
Rolling out FHIR - architecture and implementation considerations by Lloyd Mc...
 
Fhir basics session 1 Introduction to Interoperabilty & Principles of FHIR
Fhir basics session 1 Introduction to Interoperabilty & Principles of FHIRFhir basics session 1 Introduction to Interoperabilty & Principles of FHIR
Fhir basics session 1 Introduction to Interoperabilty & Principles of FHIR
 
Introduction to HL7 FHIR
Introduction to HL7 FHIRIntroduction to HL7 FHIR
Introduction to HL7 FHIR
 
Authoring Profiles in FHIR
Authoring Profiles in FHIRAuthoring Profiles in FHIR
Authoring Profiles in FHIR
 
Introduction to hl7
Introduction to hl7Introduction to hl7
Introduction to hl7
 
SMART on FHIR by Scot Post van der Burg
SMART on FHIR by Scot Post van der BurgSMART on FHIR by Scot Post van der Burg
SMART on FHIR by Scot Post van der Burg
 
HL7 Standards
HL7 StandardsHL7 Standards
HL7 Standards
 
Exploring HL7 CDA & Its Structures
Exploring HL7 CDA & Its StructuresExploring HL7 CDA & Its Structures
Exploring HL7 CDA & Its Structures
 
Hl7 overview
Hl7 overviewHl7 overview
Hl7 overview
 
What is FHIR
What is FHIRWhat is FHIR
What is FHIR
 
FHIR & Ice
FHIR & IceFHIR & Ice
FHIR & Ice
 

Similar to FHIR API for .Net programmers by Mirjam Baltus

Similar to FHIR API for .Net programmers by Mirjam Baltus (20)

Fhir path (ewout)
Fhir path (ewout)Fhir path (ewout)
Fhir path (ewout)
 
Validation in net and java (ewout james)
Validation in net and java (ewout james)Validation in net and java (ewout james)
Validation in net and java (ewout james)
 
Structure definition 101 (ewout)
Structure definition 101 (ewout)Structure definition 101 (ewout)
Structure definition 101 (ewout)
 
FHIR Search for client developers by Mirjam Baltus
FHIR Search for client developers by Mirjam BaltusFHIR Search for client developers by Mirjam Baltus
FHIR Search for client developers by Mirjam Baltus
 
Advanced .NET API (Ewout)
Advanced .NET API (Ewout)Advanced .NET API (Ewout)
Advanced .NET API (Ewout)
 
Profile and validation by Grahame Grieve
Profile and validation by Grahame GrieveProfile and validation by Grahame Grieve
Profile and validation by Grahame Grieve
 
Advanced .net api (ewout)
Advanced .net api (ewout)Advanced .net api (ewout)
Advanced .net api (ewout)
 
Authoring FHIR Profiles - extended version
Authoring FHIR Profiles - extended versionAuthoring FHIR Profiles - extended version
Authoring FHIR Profiles - extended version
 
FHIR DevDays 2015 - introduction to FHIR
FHIR DevDays 2015 - introduction to FHIRFHIR DevDays 2015 - introduction to FHIR
FHIR DevDays 2015 - introduction to FHIR
 
Authoring profiles by Michel Rutten
Authoring profiles by Michel RuttenAuthoring profiles by Michel Rutten
Authoring profiles by Michel Rutten
 
The FHIR burns brighter (what's new in DSTU2)
The FHIR burns brighter (what's new in DSTU2)The FHIR burns brighter (what's new in DSTU2)
The FHIR burns brighter (what's new in DSTU2)
 
FHIR Search for server developers by Martijn Harthoorn
FHIR Search for server developers by Martijn HarthoornFHIR Search for server developers by Martijn Harthoorn
FHIR Search for server developers by Martijn Harthoorn
 
Vitalis 2016 FHIR Introduction
Vitalis 2016 FHIR IntroductionVitalis 2016 FHIR Introduction
Vitalis 2016 FHIR Introduction
 
SMART on FHIR by Scot Post van der Burg
SMART on FHIR by Scot Post van der BurgSMART on FHIR by Scot Post van der Burg
SMART on FHIR by Scot Post van der Burg
 
Beginners .net api dev days2017
Beginners  .net api   dev days2017Beginners  .net api   dev days2017
Beginners .net api dev days2017
 
Terminology, value-sets, codesystems by Lloyd McKenzie
Terminology, value-sets, codesystems by Lloyd McKenzieTerminology, value-sets, codesystems by Lloyd McKenzie
Terminology, value-sets, codesystems by Lloyd McKenzie
 
IHE France on FHIR
IHE France on FHIRIHE France on FHIR
IHE France on FHIR
 
Vitalis 2016 FHIR App Development
Vitalis 2016 FHIR App DevelopmentVitalis 2016 FHIR App Development
Vitalis 2016 FHIR App Development
 
FHIR and DICOM by Marten Smits
FHIR and DICOM by Marten SmitsFHIR and DICOM by Marten Smits
FHIR and DICOM by Marten Smits
 
Nhs trusts meeting at salford
Nhs trusts meeting at salfordNhs trusts meeting at salford
Nhs trusts meeting at salford
 

Recently uploaded

Indore Call Girl Service 📞9235973566📞Just Call Inaaya📲 Call Girls In Indore N...
Indore Call Girl Service 📞9235973566📞Just Call Inaaya📲 Call Girls In Indore N...Indore Call Girl Service 📞9235973566📞Just Call Inaaya📲 Call Girls In Indore N...
Indore Call Girl Service 📞9235973566📞Just Call Inaaya📲 Call Girls In Indore N...
Sheetaleventcompany
 
Erotic Call Girls Bangalore {7304373326} ❤️VVIP SIYA Call Girls in Bangalore ...
Erotic Call Girls Bangalore {7304373326} ❤️VVIP SIYA Call Girls in Bangalore ...Erotic Call Girls Bangalore {7304373326} ❤️VVIP SIYA Call Girls in Bangalore ...
Erotic Call Girls Bangalore {7304373326} ❤️VVIP SIYA Call Girls in Bangalore ...
Sheetaleventcompany
 
Lucknow Call Girls Service ❤️🍑 9xx000xx09 👄🫦 Independent Escort Service Luckn...
Lucknow Call Girls Service ❤️🍑 9xx000xx09 👄🫦 Independent Escort Service Luckn...Lucknow Call Girls Service ❤️🍑 9xx000xx09 👄🫦 Independent Escort Service Luckn...
Lucknow Call Girls Service ❤️🍑 9xx000xx09 👄🫦 Independent Escort Service Luckn...
Sheetaleventcompany
 
🍑👄Ludhiana Escorts Service☎️98157-77685🍑👄 Call Girl service in Ludhiana☎️Ludh...
🍑👄Ludhiana Escorts Service☎️98157-77685🍑👄 Call Girl service in Ludhiana☎️Ludh...🍑👄Ludhiana Escorts Service☎️98157-77685🍑👄 Call Girl service in Ludhiana☎️Ludh...
🍑👄Ludhiana Escorts Service☎️98157-77685🍑👄 Call Girl service in Ludhiana☎️Ludh...
dilpreetentertainmen
 
Delhi Call Girl Service 📞8650700400📞Just Call Divya📲 Call Girl In Delhi No💰Ad...
Delhi Call Girl Service 📞8650700400📞Just Call Divya📲 Call Girl In Delhi No💰Ad...Delhi Call Girl Service 📞8650700400📞Just Call Divya📲 Call Girl In Delhi No💰Ad...
Delhi Call Girl Service 📞8650700400📞Just Call Divya📲 Call Girl In Delhi No💰Ad...
Sheetaleventcompany
 
Low Rate Call Girls Jaipur {9521753030} ❤️VVIP NISHA CCall Girls in Jaipur Es...
Low Rate Call Girls Jaipur {9521753030} ❤️VVIP NISHA CCall Girls in Jaipur Es...Low Rate Call Girls Jaipur {9521753030} ❤️VVIP NISHA CCall Girls in Jaipur Es...
Low Rate Call Girls Jaipur {9521753030} ❤️VVIP NISHA CCall Girls in Jaipur Es...
Sheetaleventcompany
 
Call Girl Service In Mumbai ❤️🍑 9xx000xx09 👄🫦Independent Escort Service Mumba...
Call Girl Service In Mumbai ❤️🍑 9xx000xx09 👄🫦Independent Escort Service Mumba...Call Girl Service In Mumbai ❤️🍑 9xx000xx09 👄🫦Independent Escort Service Mumba...
Call Girl Service In Mumbai ❤️🍑 9xx000xx09 👄🫦Independent Escort Service Mumba...
Sheetaleventcompany
 

Recently uploaded (20)

💸Cash Payment No Advance Call Girls Pune 🧿 9332606886 🧿 High Class Call Girl ...
💸Cash Payment No Advance Call Girls Pune 🧿 9332606886 🧿 High Class Call Girl ...💸Cash Payment No Advance Call Girls Pune 🧿 9332606886 🧿 High Class Call Girl ...
💸Cash Payment No Advance Call Girls Pune 🧿 9332606886 🧿 High Class Call Girl ...
 
❤️Zirakpur Escorts☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirakpur Cal...
❤️Zirakpur Escorts☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirakpur Cal...❤️Zirakpur Escorts☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirakpur Cal...
❤️Zirakpur Escorts☎️7837612180☎️ Call Girl service in Zirakpur☎️ Zirakpur Cal...
 
❤️Chandigarh Escorts Service☎️9815457724☎️ Call Girl service in Chandigarh☎️ ...
❤️Chandigarh Escorts Service☎️9815457724☎️ Call Girl service in Chandigarh☎️ ...❤️Chandigarh Escorts Service☎️9815457724☎️ Call Girl service in Chandigarh☎️ ...
❤️Chandigarh Escorts Service☎️9815457724☎️ Call Girl service in Chandigarh☎️ ...
 
❤️Call Girl In Chandigarh☎️9814379184☎️ Call Girl service in Chandigarh☎️ Cha...
❤️Call Girl In Chandigarh☎️9814379184☎️ Call Girl service in Chandigarh☎️ Cha...❤️Call Girl In Chandigarh☎️9814379184☎️ Call Girl service in Chandigarh☎️ Cha...
❤️Call Girl In Chandigarh☎️9814379184☎️ Call Girl service in Chandigarh☎️ Cha...
 
Indore Call Girl Service 📞9235973566📞Just Call Inaaya📲 Call Girls In Indore N...
Indore Call Girl Service 📞9235973566📞Just Call Inaaya📲 Call Girls In Indore N...Indore Call Girl Service 📞9235973566📞Just Call Inaaya📲 Call Girls In Indore N...
Indore Call Girl Service 📞9235973566📞Just Call Inaaya📲 Call Girls In Indore N...
 
❤️Amritsar Call Girls Service☎️98151-129OO☎️ Call Girl service in Amritsar☎️ ...
❤️Amritsar Call Girls Service☎️98151-129OO☎️ Call Girl service in Amritsar☎️ ...❤️Amritsar Call Girls Service☎️98151-129OO☎️ Call Girl service in Amritsar☎️ ...
❤️Amritsar Call Girls Service☎️98151-129OO☎️ Call Girl service in Amritsar☎️ ...
 
Erotic Call Girls Bangalore {7304373326} ❤️VVIP SIYA Call Girls in Bangalore ...
Erotic Call Girls Bangalore {7304373326} ❤️VVIP SIYA Call Girls in Bangalore ...Erotic Call Girls Bangalore {7304373326} ❤️VVIP SIYA Call Girls in Bangalore ...
Erotic Call Girls Bangalore {7304373326} ❤️VVIP SIYA Call Girls in Bangalore ...
 
Lucknow Call Girls Service ❤️🍑 9xx000xx09 👄🫦 Independent Escort Service Luckn...
Lucknow Call Girls Service ❤️🍑 9xx000xx09 👄🫦 Independent Escort Service Luckn...Lucknow Call Girls Service ❤️🍑 9xx000xx09 👄🫦 Independent Escort Service Luckn...
Lucknow Call Girls Service ❤️🍑 9xx000xx09 👄🫦 Independent Escort Service Luckn...
 
💸Cash Payment No Advance Call Girls Surat 🧿 9332606886 🧿 High Class Call Girl...
💸Cash Payment No Advance Call Girls Surat 🧿 9332606886 🧿 High Class Call Girl...💸Cash Payment No Advance Call Girls Surat 🧿 9332606886 🧿 High Class Call Girl...
💸Cash Payment No Advance Call Girls Surat 🧿 9332606886 🧿 High Class Call Girl...
 
💞 Safe And Secure Call Girls gaya 🧿 9332606886 🧿 High Class Call Girl Service...
💞 Safe And Secure Call Girls gaya 🧿 9332606886 🧿 High Class Call Girl Service...💞 Safe And Secure Call Girls gaya 🧿 9332606886 🧿 High Class Call Girl Service...
💞 Safe And Secure Call Girls gaya 🧿 9332606886 🧿 High Class Call Girl Service...
 
💞 Safe And Secure Call Girls Prayagraj 🧿 9332606886 🧿 High Class Call Girl Se...
💞 Safe And Secure Call Girls Prayagraj 🧿 9332606886 🧿 High Class Call Girl Se...💞 Safe And Secure Call Girls Prayagraj 🧿 9332606886 🧿 High Class Call Girl Se...
💞 Safe And Secure Call Girls Prayagraj 🧿 9332606886 🧿 High Class Call Girl Se...
 
💸Cash Payment No Advance Call Girls Bhopal 🧿 9332606886 🧿 High Class Call Gir...
💸Cash Payment No Advance Call Girls Bhopal 🧿 9332606886 🧿 High Class Call Gir...💸Cash Payment No Advance Call Girls Bhopal 🧿 9332606886 🧿 High Class Call Gir...
💸Cash Payment No Advance Call Girls Bhopal 🧿 9332606886 🧿 High Class Call Gir...
 
💸Cash Payment No Advance Call Girls Hyderabad 🧿 9332606886 🧿 High Class Call ...
💸Cash Payment No Advance Call Girls Hyderabad 🧿 9332606886 🧿 High Class Call ...💸Cash Payment No Advance Call Girls Hyderabad 🧿 9332606886 🧿 High Class Call ...
💸Cash Payment No Advance Call Girls Hyderabad 🧿 9332606886 🧿 High Class Call ...
 
💸Cash Payment No Advance Call Girls Kanpur 🧿 9332606886 🧿 High Class Call Gir...
💸Cash Payment No Advance Call Girls Kanpur 🧿 9332606886 🧿 High Class Call Gir...💸Cash Payment No Advance Call Girls Kanpur 🧿 9332606886 🧿 High Class Call Gir...
💸Cash Payment No Advance Call Girls Kanpur 🧿 9332606886 🧿 High Class Call Gir...
 
🍑👄Ludhiana Escorts Service☎️98157-77685🍑👄 Call Girl service in Ludhiana☎️Ludh...
🍑👄Ludhiana Escorts Service☎️98157-77685🍑👄 Call Girl service in Ludhiana☎️Ludh...🍑👄Ludhiana Escorts Service☎️98157-77685🍑👄 Call Girl service in Ludhiana☎️Ludh...
🍑👄Ludhiana Escorts Service☎️98157-77685🍑👄 Call Girl service in Ludhiana☎️Ludh...
 
Delhi Call Girl Service 📞8650700400📞Just Call Divya📲 Call Girl In Delhi No💰Ad...
Delhi Call Girl Service 📞8650700400📞Just Call Divya📲 Call Girl In Delhi No💰Ad...Delhi Call Girl Service 📞8650700400📞Just Call Divya📲 Call Girl In Delhi No💰Ad...
Delhi Call Girl Service 📞8650700400📞Just Call Divya📲 Call Girl In Delhi No💰Ad...
 
Low Rate Call Girls Jaipur {9521753030} ❤️VVIP NISHA CCall Girls in Jaipur Es...
Low Rate Call Girls Jaipur {9521753030} ❤️VVIP NISHA CCall Girls in Jaipur Es...Low Rate Call Girls Jaipur {9521753030} ❤️VVIP NISHA CCall Girls in Jaipur Es...
Low Rate Call Girls Jaipur {9521753030} ❤️VVIP NISHA CCall Girls in Jaipur Es...
 
❤️Chandigarh Escorts☎️9814379184☎️ Call Girl service in Chandigarh☎️ Chandiga...
❤️Chandigarh Escorts☎️9814379184☎️ Call Girl service in Chandigarh☎️ Chandiga...❤️Chandigarh Escorts☎️9814379184☎️ Call Girl service in Chandigarh☎️ Chandiga...
❤️Chandigarh Escorts☎️9814379184☎️ Call Girl service in Chandigarh☎️ Chandiga...
 
💸Cash Payment No Advance Call Girls Nagpur 🧿 9332606886 🧿 High Class Call Gir...
💸Cash Payment No Advance Call Girls Nagpur 🧿 9332606886 🧿 High Class Call Gir...💸Cash Payment No Advance Call Girls Nagpur 🧿 9332606886 🧿 High Class Call Gir...
💸Cash Payment No Advance Call Girls Nagpur 🧿 9332606886 🧿 High Class Call Gir...
 
Call Girl Service In Mumbai ❤️🍑 9xx000xx09 👄🫦Independent Escort Service Mumba...
Call Girl Service In Mumbai ❤️🍑 9xx000xx09 👄🫦Independent Escort Service Mumba...Call Girl Service In Mumbai ❤️🍑 9xx000xx09 👄🫦Independent Escort Service Mumba...
Call Girl Service In Mumbai ❤️🍑 9xx000xx09 👄🫦Independent Escort Service Mumba...
 

FHIR API for .Net programmers by Mirjam Baltus

  • 1. FHIR API for .Net programmers Mirjam Baltus FHIR Developer Days November 24, 2014 © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 2. Who am I?  Name: Mirjam Baltus-Bakker  Company: Furore, Amsterdam  Background:  ICT trainer  Furore FHIR team  Contact:  m.baltus@furore.com © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 3. Using the Reference Implementations HL7.FHIR SUPPORT API © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 4. Hl7.Fhir - Core contents - Model – classes generated from the spec - Parsers and Serializers - REST functionality – FhirClient - Validation - Specification  NuGet “FHIR”, or GitHub “fhir-net-api” © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 5. A FHIR Resource © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 6. A FHIR Resource in C# public partial class Observation : Hl7.Fhir.Model.Resource { // Codes that provides reliability information about an observation public enum ObservationReliability {Ok, Ongoing, …} // Codes identifying interpretations of observations public enum ObservationInterpretation {N, A, L, H } public partial class ObservationReferenceRangeComponent : Hl7.Fhir.Model.Element { … } public CodeableConcept Name { get; set; } public List<ObservationReferenceRangeComponent> ReferenceRange { get; set;} public List<ResourceReference> Performer { get; set; } } © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 7. Primitives are not really primitive… © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 8. Primitives are not really primitive… © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 9. Resource example using Hl7.Fhir.Model; var pat = new Patient(); pat.Name = new List<HumanName>(); pat.Name.Add(HumanName.ForFamily("Baltus") .WithGiven("Mirjam")); pat.MaritalStatus = new CodeableConcept("http://acme.org/MStat", "M"); pat.BirthDate = "1974-01-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.
  • 10. Choice elements [x] public Hl7.Fhir.Model.CodeableConcept MaritalStatus { set; get; } public Hl7.Fhir.Model.Element Deceased { set; get; } pat.Deceased = new FhirBoolean(true); pat.Deceased = new FhirDateTime("2012-01-30"); © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 11. Hl7.Fhir Core  Model – Resources and Datatypes in the API   Parsers and Serializers  REST functionality – FhirClient  Validation © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 12. Parsing example using Hl7.Fhir.Serialization; // Suppose we have a JSON string string str = "{"resourceType":"Patient","name":" + "[{"family":["Baltus"],"given":["Mirjam"]}]}"; // Parse the Patient from the string var pat = (Patient)FhirParser.ParseResourceFromJson(str); © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 13. Parsing example 2 // Create a file-based reader for Xml XmlReader xr = XmlReader.Create( new StreamReader(@"publishobservation-example.xml")); // Parse the Observation from the stream var obs = (Observation)FhirParser.ParseResource(xr); © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 14. Serializing example // Here’s our Observation again var obs = (Observation)FhirParser.ParseResource(xr); // Modify some fields of the observation obs.Status = Observation.ObservationStatus.Amended; obs.Value = new Quantity() { Value = 40, Units = "g" }; // Serialize the in-memory observation to Json var jsonText = FhirSerializer.SerializeResourceToJson(obs); © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 15. Hl7.Fhir Core  Model – Resources and Datatypes in the API    Parsers and Serializers  REST functionality – FhirClient  Validation © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 16. REST functionality  REST operations done with FhirClient using Hl7.Fhir.Rest; var client = new FhirClient( new Uri("http://acme.org/fhir"));  Operations throw a FhirOperationException  Outcome property with OperationOutcome © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 17. Using the FhirClient var patEntry = client.Read<Patient>("Patient/1"); var pat = patEntry.Resource; var restId = patEntry.Id; var tags = patEntry.Tags; pat.Name.Add(HumanName.ForFamily("Kramer") .WithGiven("Ewout")); client.Update<Patient>(patEntry); var myId = ResourceIdentity.Build("Patient","31"); © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 18. Using the FhirClient var pat = new Patient() { /* set up data */ }; var patEntry = client.Create(pat); var restId = patEntry.Id; var newEntry = client.Refresh(patEntry); client.Delete(patEntry); var location = new Uri("http://acme.org/fhir/Patient/34"); client.Delete(location); © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 19. Bundles in C#  Abstraction on top of Atom parser  Bundle = feed, BundleEntry = entry. Bundle result = new Bundle() { Title = "Demo bundle" }; result.Entries.Add(new ResourceEntry<Patient>() { LastUpdated=DateTimeOffset.Now, Resource = new Patient() }); result.Entries.Add(new DeletedEntry() { Id = new Uri("http://..."), When = DateTime.Now }); var bundleXml = FhirSerializer.SerializeBundleToXml(result); © 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. Search var criteria = new string[] { "family=Eve" }; Bundle result = client.Search<Patient>(criteria); while (result != null) { // Do something useful result = client.Continue(results); } © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 21. More about search  Please attend one of the presentations in the next quarter:  Search for Server developers by Martijn Harthoorn  Search for Client developers by myself © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 22. Validation  DotNetAttributeValidation validates:  Cardinality of an element  Regex patterns of the primitives code, date, dateTime, id, instant, oid, uri, uuid  Allowed types for a choice element (value[x]) pat.Deceased = new FhirString("Died on 2012-01-30");  Does not validate:  Conformance to ValueSet bindings  Profile conformance © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 23. Validation example using Hl7.Fhir.Validation; var pat = new Patient() { /* set up data */ }; // Will throw a ValidationException when an error is encountered DotNetAttributeValidation.Validate(pat); // Alternatively, use the TryXXXX pattern var errors = new List<ValidationResult>(); var success = DotNetAttributeValidation.TryValidate(pat, errors); if(!success) { /* handle errors */ } © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 24. Hl7.Fhir Core  Model – Resources and Datatypes in the API    Parsers and Serializers  REST functionality – FhirClient    Validation © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.
  • 25. Questions?  http://hl7.org/fhir m.baltus@furore.com © 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.