fhir api for dotnet (mirjam)

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. FHIR API for .Net programmers Mirjam Baltus FHIR Developer Days November 18, 2015

Upload: devdays

Post on 25-Jan-2017

340 views

Category:

Healthcare


0 download

TRANSCRIPT

Page 1: fhir api for dotnet (mirjam)

© 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 APIfor .Net programmers

Mirjam BaltusFHIR Developer DaysNovember 18, 2015

Page 2: fhir api for dotnet (mirjam)

© 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 Company: Furore, Amsterdam Background:

Furore FHIR team IT trainer & Software developer

Contact: [email protected]

Page 3: fhir api for dotnet (mirjam)

© 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 SUPPORT APIUsing the Reference Implementations

Page 4: fhir api for dotnet (mirjam)

© 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”, look for DSTU2 packages [email protected] or GitHub for support/issues

Page 5: fhir api for dotnet (mirjam)

© 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

Page 6: fhir api for dotnet (mirjam)

© 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.DomainResource{ // Codes specifying how two observations are related. public enum ObservationRelationshipType {HasMember, DerivedFrom, SequelTo, …} // Codes providing the status of an observation. public enum ObservationStatus {Registered, Preliminary, Final, …}

public partial class ObservationReferenceRangeComponent : BackboneElement { … }

public CodeableConcept Code { get; set; } public Element Value { get; set;}

public List<ResourceReference> Performer { get; set; }}

Page 7: fhir api for dotnet (mirjam)

© 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…

Page 8: fhir api for dotnet (mirjam)

© 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 FHIR Client

var client =new FhirClient("http://acme.org/fhir");

var pat = client.Read<Patient>("Patient/1");var id = pat.Id;

pat.Name.Add(HumanName.ForFamily("Kramer").WithGiven("Ewout"));

client.Update<Patient>(pat);

Page 9: fhir api for dotnet (mirjam)

© 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

var criteria = new string[] { "family=Eve" };Bundle result = client.Search<Patient>(criteria);

while (result != null){ foreach (var e in result.Entry) { Patient p = (Patient)e.Resource; // Do something with the resource } result = client.Continue(result);}

Page 10: fhir api for dotnet (mirjam)

© 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/Serializing

// Create a file-based reader for XmlXmlReader xr = XmlReader.Create(

new StreamReader(@"observation-example.xml"));

// Parse the Observation from the streamvar obs = (Observation)FhirParser.ParseResource(xr);

// Serialize the in-memory observation to Jsonvar jsonText = FhirSerializer.SerializeResourceToJson(obs);

Page 11: fhir api for dotnet (mirjam)

© 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

var pat = new Patient() { /* set up data */ };

// Will throw a ValidationException upon errorsDotNetAttributeValidation.Validate(pat);

// Alternatively, use the TryXXXX patternvar errors = new List<ValidationResult>();var success = DotNetAttributeValidation.TryValidate(pat, errors);

if (!success) { /* handle errors */ }

Page 12: fhir api for dotnet (mirjam)

© 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 NEXT?

Page 13: fhir api for dotnet (mirjam)

© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

Next Steps for you

Come to the round table with guidance session after this presentation

Try the Beginners Track orthe Patient Track at the Hackathon

See github for FhirStarters

Implementer’s Skype Channel StackOverflow: hl7 fhir tag FHIR DOTNET group on Google Groups

Page 14: fhir api for dotnet (mirjam)

© 2012 HL7 ® International. Licensed under Creative Commons. HL7 & Health Level Seven are registered trademarks of Health Level Seven International. Reg. U.S. TM Office.

The End – Questions?