Inspiration

What it does

How we built it

Challenges we ran into

Inspiration

Over 40% of older adults take 5 or more concurrent medications (polypharmacy), leading to over 1.3 million emergency room visits annually from preventable adverse drug events. Traditional clinical decision-support tools rely on flat, pairwise lookup tables that miss 3-to-4-hop biological collisions—such as Omeprazole inhibiting the hepatic CYP2C19 enzyme needed to activate Clopidogrel—while depending on high-latency cloud APIs that compromise patient privacy in rural or bedside clinics.

What it does

SafeMeds 3D Graph Studio embeds Relate by Neo4j directly in-process via a single portable 176 KB graph file (./data/safemeds.rl) paired with an interactive Three.js WebGL 3D Pharmacological Stage:

  • 4-Lane 3D Spatial Graph & One-Click Safe Swap: Visualizes Active Intake, Active Molecules, Red Enzyme/Conflict Nodes, and Safe Alternatives in 3D. Clinicians or patients can resolve severe blocks in one click with animated 3D transitions and instant Undo.
  • Sub-9ms "Ask SafeMeds Agent" & Reverse Symptom Tracer: Compiles natural-language safety questions into read-only AST-guarded openCypher queries (< 9ms) and traces adverse symptoms backward ((:Symptom)<-[:CAN_CAUSE]-(:Ingredient)<-[:CONTAINS]-(:Medicine)) to pinpoint the exact culprit drug.
  • 5-Slot Smart Daily Routine & Vital Organ Load Meters: Enforces food-drug chelation spacing gaps (e.g., 3-hour separation between Ciprofloxacin and dairy) and tracks cumulative Kidney, Liver, GI, and CNS strain.

How we built it

  • Graph Engine: Rust-powered Relate by Neo4j single-file store (safemeds.rl) modeling 53 medications, 25 active ingredients, 5 hepatic CYP450 enzymes, 12 dietary items, 10 chronic conditions, 15 adverse symptoms, and 4 vital organ systems.
  • Backend & Safety Guardrails: Python + FastAPI serving deterministic openCypher traversals protected by a strict read-only Cypher AST validator (403 Forbidden on write mutations).
  • 3D Frontend & Deployment: Three.js (WebGL) spatial stage with dynamic bounding-box camera framing, deployed on Hugging Face Spaces (ZeroGPU) with Docker and GitHub CI sync.

Challenges we ran into

  • 3D Camera Framing Across Regimen Sizes: Scaling dynamically from 2-drug regimens to 5-item polypharmacy graphs initially caused peripheral nodes to clip outside the viewport. We solved this by computing real-time 3D bounding boxes and automatically adjusting camera distance and vertical offsets.
  • Stateless Container Persistence & ZeroGPU Runtime: Serving a custom Three.js + FastAPI app with local .rl graph persistence inside Hugging Face ZeroGPU required a custom Gradio Blocks + FastAPI route-injection entrypoint with automatic non-root storage fallback.

Accomplishments that we're proud of

  • Achieving deterministic multi-hop openCypher queries in < 9ms inside a self-contained 176 KB database file with zero cloud roundtrips.
  • Delivering a transparent clinical interface where every AI answer and Safe Swap recommendation is backed by an inspectable, real-time Cypher execution trace.

What we learned

Modeling pharmacology natively as a property graph makes 3-to-4-hop enzyme inhibition, food-drug chelation, and reverse symptom attribution dramatically faster, simpler, and more explainable than relational SQL JOINs.

What's next

  • Adding FHIR / HL7 electronic health record (EHR) import, pharmacogenomic CYP450 metabolizer phenotypes (poor vs. ultra-rapid metabolizers), and offline PWA tablet support for bedside clinical teams. ## Accomplishments that we're proud of

What we learned

What's next for SafeMeds 3D Graph Studio

Built With

Share this project:

Updates

Submission history