From de00f5b8cf65000531745590cd3bdaa336b112da Mon Sep 17 00:00:00 2001 From: robertmitchellv Date: Wed, 7 Aug 2024 11:44:59 -0700 Subject: [PATCH 1/3] use json array form to solve buildx warning about shell interpretation and OS signal handling --- containers/trigger-code-reference/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers/trigger-code-reference/Dockerfile b/containers/trigger-code-reference/Dockerfile index bbdbecf32d..1d66487ad2 100644 --- a/containers/trigger-code-reference/Dockerfile +++ b/containers/trigger-code-reference/Dockerfile @@ -11,4 +11,4 @@ COPY ./seed-scripts /code/seed-scripts COPY ./description.md /code/description.md EXPOSE 8080 -CMD uvicorn app.main:app --host 0.0.0.0 --port 8080 \ No newline at end of file +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"] From 5ba64546c965a8af79b2f72b58cef080b3a883b8 Mon Sep 17 00:00:00 2001 From: robertmitchellv Date: Wed, 7 Aug 2024 12:32:02 -0700 Subject: [PATCH 2/3] move description -> README; container build/tests passed locally --- containers/trigger-code-reference/Dockerfile | 2 +- containers/trigger-code-reference/{description.md => README.md} | 0 containers/trigger-code-reference/app/main.py | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename containers/trigger-code-reference/{description.md => README.md} (100%) diff --git a/containers/trigger-code-reference/Dockerfile b/containers/trigger-code-reference/Dockerfile index 1d66487ad2..678de9c6a1 100644 --- a/containers/trigger-code-reference/Dockerfile +++ b/containers/trigger-code-reference/Dockerfile @@ -8,7 +8,7 @@ RUN pip install -r requirements.txt COPY ./app /code/app COPY ./assets /code/assets COPY ./seed-scripts /code/seed-scripts -COPY ./description.md /code/description.md +COPY ./README.md /code/README.md EXPOSE 8080 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"] diff --git a/containers/trigger-code-reference/description.md b/containers/trigger-code-reference/README.md similarity index 100% rename from containers/trigger-code-reference/description.md rename to containers/trigger-code-reference/README.md diff --git a/containers/trigger-code-reference/app/main.py b/containers/trigger-code-reference/app/main.py index 33b3d13502..6bcb33cc8d 100644 --- a/containers/trigger-code-reference/app/main.py +++ b/containers/trigger-code-reference/app/main.py @@ -26,7 +26,7 @@ app = BaseService( service_name="Trigger Code Reference", service_path="/trigger-code-reference", - description_path=Path(__file__).parent.parent / "description.md", + description_path=Path(__file__).parent.parent / "README.md", openapi_url="/trigger-code-reference/openapi.json", ).start() From 73234e28e1405dbb89fa8e2e06595d8246d891af Mon Sep 17 00:00:00 2001 From: robertmitchellv Date: Wed, 7 Aug 2024 12:33:03 -0700 Subject: [PATCH 3/3] add tcr arc diagram --- containers/trigger-code-reference/README.md | 48 ++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/containers/trigger-code-reference/README.md b/containers/trigger-code-reference/README.md index 5cfbf521de..e410cc0ca3 100644 --- a/containers/trigger-code-reference/README.md +++ b/containers/trigger-code-reference/README.md @@ -1,4 +1,4 @@ -## Getting Started with the DIBBs Trigger Code Reference Service +## Getting Started with the DIBBs Trigger Code Reference Service ### Introduction @@ -6,13 +6,13 @@ The DIBBs Trigger Code Reference (TCR) service offers a REST API devoted to quer ### Running the Trigger Code Reference Service -You can run the TCR using Docker. another OCI container runtime (e.g., Podman), or directly from the Python source code. +You can run the TCR using Docker. another OCI container runtime (e.g., Podman), or directly from the Python source code. #### Running with Docker (Recommended) To run the trigger code reference with Docker, follow these steps. -1. Confirm that you have Docker installed by running docker -v. If you don't see a response similar to what's shown below, follow [these instructions](https://docs.docker.com/get-docker/) to install Docker. +1. Confirm that you have Docker installed by running docker -v. If you don't see a response similar to what's shown below, follow [these instructions](https://docs.docker.com/get-docker/) to install Docker. ``` ❯ docker -v @@ -26,7 +26,7 @@ Congratulations, the TCR should now be running on `localhost:8080`! #### Running from Python Source Code -We recommend running the TCR from a container, but if that isn't feasible for a given use case, you can also run the service directly from Python using the steps below. +We recommend running the TCR from a container, but if that isn't feasible for a given use case, you can also run the service 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`. @@ -47,4 +47,42 @@ To build the Docker image for the trigger code reference from source instead of ### The API -When viewing these docs from the `/redoc` endpoint on a running instance of the TCR or the DIBBs website, detailed documentation on the API will be available below. +When viewing these docs from the `/redoc` endpoint on a running instance of the TCR or the DIBBs website, detailed documentation on the API will be available below. + +### Architecture Diagram + +```mermaid +flowchart LR + +subgraph requests["Requests"] + direction TB + subgraph GET["fas:fa-download GET"] + hc["/\n(Health Check)"] + getValueSets["/get-value-sets\n(Get Value Sets for Condition)"] + end + subgraph POST["fas:fa-upload POST"] + stampConditionExtensions["/stamp-condition-extensions\n(Stamp Condition Extensions)"] + end +end + +subgraph service[REST API Service] + direction TB + subgraph container["fab:fa-docker container"] + tcr["fab:fa-python trigger-code-reference
HTTP:8080/
"] + db["fas:fa-database SQLite DB"] + end +end + +subgraph response["Responses"] + subgraph JSON["fa:fa-file-alt JSON"] + rsp-hc["fa:fa-file-code OK fa:fa-thumbs-up"] + rsp-getValueSets["fa:fa-file-code Value Sets"] + rsp-stampConditionExtensions["fa:fa-file-code Stamped Bundle"] + end +end + +hc -.-> tcr -.-> rsp-hc +getValueSets -.-> tcr -.-> rsp-getValueSets +stampConditionExtensions ==> tcr ==> rsp-stampConditionExtensions +tcr --> db +```