This is a sample FHIR RESTful API service using the FhirEngine libraries.
This project requires .NET 6 SDK to be installed and credentials to the Synapxe HIP Nexus.
The command below registers the Synapxe HIP Nexus as a nuget source. Replace the <username>
and <password>
arguments with a valid set of credentials.
dotnet nuget add source https://nexus.ihis-hip.sg/repository/ihis-nuget/ -n nexus -u <username> -p <password>
Install the template using the command below. This will install the latest available version of the template.
dotnet new install Ihis.FhirEngine.WebApiTemplate.CSharp::3.0.1
Confirm that the template is installed using the command below:
dotnet new --list
These templates matched your input:
Template Name Short Name Language Tags
-------------------------------------------- ------------------- ---------- ----------------
FhirEngine Web Api fhirengine-webapi [C#] Web/WebAPI/FHIR/
Modify FhirStarter.csproj to add the source generator nuget package.
<PackageReference Include="Synapxe.Fhir.CodeGeneration" Version="1.0.0-*" />
[GeneratedFhir("Conformance/Pokemon.StructureDefinition.json",
SharedTerminologyResources = new string[] { "Conformance/PokemonType.ValueSet.json" })]
public partial class Pokemon
{
}
The Pokemon custom resource can be registered either by adding the registration method in Program.cs or through configuration.
builder.AddFhirEngineServer()
.AddCustomResource<Pokemon>();
{
"FhirEngine": {
"SystemPlugins":{
"CustomResources": [
"FhirStarter.CustomResource.Pokemon"
]
}
}
}
Add Pokemon as a resource in the Conformance/capability-statement.json
file.
"resource":[
{
"type": "Pokemon",
"documentation": "A Pokemon resource.",
"interaction": [
{
"code": "read",
"documentation": "Returns the Pokemon."
},
{
"code": "create",
"documentation": "Creates a Pokemon."
},
{
"code": "search-type",
"documentation": "Searches the Pokemon."
}
],
"searchParam": [
{
"name": "type",
"type": "string",
"definition": "SearchParameter/Pokemon-type",
"documentation": "Type of the Pokemon"
}
],
"versioning": "versioned"
}
]