Download OpenAPI specification:Download
The PHDI validation service offers a REST API for validating health care messages (e.g., whether health care messages are in the proper format and contain user-defined fields of interest).
The validation service can be run using Docker (or any other OCI container runtime e.g., Podman), or directly from the Python source code.
To run the validation service with Docker follow these steps.
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
docker pull ghcr.io/cdcgov/phdi/validation:latest
. docker run -p 8080:8080 validation:latest
.Congratulations, the validation service should now be running on localhost:8080
!
We recommend running the validation service 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.
git clone https://github.com/CDCgov/phdi
./phdi/containers/validation/
.python -m venv .venv
.source .venv/bin/activate
(MacOS and Linux), venv\Scripts\activate
(Windows Command Prompt), or .venv\Scripts\Activate.ps1
(Windows PowerShell).pip install -r requirements.txt
into your virtual environment.localhost:8080
with python -m uvicorn app.main:app --host 0.0.0.0 --port 8080
.To build the Docker image for the validation service from source code instead of downloading it from the PHDI repository, follow these steps.
git clone https://github.com/CDCgov/phdi
./phdi/containers/validation/
.docker build -t validation .
.When viewing these docs from the /redoc
endpoint on a running instance of the validation service or the PHDI website, detailed documentation on the API will be available below.
Check if the value presented in the 'message' key is a valid example of the type of message specified in the 'message_type'.
message_type required | string (Message Type) Enum: "ecr" "elr" "vxu" "fhir" The type of message to be validated. |
include_error_types required | string (Include Error Types) A comma separated list of the types of errors that should be included in the return response. Valid types are fatal, errors, warnings, information |
message required | string (Message) The message to be validated. |
rr_data | string (Rr Data) If validating an eICR message, the accompanying Reportability Response data. |
{- "message_type": "ecr",
- "include_error_types": "string",
- "message": "string",
- "rr_data": "string"
}
{- "message_valid": "True",
- "validation_results": {
- "details": "Validation completed with no fatal errors!"
}
}