/FhirLoader

Simple command line FHIR loader

Primary LanguageC#

FHIR Server Loading tool

Simple tool for multi-threaded loading of FHIR data into a FHIR server. The tool will process bundles (like the ones generated by Synthea).

Before sending them to the server, the tool will resolve all internal links in the bundle and append all the resources to an ndjson file (one resource per line). If this buffer file already exists, the tool will not create it, so it is also possible to simply specify the buffer file if it is created by another tool.

Usage:
  FhirLoader [options]

Options:
  --input-folder <input-folder>                              inputFolder
  --fhir-server-url <fhir-server-url>                        fhirServerUrl
  --authority <authority>                                    authority
  --client-id <client-id>                                    clientId
  --client-secret <client-secret>                            clientSecret
  --access-token <access-token>                              accessToken
  --buffer-file-name <buffer-file-name>                      bufferFileName
  --re-create-buffer-if-exists                               reCreateBufferIfExists
  --max-degree-of-parallelism <max-degree-of-parallelism>    maxDegreeOfParallelism
  --refresh-interval <refresh-interval>                      refreshInterval
  --version                                                  Show version information
  -?, -h, --help                                             Show help and usage information

Examples

Authenticating with client id and secret

dotnet run -- --client-secret "XXXX" --client-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --input-folder ..\synthea\output\fhir\ --authority "https://login.microsoftonline.com/{tenant-id}" --fhir-server-url "https://{myfhirserver}.azurehealthcareapis.com" --max-degree-of-parallelism 14

Authenticating with Azure CLI

$fhirServerUrl = "https://{myfhirserver}.azurehealthcareapis.com"
$inputFolder = "..\synthea\output\fhir\"

# enable healthcare plugin for Azure CLI
az extension add --name healthcareapis

# authorize user to access FHIR service
az role assignment create `
  --assignee $(az account show --query 'user.name' --output tsv) `
  --scope $(az healthcareapis service list --query "[?properties.authenticationConfiguration.audience=='$fhirServerUrl'].id" --output tsv) `
  --role 'FHIR Data Contributor'

# run loader
dotnet run -- `
  --access-token $(az account get-access-token --resource $fhirServerUrl --query accessToken --output tsv) `
  --fhir-server-url $fhirServerUrl `
  --input-folder $inputFolder