All commands

Copy-paste recipes for Docker, training, trust jobs, tests, and the docs site.

1. Install & run

# Clone
git clone https://github.com/ranasl62/ehr-chronic-disease-risk-prediction.git
cd ehr-chronic-disease-risk-prediction

# One-command stack (prepare → API :8000 → Angular :8080)
docker compose up --build
# or: make researcher-up
# background: make researcher-up-d
# stop: make researcher-down

# Pull published Docker Hub images (no local build; repos must be public)
docker compose -f docker-compose.yml -f docker-compose.publish.yml pull
docker compose -f docker-compose.yml -f docker-compose.publish.yml up
# or: make researcher-up-pull
# images: ranasl62/ehr-risk-api:latest · ranasl62/ehr-risk-web:latest

# Optional env / GPU overrides
cp .env.example .env
# cp docker-compose.override.example.yml docker-compose.override.yml

# Local Python API
pip install -r requirements.txt && pip install -e .
PYTHONPATH=. uvicorn api.main:app --reload --port 8000

# Local Angular (proxies API)
cd web && npm install && npm start

2. Train / compare / trust

# Train (demo longitudinal)
make train
# Patient-grouped split + bootstrap
make train-patient
# Temporal split
make train-temporal

# CLI package
ehr-ai train --help
PYTHONPATH=. python -m training.train \
  --format longitudinal --data data/demo/ehr_data.csv --model logreg

# Leakage audit & SHAP
make leak-audit
make shap

# Paper-style synthetic + quick experiments (local academic package)
make -C research-paper paper-quick

3. API smoke (curl)

curl -sS http://127.0.0.1:8000/health | jq .
curl -sS http://127.0.0.1:8000/v1/workspace/status | jq .
curl -sS 'http://127.0.0.1:8000/v1/datasets/profile?path=data/demo/ehr_data.csv' | jq .
curl -sS 'http://127.0.0.1:8000/v1/datasets/profile?path=data/demo/ehr_data.csv&age_band=50_59' | jq .
curl -sS http://127.0.0.1:8000/v1/model/schema | jq .
curl -sS -X POST http://127.0.0.1:8000/v1/predict \
  -H 'Content-Type: application/json' \
  -d '{"features":{"w7d_glucose":120},"include_explanation":false}'

When API_KEY is set, add -H 'X-API-Key: …'. In the UI, save the key under Config.

4. Tests

# Backend
PYTHONPATH=. pytest tests/ -q --tb=short
# or via API container
docker compose exec -T api python -m pytest tests/ -q --tb=short

# UI contract + live smoke
docker compose exec -T api python -m pytest tests/test_ui_api_contract.py tests/test_live_api_smoke.py -q

# Frontend
cd web && npm run test:ci

# Both
make test-all

5. Documentation website

# Preview
cd docs && python3 -m http.server 4173

# Refresh UI screenshots (stack must be up)
bash scripts/capture_docs_website_screenshots.sh

# GitHub Pages deploys from docs via .github/workflows/pages.yml

6. Make targets

make install
make test
make test-web
make test-all
make train
make train-patient
make train-temporal
make leak-audit
make shap
make docker-smoke
make researcher-up
make researcher-up-d
make researcher-down
make researcher-logs

# Academic paper verification (research-paper/ is local-only / gitignored)
make -C research-paper paper-synth
make -C research-paper paper-quick
make -C research-paper mimic-lock