Skip to content

How FhirStarter.Inferno works

verzada edited this page Apr 11, 2017 · 2 revisions

Folder structure

The FhirStarter.Inferno contains references to FhirStarter.Bonfire and Fhirstarter.Flare project. The ExamplePatientService under Services is meant to get you going with a new FHIR server implementation.

To create your own service, make a new service under Services like this

public class ExampleService : IFhirService { }

Let Visual Studio add the missing methods so you end up with something like this

` public class ExampleService : IFhirService { public List GetSupportedResources() { throw new NotImplementedException(); }

    public string GetAlias()
    {
        throw new NotImplementedException();
    }

    public List<ModelInfo.SearchParamDefinition> SearchParameters()
    {
        throw new NotImplementedException();
    }

    public OperationDefinition GetOperationDefinition()
    {
        throw new NotImplementedException();
    }

    public HttpResponseMessage Create(IKey key, Resource resource)
    {
        throw new NotImplementedException();
    }

    public Base Read(SearchParams searchParams)
    {
        throw new NotImplementedException();
    }

    public Base Read(string id)
    {
        throw new NotImplementedException();
    }

    public HttpResponseMessage Update(IKey key, Resource resource)
    {
        throw new NotImplementedException();
    }

    public HttpResponseMessage Delete(IKey key)
    {
        throw new NotImplementedException();
    }

`

Filling out the blanks in the methods from the IFhirService interface

GetSupportedResources()

Normally you just need to return the one supported resource you use here. F.ex. the resource Patient. The idea behind this method was to display which FHIR Resources could be returned by the queried Resource.

GetAlias()

The alias for the service, aka the resource you run your requests against. Ex. http://hostname//fhir/<resource / alias> The reason why there's a GetAlias method, is due to the fact that FhirStarter only supports queries against one basic service in the url, but it supports several aliases.

TODO: rename alias

SearchParameters()

Lists all supported queries in the current service for the conformance (ex. ../fhir/metadata) Check the example to see how the SearchParams are described.

GetOperationDefinition()

Creates the conformity for OperationDefintion on a separate URL Check the example to see how OperationDefinitions are described.

Create(IKey key, Resource resource)

Describes how to create a record in a dataprovider

Read(SearchParams searchParams)

Describes how to read data from a dataprovider by using SearchParams object

Read(string id)

Describes how to read data from a dataprovider by using an string id

HttpResonseMessage Update(IKey key, Resource resource)

Updates a record in a dataprovider with the provided resource

HttpResponse Delete(IKey key)

Deletes a record by using the key