PHDI Orchestration (1.2.11)

Download OpenAPI specification:Download

Getting Started with the DIBBs Orchestration

Introduction

The PHDI Orchestration app offers a REST API for processing messages through a series of microservices.

Running Orchestration

The Orchestration app can be run using Docker (or any other OCI container runtime e.g., Podman), or directly from the Python source code.

To run the Orchestration app with Docker, follow these steps.

  1. Confirm that you have Docker installed by running docker -v. If you do not see a response similar to what is shown below, follow these instructions to install Docker.
    ❯ docker -v
    Docker version 20.10.21, build baeda1f
    
  2. Download a copy of the Docker image from the PHDI repository by running docker pull ghcr.io/cdcgov/phdi/orchestration:latest.
  3. Run the service with docker run -p 8080:8080 orchestration:latest.

Congratulations, the Orchestration app should now be running on localhost:8080!

Running from Python Source Code

We recommend running the Orchestration app from a container, but if that is not feasible for a given use-case, it may also be run directly from Python using the steps below.

  1. Ensure that both Git and Python 3.10 or higher are installed.
  2. Clone the PHDI repository with git clone https://github.com/CDCgov/phdi.
  3. Navigate to /phdi/containers/orchestration/.
  4. Make a fresh virtual environment with python -m venv .venv.
  5. Activate the virtual environment with source .venv/bin/activate (MacOS and Linux), venv\Scripts\activate (Windows Command Prompt), or .venv\Scripts\Activate.ps1 (Windows Power Shell).
  6. Install all of the Python dependencies for the Orchestration app with pip install -r requirements.txt into your virtual environment.
  7. Run the Orchestration app on localhost:8080 with python -m uvicorn app.main:app --host 0.0.0.0 --port 8080.

Building the Docker Image

To build the Docker image for the Orchestration app from source instead of downloading it from the PHDI repository follow these steps.

  1. Ensure that both Git and Docker are installed.
  2. Clone the PHDI repository with git clone https://github.com/CDCgov/phdi.
  3. Navigate to /phdi/containers/orchestration/.
  4. Run docker build -t orchestration ..

The API

When viewing these docs from the /redoc endpoint on a running instance of the Orchestration app or the PHDI website, detailed documentation on the API will be available below.

Health Check

Check service status. If an HTTP 200 status code is returned along with '{"status": "OK"}' then the service is available and running properly.

Responses

Response samples

Content type
application/json
{
  • "status": "OK"
}

Process Endpoint

Wrapper function for unpacking an uploaded file, determining appropriate parameter and application settings, and applying a config-driven workflow to the data in that file. This is one of two endpoints that can actually invoke and apply a config workflow to data and is meant to be used to process files.

:param message_type: The type of stream of the uploaded file's underlying data (e.g. ecr, elr, etc.). If the data is in FHIR format, set to FHIR. :param data_type: The type of data held in the uploaded file. Eligible values include ecr, zip, fhir, and hl7. :param config_file_name: The name of the configuration file to load on the service's back-end, specifying the workflow to apply. :param upload_file: A file containing clinical health care information. :return: A response holding whether the workflow application was successful as well as the results of the workflow.

Request Body schema: multipart/form-data
message_type
string (Message Type)
data_type
string (Data Type)
config_file_name
string (Config File Name)
upload_file
string <binary> (Upload File)

Responses

Response samples

Content type
application/json
Example
{
  • "message": "Processing succeeded!",
  • "content": {
    }
}

Process Message Endpoint

Wrapper function for unpacking a message processing input and using those settings to apply a config-driven workflow to a raw string of data. This endpoint is the second of two workflow-driven endpoints and is meant to be used with raw string data (meaning if the data is JSON, it must be string serialized with json.dumps).

:param request: A response holding whether the workflow application was successful as well as the results of the workflow.

Request Body schema: application/json
message_type
required
string (Message Type)
Enum: "ecr" "elr" "vxu" "fhir"

The type of message to be validated.

data_type
required
string (Data Type)
Enum: "ecr" "zip" "fhir" "hl7"

The type of data of the passed-in message. Must be one of 'ecr', 'fhir', or 'zip'. If data_type is set to 'zip', the underlying unzipped data is assumed to be ecr.

config_file_name
required
string (Config File Name)

The name of a config file in either the default/ or custom/ schemas directory that will define the workflow applied to the passed data.

required
Message (object) or Message (string) (Message)

The message to be validated.

rr_data
string (Rr Data)

If an eICR message, the accompanying Reportability Response data.

Responses

Request samples

Content type
application/json
{
  • "message_type": "ecr",
  • "data_type": "ecr",
  • "config_file_name": "string",
  • "message": { },
  • "rr_data": "string"
}

Response samples

Content type
application/json
Example
{
  • "message": "Processing succeeded!",
  • "content": {
    }
}

List Configs

Get a list of all the process configs currently available. Default configs are ones that are packaged by default with this service. Custom configs are any additional config that users have chosen to upload to this service (this feature is not yet implemented)

Responses

Response samples

Content type
application/json
{
  • "default_configs": [
    ],
  • "custom_configs": [ ]
}

Get Config

Get the config specified by 'processing_config_name'.

:param processing_config_name: The name of the processing configuration to retrieve. :param response: The response object used to modify the response status and body.

path Parameters
processing_config_name
required
string (Processing Config Name)

Responses

Response samples

Content type
application/json
{
  • "message": "Config found!",
  • "workflow": {
    }
}

Upload Config

Upload a new processing config to the service or update an existing config.

:param processing_config_name: The name of the processing configuration to be uploaded or updated. :param input: A Pydantic model representing the processing configuration data. :param response: The response object used to modify the response status and body.

path Parameters
processing_config_name
required
string (Processing Config Name)
Request Body schema: application/json
required
object (Workflow)

A JSON-formatted config dict containing a single key workflow that maps to a list of WorkflowServiceStep objects, each defining one step in the orchestration configuration to upload.

overwrite
boolean (Overwrite)
Default: false

When true if a config already exists for the provided name it will be replaced. When false no action will be taken and the response will indicate that a config for the given name already exists. To proceed submit a new request with a different config name or set this field to true.

Responses

Request samples

Content type
application/json
{
  • "workflow": {
    },
  • "overwrite": false
}

Response samples

Content type
application/json
{
  • "message": "Config uploaded successfully!"
}