Medical patient dashboard: patient history, medications, drug interactions (FDA), and AI-generated summaries in one place. Replaces scattered legacy systems with a single Metricare UI and API.
| Path | Purpose |
|---|---|
frontend/ |
React + Vite app. Node/npm only — run npm install and npm run dev here (not at root). |
backend/ |
FastAPI (Python). Python only — no Node; use a venv and pip install -r requirements.txt here. |
api/ |
Vercel serverless entry (wraps backend for serverless deploy). No local install. |
| Root | vercel.json, requirements.txt (for Vercel), and convenience scripts. Do not run npm install at root — only in frontend/. |
- Node.js (v18+) and npm — for the frontend.
- Python 3.9+ — for the backend. On some systems the command is
python3instead ofpython.
Always run these from the backend/ directory:
cd backend
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txtThe backend reads backend/.env. Copy the example and add your keys:
cp .env.example .envEdit backend/.env:
# Required for POST /patient/summary (AI summaries)
GEMINI_API_KEY=your_gemini_api_key_here
# Optional: use a different Gemini model (default is gemini-2.5-flash)
# GEMINI_MODEL=gemini-2.5-flash
# Optional: FDA API key (OpenFDA provides a demo key by default)
# FDA_API_KEY=your_fda_key_hereGet a Gemini API key at Google AI Studio. Use a key that matches the model (e.g. 2.5 Flash for gemini-2.5-flash).
From the backend directory (with .venv activated):
uvicorn main:app --reload --host 0.0.0.0 --port 8000Or from the project root (backend must be set up first):
npm run dev(or npm run dev:backend)
- API base URL: http://localhost:8000
- Swagger UI (interactive docs): http://localhost:8000/docs
- OpenAPI JSON: http://localhost:8000/openapi.json
If port 8000 is in use:
cd backend && uvicorn main:app --reload --host 0.0.0.0 --port 8001Install and run only from the frontend/ directory (do not run npm install at repo root):
In a separate terminal:
cd frontend
npm install
npm run devOr from the project root: npm run dev:frontend
- App: http://localhost:5173
- Landing: http://localhost:5173/
- Dashboard: http://localhost:5173/dashboard
curl http://localhost:8000/healthExpected: {"status":"healthy"}
curl http://localhost:8000/Expected: {"message":"Metricare API is running"}
Replace PATIENT_ID with any string (e.g. 123).
Get patient:
curl http://localhost:8000/patient/PATIENT_IDGet patient history:
curl http://localhost:8000/patient/PATIENT_ID/historyGet patient medications:
curl http://localhost:8000/patient/PATIENT_ID/medicationsGet contraindications (FDA-based):
curl http://localhost:8000/patient/PATIENT_ID/contraindicationsRequires GEMINI_API_KEY in backend/.env. Sends history + medications to Gemini and returns a short summary.
curl -X POST http://localhost:8000/patient/summary \
-H "Content-Type: application/json" \
-d '{
"patient_name": "Test Patient",
"history": [
{"label": "Checkup", "date": "Jan 2025", "items": ["Routine exam"]}
],
"medications": [
{"label": "Aspirin", "items": ["81mg daily"]}
]
}'Expected shape: [{"type": "diagnostic", "summary": "..."}]. If the key is missing or invalid, you get a 500 with a Gemini error message.
Search drugs by name:
curl "http://localhost:8000/drugs/search?q=aspirin"Get drug info by name:
curl http://localhost:8000/drugs/aspirin- Open http://localhost:8000/docs
- Expand an endpoint, click Try it out, set parameters or request body, then Execute.
- For POST /patient/summary, use the same JSON body as in the curl example above.
| What | Command / URL |
|---|---|
| Backend (from repo root) | npm run dev or npm run dev:backend |
| Backend (from backend/) | uvicorn main:app --reload --host 0.0.0.0 --port 8000 |
| Frontend (from repo root) | npm run dev:frontend |
| Frontend (from frontend/) | npm run dev → http://localhost:5173 |
| API docs | http://localhost:8000/docs |
| Health | http://localhost:8000/health |
backend/.env is gitignored. Do not commit API keys. If a key was ever committed, rotate it in the provider’s console.