caelum0x 174222bcaa feat: Builder-Track named-user tools, bio + evidence-intelligence platform, Apache-2.0
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).
2026-07-10 16:23:13 +03:00

67 lines
2.9 KiB
Python

import os
import sys
import spacy
from spacy.vocab import Vocab
import shutil
import pytest
def test_custom_segmentation(combined_all_model_fixture):
text = "Induction of cytokine expression in leukocytes by binding of thrombin-stimulated platelets. BACKGROUND: Activated platelets tether and activate myeloid leukocytes."
doc = combined_all_model_fixture(text)
sents = list(doc.sents)
assert len(sents) == 2
expected_tokens = [
"Induction",
"of",
"cytokine",
"expression",
"in",
"leukocytes",
"by",
"binding",
"of",
"thrombin-stimulated",
"platelets",
".",
"BACKGROUND",
":",
"Activated",
"platelets",
"tether",
"and",
"activate",
"myeloid",
"leukocytes",
".",
]
actual_tokens = [t.text for t in doc]
assert expected_tokens == actual_tokens
assert doc.has_annotation("DEP")
assert doc[0].dep_ == "ROOT"
assert doc[0].tag_ == "NN"
def test_full_pipe_serializable(combined_all_model_fixture):
text = "Induction of cytokine expression in leukocytes (CEIL) by binding of thrombin-stimulated platelets. BACKGROUND: Activated platelets tether and activate myeloid leukocytes."
doc = [doc for doc in combined_all_model_fixture.pipe([text, text], n_process = 2)][0]
# If we got here this means that both model is serializable and there is an abbreviation that would break if it wasn't
assert len(doc._.abbreviations) > 0
abbrev = doc._.abbreviations[0]
assert abbrev["short_text"] == "CEIL"
assert abbrev["long_text"] == "cytokine expression in leukocytes"
assert doc[abbrev["short_start"] : abbrev["short_end"]].text == abbrev["short_text"]
assert doc[abbrev["long_start"] : abbrev["long_end"]].text == abbrev["long_text"]
def test_full_pipe_not_serializable(combined_all_model_fixture_non_serializable_abbrev):
text = "Induction of cytokine expression in leukocytes (CEIL) by binding of thrombin-stimulated platelets. BACKGROUND: Activated platelets tether and activate myeloid leukocytes."
# This line requires the pipeline to be serializable, so the test should fail here
doc = combined_all_model_fixture_non_serializable_abbrev(text)
with pytest.raises(TypeError):
doc.to_bytes()
# Below is the test version to be used once we move to spacy v3.1.0 or higher
# def test_full_pipe_not_serializable(combined_all_model_fixture_non_serializable_abbrev):
# text = "Induction of cytokine expression in leukocytes (CEIL) by binding of thrombin-stimulated platelets. BACKGROUND: Activated platelets tether and activate myeloid leukocytes."
# # This line requires the pipeline to be serializable (because it uses 2 processes), so the test should fail here
# with pytest.raises(TypeError):
# list(combined_all_model_fixture_non_serializable_abbrev.pipe([text, text], n_process = 2))