Clinicians routinely juggle heterogeneous data, patient history, physical examination findings, laboratory panels, haematological morphology, and imaging results, across disconnected systems. This fragmentation introduces risk: relevant findings get overlooked, evidence retrieval is inconsistent, and diagnostic reasoning is not reproducible across encounters.
Aletheia: Clinical Workstation consolidates all clinical inputs into a single structured workspace and delegates synthesis to a purpose-built AI reasoning pipeline powered by Google Gemini. It returns a fully structured, versioned, and citation-verified differential diagnosis report within a single session, no cloud account required, no data leaving your machine.
Designed for individual clinical practitioners, research fellows, and academic departments evaluating AI-assisted diagnostic reasoning. Available as a standalone desktop application or deployed locally as a web application.
Browse, search, tag, and archive all clinical cases from a single disciplined interface.
↑ Casebook listing with active/archived state.
Structured clinical input forms alongside a live-rendered AI report — side by side.
↑ Left panel: Anamnesis, Physical Exam, Laboratory, and Morphological data forms. Right panel: Rendered structured report with inline citations.
Version-controlled differential diagnosis with confidence shifts and rank movement across report iterations.
↑ Differential evolution timeline comparing V1 → V2 → V3 with certainty bands and evidence counts.
Editorial-grade, fully structured clinical reports with PubMed-verified inline citations.
↑ Report rendered in TeX Gyre Termes with Vancouver-formatted references, confidence bars, and severity indicators.
Case Management: Full CRUD lifecycle for clinical cases with soft-archival, permanent deletion, and tag-based classification. Clinical sections (Anamnesis, Physical Exam, Laboratory, Morphological Data) are stored as typed JSON aggregates.
AI Reasoning Pipeline: A ten-stage orchestrated reasoning engine (ReasoningOrchestrationService) that performs deterministic preprocessing, structured prompt assembly, Gemini inference, response parsing, citation verification against PubMed E-utilities, deduplication, certainty policy enforcement, language enhancement, and immutable version persistence.
PubMed Evidence Grounding: Asynchronous NCBI E-utilities client with rate-limit enforcement, exponential back-off, per-PMID cache-stampede prevention, and automatic fallback metadata. Every citation in the report is verified against PubMed.
Evidence Cache: Global SHA-256-keyed evidence cache that de-duplicates grounding API calls across all cases, reducing redundant Gemini calls. Configurable TTL with soft-invalidation support.
Follow-Up Timeline: Append-only delta event system recording incremental clinical updates per case for longitudinal tracking without duplicating the full case state.
Report Version History: Immutable, append-only structured report snapshots with per-case versioning, differential evolution tracking, and multi-dimensional confidence scoring.
Export Services: One-click PDF export (via ReportLab with TeX Gyre Termes typography) and PowerPoint export (via python-pptx), both served as file streams.
Settings Management: Runtime key-value settings store managing API keys, grounding toggles, cache TTL, and export preferences, no schema migrations required.
Ensure the following tools are available in your system PATH:
| Tool | Minimum Version | Check |
|---|---|---|
| Python | 3.11 | python --version |
| Node.js | 18.0 | node --version |
| npm | 9.0 (bundled with Node 18) | npm --version |
| Git | Any | git --version |
Aletheia is available both as a standalone desktop application and as a locally-hosted web application.
- Navigate to the Releases page of this repository.
- Download the latest
.ziprelease file for your Linux system. - Extract the
.ziparchive. - From the extracted folder, you can either:
- Run the
.AppImagedirectly. - Run the
./install.shscript to install Aletheia to your system's applications menu. (You can remove it later using./uninstall.sh).
- Run the
Note: The desktop version is a self-contained application that bundles the required dependencies. You will still need an API key for Google Gemini.
git clone https://github.com/biowess/aletheia.git
cd aletheiacp backend/.env.example backend/.envOpen backend/.env and set your API key:
# Required — get yours at https://aistudio.google.com
GEMINI_API_KEY=your_gemini_api_key_here
# Optional — upgrades PubMed rate limit from 3 req/s to 10 req/s
# Register at https://www.ncbi.nlm.nih.gov/account/
NCBI_API_KEY=your_ncbi_api_key_hereNote: You can also set the Gemini API key after launch via the in-app Settings page (
/settings), which writes the value to the local database at runtime.
Linux / macOS:
chmod +x initialize.sh
./initialize.shWindows:
Unfortunately, this project currently only supports Linux (native or via WSL 2).
Due to differences in OS loopback and DNS routing behaviors between Linux and Windows, running the development server natively on Windows will result in proxy connection errors (ECONNREFUSED). Native Windows compatibility is planned for a future release.
That's it. The launcher automatically:
- Bootstraps a lightweight python virtual environment
- Installs required Python and Node.js dependencies
- Orchestrates parallel server startup
- Starts both the FastAPI server and Vite dev server, then opens
http://localhost:5173
You can pass standard launcher flags directly:
# Start without auto-opening the browser
./initialize.sh --no-browserFor development scenarios where you want full control:
Backend
cd backend
python -m venv .venv
# macOS / Linux
source .venv/bin/activate
# Windows
.venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadFrontend (in a separate terminal)
cd frontend
npm install
npm run devAll variables go in backend/.env. Copy backend/.env.example as your starting point.
| Variable | Required | Default | Description |
|---|---|---|---|
GEMINI_API_KEY |
✅ | (empty) | Google Gemini API key for AI inference |
NCBI_API_KEY |
☐ | (empty) | NCBI PubMed key — upgrades rate limit to 10 req/s |
DEBUG |
☐ | false |
Enable debug mode |
LOG_LEVEL |
☐ | INFO |
Logging level (DEBUG, INFO, WARNING, ERROR) |
DATABASE_URL |
☐ | sqlite+aiosqlite:///./clinical_workstation.db |
Database connection string |
GEMINI_MODEL |
☐ | gemini-3.1-flash-lite |
Gemini reasoning model |
GEMINI_GROUNDING_ENABLED |
☐ | true |
Enable PubMed search grounding |
MAX_EVIDENCE_CACHE_AGE_HOURS |
☐ | 72 |
Evidence cache TTL in hours |
PDF_OUTPUT_DIR |
☐ | ./exports |
Directory for generated PDF/PPTX exports |
BACKEND_HOST |
☐ | 0.0.0.0 |
Host to bind the backend server |
BACKEND_PORT |
☐ | 8000 |
Backend server port |
CORS_ORIGINS |
☐ | http://localhost:5173 |
Allowed CORS origins (comma-separated) |
aletheia/
│
├── launcher.py # Unified bootstrapper - single entry point
│
├── backend/ # Python / FastAPI server
│ ├── main.py # App factory, lifespan, CORS, route registration
│ ├── requirements.txt
│ ├── .env.example # Environment variable template
│ └── app/
│ ├── core/
│ │ ├── config.py # pydantic-settings Settings class
│ │ ├── database.py # Async SQLAlchemy engine, session factory, init_db()
│ │ └── logging.py # loguru configuration
│ ├── models/ # SQLAlchemy ORM models
│ │ ├── case.py # Case (JSON columns for clinical sections)
│ │ ├── report_version.py
│ │ ├── follow_up_entry.py
│ │ ├── evidence_cache.py
│ │ └── app_settings.py
│ ├── schemas/ # Pydantic request/response schemas
│ ├── api/
│ │ ├── router.py # API v1 router aggregator
│ │ └── routes/ # cases, follow_ups, reasoning, export, admin
│ ├── services/ # Business logic layer
│ │ ├── case_service.py
│ │ ├── reasoning_service.py # 10-stage orchestration facade
│ │ ├── pubmed_client.py # NCBI E-utilities async client
│ │ ├── evidence_cache_service.py
│ │ ├── pdf_export_service.py
│ │ └── pptx_export_service.py
│ └── reasoning/
│ ├── prompts.py # Structured prompt assembly
│ ├── parser.py # JSON extraction + json-repair
│ ├── preprocessing.py # Deterministic lab/exam heuristics
│ ├── certainty.py # Certainty policy enforcement
│ ├── grounding.py # Gemini search grounding service
│ └── providers/ # AI provider abstraction (GeminiProvider)
│
└── frontend/ # React 19 / TypeScript SPA
└── src/
├── App.tsx # React Router shell
├── pages/ # CasebookPage, NewCasePage, CaseWorkspacePage, SettingsPage
├── components/
│ ├── layout/ # AppShell, WorkspaceSplitPane, ClinicalInputPanel
│ ├── report/ # ReportRenderer, ReportVersionList, ConfidenceBar, etc.
│ ├── timeline/ # TimelinePanel, TimelineEntry, AddFollowUpModal
│ ├── forms/ # AnamnesisForm, PhysicalExamForm, LaboratoryForm, MorphologicalForm
│ ├── casebook/ # CaseCard, EmptyState
│ └── ui/ # Spinner, Toast, SplashScreen, ErrorBanner, LoadingSkeleton
├── stores/ # Zustand + Immer: caseStore, reportStore, settingsStore, uiStore
├── api/ # Typed fetch wrappers: cases, reasoning, export, followUps, settings
└── types/ # TypeScript interfaces for all domain entities
Request flow:
Browser (React SPA)
→ Zustand Store (async actions)
→ API Client (fetch wrapper → /api/v1)
→ Vite Dev Proxy (→ localhost:8000)
→ FastAPI Router
→ Route Handler (Pydantic validation, DB session injection)
→ Service Layer (business logic)
→ SQLAlchemy AsyncSession (SQLite)
→ Google Gemini API
→ NCBI PubMed E-utilities
The FastAPI backend auto-generates interactive documentation at runtime:
| Interface | URL |
|---|---|
| Swagger UI | http://localhost:8000/docs |
| ReDoc | http://localhost:8000/redoc |
| OpenAPI JSON | http://localhost:8000/openapi.json |
| Health check | http://localhost:8000/api/health |
# Activate the virtual environment first
source backend/.venv/bin/activate # macOS / Linux
# or: backend\.venv\Scripts\activate # Windows
# Install dev dependencies
pip install -r backend/requirements-dev.txt
# Run all tests
cd backend && pytest
# Run a specific test file
pytest tests/test_pubmed_client.py -v
# Run with coverage report
pytest --cov=app --cov-report=htmlFrontend
cd frontend
npm run build
# Output: frontend/dist/
# Preview the production build locally
npm run previewBackend (with Gunicorn)
cd backend
source .venv/bin/activate
pip install gunicorn
gunicorn main:app \
-k uvicorn.workers.UvicornWorker \
--workers 4 \
--bind 0.0.0.0:8000 \
--access-logfile - \
--error-logfile -
⚠️ Remove the--reloadflag for production. Use Gunicorn for process supervision instead.
| Layer | Technology | Role |
|---|---|---|
| Bootstrapper | Python 3.11+ (launcher.py) |
Environment validation, venv, npm install, port resolution, process supervision |
| Web Framework | FastAPI ≥ 0.111 | Async ASGI framework, OpenAPI generation, Pydantic integration |
| ASGI Server | Uvicorn[standard] ≥ 0.29 | Production ASGI server with uvloop and httptools |
| ORM | SQLAlchemy 2.0 (async) | AsyncSession, Mapped columns, async query execution |
| DB Driver | aiosqlite ≥ 0.20 | Non-blocking asyncio-compatible SQLite driver |
| Data Validation | Pydantic v2 | All request/response bodies, DTOs, settings |
| Configuration | pydantic-settings ≥ 2.0 | Type-safe .env management |
| LLM Provider | google-genai ≥ 1.0 | Gemini inference + search grounding |
| HTTP Client | httpx ≥ 0.27 | Async client for PubMed E-utilities |
| Retry Logic | tenacity ≥ 8.0 | Exponential back-off for API calls |
| PDF Export | ReportLab ≥ 4.0 | Structured clinical PDF with custom typography |
| PPTX Export | python-pptx ≥ 0.6.23 | PowerPoint report export |
| Logging | loguru ≥ 0.7 | Structured logging with rotation and gzip compression |
| JSON Repair | json-repair ≥ 0.30 | Fault-tolerant LLM JSON output recovery |
| Frontend Framework | React 19 + TypeScript | SPA |
| Build Tool | Vite | Dev server with API proxy, production build |
| Styling | Tailwind CSS | Semantic design token system (clinical.*, aletheia.* namespaces) |
| State Management | Zustand + Immer | Global domain state with mutation-style updates |
| Animation | Framer Motion 12 | Splash screen, panel reveals, physics-based transitions |
| UI Font | IBM Plex Sans | Clinical, serious tone |
| Report Font | EB Garamond | Editorial, scholarly report rendering |
Aletheia uses a canonical brand palette designed for clinical precision and trust:
| Token | Hex | Usage |
|---|---|---|
--aletheia-navy |
#162C41 |
Primary text, headings, interactive states |
--aletheia-slate |
#4F606F |
Secondary text, subheadings |
--bg-primary |
#F5F8FB |
Page background |
--border-default |
#D7E2EC |
Default borders and dividers |
--state-stable |
#3E6B61 |
Stable diagnostic state indicator |
--state-evolving |
#C58A2B |
Evolving diagnostic state indicator |
--confidence-high |
#244B73 |
High-confidence differential display |
The design philosophy: clinical, elegant, precise, restrained. No rounded pills, no neon gradients, no startup aesthetic. Every component is designed to feel like a precision instrument.
Near-term
- OS keychain integration for secrets management (replace
.envplaintext storage) - Gemini streaming responses with progressive report section rendering
- Thread pool execution for PDF/PPTX export (prevent event-loop blocking)
- Implement cross-platform IPv4/IPv6 dual-binding for Windows compatibility.
Mid-term
- PostgreSQL migration with asyncpg (unblock concurrent writes)
- Alembic migration pipeline for schema evolution
- JWT-based authentication middleware for shared/network deployments
- Comprehensive pytest-asyncio test suite
Long-term
- Multi-user / multi-tenant architecture with row-level isolation
- OpenTelemetry observability stack (Jaeger / Tempo)
- Additional AI provider backends (Claude, GPT-4o) via
BaseAIProviderabstraction - Docker Compose deployment (FastAPI + PostgreSQL + Nginx)
Custom: see LICENSE for details.





