Spaces:
Runtime error
Runtime error
|
Download documentation/backend_general.md from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 2.34 kB
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/documentation/backend_general.md
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/documentation/backend_general.md
-
curl -L -o backend_general.md https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/documentation/backend_general.md
2.34 kB
SwiftQuery Backend Documentation
Overview
SwiftQuery is a Flask-based web application designed to assist doctors with patient management, clinical note enhancement, and AI-powered insights. It uses MongoDB as its primary database and integrates various AI services (Google Gemini, Groq, CyborgDB).
Architecture
- Framework: Flask (Python)
- Database: MongoDB (accessed via
Flask-PyMongo) - Authentication: Session-based with
bcryptfor password hashing. - AI Integration: Modular agents in
ai_agents/for RAG and text processing.
Key Directories
utils/blueprints/: Contains the route logic for different user roles (Admin, Doctor, Patient, Assistant, Chat).utils/db/: Database configuration (db.py) and schema definitions.ai_agents/: Logic for RAG pipelines and clinical summaries.static/&templates/: Frontend assets and HTML files.
Setup & Configuration
- Environment Variables: Managed via
.env(requiresMONGO_URI,GOOGLE_AI_API_KEY,GROQ_API_KEY,CYBORGDB_API_KEY,SECRET_KEY). - Dependencies: Listed in
requirements.txt. Install viapip install -r requirements.txt. - Run: Execute
python main.pyto start the server.
Blueprints
1. Auth (auth.py)
- Handles user login for all roles (Doctor, Admin, Patient, Assistant).
- Manages session creation and destruction (
/logout).
2. Admin (admin.py)
- Manage Users: Add/Delete Doctors, Assistants, and Patients.
- Patient ID: Generates structured IDs like
SQ-2024-001.
3. Doctor (doctor.py)
- Dashboard: View assigned patients.
- Session Management: Start/End sessions to activate AI context.
- Recording: Upload audio for transcription.
4. Patient (patient.py)
- Read-Only Access: View medical history, consultations, reports, and bills.
- Reports: Download test reports.
5. Assistant (assistant.py)
- Data Entry: Add medical records (History, Consultations, Tests, Treatments) for patients.
- Account Creation: Helper interface for creating new accounts.
Database Schema
Collections include:
patient: Core profile.doctor,admin,administrativeassistant: User roles.medicalhistory,consultation,testreport,treatment: Clinical records.chatsession,chatmessage: AI interaction logs.