How donggunseo/chain-orchestrator-v03 works
CHAIN is a clinical-event orchestration engine: external records and test events enter through source adapters, become versioned published data and validated workflow events, and drive a Temporal workflow that manages context, agent calls, state transitions, and clinician review. Worker activities perform I/O outside the reducer, including source resolution, agent invocation, notifications, and mock presentation effects. The README documents these product capabilities; source-level evidence is strongest for the sampled adapter, reducer, runtime, and activity boundaries. Unsampled subsystems are included where documented, with links omitted when their wiring is not shown.
Main entry points: engine.py State reducer · orchestration_activities.py Worker activities · validation.py Validation primitives · runtime.py Agent runtime
Components 34
Workflow runtime
- Temporal Workflow
chain_demo/temporal_workflow.py - State reducer
chain_demo/engine.py - Worker activities
chain_demo/orchestration_activities.py - Worker assembly
chain_demo/worker.py - Wire contracts
chain_demo/contracts.py - Validation primitives
chain_demo/validation.py
Sources and context
- Source ingress
chain_demo/adapters/ingress.py - Source adapters
chain_demo/adapters/base.py - Published store
chain_demo/adapters/store.py - Source contracts
chain_demo/source_contracts.py - Context ledger
chain_demo/context.py - HITL documents
chain_demo/hitl_documents.py
Agent execution
- Agent runtime
chain_demo/agents/runtime.py - Scoped agent requests
chain_demo/agent_requests.py - Agent services and cache
chain_demo/agents/services.py - Clinical summary
chain_demo/agents/clinical_summary.py - Stroke screening
chain_demo/agents/stroke_screening.py - tPA support
chain_demo/agents/tpa_decision_support.py - Fixture backend
chain_demo/agents/fixture_backend.py
Workflow configuration
- Agent configuration
chain_demo/agent_config.py - Implementation registry
chain_demo/registry.py - Orchestration config
chain_demo/orchestration_config.py - Workflow DSL schema
chain_demo/orchestration_schema.py - State specification
chain_demo/state_specification.py - Expressions
chain_demo/expressions.py
Review and effects
- Notifier
chain_demo/notifier.py - Presentation effects
chain_demo/effects.py - Effect contracts
chain_demo/effect_contracts.py
Other components
- Backend
- Temporal Service
- Hospital systems
- Agent APIs
- Notification provider
- EHR dashboard
Connections 47
- Backend → Temporal Service: starts and signals
README.md - Temporal Service → Temporal Workflow: dispatches work
README.md - Temporal Workflow → State reducer: drives reducer
chain_demo/temporal_workflow.py - Temporal Workflow → Worker activities: schedules activities
README.md - Worker assembly → Temporal Workflow: registers workflow
chain_demo/worker.py - Worker assembly → Worker activities: registers activities
README.md - State reducer → Scoped agent requests: builds scoped jobs
chain_demo/engine.py - State reducer → Context ledger: updates context
chain_demo/engine.py - State reducer → Wire contracts: validates workflow data
chain_demo/engine.py - State reducer → Workflow DSL schema: uses workflow bundle
chain_demo/engine.py - State reducer → State specification: uses state metadata
chain_demo/engine.py - State reducer → Expressions: evaluates conditions
chain_demo/engine.py - Hospital systems → Source adapters: publishes records
README.md - Source adapters → Published store: publishes versions
chain_demo/adapters/base.py - Source adapters → Source ingress: emits events
- Source ingress → Wire contracts: validates events
chain_demo/adapters/ingress.py - Source ingress → Source contracts: resolves source
chain_demo/adapters/ingress.py - Worker activities → Source ingress: resolves events
chain_demo/orchestration_activities.py - Worker activities → Published store: reads source versions
README.md - Source contracts → Wire contracts: validates snapshots
chain_demo/source_contracts.py - Context ledger → HITL documents: builds source views
chain_demo/context.py - Worker activities → Agent runtime: invokes agents
chain_demo/orchestration_activities.py - Agent runtime → Agent configuration: validates bundle
chain_demo/agents/runtime.py - Agent runtime → Implementation registry: loads implementation
chain_demo/agents/runtime.py - Agent runtime → Fixture backend: uses fixture backend
chain_demo/agents/runtime.py - Agent runtime → Agent services and cache: creates services
chain_demo/agents/runtime.py - Agent runtime → Agent APIs: calls external agent
- Agent services and cache → Clinical summary: supports summary cache
chain_demo/agents/clinical_summary.py - Agent services and cache → Stroke screening: supports screening
chain_demo/agents/stroke_screening.py - Agent services and cache → tPA support: supports tPA
chain_demo/agents/tpa_decision_support.py - Worker assembly → Orchestration config: loads configuration
chain_demo/worker.py - Orchestration config → Agent configuration: loads agent config
chain_demo/orchestration_config.py - Orchestration config → Workflow DSL schema: builds workflow bundle
chain_demo/orchestration_config.py - Orchestration config → State specification: loads state spec
chain_demo/orchestration_config.py - Workflow DSL schema → Expressions: validates expressions
chain_demo/orchestration_schema.py - Workflow DSL schema → Effect contracts: checks operations
chain_demo/orchestration_schema.py - Worker activities → Notifier: records notification
chain_demo/orchestration_activities.py - Notifier → Notification provider: sends notification
- Worker activities → Presentation effects: applies effect
chain_demo/orchestration_activities.py - Presentation effects → Effect contracts: validates receipt
chain_demo/effects.py - Presentation effects → EHR dashboard: records mock display
- Validation primitives → Wire contracts: provides primitives
chain_demo/contracts.py - Validation primitives → Source contracts: provides primitives
chain_demo/source_contracts.py - Validation primitives → Effect contracts: provides primitives
chain_demo/effect_contracts.py - Validation primitives → Workflow DSL schema: provides primitives
chain_demo/orchestration_schema.py - Validation primitives → Agent configuration: provides primitives
chain_demo/agent_config.py - Validation primitives → Implementation registry: provides primitives
chain_demo/registry.py