Author: Nicholas Sunderland ([email protected])
Collaborative phenotype coding toolkit: Vue + PrimeVue frontend (Netlify) and FastAPI backend (Fly.io) with Supabase auth/DB.
frontend/: Vue 3 + Vite app (PrimeVue UI). Routes:/home,/accordionconsensus tool,/examplesgallery,/termslegal,/flowflow view.backend/: FastAPI API, Supabase DB access, seed/utility scripts (db/). Example endpoint/api/example-phenotypes.backend/db/schema.sql: Supabase schema (phenotypes, selections, consensus, codes).backend/db/ukb_cooccurrence.py: Generates co-occurrence metrics (jaccard/lift/counts) CSV for import.
Backend (FastAPI):
cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reloadFrontend (Vue):
cd frontend
npm install
npm run devCreate .env files:
backend/.env:DATABASE_URL=...,EXAMPLE_PROJECT_IDS=uuid1,uuid2,ORIGIN=http://localhost:5173, etc.frontend/.env:VITE_API_URL=http://localhost:8000,VITE_SUPABASE_URL=...,VITE_SUPABASE_ANON_KEY=....
- In Supabase: enable GitHub/Google providers; set Site URL
http://localhost:5173(and production URL), redirect URLs include both local and production. - Copy
project.supabase.coURL and anon key intofrontend/.env. - Backend uses
DATABASE_URL(service role) andEXAMPLE_PROJECT_IDSfor public examples. - RLS: ensure read-only policies for vocab tables; project/phenotype/selection policies already in
schema.sql.
From backend/db:
- Seed test data:
python seed_db_testing.py - Seed production sample:
python seed_db.py - Generate co-occurrence CSV:
python ukb_cooccurrence.py(readsbackend/.env, outputs~/Downloads/cooccurrence_web_summary.csv) Import CSV intocode_cooccurrence(ordered pairs enforced).
- Frontend (Netlify): set env vars (
VITE_API_URL,VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY); build commandnpm run build, publishfrontend/dist. - Backend (Fly.io): set
VITE_DATABASE_URL,EXAMPLE_PROJECT_IDS, CORSORIGIN; runfly deployfrombackend/.
- Frontend:
cd frontend && npm test(Vitest). - Backend:
cd backend && python -m unittest discover -s tests.
- Do not store PHI/PII in free-text fields; code selections should reference vocab only.
- Counts metric suppresses low numbers (<100). Service role bypasses RLS; public exposure should use curated endpoints only.