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).
50 lines
2.0 KiB
TypeScript
50 lines
2.0 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { buildEvidenceCertainty } from "../lib/verify/evidenceCertainty";
|
|
import type { TrialResultAnalysis } from "../lib/sources/clinicaltrials";
|
|
|
|
// Oracle sanity test: two clinicaltrials sources, each with a registered PRIMARY
|
|
// hazard-ratio primary result showing a consistent, precise ~25% reduction, should
|
|
// pool into a significant effect and rate "high" GRADE certainty (no inconsistency,
|
|
// no imprecision, no declared judgement downgrades). A pubmed source and a source
|
|
// with no poolable ratio are correctly ignored.
|
|
|
|
function hrAnalysis(point: number, lo: number, hi: number): TrialResultAnalysis {
|
|
return {
|
|
outcomeTitle: "Primary composite endpoint",
|
|
outcomeType: "PRIMARY",
|
|
paramType: "Hazard Ratio (HR)",
|
|
paramValue: point,
|
|
ciPct: 95,
|
|
ciLower: lo,
|
|
ciUpper: hi,
|
|
pValue: "0.001",
|
|
method: "Cox",
|
|
};
|
|
}
|
|
|
|
describe("buildEvidenceCertainty", () => {
|
|
it("pools two consistent registered HR primaries and rates high certainty", () => {
|
|
const result = buildEvidenceCertainty([
|
|
{ source_type: "clinicaltrials", title: "TRIAL-A", registered_results: [hrAnalysis(0.75, 0.65, 0.86)] },
|
|
{ source_type: "clinicaltrials", title: "TRIAL-B", registered_results: [hrAnalysis(0.76, 0.66, 0.88)] },
|
|
{ source_type: "pubmed", title: "Review", registered_results: null },
|
|
]);
|
|
expect(result).not.toBeNull();
|
|
expect(result!.pooledSourceCount).toBe(2);
|
|
expect(result!.pooled.measure).toBe("HR");
|
|
expect(result!.pooled.point).toBeLessThan(1);
|
|
expect(result!.pooled.significant).toBe(true);
|
|
expect(result!.certainty).toBe("high");
|
|
expect(result!.contributingSources).toEqual(["TRIAL-A", "TRIAL-B"]);
|
|
});
|
|
|
|
it("returns null when fewer than two sources are poolable", () => {
|
|
expect(
|
|
buildEvidenceCertainty([
|
|
{ source_type: "clinicaltrials", title: "TRIAL-A", registered_results: [hrAnalysis(0.75, 0.65, 0.86)] },
|
|
{ source_type: "pubmed", title: "Review", registered_results: null },
|
|
])
|
|
).toBeNull();
|
|
});
|
|
});
|