Skip to main content

Load Sample Data

Prerequisites​

Before loading sample data, ensure you have the following:

  • A running instance of Haste Health (refer to the Quick Start guide if needed).
  • haste-health CLI tool installed. You can find installation instructions in the Setting Up CLI tutorial.

Download Sample FHIR Data​

You can download sample FHIR data files from the Synthea project. Download R4 data files from here.

A Synthea FHIR download holds three kinds of file:

FileContains
hospitalInformation<timestamp>.jsonThe Organizations and Locations where patients receive care, as a batch Bundle.
practitionerInformation<timestamp>.jsonThe Practitioners and PractitionerRoles who provide that care, as a batch Bundle.
<Given>_<Family>_<uuid>.jsonOne patient and their whole record, as a transaction Bundle.

Patient bundles do not contain the organizations, locations and practitioners they refer to. They name them by identifier with conditional references such as Practitioner?identifier=http://hl7.org/fhir/sid/us-npi|9999999499, which the server resolves to the one matching resource when it processes the transaction. Those resources must therefore be loaded first.

Load Sample Data into Haste Health​

1. Load organizations, locations and practitioners​

Load the two information files once per project:

haste-health api batch --file ~/my-synthea-data-fhir/hospitalInformation*.json
haste-health api batch --file ~/my-synthea-data-fhir/practitionerInformation*.json

2. Wait for them to be indexed​

Conditional references are resolved by search, and resources are added to the search index shortly after they are written. Before loading patients, check that the practitioners are searchable: the total returned should equal the number of Practitioner entries in the practitionerInformation file.

haste-health api search-type Practitioner "_count=0"

3. Load the patients​

for file in ~/my-synthea-data-fhir/*.json
do
case "$(basename "$file")" in
hospitalInformation*|practitionerInformation*) continue ;;
esac
haste-health api transaction --file "$file"
done

Verify Data Load​

After loading the data, you can verify that the data has been successfully imported by accessing the Haste Health admin interface or by querying the FHIR API directly.

Issues​

  • A patient bundle that fails with Conditional reference '...' matched no resources. was loaded before the organizations and practitioners it refers to were loaded and indexed. Complete steps 1 and 2, then load it again.
  • A patient bundle that fails with Conditional reference '...' matched multiple resources. refers to a resource that was loaded more than once, for example by loading the same download's information files twice. Load each download's information files only once per project.
  • Load a download's patients after that download's own information files. Another download's information files may not include the organizations and practitioners they refer to.
  • If you encounter issues related to bundle size (413 HTTP) errors, consider increasing the MAX_REQUEST_BODY_SIZE environment variable in your Docker setup. For example, set MAX_REQUEST_BODY_SIZE=8388608 for 8mb.
  • On a hosted tenant, requests are rate limited per 15-minute window (see Pricing). The free tier's budget fits any single Synthea patient and roughly 20 patients per window. A request over the limit fails with 429 and an error saying when the limit resets; wait until then before loading the remaining files.