Spaces:
Paused
Paused
Commit History
-
feat(ui): headless UI-verification harness (run-ui skill) + fix combobox JS (#33)
KevinIsInCoding +1: Claude Opus 4.8Unverified signatureAdds a reusable, deterministic UI check for the Clinical Trials tab so UI changes stop shipping blind. Building it surfaced and fixed a real production bug. - .claude/skills/run-ui/: launches the app in UI-smoke mode and drives the tab in headless Chromium (Playwright), asserting placeholder, 3-char gate, clean picked value, one-line labels, and a search result — plus a screenshot. Exits non-zero on failure (CI-usable). SKILL.md documents usage + the gotchas learned. - app.py: CANDLE_UI_SMOKE mode skips the heavy startup loads (cross-encoder, ChromaDB, graph, Anthropic client) so UI tests boot in ~25s instead of ~60s. - FIX: the combobox in-box placeholder + 3-char gate never ran — Gradio ignored `js=`/`demo.load(js=)` in this version. Inject the script via gr.Blocks(head=...) with a MutationObserver (the tab renders lazily). This was broken on the live Space too; now verified working end-to-end. - agents/research_agent.py: skip the cross-encoder load under CANDLE_UI_SMO…66d56de
-
feat(trials): facility & geography search + targeted mechanism & explainable evidence tier (#22)
KevinIsInCoding +1: Claude Opus 4.8Unverified signature* feat(trials): facility & geography trial search with evidence enrichment Physicians can now find ALS trials by facility ("trials at Mass General Hospital") or geography ("trials in NY"), with each result enriched by surrounding research evidence. - ingestion: _flatten_trial() parses contactsLocationsModule so each trial persists a locations list (facility/city/state/country/status/lat/lon) plus central contact phone/email; TrialSummary gains matching fields. - trials_query.py (new): search_trials_by_location() (state abbrev→name, token-substring facility match, recruiting filter) and enrich_trial() (key papers via the RAG retriever + citation boost, sibling trials for the same compound, heuristic Strong/Moderate/Emerging evidence tier), plus an HTML renderer. - agent: new find_trials_by_location tool wired into RESEARCH_TOOLS and dispatched in research_agent; prompt guidance added for when to use it. - app: dedicated "Clinical Trials" tab (facility/state/city/status i…f77eaaf
-
feat: retrieval grounding, trial quality, and drug-name typo suggestions
KevinIsInCoding +1: Claude Opus 4.8Session of improvements to retrieval accuracy, clinical-trial matching, and query robustness for the physician-facing tool. Retrieval grounding & citation integrity: - Grounding gate: suppress spurious semantic matches when a query's focus entity is absent from the corpus (papers=0 → honest "no evidence"), preventing citation-grafting hallucinations. - Landscape-mention labeling: flag papers that name a compound only in full-text pipeline tables (not the abstract) so the model labels such citations instead of presenting them as primary studies. - Keyword search + abstract-scoped grounding helpers in rag/retriever.py. - Stricter synthesis prompt: inline citations, grounding rule, no training- knowledge gap-filling. Clinical trials: - Include Expanded Access Programs (studyType:int exp); tag study_type / is_expanded_access and surface "Expanded Access" as the phase label. - Compound-specific trial matching: match only the queried compound/target (never the KG-expanded gal…6e92226
-
feat: RRF merge + cross-encoder reranking for retrieval pipeline
KevinIsInCoding +1: Claude Sonnet 4.6- Replace flat score-merge with Reciprocal Rank Fusion (k=10, top_n=20) combining semantic search (30) and entity search (30) candidates - Add cross-encoder reranking (ms-marco-MiniLM-L-6-v2, top_n=15) loaded once at agent startup for zero per-request overhead - Move citation boost to after cross-encoder so it amplifies relevance rather than corrupting RRF input scores - Raise entity query cap 8 → 12 in search_by_entities() - Add exact NCT ID match in trial lookup (_handle_search step 7) - Update config.py with RETRIEVAL_SEMANTIC_N, RETRIEVAL_ENTITY_N, RETRIEVAL_ENTITY_QUERY_CAP, RRF_K, RRF_TOP_N, CROSS_ENCODER_MODEL, CROSS_ENCODER_TOP_N Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>3bfe897
-
fix(query): rank trials by status+relevance, raise cap from 5 to 10
KevinIsInCoding +1: Claude Sonnet 4.6Previously find_trials_for_entities() broke early on arbitrary set iteration order, silently dropping relevant trials (AMX0114 was position 7, never seen). - Collect all matching trial nodes before truncating - Score each trial by number of linked query entities - Sort: RECRUITING first, then ACTIVE_NOT_RECRUITING, then by score - Raise max_trials default 5 → 10 (agent call updated to match) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>eb40daa
-
feat: Stage 4 — entity extraction + knowledge graph + KG-expanded RAG
KevinIsInCoding +1: Claude Sonnet 4.6Entity extraction pipeline: - extraction/normalizer.py: HGNC alias table (TDP-43→TARDBP, BIIB067→tofersen, etc.), compound/mechanism alias maps, CanonicalRegistry for persistent canonical_ids.json - extraction/extractor.py: Claude Sonnet NER, 10 papers/batch, uses full_text over abstract when available, resumable via .progress.json, rate-limit retry - scripts/extract_entities.py: CLI with --max for test runs, --reset to restart Knowledge graph: - graph/builder.py: NetworkX DiGraph, seed ALS entities (genes/compounds/mechanisms), upsert nodes+edges with running-average confidence, trial→target links - graph/query.py: expand_query_entities() (BFS, confidence-filtered), find_trials_for_entities() (KG-linked trial lookup) - graph/serializer.py: pickle (fast) + JSON (human-readable) save/load - scripts/build_graph.py: CLI runner Agent upgrade (KG+RAG): - agents/research_agent.py: step 1 = KG expansion of query entities before RAG; "tofersen" now surfaces SOD1 papers even if not …42fb3af -
feat: Stage 3 — RAG pipeline + working end-to-end query
KevinIsInCoding +1: Claude Sonnet 4.6- rag/indexer.py: ChromaDB collection builder with section-aware chunking (one chunk per PMC XML section, falls back to abstract) - rag/retriever.py: semantic search + entity search with citation-weighted re-ranking (score = similarity * log(citation_count + 2)) - agents/research_agent.py: streaming synthesis agent (mirrors beacon pattern) uses search_research_landscape tool → RAG + trial match → Claude synthesis - scripts/build_index.py: CLI to build ChromaDB index from papers.jsonl - main.py: Rich CLI interface with streaming output - Add openai dependency (required by llm.py provider abstraction) Verified: 510 chunks indexed from 499 papers, end-to-end query returns structured research landscape with PMIDs, mechanisms, and trial links. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>56fa10c -
feat: initial project scaffold and Stage 2 ingestion pipeline
KevinIsInCoding +1: Claude Sonnet 4.6- Project foundation: config, models, tools, llm, logging, prompts - Tool schemas: extract_entities.json, search_landscape.json - Stage 2 ingestion: - ingestion/pubmed.py: PubMed Entrez client (batch fetch, rate-limit aware) - ingestion/pmc.py: PMC XML full-text fetcher (JATS section parser) - ingestion/semantic_scholar.py: citation count enrichment via S2 batch API - ingestion/clinicaltrials.py: ClinicalTrials.gov v2 ALS trials client - scripts/ingest_papers.py: orchestrates PubMed + PMC + citations - scripts/ingest_trials.py: fetches recruiting ALS trials - Stub modules for Stage 3-5 (rag/, graph/, agents/, app.py, main.py) - MIT License, .gitignore (excludes data/, .env, logs/) - CLAUDE.md architecture guide Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>0ccfe4a