Now you can remove these instructions from the readme,
This is a simple Flask API that provides Get/Post/Patch services for documents in the Encounter collection. This API uses data from a backing Mongo Database, and supports a Single Page Application.
The OpenAPI specifications for the api can be found in the docs folder, and are served here
- Mongo Compass - if you want a way to look into the database
pipenv installpipenv run testpipenv run localpipenv run startpipenv run containerThis will build the new container, and {re}start the mongodb and API container.
NOTE: Assumes the API is running at localhost:8088
pipenv run stepciRun Load Tests
pipenv run loadGenerates loads of test data
/srcthis folder contains all source code/src/server.pyis the main entrypoint, which initializes the configuration and registers routes with Flask/src/config/config.pyis the singleton config object that manages configuration values and acts as a cache for enumerators and other low volatility data values./src/modelscontains helpers related to creating transactional data objects such as breadcrumbs or RBAC tokens/src/routescontains Flask http request/response handlers/src/servicesservice interface that wraps database calls with RBAC, encode/decode, and other business logic/src/utils/mongo_io.pyis a singleton that manages the mongodb connection, and provides database io functions to the service layer./testthis folder contains unit testing, and testing artifacts. The sub-folder structure mimics the/srcfolder
If you want to do more manual testing, here are the curl commands to use
This endpoint supports the prometheus monitoring standards for a healthcheck endpoint
curl http://localhost:8088/api/health/curl http://localhost:8088/api/config/curl http://localhost:8088/api/encounter/eeee00000000000000000001/curl -X POST localhost:8088/api/encounter/ \
-H "Content-Type: application/json" \
-d '{"date":"2024-12-07 00:00:00","mentorId":"aaaa00000000000000000005","personId":"aaaa00000000000000000024","planId":"eeff00000000000000000004","status":"Active"}'curl -X PATCH localhost:8088/api/encounter/eeee00000000000000000001 \
-H "Content-Type: application/json" \
-d '{"status":"Archived"}'curl http://localhost:8088/api/plan/eeff00000000000000000002/curl -X POST localhost:8088/api/plan/ \
-H "Content-Type: application/json" \
-d '{"name":"test"}'curl -X PATCH localhost:8088/api/plan/eeff00000000000000000002 \
-H "Content-Type: application/json" \
-d '{"status":"Archived"}'curl http://localhost:8088/api/people/curl http://localhost:8088/api/mentors/The api/config/ endpoint will return a list of configuration values. These values are either "defaults" or loaded from an Environment Variable, or found in a singleton configuration file of the same name. Configuration files take precedence over environment variables. The variable "CONFIG_FOLDER" will change the location of configuration files from the default of ./
The api/health/ endpoint is a Prometheus Healthcheck endpoint.
The Dockerfile uses a 2-stage build, and sup8090s both amd64 and arm64 architectures.