Contains code for steps in clin pipelines.
Main-Class : FileImport
This application import files metadata into FHIR. Input files are located in object store. Each batch of files contains :
- a metadata.json that contains the metadata of files and details about experiments
- a list of files that needs to be imported in clin. For each patient it is expected to have a CRAM + CRAI, a VCF + TBI, a qaulity report file (TGZ). Each file is listed in metatadata.json. If a file is missing, the application exits in error.
The image below illustrate the process :
First, FHIR resources are built and validated against the server. Then, if resources are valid, files are moved to final destination. Initial filenames are replaced by uuid. Then, a bundle containing FHIR resources to create/update is sent to the server.If this operation fails, a rollback of files happens.
Main-Class : FhirExport
This application is used to export data from fhir in NDJSON format and import this data in a bucket on an object store.
sbt assembly
docker build -t clin-pipelines .
Configuration (Typesafe Config) is defined in file application.conf. Some attributes can be overridden by environment variables. For instance :
AWS_ACCESS_KEY
/AWS_SECRET_KEY
: credentials for object storeAWS_ENDPOINT
: object store urlAWS_BUCKET_NAME
: Bucket where are input filesAWS_OUTPUT_BUCKET_NAME
: Bucket where copy output filesAWS_OUTPUT_PREFIX
: Prefix where to copy output filesKEYCLOAK_URL
: Keycloak authentication server urlKEYCLOAK_CLIENT_KEY
/KEYCLOAK_CLIENT_SECRET
: Credentials for keycloakKEYCLOAK_REALM
FHIR_URL
: Fhir Server URLFERLOAD_URL
: Ferload instance server url. This is used to build DocumentReference urls.
It's possible to run the application from any IDE. Just configure environment variables and run the desired main class.
There are 2 ways running tests :
- Running tests
Before running tests, required containers are automatically started if they are not already running. Containers are then automatically stopped and deleted. For running test from sbt :
sbt test
- Starts containers aside, and then running tests
Because starting and initializing FHIR containers takes time, it's also possible to start containers aside and run test. To start a container you can start main application in one of those class :
- MinioServer : Start a minio server
- FhirServer : Start a fhir server
- WholeStack : Start a fhir server + a minio server
After each test execution, data created by tests is cleaned up, but containers are kept up and running.