Download OpenAPI specification:Download
The PHDI tabulation service offers a REST API to extract and tabulate data from a FHIR server according to a user-defined schema, and then persist the data in one of serveral supported formats. More information about this process and writing schemas can be found here.
The tabulation 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 tabulation 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/tabulation:latest
. docker run -p 8080:8080 -v $(pwd):/code tabulation:latest
.Congratulations, the tabulation service should now be running on localhost:8080
!
We recommend running the tabulation 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/tabulation/
.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 tabulation service from source code instead of downloading it from the PHDI repository, follow these steps.
git clone https://github.com/CDCgov/phdi
./phdi/containers/tabulation/
.docker build -t tabulation .
.When viewing these docs from the /redoc
endpoint on a running instance of the tabulation service or the PHDI website, detailed documentation on the API will be available below.
This endpoint will extract, tabulate, and persist data from a FHIR server according to a user-defined schema in the method of the user's choosing.
schema required | object (Schema) A JSON formatted PHDI schema. |
output_type required | string (Output Type) Enum: "parquet" "csv" "sql" Method for persisting data after extraction from the FHIR server and tabulation. |
fhir_url | string (Fhir Url) The URL of the FHIR server from which data should be extracted, should end with '/fhir'. If not provided here then it must be set as an environment variable. |
cred_manager | string (Cred Manager) Enum: "azure" "gcp" Chose a PHDI credential manager to use for authentication with the FHIR. May be set here or as an environment variable. If not provided anywhere then un-authenticated FHIR server requests will be attempted. |
{- "schema": { },
- "output_type": "parquet",
- "fhir_url": "string",
- "cred_manager": "azure"
}
null