{"slug": "i-built-pa-trace-an-on-device-medgemma-workflow-for-prior-authorization", "title": "I Built PA-Trace: An On-Device MedGemma Workflow for Prior Authorization", "summary": "A developer built PA-Trace, an on-device agentic workflow using Google's MedGemma model to automate prior-authorization documentation for imaging orders. The system extracts evidence from clinic notes, cross-references payer criteria, and assembles a structured packet with highlighted evidence spans, aiming to reduce the $35 billion annual US administrative spending tied to prior authorization. The project, submitted to Google Research's MedGemma Impact Challenge, emphasizes a human-in-the-loop, abstention-first design focused on documentation assembly rather than clinical decision-making.", "body_md": "I believe **AI can improve humanity**.\n\nBut in healthcare, that future may start with something less glamorous:\n**removing administrative friction**.\n\nThat was the idea behind **PA-Trace**, my submission to Google Research's\n[MedGemma Impact Challenge on Kaggle](https://www.kaggle.com/competitions/med-gemma-impact-challenge), which ran from **January 13, 2026** to **February 24, 2026**.\n\nAn estimated **$35 billion** of annual\n**US healthcare administrative spending** is tied to prior-authorization\nadministration, according to a\n[2024 Health Affairs Scholar paper](https://academic.oup.com/healthaffairsscholar/article/2/9/qxae096/7727862). In the public\n[PA-Trace Kaggle writeup](https://www.kaggle.com/competitions/med-gemma-impact-challenge/writeups/pa-trace-agentic-prior-auth-documentation-with-ve), I framed one narrow slice of that problem: imaging orders that require\nstaff to dig through unstructured clinic notes, cross-check payer criteria,\nand assemble a packet that can survive first-pass review.\n\nEarlier this year I built\n[Checkstand](https://www.linkedin.com/posts/eido-askayo_edgeai-gemma3n-androiddev-activity-7412454097318039552-r6fI), a local Gemma 3n submission focused on offline receipt intelligence.\nPA-Trace came from the same instinct: keep the model close to the data, keep\nprivacy boundaries simple, and solve **one workflow** well instead of\npromising magic.\n\nIf you read my earlier post\n[Hands-on Agentic AI: LangChain 1.0](https://eido-askayo.blogspot.com/2025/10/hands-on-agentic-ai-langchain-1dot0.html), the simple mental model still applies: **model + tools = agentic AI**.\n\nFor healthcare admin workflows, I would extend it like this:\n\nmodel + tools + validation + deterministic rules = something a human can actually trust\n\nIn plain English, **prior authorization** is the process of proving to a\npayer that a requested treatment, scan, or medication meets the insurer's\ncriteria before it gets approved.\n\nFor imaging, that often means showing things like symptom duration, conservative care history, and whether red-flag indications are present. None of that is conceptually exotic. The pain is operational.\n\nThe clinic note has the facts. The payer policy has the rules. The staff member has to bridge the two.\n\nThat is why this kind of work matters. Delays here do not look like dramatic AI demos. They look like back-and-forth paperwork, rejected submissions, and more waiting before the next step in care can happen.\n\nPA-Trace is an **on-device, agentic workflow** that turns:\n\ninto:\n\nThe public repo describes it as a **documentation-assembly prototype**, and\nthat is exactly the right framing.\n\nIt is not trying to diagnose the patient.\n\nIt is not trying to recommend treatment.\n\nIt is not submitting anything to a payer portal.\n\nIt is trying to make one ugly administrative handoff more structured, faster, and easier to review.\n\nThe output bundle is concrete:\n\n`packet.json`\n\n`checklist.json`\n\n`provenance.json`\n\n`packet.md`\n\n`highlights.html`\n\nThat last artifact is especially useful. It renders the clinic note with highlighted evidence spans so you can see exactly where the system found the facts it used.\n\nThis is the part that made the project more credible.\n\nA lot of healthcare AI discussion jumps quickly to diagnosis, triage, treatment planning, or clinical decision support. Those are important areas, but they also invite bigger claims, bigger safety burdens, and more room for overreach.\n\nPA-Trace stays deliberately smaller.\n\nIt focuses on **documentation assembly** for prior authorization, which is\na real bottleneck, but also a better fit for a system that should be\n**abstention-first** and **human-in-the-loop**.\n\nThat design choice shows up everywhere in the repo:\n\nThat is also why I think this project says something useful about healthcare AI more broadly.\n\nIf AI is going to improve humanity, some of that progress will not come only from grand medical breakthroughs.\n\nSome of it will come from\n**smaller systems that remove invisible friction from care**.\n\nThe local architecture is simple enough to understand, which is part of the point.\n\nThe public\n[GitHub repo](https://github.com/gryphon2411/pa-trace-starter) uses\na compact Python pipeline:\n\n`llama-cpp-python`\n\nextracts\nstructured facts from the note\n`MET`\n\n,\n`NOT_MET`\n\n, or `UNKNOWN`\n\nHere is the workflow in one view:\n\n``` php\nflowchart TD\n  A[Clinic note] --> D[Policy retrieval]\n  B[Imaging order] --> D\n  C[Payer policy] --> D\n  D --> E[MedGemma extraction]\n  E --> F[Evidence validation + baseline boost]\n  F --> G[Deterministic checklist]\n  G --> H[Packet bundle + highlights]\n```\n\nThe trust boundary is not the model alone.\n\nIt is the **harness** around the model: retrieval, evidence validation,\nfallback logic, and deterministic output rules. That is why the system is more\ninteresting to me as an engineering pattern than as a raw model demo.\n\nThe original Kaggle writeup is still the public source of truth for this project, and I still trust it.\n\nComing back to the repo later, the main picture still held. The documentation-first, abstention-first design is still the most important thing about PA-Trace, and the headline numbers from the Kaggle writeup are still the right ones to reference for the LLM workflow:\n\n| Metric | Kaggle writeup score |\n|---|---|\n`decision_accuracy` |\n1.00 |\n`provenance_valid_rate` |\n1.00 |\n`abstention_precision_on_unknown` |\n1.00 |\n`conservative_care_weeks` |\n1.00 |\n`red_flags_present` |\n0.91 |\n`symptoms_duration_weeks` |\n0.82 |\n\nOne implementation detail is worth calling out for readers who inspect the\nrepo directly: the checked-in `runs/eval/metrics.json`\n\nis a\n**baseline-mode artifact**, while the headline numbers above correspond to\nthe **LLM evaluation path**.\n\nAnother small nuance is that the current LLM evaluation covers\n**11 synthetic cases**. That does not change the public story, but it helps\nexplain the repo as it exists today.\n\nThis is the most important nuance in the whole project.\n\n**Field extraction is not perfect.**\n\nThe reason the system still looks strong is that the final checklist is conservative and deterministic.\n\nWhen I revisited the LLM path, three concrete misses stood out:\n\n`case_01`\n\n`red_flags_present = false`\n\n, but the\noutput marked `cauda_equina`\n\nfrom the phrase\n`positive straight leg raise`\n\n`case_08`\n\n`three months`\n\n`3`\n\n`case_10`\n\n`1 week`\n\n`7`\n\nThose are real misses, and they should be described honestly.\n\nBut they also explain why the project architecture matters.\n\nThe system is designed so that missing or uncertain evidence pushes the result\ntoward **review** rather than confident hallucination. That is why the\nfinal decision behavior remained stronger than the raw extraction fidelity.\n\nIn other words,\n**the project is better because it does not ask the model to do everything**.\n\nThe Kaggle writeup and the local repo are consistent on the core deployment\nidea: **keep the workflow local**.\n\nThat had a few benefits:\n\nThe README recommends roughly **6 GB of VRAM** for the CUDA path, with a\nslower CPU fallback if needed. That is not “runs anywhere instantly,” but it\nis still a very different posture from shipping notes to a remote model and\nhoping the rest of the control stack behaves.\n\nThis is also where PA-Trace feels like a natural follow-up to Checkstand for me.\n\nBoth projects came from the same local-first instinct. Keep the model close to the data. Keep the system bounded. Make privacy and observability easier, not harder.\n\nPA-Trace is still a **hackathon prototype**, and its limits matter:\n\nSo no, this is not a finished healthcare product.\n\nBut I do think it is a meaningful prototype.\n\nIt demonstrates a shape of healthcare AI that I trust more than grand claims:\nnarrow scope, visible evidence, deterministic final logic, and a willingness\nto say ** UNKNOWN** when the documentation is not strong\nenough.\n\nI still believe AI can improve humanity.\n\nWhat PA-Trace reminded me is that the version people will trust does not begin with pretending the model can do everything.\n\nIt begins with\n**narrow systems that solve real problems without pretending to do more than\nthey can**.\n\nIn healthcare, that can mean better diagnostics one day.\n\nBut it can also mean something smaller and more immediate: less paperwork friction, fewer resubmission loops, and more human time for the parts of care that actually need humans.\n\nThat is not the loudest version of AI progress.\n\nIt might be one of the most useful.", "url": "https://wpnews.pro/news/i-built-pa-trace-an-on-device-medgemma-workflow-for-prior-authorization", "canonical_source": "https://eido-askayo.blogspot.com/2026/07/i-built-pa-trace-on-device-medgemma.html", "published_at": "2026-07-08 11:06:39+00:00", "updated_at": "2026-07-08 11:07:48.180056+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-agents", "developer-tools"], "entities": ["Google Research", "MedGemma", "Kaggle", "PA-Trace", "Health Affairs Scholar", "Checkstand", "LangChain"], "alternates": {"html": "https://wpnews.pro/news/i-built-pa-trace-an-on-device-medgemma-workflow-for-prior-authorization", "markdown": "https://wpnews.pro/news/i-built-pa-trace-an-on-device-medgemma-workflow-for-prior-authorization.md", "text": "https://wpnews.pro/news/i-built-pa-trace-an-on-device-medgemma-workflow-for-prior-authorization.txt", "jsonld": "https://wpnews.pro/news/i-built-pa-trace-an-on-device-medgemma-workflow-for-prior-authorization.jsonld"}}