Spaces:
Runtime error
Download README.md from Darshankumarr03/Swift-Query: direct link, hf CLI and curl.
- Browser
- Download file 8.18 kB
-
https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/README.md
- Command line
-
hf download hf://spaces/Darshankumarr03/Swift-Query/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Darshankumarr03/Swift-Query/resolve/main/README.md
title: Swift Query
emoji: π
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: apache-2.0
short_description: Privacy-Preserving Clinical Intelligence System
SwiftQuery: Secure Medical AI with CyborgDB
A Privacy-First Healthcare OS validating Encrypted Vector Search.
OS REQUIREMENT: LINUX OR WSL (Windows Subsystem for Linux) due to the "CyborgDB Effect", this application CANNOT run on native Windows. The core
cyborgdb-coreencryption libraries currently require a Linux environment. Users on Windows MUST use WSL2 (Ubuntu 20.04+ recommended).
Project Details
SwiftQuery is a secure, AI-powered healthcare operating system designed to demonstrate the power of encrypted vector search in a medical context. It provides a platform for managing patient data, interacting with AI assistants, and ensuring that sensitive patient information remains private and secure, even during complex AI-powered searches.
The backend is built with Python and Flask, leveraging MongoDB for data storage. The AI capabilities are powered by Google's Gemini models and the Langchain framework.
The core of SwiftQuery's security model is CyborgDB.
Features
Core Features
- Secure User Authentication: Separate login and registration for doctors, patients, and assistants.
- Role-Based Dashboards: Customized dashboards for each user type, providing access to relevant information and actions.
- AI-Powered Clinical Summarization: Utilizes generative AI to create concise summaries of patient records.
- Intelligent Patient Search: Enables searching for patients based on symptoms, diagnoses, or other clinical notes.
Focus on CyborgDB: Encrypted Vector Search
CyborgDB is central to SwiftQuery's mission of providing a privacy-first healthcare platform. Here's how it's used:
- Encryption at the Core: Instead of performing similarity searches on raw, unencrypted patient data, SwiftQuery uses CyborgDB to encrypt the vector embeddings of patient information. This means that sensitive data is never exposed in its raw form during AI-powered search operations.
- Secure Similarity Search: When a doctor searches for patients with similar symptoms, the query is also encrypted and sent to CyborgDB. The similarity search is performed on the encrypted data, ensuring that the underlying patient information remains confidential.
- Privacy-Preserving AI: By integrating CyborgDB, SwiftQuery can leverage the power of AI for tasks like patient similarity search without compromising patient privacy. The AI models interact with encrypted data, not the raw, sensitive information.
- "The CyborgDB Effect": This project highlights the "CyborgDB Effect," where the use of advanced encryption technologies necessitates a specific development environment (Linux/WSL) to ensure the highest level of security. This is a deliberate design choice to prioritize security and privacy.
π Getting Started
1. Prerequisites
- OS: Linux (Ubuntu/Debian) or Windows + WSL2.
- Python: 3.9+
- MongoDB: A URI for a MongoDB Instance (Local or Atlas).
- API Keys:
GOOGLE_AI_API_KEY: For Gemini 1.5 Pro/Flash.CYBORGDB_API_KEY: For Encrypted Vector Search.
2. Installation
Clone the Repository
git clone https://github.com/Darshanroy/SwiftQuery.git cd SwiftQuerySet Up Virtual Environment
python3 -m venv .venv source .venv/bin/activateInstall Dependencies Note: This step will fail on native Windows due to CyborgDB dependencies.
pip install -r requirements.txt
3. Configuration
Create a .env file in the root directory:
# Core Secrets
SECRET_KEY=your_development_secret_key
MONGO_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/?retryWrites=true&w=majority
# AI & Encrypted Search
GOOGLE_AI_API_KEY=your_gemini_api_key
CYBORGDB_API_KEY=your_cyborgdb_api_key
# Optional: Port Configuration
PORT=8092
4. Running the Application
Use the provided helper script to start the server:
chmod +x devserver.sh
./devserver.sh
Or run manually with Python:
python3 main.py
Server will start at http://localhost:8092.
File Structure
.
βββ GEMINI.md
βββ README.md
βββ ai_agents
β βββ clinical_summarizer.py
β βββ patient_rag.py
β βββ rag_similar_patient.py
βββ app.log
βββ db.py
βββ devserver.sh
βββ documentation
β βββ backend_ai.md
β βββ backend_general.md
β βββ vectordb_integration.md
βββ global_error.txt
βββ main.py
βββ patient.py
βββ requirements.txt
βββ static
β βββ script.js
βββ templates
β βββ admin
β βββ assistant
β βββ doctor
β βββ index.html
β βββ patient
βββ tests
β βββ audit_assistants.py
β βββ check_env.py
β βββ create_chat_session_collection.py
β βββ debug_assistant_routes.py
β βββ debug_dashboard_error.py
β βββ debug_direct.py
β βββ debug_dns_python.py
β βββ debug_patient_search.py
β βββ debug_patients.py
β βββ debug_render.py
β βββ debug_simple.py
β βββ debug_uri.py
β βββ debug_uri_2.py
β βββ extract_data.py
β βββ init_db.py
β βββ inspect_db.py
β βββ inspect_patient.py
β βββ reset_db_schema.py
β βββ reset_password.py
β βββ test_google_dns.py
β βββ test_render_assistant.py
β βββ verify_fix.py
β βββ verify_history.py
β βββ verify_login.py
β βββ verify_recording.py
β βββ verify_search_mode.py
β βββ verify_view.py
β βββ verify_workflow.py
βββ utils
βββ blueprints
β βββ admin.py
β βββ ai.py
β βββ assistant.py
β βββ auth.py
β βββ chat.py
β βββ doctor.py
β βββ enhancer.py
β βββ history.py
β βββ patient.py
βββ db
β βββ db.py
β βββ helper.py
βββ logging
βββ logger.py
βββ logger_setup.py
File Details
| File/Folder | Description |
|---|---|
main.py |
The main entry point for the Flask application. It initializes the app, registers blueprints, and starts the server. |
requirements.txt |
Lists all the Python dependencies for the project. |
.env |
Configuration file for storing secrets and environment variables like API keys and database URIs. |
devserver.sh |
A shell script for convenience to run the development server. |
ai_agents/ |
Contains the core AI logic. This includes scripts for clinical summarization, patient RAG, and similar patient search using encrypted vector search. |
utils/blueprints/ |
This directory contains the Flask Blueprints, which organize the application's routes into modular components (e.g., auth.py, patient.py, doctor.py). |
templates/ |
Contains all the HTML templates for the web interface, organized by user roles (admin, assistant, doctor, patient). |
static/ |
Holds static assets such as CSS, JavaScript (script.js), and images. |
tests/ |
Contains all the testing, debugging, and utility scripts for the project. |
db.py |
Includes functions for interacting with the MongoDB database. |
patient.py |
Defines the Patient class and related functions for patient data management. |
β οΈ Known Limitations
- Windows Support: Not available. Requires WSL or Linux VM.
- Memory Usage: The local embedding model (
all-MiniLM-L6-v2) requires ~500MB RAM. - SRV Timeouts: On some WSL configurations, DNS issues may occur. The app includes a patch to force Google DNS (
8.8.8.8).
Built for the CyborgDB Hackathon. Demonstrating Encrypted Vector Search in Healthcare.