Builds PaperTrail from the base skeleton into a full evidence-verification platform for the "Built with Claude: Life Sciences" hackathon (Builder Track). New named-user features (Build Beyond the Bench): - Lab Notebook Companion — rough bench notes -> structured, searchable, grounded experiment records (lib/labNotebook, /console/lab-notebook, migration 0059) - Clinical Trial Matcher — de-identified patient notes -> ranked eligible ClinicalTrials.gov trials with per-criterion inclusion/exclusion reasoning (lib/trialMatcher, /console/trial-matcher, migrations 0060) Platform: - Deterministic verification moat (biostats recompute, exact-span grounding) - 11 biomedical evidence engines (FAERS, GWAS, Open Targets, ChEMBL, ClinVar, PharmGKB, PubTator, DDI, repurposing, biomarker, unified verifier) - Evidence Intelligence (KG, dossier, provenance/export, RWE) + enterprise governance (RBAC, /api/v1 gateway, metering, audit chain, retention) - 17 OSS projects assimilated into native TypeScript on our stack (backend/engines retained + credited in NOTICE) - Multi-format upload (PDF/DOCX/XLSX/CSV/MD/TXT), logo, marketing site - Next.js 16 upgrade, benchmark harness (honest smoke-test caveat) Licensing: Apache-2.0 (LICENSE + NOTICE).
87 lines
3.2 KiB
TypeScript
87 lines
3.2 KiB
TypeScript
import type { PrismaAutopilotResult } from "@/lib/prisma/autopilot";
|
|
|
|
// The synthesised evidence report over the INCLUDED body of evidence. Renders the
|
|
// composite report's headline (pooled estimate, GRADE certainty, verdict) when ≥2
|
|
// studies pooled, or the honest insufficient message otherwise — the same honesty rule
|
|
// the deterministic pipeline enforces. Also lists the per-record grounded extractions.
|
|
|
|
type Report = NonNullable<PrismaAutopilotResult["report"]>;
|
|
|
|
function GradeBadge({ certainty }: { certainty: string }) {
|
|
const cls =
|
|
certainty === "high"
|
|
? "bg-emerald-100 text-emerald-800"
|
|
: certainty === "moderate"
|
|
? "bg-sky-100 text-sky-800"
|
|
: certainty === "low"
|
|
? "bg-amber-100 text-amber-800"
|
|
: "bg-red-100 text-red-800";
|
|
return (
|
|
<span className={`rounded px-2 py-0.5 text-xs font-semibold uppercase ${cls}`}>
|
|
GRADE: {certainty}
|
|
</span>
|
|
);
|
|
}
|
|
|
|
export function EvidencePanel({
|
|
report,
|
|
extractedRecords,
|
|
}: {
|
|
report: Report | null;
|
|
extractedRecords: PrismaAutopilotResult["extractedRecords"];
|
|
}) {
|
|
return (
|
|
<div className="space-y-4">
|
|
<div className="rounded-lg border border-ink/15 bg-white p-4">
|
|
<h2 className="text-sm font-semibold uppercase tracking-wide text-ink/50">
|
|
Synthesised evidence
|
|
</h2>
|
|
{!report ? (
|
|
<p className="mt-2 text-sm text-ink/60">
|
|
No records were included at screening, so there is no body of evidence to
|
|
synthesise.
|
|
</p>
|
|
) : report.ok ? (
|
|
<div className="mt-2 space-y-2">
|
|
<div className="flex items-center gap-2">
|
|
<GradeBadge certainty={report.certainty.certainty} />
|
|
<span className="text-xs font-medium uppercase text-ink/50">
|
|
{report.verdict.verdict.replace(/_/g, " ")}
|
|
</span>
|
|
</div>
|
|
<p className="text-sm leading-relaxed text-ink/80">{report.rationale}</p>
|
|
</div>
|
|
) : (
|
|
<div className="mt-2 space-y-1">
|
|
<p className="text-sm text-ink/70">{report.reason}</p>
|
|
<p className="text-xs text-ink/40">
|
|
{report.usableStudies} usable {report.usableStudies === 1 ? "study" : "studies"}{" "}
|
|
— an honest “couldn’t pool” rather than a forced
|
|
low-confidence answer.
|
|
</p>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{extractedRecords.length > 0 ? (
|
|
<div className="rounded-lg border border-ink/15 bg-white p-4">
|
|
<h2 className="text-sm font-semibold uppercase tracking-wide text-ink/50">
|
|
Grounded extractions ({extractedRecords.length})
|
|
</h2>
|
|
<ul className="mt-3 divide-y divide-ink/10">
|
|
{extractedRecords.map((r) => (
|
|
<li key={r.id} className="flex items-center justify-between py-2">
|
|
<span className="text-sm text-ink/80">{r.title}</span>
|
|
<span className="text-xs tabular-nums text-ink/50">
|
|
{r.groundedEffectCount} grounded
|
|
{r.droppedEffectCount > 0 ? ` · ${r.droppedEffectCount} dropped` : ""}
|
|
</span>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
) : null}
|
|
</div>
|
|
);
|
|
}
|