A containerized Patient Documentation System built with Python, FastAPI, and SQLModel. Designed to allow doctors to document patient interactions and review medical history.
- Document Interactions: Record health outcomes (Healthy, Monitor, Critical) and notes.
- View History: Retrieve chronological history of interactions for a specific patient.
- Demographics: Tracks Name, DOB, and Gender. Note: The system allows multiple patients with identical names/birthdays to exist. Uniqueness is guaranteed by system ID, not demographics.
- Clean Architecture: Modular structure separating Domain, Application, and Infrastructure layers.
- Type Safety: Strictly typed Python using Pydantic and SQLModel.
- Containerized: Docker-ready for consistent deployment.
- Docker & Docker Compose
-
Start the Application
docker compose up --build
-
Access the API Documentation Open your browser to http://localhost:8000/docs to see the Swagger UI.
-
Run Tests
docker compose run --rm api pytest
If you wish to run locally without Docker:
-
Install generic dependencies (Poetry):
pip install poetry poetry install
-
Run the server:
poetry run uvicorn app.main:app --reload
-
Run linting/formatting:
poetry run ruff check . poetry run ruff format . poetry run mypy app
See TECHNICAL_CONCEPT.md for a detailed breakdown of the architectural decisions.
This project is licensed under the terms of the MIT license.
This project was accelerated by the usage of the following open-source resources:
- Full Stack FastAPI Template: Used for the initial project structure, Docker configuration, and toolchain setup.
- Netflix Dispatch: Architectural inspiration for the Interaction/Outcome domain modeling and timestamp handling patterns.
The system has a built-in middleware for simulating failures.
-
Header:
X-Simulation-Mode -
Values:
error(503),latency(2s delay). -
Usage:
# Simulate Failure curl -v -H "X-Simulation-Mode: error" http://localhost:8000/api/v1/patients/ # Simulate Latency curl -v -H "X-Simulation-Mode: latency" http://localhost:8000/api/v1/patients/