Clinical decision support demo for skin lesion analysis. Full-stack app with wearables + vision fusion, Gemini reasoning, and HAM10000 dataset integration.
/frontend– Next.js App Router + Tailwind/backend– FastAPI/sample_cases– Demo CSV files (wearables)/tools– Scripts (e.g.build_ham_index.py)
- Python 3.10+
- Node.js 18+
- Kaggle account (for HAM10000 dataset)
- Clone the repo and install dependencies
- Set up Kaggle (see Step 1 below)
- Build the HAM index (see Step 2 below)
- Set environment variables (see Step 3 below)
- Run backend (see Step 4 below)
- Run frontend (see Step 5 below)
The HAM10000 dataset is downloaded via kagglehub. Each developer needs their own Kaggle account and API token.
- Create a Kaggle account (free) at kaggle.com
- Create an API token:
- Go to Kaggle Account → API
- Click Create New Token — this downloads
kaggle.json
- Place the token:
- Put
kaggle.jsonin~/.kaggle/(e.g.~/.kaggle/kaggle.json) - Or set env vars:
KAGGLE_USERNAMEandKAGGLE_KEY
- Put
- Install kagglehub:
pip install kagglehub - Do not commit
kaggle.json— it is in.gitignore
python -c "import kagglehub; kagglehub.login()"Follow the prompts to authenticate.
Before running the backend, build the image index (this downloads the dataset via Kaggle):
pip install kagglehub
python tools/build_ham_index.pyThis will:
- Download/cache the HAM10000 dataset via kagglehub (~6GB)
- Load
HAM10000_metadata.csvfrom the project root (includes age, sex, localization) - Scan the dataset directory for image files
- Output
backend/data/ham_index.jsonwith metadata for richer Gemini reasoning
If the index is missing, the backend returns: "HAM index not built. Run: python tools/build_ham_index.py"
Note: ham_index.json is in .gitignore — each developer runs build_ham_index.py locally. Rebuild to refresh age/sex/localization: python tools/build_ham_index.py
Create backend/.env or set:
export GEMINI_API_KEY=your_gemini_api_key
export HAM_DATASET_ID=kmader/skin-cancer-mnist-ham10000
export APP_VERSION=0.1.0Create frontend/.env.local:
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
cd backend
pip install -r requirements.txt
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000Or from project root:
pip install -r backend/requirements.txt
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm install
npm run dev-
New Case (
/new-case):- Upload wearables CSV or choose "Use sample CSV"
- In "Pick Dataset Image": select class/label and click "Random sample"
- Or upload your own image
- Click "Create Case"
-
Case Analysis (
/cases/[id]):- DAG tab: Pipeline nodes + right-side reasoning panel (Gemini per-node reasoning)
- Graphs tab: Scores, CIs, heatmap
- Mock Patient tab: Load Patient A/B/C CSV, pick random mel/non-mel image, Create & Run
-
Run Analysis: Click "Run Analysis" to execute the pipeline (wearables → vision → fusion → guardrails → Gemini reasoning).
- No images in git. The HAM10000 dataset (~6GB) is downloaded/cached locally via kagglehub.
- The app works on the developer machine where the dataset is cached.
ham_index.jsonis generated locally and should not be committed (paths are machine-specific). If it was previously committed, rungit rm --cached backend/data/ham_index.jsonto stop tracking it.
The following are excluded from version control:
- Secrets:
kaggle.json,.env,.env.local,*.env.*.local - HAM10000 data:
dataset/,ham10000/,ham10000_images/,skin-cancer-mnist-ham10000/ - Generated index:
ham_index.json,backend/data/ham_index.json - Dependencies:
node_modules/,__pycache__/,.venv/,venv/ - Build output:
.next/,dist/,build/
- Never hardcode secrets.
GEMINI_API_KEYis backend-only.- Kaggle tokens: use
~/.kaggle/kaggle.jsonor env vars; do not embed in the repo.