Inspiration

What it does

How we built it

Challenges we ran into## Inspiration

During an emergency, an internet blackout, or in a rural clinic, cloud-dependent healthcare AI completely stalls. Clinicians cannot afford a 500ms network round-trip, and medical data privacy regulations (HIPAA, GDPR) strictly forbid unencrypted patient vitals, clinical observations, and notes from being transmitted to third-party cloud servers.

We were inspired to build EdgeMed: an autonomous, 100% offline-first clinical memory platform that brings lightning-fast AI semantic search and structured patient history directly to edge devices at the point of care—without ever requiring an internet connection.

What it does

EdgeMed is a local-first clinical decision-support and memory platform powered by embedded Qdrant Edge:

  • Sub-10ms Hybrid Retrieval: Combines on-device dense vector embeddings with sparse lexical search using Reciprocal Rank Fusion (RRF $k=60$) to query 10,000+ clinical records in under $8.9\text{ ms}$ ($p50$).
  • Encrypted Ground Truth: Stores all records, longitudinal vitals, and revision histories inside a tamper-evident, AES-256-CBC encrypted SQLCipher database with HMAC-SHA256 audit chaining.
  • Offline Multi-Branch Conflict Resolution: When multiple clinicians edit records asynchronously on different tablets during an outage, EdgeMed uses a Git-like Directed Acyclic Graph (DAG) to preserve divergent branches and provide audited 3-way conflict adjudication instead of silent overwrites.
  • Zero-Egress Privacy Guard: Enforces physical barrier rules where patient observations remain strictly LOCAL_ONLY, while only approved reference guidelines sync to central systems over Ed25519-signed mTLS 1.3 channels.
  • 4 Integrated Clinician Workspaces: A responsive React 19 interface providing Visual Data Logging, Synthetic Patient Rosters (longitudinal charts & allergy alerts), Sync Monitor & Network Degradation Lab, and Memory & Hybrid Search Engine.

How we built it

We designed a Canonical-First Dual-Projection Architecture:

  • Core Vector Engine: Embedded Qdrant Edge (Rust) running locally on device, indexing 384-dimensional cosine embeddings generated by on-device FastEmbed ONNX (BAAI/bge-small-en-v1.5).
  • Lexical Postings Index: A custom, persistent SQLite inverted index (lexical_postings) powering sub-3ms keyword search without memory thrashing.
  • Canonical Storage: SQLCipher 4 with PBKDF2 key derivation, strict multi-tenant ward isolation (ward-a, ward-b), and fail-closed keyrings.
  • Perimeter Security: FastAPI backend guarded by BoundedHTTP middleware (32 KiB payload cap, timing-safe CSRF tokens, strict Origin/Host validation).
  • Frontend SPA: Built with React 19, TypeScript, and Vite, featuring custom SVG trendlines and accessible Catppuccin Latte & Mocha themes.

Challenges we ran into

  1. The 10k-Record Memory Thrashing Bottleneck: Naive in-memory lexical scoring exceeded 32 MiB on low-power devices, causing search latency to spike over $100\text{ ms}$. We engineered a persistent sparse inverted postings index with precomputed document frequencies ($O(1)$ query prep), slashing hybrid search latency from $101.5\text{ ms}$ to $8.9\text{ ms}$ ($11.4\times$ faster).
  2. The "Zombie Projection" Trap: When records are updated or tombstoned in SQLCipher, naive vector caches often return stale search hits. We instituted a strict Canonical Current-Head Gate that cross-verifies all vector candidates against active database heads before returning results.
  3. Decentralized Offline Conflicts: Care teams updating the same patient chart concurrently offline caused destructive overwrites. We resolved this by modeling all memory updates as an append-only revision DAG that surfaces multi-head branching directly to doctors.

Accomplishments that we're proud of

  • Achieving $8.9\text{ ms}$ $p50$ hybrid search latency across a 10,000-record clinical dataset entirely on local edge hardware with zero cloud calls.
  • $77 / 77$ automated backend integration and security tests passing, accompanied by 4 end-to-end Playwright browser test suites.
  • Authoring a comprehensive, production-grade Threat Model (THREAT_MODEL.md) detailing trust boundaries, ward-level isolation, and cryptographic fail-safes.
  • Delivering a fully usable, polished clinician interface across 4 distinct workspaces with keyboard navigation (Ctrl+K) and network simulation tools.

What we learned

  • How to deeply integrate and optimize Qdrant Edge and ONNX runtimes for resource-constrained edge machines.
  • The power of decoupled dual-projection architectures (treating vector search as an ephemeral index subordinate to an encrypted source-of-truth).
  • How to implement cryptographic zero-egress guards that mathematically prevent data leaks in distributed networks.

What's next for edgemed

  • Native Mobile Packaging: Compiling EdgeMed as an on-device local engine for Android/iOS bedside tablets.
  • Hospital IdP Integration: Adding enterprise SAML/OIDC authentication bridges for hospital intranet deployment.
  • Wearable Sensor Ingestion: Streaming real-time BLE telemetry from patient monitors directly into EdgeMed's encrypted time-series revision stream.

Accomplishments that we're proud of

What we learned

What's next for edgemed

Built With

  • argon2
  • bm25
  • cryptography
  • docker
  • edge-computing
  • fastapi
  • fastembed
  • healthcare
  • hybrid-search
  • offline-first
  • onnx
  • playwright
  • pytest
  • python
  • qdrant
  • qdrant-edge
  • react
  • render
  • sqlcipher
  • sqlite
  • typescript
  • vector-search
  • vite
Share this project:

Updates

Submission history