How sahil-kachhap/mosaic-clinical-trial-integrity works
MOSAIC collects ClinicalTrials.gov and PubMed evidence, parses and stores it, then exposes investigation and review through a REST API. The documented analysis workflow coordinates six specialist agents to produce integrity signals; uncertain findings can enter human review, with reviewer corrections informing procedural memory. The graph preserves the documented processing, memory, and API capabilities. Some modules were not excerpted, so their internal links are included only where the README or SOURCE INDEX supports them.
Main entry points: graph_builder.py Investigation graph · main.py FastAPI application · search_tools.py Search and memory tools · run_ingestion.py Ingestion runner
Components 34
Evidence ingestion
- Ingestion runner
ingestion/run_ingestion.py - Trials client
ingestion/clinical_trials_client.py - Literature client
ingestion/pubmed_client.py - Document parser
ingestion/document_parser.py - Cloud object storage
ingestion/gcs_store.py - Chunking and embeddings
processing
Investigation
- Investigation graph
graph/graph_builder.py - Supervisor
agents/supervisor.py - Missing results
agents/missing_results_agent.py - Broken promises
agents/broken_promises_agent.py - Sponsor track record
agents/track_record_agent.py - Pattern finder
agents/pattern_finder_agent.py - Side effects
agents/side_effect_agent.py - Timeline analyst
agents/timeline_agent.py - Clinical tools
tools/clinical_tools.py - Literature tools
tools/pubmed_tools.py - Search and memory tools
tools/search_tools.py - Analysis state
graph/state.py
Persistent memory
- Vector store
processing/vector_store.py - Episodic memory
memory/episodic_store.py - Procedural memory
memory/procedural_store.py - Sponsor intelligence
memory/semantic_store.py
API and review
- FastAPI application
api/main.py - Analysis routes
api/routers/analysis.py - Signal routes
api/routers/signals.py - Memory routes
api/routers/memory.py - Review routes
api/routers/review.py - Human review gate
graph/hitl.py - Service dependencies
api/dependencies.py
Shared runtime
- Runtime settings
config/settings.py - Logging configuration
config/logging_config.py
Other components
- Researcher
- ClinicalTrials.gov
- PubMed
Connections 34
- ClinicalTrials.gov → Trials client: provides studies
- PubMed → Literature client: provides papers
- Ingestion runner → Trials client: fetches studies
ingestion/run_ingestion.py - Ingestion runner → Literature client: fetches papers
ingestion/run_ingestion.py - Ingestion runner → Document parser: parses records
ingestion/run_ingestion.py - Ingestion runner → Cloud object storage: saves records
ingestion/run_ingestion.py - Chunking and embeddings → Vector store: stores vectors
- Investigation graph → Supervisor: registers
graph/graph_builder.py - Investigation graph → Missing results: registers
graph/graph_builder.py - Investigation graph → Broken promises: registers
graph/graph_builder.py - Investigation graph → Sponsor track record: registers
graph/graph_builder.py - Investigation graph → Pattern finder: registers
graph/graph_builder.py - Investigation graph → Side effects: registers
graph/graph_builder.py - Investigation graph → Timeline analyst: registers
graph/graph_builder.py - Missing results → Analysis state: reads and updates
agents/missing_results_agent.py - Side effects → Analysis state: reads and updates
agents/side_effect_agent.py - Missing results → Search and memory tools: uses tools
agents/missing_results_agent.py - Side effects → Search and memory tools: uses tools
agents/side_effect_agent.py - Clinical tools → Trials client: fetches studies
tools/clinical_tools.py - Clinical tools → Document parser: parses studies
tools/clinical_tools.py - Search and memory tools → Vector store: searches vectors
tools/search_tools.py - Search and memory tools → Episodic memory: reads and writes
tools/search_tools.py - Search and memory tools → Sponsor intelligence: reads and updates
tools/search_tools.py - Researcher → FastAPI application: requests analysis
- FastAPI application → Analysis routes: routes requests
api/main.py - FastAPI application → Signal routes: routes requests
api/main.py - FastAPI application → Memory routes: routes requests
api/main.py - FastAPI application → Review routes: routes requests
api/main.py - Review routes → Human review gate: submits decisions
api/routers/review.py - Review routes → Service dependencies: gets gate
api/routers/review.py - Human review gate → Procedural memory: learns from feedback
graph/hitl.py - Memory routes → Episodic memory: accesses memory
api/routers/memory.py - Memory routes → Procedural memory: accesses memory
api/routers/memory.py - Memory routes → Sponsor intelligence: accesses memory
api/routers/memory.py