Add payer appeals-letter app (Aayush Mishra) - #10
Open
aayushmishraaa wants to merge 1 commit into
Open
Conversation
An API-driven app that drafts insurance appeal letters from a denial reason and a clinical fact, routed through human approval before anything is exported. Verified against the live API. Given a CARC 197 prior-authorisation denial and the fact that authorisation PA-2026-8823 was obtained and valid on the date of service, the drafted letter reads: "This determination should be reconsidered because prior authorization PA-2026-8823 was obtained from the payer on 2026-02-19 and was valid on the date of service, directly addressing the stated denial reason." The part worth reading is app/grounding.py. A model given a denial reason and a clinical fact writes a fluent appeal letter whether or not the fact answers the denial, and when they do not match it bridges the gap by inventing clinical detail. In a payer appeal that is a false statement submitted to an insurer over a clinician's name — so relevance is checked BEFORE drafting and the verdict is shown to the reviewer before they read a word of the letter. When the fact does not fit, the app still drafts — refusing would push the user to write it by hand with no warning at all — but drafts honestly. Given a prior-authorisation denial and a fact about seasonal allergies it produced: "Please note that the documentation directly addressing the prior authorization requirement is not enclosed with this letter." No invented rebuttal. The gate is real: export returns 409 while any decision is outstanding, and the several approval rounds a large edit produces are surfaced rather than letting a reviewer believe they have seen the whole letter. In a live run of four changes with three approved and one rejected, the exported .docx still carries the untouched placeholder for the rejected section — the rejection is visible in the artefact, not only in a log. Everything is fictional and the UI says so in a banner that does not dismiss. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aayush Mishra
An API-driven app that drafts insurance appeal letters from a denial reason and a clinical fact, routed through human approval before anything is exported. A reviewer types one fictional denial reason and one clinical fact; the drafted letter addresses that denial using that fact, and nothing leaves the app unreviewed.
Built for the SuperDocs engineer task.
Verified against the live API
Input: CARC 197 — prior authorisation absent + "Prior authorization PA-2026-8823 was obtained on 2026-02-19 and was valid on the date of service."
Output: "This determination should be reconsidered because prior authorization PA-2026-8823 was obtained from the payer on 2026-02-19 and was valid on the date of service, directly addressing the stated denial reason."
Held at HITL, exported as
.docxonly after review.The part worth reading:
app/grounding.pyA model given a denial reason and a clinical fact writes a fluent appeal letter whether or not the fact answers the denial — and when they don't match, it bridges the gap by inventing clinical detail. In a payer appeal that isn't a bad user experience; it's a false statement submitted to an insurer over a clinician's name.
So relevance is checked before drafting, and the verdict is shown to the reviewer before they read a word.
When the fact doesn't fit, the app still drafts — refusing would just push the user to write it by hand with no warning at all — but drafts honestly. Given a prior-auth denial and a fact about seasonal allergies, it produced:
No invented rebuttal. It also flags concrete specifics (numbers, dates, dosages) that appear in the letter but in none of the inputs — a payer will verify each one.
The gate is real
.docxstill carries the untouched placeholder for the rejected section — the rejection is visible in the artefact, not only in a logSuperDocs surfaces used
chat/asyncwithapproval_mode: ask_every_time·jobs/{id}polling ·chat/{session}/approve·documents/export·sessions/{id}/jobsfor recovering a wedged session.The letter starts from a template document rather than being generated from nothing — appeal letters have a house format a compliance team already approved, and starting from a document means targeted edits on named sections.
Notes
Everything is fictional; the UI says so in a banner that doesn't dismiss. Limitations are stated plainly in the README — in-memory drafts, a deliberately coarse relevance check, and one fact per appeal.