test_server

command
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

README

FHIR Bulk Data Test Server

test_server is a HTTP Server which serves (part of) the FHIR Bulk Data APIs spec. It is geared towards load testing or reproducible integration testing with a sequence of expected requests returning fixed data, rather than supporting arbitrary requests to simulate the behaviour of a real server.

Test Data Folder Structure

The server runs based on NDJSON files under the directory given in the --data_dir flag, which should be organised as follows:

{--data_dir}/{export_group_id}/{timestamp}/{resource_type}_{index}.ndjson

Timestamp should be of the form YYYYMMDDTHHMMSSZ (e.g. 20230217T142649Z). This compact form avoids special characters which cannot be used in file paths on Windows. For the provided export_group_id, the server will provide the dataset with the earliest timestamp which is greater than the _since parameter (or the earliest timestamp overall if the _since parameter is unset).

If no dataset exists with a timestamp greater than the _since parameter, this server will return a 404 error to the initial $export call - this is assumed to be an error in setting up the test. If you wish to test the case of there being no changes to the data, or no data at all, you should add a timestamp folder which is empty.

Default Synthetic Data Options

There are two default Synthetic Data options if you don't want to upload your own. If --data_dir flag is not provided the synthetic dataset in the synthetic_testdata folder will be used. The FHIR Patient resource changes names from OldFamilyName, OldGivenName to NewFamilyName, NewGivenName between timestamps.

If the --synthea flag is provided upon startup the test_server will download a zip of synthetic FHIR generated by the Synthea Patient Generator from https://github.com/synthetichealth/synthea-sample-data/raw/master/downloads/synthea_sample_data_fhir_r4_nov2021.zip. The Synthea FHIR transaction bundles are converted to ndjson and saved in the `{--data_dir}/group_id_synthea/20230222T150000Z folder. The Synthea data contains 1000 synthetic patients (About 1GB of FHIR data with most FHIR Resource Types). More information can be found in the Synthea documentation.

If the --synthea flag is set the --data_dir flag must also be set. The --synthea_rows_per_ndjson flag determines how many FHIR resources are stored in each ndjson file. For example, if the zip contains 800 FHIR Observations and synthea_rows_per_ndjson=500 then Observation_0.ndjson will hold 500 FHIR Observations and Observation_1.ndjson will hold the remaing 300.

Documentation

Overview

Binary test_server is a HTTP Server which serves (part of) the Bulk FHIR Export interface. It is geared towards load testing and reproducible integration testing. See README for more information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL