Spaces:
Sleeping
Sleeping
Download web/src/pages/AboutPage.tsx from TBM99/CoverageCheck: direct link, hf CLI and curl.
- Browser
- Download file 8.6 kB
-
https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/pages/AboutPage.tsx
- Command line
-
hf download hf://spaces/TBM99/CoverageCheck/web/src/pages/AboutPage.tsx
-
curl -L -o AboutPage.tsx https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/pages/AboutPage.tsx
8.6 kB
| import { ExternalLink } from 'lucide-react' | |
| import { useEffect, useState } from 'react' | |
| import { inForce } from '@/lib/format' | |
| import type { CorpusDoc } from '@/lib/types' | |
| /** What CoverageCheck is, the documents it answers from (data/manifest.csv, exported to | |
| * corpus.json), what was left out and why (data/CORPUS.md), its limits, and how it was | |
| * built with Claude Code. */ | |
| export function AboutPage() { | |
| const [corpus, setCorpus] = useState<CorpusDoc[]>([]) | |
| useEffect(() => { | |
| fetch('/data/corpus.json').then((r) => r.json()).then(setCorpus).catch(() => setCorpus([])) | |
| }, []) | |
| const laws = corpus.filter((d) => !d.form_id?.startsWith('OAP') && !d.form_id?.startsWith('OPCF')) | |
| const forms = corpus.filter((d) => !laws.includes(d)) | |
| const sections = corpus.reduce((n, d) => n + d.sections, 0) | |
| return ( | |
| <div className="h-full overflow-y-auto"> | |
| <div className="mx-auto max-w-4xl space-y-12 px-4 py-8 text-[15px] leading-relaxed"> | |
| <header className="space-y-3"> | |
| <h1 className="text-3xl font-semibold tracking-tight">About CoverageCheck</h1> | |
| <p> | |
| CoverageCheck answers underwriting questions about Ontario auto insurance from the public documents only: the | |
| FSRA policy forms and the Ontario laws they rely on. Every answer cites the text it rests on, and every quote is | |
| checked against its source. It exists to measure one thing: how much the design of retrieval changes the | |
| quality of the answers, and when a system should say "I can't determine this". | |
| </p> | |
| <p className="rounded-xl bg-amber-50 p-3 text-sm text-amber-900"> | |
| This is a portfolio demo, not an insurance tool. Its answers are not coverage advice: read the cited text, and | |
| check the edition of each form on the actual policy. | |
| </p> | |
| </header> | |
| <section className="space-y-3"> | |
| <h2 className="text-xl font-semibold tracking-tight">Three ways to answer, one model</h2> | |
| <p className="text-sm"> | |
| All three systems use the same answer model (Claude Haiku) and the same answer prompt; they differ only in what | |
| they find and show it. | |
| </p> | |
| <ul className="list-disc space-y-2 pl-5 text-sm"> | |
| <li><span className="font-medium">A 路 Naive RAG</span>: the question's 5 most similar fixed-size text windows. No structure, no policy-date filter.</li> | |
| <li><span className="font-medium">B 路 Structure-aware hybrid RAG</span>: keyword and meaning search fused, the versions in force on the policy date, a cross-encoder reranks, and the sections a passage cites are pulled in.</li> | |
| <li><span className="font-medium">C 路 Agent (LangGraph)</span>: B's search, then an LLM judge lists the facts the answer needs and which passages state each, searches again for the missing ones, keeps the passages that cover every fact, answers, and verifies each quote before replying.</li> | |
| </ul> | |
| <p className="text-sm"> | |
| In the chat, a follow-up question is first rewritten into a standalone one from the conversation, then answered by | |
| the chosen system exactly as it was tested. | |
| </p> | |
| </section> | |
| <section className="space-y-3"> | |
| <h2 className="text-xl font-semibold tracking-tight">The documents</h2> | |
| <p className="text-sm"> | |
| {corpus.length} documents ({forms.length} FSRA forms and {laws.length} laws), split into {sections} sections by | |
| their own structure, each with its stated in-force dates. | |
| </p> | |
| <div className="overflow-x-auto rounded-xl border"> | |
| <table className="w-full min-w-[36rem] text-left text-xs"> | |
| <thead className="bg-muted text-muted-foreground"> | |
| <tr> | |
| <th className="px-3 py-2 font-medium">Document</th> | |
| <th className="px-3 py-2 font-medium">Edition</th> | |
| <th className="px-3 py-2 font-medium">In force</th> | |
| <th className="px-3 py-2 text-right font-medium">Sections</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {corpus.map((d) => ( | |
| <tr key={d.doc_id} className="border-t"> | |
| <td className="px-3 py-1.5"> | |
| <span className="font-medium">{d.form_id ?? d.doc_id}</span>{' '} | |
| <span className="text-muted-foreground">{d.title}</span> | |
| {d.url && ( | |
| <a href={d.url} target="_blank" rel="noreferrer" className="ml-1 inline-flex text-primary" aria-label={`Source of ${d.doc_id}`}> | |
| <ExternalLink className="size-3" /> | |
| </a> | |
| )} | |
| </td> | |
| <td className="px-3 py-1.5">{d.version ?? 'undated'}</td> | |
| <td className="px-3 py-1.5 text-muted-foreground">{inForce(d.effective_from, d.effective_to).replace(/^in force /, '')}</td> | |
| <td className="px-3 py-1.5 text-right tabular-nums">{d.sections}</td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| <details className="text-sm"> | |
| <summary className="cursor-pointer font-medium">What was left out, and why</summary> | |
| <ul className="mt-2 list-disc space-y-1 pl-5"> | |
| <li>OPCF forms not on the FSRA forms page (8, 13C, 39 and others): questions about them are correctly unanswerable here.</li> | |
| <li>The Statutory Conditions regulation: reproduced word for word in OAP 1 Section 8.</li> | |
| <li>SABS guidelines (Minor Injury Guideline): claims handling, not policy wording.</li> | |
| <li>The rest of the Insurance Act and the laws only mentioned in passing (Family Law Act, Bank Act and others).</li> | |
| <li>The Fault Determination Rules' collision diagrams are images: only the text of each rule is indexed.</li> | |
| </ul> | |
| </details> | |
| </section> | |
| <section className="space-y-3"> | |
| <h2 className="text-xl font-semibold tracking-tight">Limitations</h2> | |
| <ul className="list-disc space-y-2 pl-5 text-sm"> | |
| <li>The test questions and their gold answers were written and reviewed by LLM agents, and every answer was graded by an LLM: neither was checked by an insurance professional.</li> | |
| <li>The FSRA forms have mostly no stated dates and only one edition each is public; the date questions rest mainly on the two SABS versions.</li> | |
| <li>System C is the most accurate and the slowest (around 20 seconds a question).</li> | |
| <li>The chat keeps the conversation in the browser tab only; a reload starts over.</li> | |
| </ul> | |
| </section> | |
| <section className="space-y-3"> | |
| <h2 className="text-xl font-semibold tracking-tight">How it was built with Claude Code</h2> | |
| <p className="text-sm"> | |
| The project was built with Claude Code as the engineer and its owner as the one who decided. The way of working | |
| mattered as much as the code: | |
| </p> | |
| <ul className="list-disc space-y-2 pl-5 text-sm"> | |
| <li><span className="font-medium">Small steps, plan first.</span> Each step began with a survey of the real data and a short plan; the owner approved the decisions before any code.</li> | |
| <li><span className="font-medium">Tests that can fail.</span> Every module has tests on synthetic and real data; a mutation check then broke each rule on purpose to prove some test catches it.</li> | |
| <li><span className="font-medium">Independent audits.</span> From data preparation to the first web page, two separate review agents (one hunting for wrong results on real data, one for design flaws) audited each step; every claim was re-checked on the data before acting on it. The last steps skipped them for time.</li> | |
| <li><span className="font-medium">An honest final test.</span> Separate agents, blind to the code and the systems' outputs, wrote and reviewed the held-out questions; the systems were frozen before it was opened; pass criteria were declared before each run.</li> | |
| <li><span className="font-medium">Cost discipline.</span> The whole project ran on a few dollars of API credit: every live run was estimated first and its spend recorded; answers were cached and replayed.</li> | |
| </ul> | |
| </section> | |
| </div> | |
| </div> | |
| ) | |
| } | |