First you have to install NodeJS if you don't already have it from https://nodejs.org/. This app has been developed on Node version 7.9 and also tested on Node 8 and 9. There is a known conflict that currently prevents use of Node version 10 or later. If your system's version is outside that range you will want to install a supported version. This is easy to do using the Node Version Manager from https://github.com/creationix/nvm. (Note the instruction on updating your shell's configuration file or you may find the Node version reverts on starting a new session)
Then clone the repo, install the dependencies and start it:
git clone https://github.com/smart-on-fhir/bulk-data-server.git
cd bulk-data-server
npm i
Run the following command:
npm start
You should see "Server listening on http://localhost:9443", and can open that URL in your browser to load the server's front end.
The bulk-data server can be accessed by clients like the FHIR Downloader. To connect a client, you will need the server's FHIR endpoint that is displayed in the "FHIR Server URL" field towards the bottom of the page.
The server can also handle authenticated requests using the SMART Backend Services specification. To use it you should have a pair of RS256 private and public keys (the server only require you to input the public key). Alternatively, you can generate the key pair by clicking on the "Generate Keys" button. The other required piece is the "Service URL" which acts as a unique identifier of your client. Once you have the public key and the Service URL, the server will generate a Client ID
for you. You can also download the settings a client will need in JSON format by using the "Download as JSON" button. These settings include:
private_key
- Only included if keys are generated by the serverclient_id
- client_id to send while authorizingfhir_url
- where to send your FHIR requeststoken_url
- where to send your authorization requestsservice_url
- client identifier
Note that changing options may also change some of these settings (the fields that change will flash green).
- Use the Synthea Patient Generator to generate patients.
- Import these patients into the server's database:
node data/import -d /path/to/my/patients/ -f 3
Note that -f
is for FHIR version and is required. Use 4
for R4
, 3
for STU3
or 2
for DSTU2
.
You can customize your settings by editing the file config.js
. You can also pass the following environment variables:
NODE_ENV
- Typically this isproduction
,development
ortest
. Defaults toproduction
.PORT
- The port to listen on. Defaults to9444
for running tests and9443
otherwise.BASE_URL
- The base url for the link generation. Defaults tohttp://localhost:${PORT}
. Note: if this does not match the deployed URL, some of the returned information may not be correct.SECRET
- The secret for signing jwt tokens. Defaults to "this-is-our-big-secret". You must set this one.