Sprint 6 · Security Baseline · 44.4% complete
UI Layer
API Layer
Orchestration
Agents
Core Services
Infrastructure
Data Layer
External Systems
1151× query cache speedup
95% faster than manual
60% LLM cost reduction
29/29 tests passing
4–8 hr turnaround (was 14–21 days)
$100–150 per request (was $1,500+)
UI Layer — Streamlit
:8501 · :8502 · :8503
Research Notebook
:8501 · Chat analytics · feasibility
exploratory
Researcher Portal
:8502 · IRB form · request tracker
formal requests
Admin Dashboard
:8503 · Approvals · monitoring
⊙ 5 approval gates
↓ HTTPS / REST
API Layer — FastAPI
:8000 · uvicorn · async
/research
status · list · download
/approvals
pending · respond · scope-change
/analytics
execute · view-defs · schema
/analytics/materialized-views
refresh · stale · status
/health
full · /live · /ready (k8s)
/mcp /a2a
context · agent messages
⚠ Sprint 6 adds here: AuthMiddleware (JWT) → RBACMiddleware → InputValidationMiddleware
Orchestration Layer — LangGraph
15 workflow states · A2A coordination
ResearchRequestOrchestrator
route_task() · 3-step routing loop · recursive A2A
approval gate checks
WorkflowEngine
12 transition rules · (agent, task) → next_step
state machine
CoordinatorAgent
scope changes · escalation
ApprovalService
gate persistence · RBAC · timeouts
human-in-loop
↓ agent dispatch
Agent Layer — 6 Specialized Agents
BaseAgent · 3 retries · exponential backoff
Requirements
LLM extraction · JSON
gate 1
Phenotype
SQL gen · feasibility
gate 2
Calendar
kickoff scheduling · agenda
gate 3
Extraction
FHIR · Epic · CDW
QA
validation · quality checks
gate 4
Delivery
packaging · notification
→ COMPLETE
↓ service calls
Core Services
LangChain · SQLAlchemy async · asyncpg
LLM Client
Claude · OpenAI · Ollama · fallback
SQLonFHIRAdapter
SELECT sandbox · async engine
HybridRunner
MaterializedViewRunner · PostgresRunner · SpeedLayerRunner · merge
15–30ms end-to-end
MCP Servers
Terminology · Epic · FHIR stubs
Sprint 7 →
↓ storage / caching
Infrastructure — Lambda Architecture
Docker Compose · Redis :6379 · asyncpg pool 5-20
Batch Layer
Materialized views · 2AM cron · 5-10ms
Speed Layer
Redis 7 · TTL 24h · fhir:{type}:{id}
LangSmith
@traceable · cost tracking · traces
HAPIDBClient
asyncpg pool · 5-20 conns · :5433
↓ persistence
Data Layer
:5432 · :5433 · :5434
HAPI FHIR PostgreSQL
:5433 · hfj_resource · hfj_res_ver · sqlonfhir views
ResearchFlow DB
:5434 · 6 tables · audit trail · approvals
Redis 7
:6379 · TTL 24h · 256mb · AOF
External Systems
API · FHIR R4 · future MCP
Anthropic API
claude-3-5-sonnet · primary LLM
HAPI FHIR Server
:8081 · R4 · hapiproject/hapi
Clinical Data Warehouse
Epic · OMOP · CDW (Sprint 7)
stubs → Sprint 7
Email / Calendar
MCP stubs · Sprint 7 target
not yet live