Skip to content
/ magniFHIR Public

Basic Patient resource browser to provide visibility into your FHIR servers.

License

Notifications You must be signed in to change notification settings

chgl/magniFHIR

Repository files navigation

magniFHIR

OpenSSF Scorecard SLSA 3

Visibility into your FHIR server.

Running

docker run --rm -it -p 8080:8080 \
    -e FhirServers__0__Name="HAPI FHIR Test Server" \
    -e FhirServers__0__BaseUrl="https://hapi.fhir.org/baseR4" \
    ghcr.io/chgl/magnifhir:v1.5.2

Open http://localhost:8080/ in your browser, select the HAPI FHIR Test Server in the server selection and click on Patient Browser in the left-hand menu.

Screenshots

Screenshot showing the server selection

Screenshot showing the patient browser

Screenshot showing the patient record conditions tab

Screenshot showing the patient record observations tab

Configuration

Multiple FHIR servers can be configured including support for basic authentication. You can use environment variables to set each entry in the FhirServers key, as done above, or mount a file called appsettings.Production.json inside the container as /opt/magnifhir/appsettings.Production.json.

The basic structure and available configuration options is shown here:

{
  "FhirServers": [
    {
      "Name": "HAPI FHIR JPA Server",
      "BaseUrl": "http://hapi-fhir-server.127.0.0.1.nip.io/fhir"
    },
    {
      "Name": "Linux4Health FHIR Server (empty)",
      "BaseUrl": "http://l4h-fhir-server.127.0.0.1.nip.io/fhir-server/api/v4",
      "Auth": {
        "Basic": {
          "Username": "fhiruser",
          "Password": "change-user-password"
        }
      }
    }
  ]
}

Customizing Resource Browsers

Warning This is an experimental feature. No guarantees that there won't be changes to the default resource tables or the way data is displayed.

It is possible to customize the tables displaying FHIR resources in the Patient Record view. This allows changing the type of resources displayed and the path within each resource to show as a column in the table. See the ResourceBrowsers key in appsettings.json for the defaults.

It's easiest to define a custom appsettings.Production.json and mount it inside the container. See the configuration section above.

Development

Docker Compose

Start all prerequisite services for development by running:

docker compose -f hack/compose.yaml --profile=l4h --profile=azure up

This will start three FHIR servers and their corresponding databases. The servers are running behind Traefik as a reverse proxy to provide nice URLs that are resolved to localhost:

Type Base URL
HAPI FHIR JPA Server Starter http://hapi-fhir-server.127.0.0.1.nip.io/fhir
Linux4Health FHIR Server http://l4h-fhir-server.127.0.0.1.nip.io/fhir-server/api/v4
FHIR Server for Azure http://azure-fhir-server.127.0.0.1.nip.io/

The HAPI FHIR JPA Server is pre-filled with sample Synthea data. To only start the HAPI FHIR server, you can remove the --profile=l4h --profile=azure flags from the docker compose invocation.

Install the packages and launch the server in Hot-Reload mode:

dotnet restore
dotnet watch --project=src/magniFHIR

Kubernetes (KinD)

Prerequisites:

Create a cluster for testing using KinD:

kind create cluster --name=magnifhir-dev

Build the container image and deploy to the cluster in development mode:

skaffold dev

This includes a HAPI FHIR server deployed via Helm and the same set of sample data as used by the Docker Compose setup.

Skaffold is used to re-build the container image whenever the source code changes, deploy the HAPI FHIR server as a test-dependency, and also build and deploy the job used to load sample data into the server. See skaffold.yaml and the contents of the hack/k8s directory for details.