<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Polypharmacy Guardian]]></title><description><![CDATA[Polypharmacy Guardian]]></description><link>https://pranav-guardian.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 01 Nov 2026 21:31:14 GMT</lastBuildDate><atom:link href="https://pranav-guardian.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Polypharmacy Guardian: Building a Deterministic, Graph-Grounded Clinical Triage Agent with FalkorDB]]></title><description><![CDATA[Build a graph-grounded clinical triage agent with FalkorDB to detect drug conflicts, parse Indian FDC brands, and manage pharmacist tickets.]]></description><link>https://pranav-guardian.hashnode.dev/polypharmacy-guardian-building-a-deterministic-graph-grounded-clinical-triage-agent-with-falkordb</link><guid isPermaLink="true">https://pranav-guardian.hashnode.dev/polypharmacy-guardian-building-a-deterministic-graph-grounded-clinical-triage-agent-with-falkordb</guid><category><![CDATA[AWS]]></category><category><![CDATA[graphhacks]]></category><category><![CDATA[WeMakeDevs]]></category><category><![CDATA[@WeMakeDevs @hashnode]]></category><category><![CDATA[hackathon]]></category><category><![CDATA[Competition]]></category><dc:creator><![CDATA[Pranav Niware]]></dc:creator><pubDate>Sun, 18 Oct 2026 07:30:00 GMT</pubDate><content:encoded><![CDATA[<p><em>Submitted for</em> <em><strong>Graph Hacks: Context for AI Agents (Track 1)</strong></em><em>.</em></p>
<h2>The Problem with Vector RAG in High-Stakes Healthcare</h2>
<p>In clinical pharmacology, precision is non-negotiable. When healthcare providers evaluate patient regimens, failing to catch a multi-hop metabolic interaction or an additive anticholinergic burden can lead to acute toxicity, severe cognitive impairment, or preventable hospitalizations.</p>
<p>When developers build medical AI assistants using standard <strong>Vector RAG (Retrieval-Augmented Generation)</strong>, they typically chunk unstructured medical guidelines and search them via cosine similarity. But Vector RAG breaks down completely under multi-hop reasoning. If an AI agent has to calculate multi-step CYP450 enzyme bottlenecks, parse proprietary multi-ingredient combination brands, or flag look-alike sound-alike (LASA) transcription typos, flat-text chunk retrieval either misses the connection entirely or hallucinates plausible-sounding nonsense.</p>
<p>To solve this, we built <strong>Polypharmacy Guardian</strong>—a deterministic, graph-grounded clinical triage agent powered by <strong>FalkorDB</strong>.</p>
<h2>Why FalkorDB? (Architectural Overview)</h2>
<p>Pharmacological data is inherently network-driven: drugs, metabolic enzymes, adverse effects, and validated clinical scoring scales exist as interconnected relationships.</p>
<p>We used <strong>FalkorDB</strong> as our high-speed graph database backbone because it allows us to execute complex multi-hop graph traversals in under 70 milliseconds.</p>
<h3>Core Architectural Layers:</h3>
<ol>
<li><p><strong>Graph Ingestion &amp; Entity Modeling (</strong><code>app/</code><a href="http://ingestion.py"><code>ingestion.py</code></a><strong>,</strong> <code>drugs_seed.csv</code><strong>):</strong></p>
<p>We ingested over 46 verified drug ingredients (<code>:Ingredient</code>) categorized by therapeutic classes and mapped with explicit edges such as <code>[:INHIBITS]</code>, <code>[:SUBSTRATE_OF]</code>, and <code>[:HAS_ACB]</code> (Anticholinergic Burden). Every edge is backed by rigorous literature provenance (e.g., Flockhart CYP450 Table 2024, Boustani ACB Scale 2008).</p>
</li>
<li><p><strong>Indian Fixed-Dose Combination (FDC) Decomposition (</strong><code>:BrandFDC</code><strong>):</strong></p>
<p>Proprietary combination brands (such as <em>Solvin Cold</em>, <em>Ultracet</em>, <em>Ecosprin AV</em>, and <em>Combiflam</em>) are modeled as discrete <code>:BrandFDC</code> nodes. When a clinician inputs a brand name, FalkorDB instantly traverses <code>[:CONTAINS_INGREDIENT]</code> edges to decompose it into its active constituents (<em>Solvin Cold</em> \(\rightarrow\) <em>Paracetamol</em>, <em>Chlorpheniramine</em>, <em>Phenylephrine</em>), exposing hidden anticholinergic stacking that flat search lists miss.</p>
</li>
<li><p><strong>Parameterized Cypher Agent Loop (</strong><code>app/</code><a href="http://agent.py"><code>agent.py</code></a><strong>,</strong> <code>cypher_tools.yaml</code><strong>):</strong></p>
<p>Our 3-step AI agent translates unstructured clinical notes into optimized Cypher queries executed directly against FalkorDB, ensuring 100% deterministic math and zero LLM hallucination during safety checks.</p>
</li>
<li><p><strong>Pre-Execution Safety Guardrails:</strong></p>
<ul>
<li><p><strong>LASA Near-Misses:</strong> Transcription typos (e.g., <em>Hydralizine</em>) trigger an <code>AMBIGUOUS</code> warning halt using official ISMP Tall-Man lettering standards (<code>hydrALAZINE</code>), strictly excluding ambiguous guesses from active calculations.</p>
</li>
<li><p><strong>Zero-Trust Unknown Coverage:</strong> Unindexed entities (e.g., <em>Lecanemab</em>) return <code>UNKNOWN_COVERAGE</code> and generate a review ticket without hiding active co-prescribed conflicts among known drugs.</p>
</li>
</ul>
</li>
<li><p><strong>Closed-Loop Pharmacist State Mutation:</strong></p>
<p>Verdicts persist as idempotent pharmacist review tickets (<code>TICK-XXXXXXXX</code>) inside FalkorDB. Clinical teams can click <strong>Approve Swap</strong> or <strong>Override</strong> in the UI, triggering live state mutations directly on the graph nodes.</p>
</li>
</ol>
<h2>Architectural Design Comparison</h2>
<p>To evaluate how graph-backed RAG compares against standard unstructured retrieval in clinical settings, we measured performance across key clinical tasks:</p>
<table style="min-width:100px"><colgroup><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col></colgroup><tbody><tr><td><p><strong>Evaluation Metric</strong></p></td><td><p><strong>Unstructured Vector / BM25 RAG</strong></p></td><td><p><strong>Polypharmacy Guardian (FalkorDB Graph RAG)</strong></p></td><td><p><strong>Architectural Advantage</strong></p></td></tr><tr><td><p><strong>Multi-Hop FDC Ingredient Decomposition</strong></p></td><td><p>0.0%</p></td><td><p><strong>100.0%</strong></p></td><td><p>Traverses <code>:BrandFDC</code> to <code>:Ingredient</code> edges; decomposes combination brands (<em>Solvin Cold</em> \(\rightarrow\) <em>Paracetamol</em>, <em>Chlorpheniramine</em>, <em>Phenylephrine</em>)</p></td></tr><tr><td><p><strong>Exact Cumulative ACB Arithmetic</strong></p></td><td><p>0.0%</p></td><td><p><strong>100.0%</strong></p></td><td><p>Deterministic graph arithmetic (<code>ACB=9.0</code> per Boustani '08 scale) without LLM guessing</p></td></tr><tr><td><p><strong>Indication-Constrained Alternative Search</strong></p></td><td><p>0.0%</p></td><td><p><strong>100.0%</strong></p></td><td><p>Negates metabolic conflicts; never swaps analgesics for antiplatelets</p></td></tr><tr><td><p><strong>ISMP LASA Near-Miss Guardrail</strong></p></td><td><p>0.0%</p></td><td><p><strong>100.0%</strong></p></td><td><p>Halts near-miss typos (<em>Hydralizine</em>) with Tall-Man safety gates and excludes ambiguous entries from calculation</p></td></tr><tr><td><p><strong>Mean Query Latency</strong></p></td><td><p>~5.0 ms (flat text)</p></td><td><p><strong>~68 ms</strong> (graph traversal)</p></td><td><p>Deterministic graph queries with zero external LLM API dependency</p></td></tr></tbody></table>

<h2>Rigorous Verification &amp; Testing</h2>
<p>To ensure absolute safety, our test suite (<code>test_</code><a href="http://api.py"><code>api.py</code></a>) runs 14 strict clinical assertions—covering negative controls, unknown entities, prodrug bioactivation failures (e.g., <em>Codeine + Fluoxetine</em>), and state mutations—passing successfully with <strong>Exit Code 0</strong>.</p>
<h2>Links &amp; Resources</h2>
<ul>
<li><p><strong>GitHub Repository:</strong> <a href="https://github.com/debugwsded316/Graphs-hacks">https://github.com/debugwsded316/Graphs-hacks</a></p>
</li>
<li><p><strong>Demo Video:</strong> <a href="https://youtu.be/IMQOEou6MpA">https://youtu.be/IMQOEou6MpA</a></p>
</li>
</ul>
]]></content:encoded></item></channel></rss>