1 line
4.8 KiB
JSON
1 line
4.8 KiB
JSON
{"repo": "aarushshah2/delirium-poc-phase-2", "files": {"README.md": {"8cab6343a654ae507ce77404bd6a94119a41e2e0": {"t": 1785674377.3883982, "n": 4531, "h": "c52442d10d0ce1a6", "c": "# Delirium POC — ICU Delirium Monitoring Platform\n\nFull-stack proof-of-concept for ICU delirium detection and monitoring.\n\n**Phase 2:** Speech pipeline (Whisper), NLP coherence (spaCy + LLM), orientation Q&A (SOMC/CAM-ICU) \n**Phase 3:** Continuous bedside monitoring, weighted risk engine, WebSocket alerts \n**Portal:** JWT auth with Admin, Doctor, Nurse, and Patient role-based UIs\n\n**Project walkthrough (video script + cover letter):** [WALKTHROUGH.md](./WALKTHROUGH.md)\n\n---\n\n## Prerequisites\n\n- Python 3.10+\n- [ffmpeg](https://ffmpeg.org/) — required by Whisper (`brew install ffmpeg` / `apt install ffmpeg`)\n- **LLM API key** — Groq recommended (`OPENAI_API_KEY` + `OPENAI_BASE_URL`); Ollama optional for local use\n\n---\n\n## Setup\n\n```bash\n# 1. Clone / navigate to project\ncd delirium_phase2\n\n# 2. Create virtual environment\npython -m venv venv\nsource venv/bin/activate # Windows: venv\\Scripts\\activate\n\n# 3. Install dependencies\npip install -r requirements.txt\n\n# 4. Download spaCy model\npython -m spacy download en_core_web_sm\n\n# 5. Configure environment\ncp .env.example .env # set OPENAI_API_KEY (Groq) and DATABASE_URL\n\n# 6. Start the API\n./scripts/demo-start.sh\n# or: DISABLE_HARDWARE_MONITORING=True PORT=8000 python main.py\n```\n\nOpen **http://localhost:8000/auth** in your browser. Default admin: `admin@hospital.com` / `password123`.\n\n---\n\n## Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `DATABASE_URL` | `postgresql://localhost/delirium_db` | PostgreSQL or `sqlite:///delirium_db.sqlite3` |\n| `OPENAI_API_KEY` | — | Required for coherence/orientation (Groq or OpenAI) |\n| `OPENAI_BASE_URL` | `https://api.openai.com/v1` | Use `https://api.groq.com/openai/v1` for Groq |\n| `OPENAI_MODEL` | `gpt-4o-mini` | e.g. `llama-3.3-70b-versatile` on Groq |\n| `DISABLE_HARDWARE_MONITORING` | `False` | Set `True` for cloud/laptop demo without camera/mic |\n| `WHISPER_MODEL` | `base` | Whisper model size: `tiny`, `base`, `small`, `medium`, `large` |\n| `PORT` | `8000` | API port |\n\nSee [`.env.example`](./.env.example) for JWT, SMTP, and other production vars.\n\n```bash\n# Example: Groq + cloud demo mode\nOPENAI_API_KEY=gsk_... OPENAI_BASE_URL=https://api.groq.com/openai/v1 \\\n DISABLE_HARDWARE_MONITORING=True ./scripts/demo-start.sh\n```\n\n---\n\n## API Endpoints\n\n### Speech Pipeline\n| Method | Path | Description |\n|--------|------|-------------|\n| `POST` | `/api/transcribe` | Upload audio → Whisper transcription + speech metrics |\n| `POST` | `/api/transcribe-and-analyze` | Transcribe + run coherence in one call |\n\n### Coherence Analysis\n| Method | Path | Description |\n|--------|------|-------------|\n| `POST` | `/api/analyze` | Analyze text → spaCy + Ollama coherence score |\n\n### Orientation Module\n| Method | Path | Description |\n|--------|------|-------------|\n| `POST` | `/api/orientation/session` | Create assessment session |\n| `GET` | `/api/orientation/question` | Get next question for session |\n| `POST` | `/api/orientation/answer` | Submit answer + response time → score |\n| `GET` | `/api/orientation/summary` | Full session summary + risk assessment |\n| `GET` | `/api/orientation/questions` | List full question bank |\n\nFull interactive docs: **http://localhost:8000/docs**\n\n---\n\n## Scoring Reference (POC Spec)\n\n| Response Type | Score |\n|---------------|-------|\n| Correct, ≤ 5s | +1.0 |\n| Correct, 5–10s | +0.75 |\n| Correct, > 10s | +0.5 |\n| Incorrect | 0.0 |\n| No response | −1.0 |\n\nA **3-point cumulative decline** over recent responses triggers a trend flag.\n\n---\n\n## Coherence Risk Tiers\n\n| Score | Tier |\n|-------|------|\n| 80–100 | Low |\n| 55–79 | Moderate |\n| 35–54 | High |\n| 0–34 | Critical |\n\nComposite = 40% structural (spaCy) + 60% semantic (Ollama).\n\n---\n\n## Notes\n\n- LLM (Groq/OpenAI) powers coherence and orientation; rule-based fallbacks apply if the API is unreachable.\n- Whisper runs locally for batch transcription; live mic uses faster-whisper when hardware monitoring is enabled.\n- Orientation sessions and auth persist to PostgreSQL/SQLite via SQLAlchemy.\n- Deploy with Docker: `docker build -t delirium-poc .` or use [`render.yaml`](./render.yaml) for Render.\n- The `/api/transcribe-and-analyze` endpoint is the recommended integration point for Phase 1's video pipeline handoff.\n\n---\n\n## Phase Integration\n\n```\nPhase 1 (Video) ──► /api/transcribe-and-analyze ──► Phase 2 coherence score\n │\n feeds Risk Engine (Phase 3)\n```\n"}}}} |