Skip to content

Getting started

verzada edited this page Nov 16, 2017 · 13 revisions

How to get started with creating a FHIR web service

Some basic information first

Before I start explaining how you create a FHIR web service, you need to know about the structure in FhirStarter.

Name of the library Explaination
FhirStarter.Bonfire.STU3 The Bonfire project is the main library. It is the core library which 99% of the logic lies in.
FhirStarter.Flare.STU3 The Flare project contains only the global.asax and global.asax.cs file plus a xslt to render results to html.
Spark.Engine The Spark.Engine code was originally in FhirStarter.Bonfire, but is now a separated library.
FhirStarter.Inferno The Inferno project runs the FHIR service. This service references the Bonfire and Flare project directly for debugging purposes
Fhirstarter.Inferno.Template The Inferno.Template project references the nuget packages from nuget.org, and can be used as a starting project for new FHIR projects since all the basic necessities are present in the template project.

A FhirStarter service is based on the IFhirService interface. It contains all the necessary methods which the FhirController needs to access when receiving a request.

The FhirController is using ninject to create instances of IFhirServices, so you can have as many services as you want, but the resource in each service must be unique. So you can't for example have two Patient services in the same Inferno project.

How to get a head with FhirStarter

Since most of the logic to handle FHIR is in the Bonfire project, the only thing needed to get things running is to copy the FhirStarter.Inferno.Template project and put it in your FHIR solution. This way you also ensure you get the updated nuget packages which are accessible through nuget.org

It is preferable to change the Inferno.Template project (assembly and all) to something more easily associative with what the service is supposed to do. For example, PatientRegistry if the Inferno service is just getting patients from a registry. If you change the assembly name, do also change the reference to the dll name in the appSetting element in the web.config (See the Settings for more information).