Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 4.28 KB

File metadata and controls

81 lines (58 loc) · 4.28 KB

NVSS FHIR API Getting Started for Development

This guide walks through first time for local development of this FHIR server. It includes setting up a native .NET environment via CLI and running the Microsoft SQL server through Docker.

  1. Install .NET Core 6.0.100 by going to the .NET Core 6.0 download page, scrolling down to 6.0.0, and collapsing the dropdown to find 6.0.100 SDK. You can also find an alternative install on GitHub.

  2. Install Docker Desktop to enable running containerized applications.

  3. In a command line interface, download the MSSQL Docker image with the command:

docker pull mcr.microsoft.com/mssql/server:2022-latest
  1. Install .NET EF Core for managing database migrations and schema:
dotnet tool install --global dotnet-ef --version 7
  1. Clone the Reference Server and make it the working directory.

  2. Pick a secure random password, which the remainder of this guide will refer to as yourStrong(!)Password. Never commit this password to GitHub.

  3. Open the file messaging/appsettings.Development.json and modify the NVSSMessagingDatabase field to use the Password yourStrong(!)Password. Never commit this password to GitHub.

  4. Launch MSSQL database server in the background via Docker:

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=yourStrong(!)Password" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
  • Optional: run docker ps to check working Docker services.
  • Note: On an Apple silicon Mac you may need to add --platform=linux/amd64 to the docker run command above.
  • Warning: Based on your shell special characters may need to be escaped or avoided.
  1. Load the database migrations:
dotnet ef --project messaging database update
  • Note: To reset the database you can use dotnet ef --project messaging database drop followed by dotnet ef --project messaging database update
  1. Run the server with the command below. It may ask you for a system password when generating a developer certificate.
dotnet run --project messaging

If it worked successfully you should see something like this:

Building...
[15:46:53 INF] Starting the NVSS FHIR API
[15:46:53 INF] Now listening on: https://localhost:5001
[15:46:53 INF] Now listening on: http://localhost:5000
[15:46:53 INF] Background job processing has started

[15:46:53 INF] Application started. Press Ctrl+C to shut down.
[15:46:53 INF] Hosting environment: Development
[15:46:53 INF] Content root path: /Users/nightingaleproject/nvss/Reference-NCHS-API/messaging
  1. If the system keeps prompting you for a password, you can have the system trust your new developer cert by running the command:
dotnet dev-certs https --trust
  1. To confirm the server is running properly, visit https://127.0.0.1:5001/swagger/v1/swagger.json, where you should get a JSON file and see StatusCode: 200 in the server logs. Authentication and authorization are disabled in development mode. You can view the REST API documentation on GitHub Pages or http://localhost:5001/swagger/index.html.

Run Messaging Tests

From messaging directory with MSSQL database already running, run:

dotnet test

Next Steps

  • Checkout our Testing Tools to quickly populate the FHIR API database with content suitable for exercising the software.
  • Launch the Status UI to get a NVSS FHIR messages status dashboard.
  • Use the Canary Testing Framework to generate sample FHIR messages.
  • Try the Postman Collections provided, but disregard authentication and use https://127.0.0.1:5001/ as the base URL.