Import FHIR resources
Usage
The import
command can import FHIR resources in a FHIR server from local JSON files.
It supports "primitive" deduplication based on merger bonFHIR rules.
Source formats
The --source
arguments support multiple sources for data:
- all sources must ultimately resolve to JSON files of individual resources or FHIR Bundle
- glob patterns are supported - e.g.
**/*.json
- files can be zip archived; in this case, zip files are unzip in a temporary location prior to being processes
- this can also be a full URL of a file to download; in this case, the file is downloaded first, unzipped if it is a zip file, and all files are processed individually
- finally,
synthea-sample
can be used a shorthand for around a thousands synthetic patients generated by the Synthea / SyntheticMass project
FHIR Server authentication
Authentication mode supported:
- no authentication (do not pass any
--auth-...
flag) - a stable value in the
Authorization
header (use the--auth-header
flag) -client credentials flow; use the remaining--auth-...
flags
Flags
--source
: See above for a discussion on possible sources--fhir
: The FHIR version to use; we currently supportr4b
andr5
--base-url
: The base URL of the FHIR server--auth-header
: The value to use as anAuthorization
header to authenticate to the server with a token--auth-token-url
: The URL to use to obtain an OAuth2 token (client credentials)--auth-client-id
: The client ID to use to obtain an OAuth2 token (client credentials)--auth-client-secret
: The client secret to use to obtain an OAuth2 token (client credentials)--skip-connectivity-test
: Skip the server connectivity test prior to running the command
Example usage
The following command will launch the synthetic patient data import in a local FHIR server setup by any Project template
npx @bonfhir/cli import --source synthea-sample --fhir r4b --base-url http://localhost:8103/fhir/R4/ --auth-token-url http://localhost:8103/oauth2/token --auth-client-id f54370de-eaf3-4d81-a17e-24860f667912 --auth-client-secret 75d8e7d06bf9283926c51d5f461295ccf0b69128e983b6ecdd5a9c07506895de