Hello my FHIR-ly friends, and welcome to my first post on Microsoft FHIR server!
Over the last few months, i worked with Microsoft Open Source FHIR Server (OSS) and wanted to share my experience on setting it up and running locally. Yes, you may run it locally without internet 🙂
This might be helpful, if you just starting to learn HL7 FHIR (https://www.hl7.org/fhir/) and don’t / can’t spin one on your cloud environment of choice. You might also use any publicly available FHIR endpoints, discover-able from the link above.
Following steps will assist you in spinning it with a Cosmos DB (emulator flavor) or a more traditional SQL Server instance. Well, let’s start right away!
- First, let’s get the latest code: https://github.com/microsoft/fhir-server
- Install Visual Studio 17/19 with updates (the community version is FREE 🙂
- We have 2 dependencies: Cosmos DB emulator or SQL Server (depending on the data layer you’ve chosen). We will continue with instructions on Cosmos DB, and show the tip for launching it with local SQL instance as well.
- Install Dot Net SDK 2.2.* (https://dotnet.microsoft.com/download/dotnet-core/2.2). Don’t forget to check the docs, in case it is updated to a higher version 😉
- Install Azure Cosmos Emulator (https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator ).
- In VS open Microsoft.Health.Fhir.sln & restore the packages
- Run the build process & set Microsoft.Health.Fhir.Stu3.Web as a start-up project
- Note: You could also use Microsoft.Health.Fhir.R4.Web – based on fhir resource versions that you are planning to load.
- Made following changes in appsettings.json
"Security": {
"Enabled": true,
"EnableAadSmartOnFhirProxy": false,
"Authentication": {
"Audience": "fhir-api",
"Authority": "https://localhost:44348"
},
"PrincipalClaims": [
"iss",
"oid"
],
"Authorization": {
"Enabled": true
}
},
Option 1: Selecting Cosmos DB data layer
Option 2: Select SQL data layer & start project (aka Press F5)
Lunch the FHIR server locally by pressing F5 – should look like following screen:
- Run postman Query for Server CapabilityStatement: https://localhost:44348/metadata?_format=json
- Check the Postman SSL certification verification is off, or accept the dotnet development certificate.
- Retrieve token to access the FHIR Server resources:
POST https://localhost:44348/connect/token
BODY: client_id=serviceclient&client_secret=serviceclient&grant_type=client_credentials&scope=fhir-api
Hope you got so far & starting your celebration… Yes, my friend, you did it! Congratulations!!!
You are ready to play with FHIR 🔥 … Just remember, to follow the FHIR safety rules that we will cover on next post 🙂 Stay tuned and let me know what are you thoughts in the comments. Thanks!