How abhioriganti/supplychain_copilot works
SupplyChain Copilot is a governed supply-chain analytics and supplier-document Q&A application. A user asks in the Streamlit interface; the Cortex Agent routes to governed warehouse analytics, document search, or both, and the interface presents the answer with SQL/results and page citations. Separate branches prepare warehouse and document data, surface late-delivery risk, and support a simulated human-approved incident workflow. Evaluation and request logging provide quality and operational oversight. The README documents the major product capabilities; some implementation links below rely on those statements or the source index because their source was not excerpted.
Main entry points: client.py Cortex Agent client · streamlit_app.py Streamlit app · service.py Incident workflow · pipeline.py Document processing
Components 22
User experience
- Streamlit app
app/streamlit_app.py - Answer presentation
src/supplychain_copilot/ui/components.py - Risk display
src/supplychain_copilot/ui/risk.py - Incident interface
src/supplychain_copilot/ui/incidents.py
Evidence preparation
- Order ingestion
src/supplychain_copilot/ingestion - Warehouse model
src/supplychain_copilot/warehouse - Governed metrics
src/supplychain_copilot/semantic/analyst.py - Document processing
src/supplychain_copilot/documents/pipeline.py - PDF extraction
src/supplychain_copilot/documents/extract.py - Document registry
src/supplychain_copilot/documents/registry.py
Answering and risk
- Cortex Agent client
src/supplychain_copilot/agent/client.py - Document search
src/supplychain_copilot/retrieval/search_client.py - Late-risk model
src/supplychain_copilot/ml/late_risk.py
Operations and oversight
- Incident workflow
src/supplychain_copilot/incidents/service.py - Audit event store
src/supplychain_copilot/incidents/store.py - n8n approval
src/supplychain_copilot/incidents/n8n_workflow.py - Incident callback API
src/supplychain_copilot/incidents/api.py - Request logging
src/supplychain_copilot/observability.py - Answer evaluation
src/supplychain_copilot/evaluation/runner.py
Other components
- Business user
- Snowflake Cortex
- Slack
Connections 25
- Business user → Streamlit app: asks
- Streamlit app → Cortex Agent client: submits question
app/streamlit_app.py - Cortex Agent client → Snowflake Cortex: runs tools
src/supplychain_copilot/agent/client.py - Snowflake Cortex → Cortex Agent client: returns answer
- Cortex Agent client → Document search: search tool
- Cortex Agent client → Governed metrics: analytics tool
- Streamlit app → Answer presentation: renders answer
app/streamlit_app.py - Streamlit app → Request logging: logs request
app/streamlit_app.py - Order ingestion → Warehouse model: loads data
src/supplychain_copilot/warehouse/reconcile.py - Warehouse model → Governed metrics: defines metrics
- Document processing → PDF extraction: extracts PDFs
src/supplychain_copilot/documents/pipeline.py - Document processing → Document registry: checks provenance
src/supplychain_copilot/documents/pipeline.py - Document processing → Snowflake Cortex: indexes chunks
- Document search → Snowflake Cortex: queries index
src/supplychain_copilot/retrieval/search_client.py - Streamlit app → Risk display: shows risk
app/streamlit_app.py - Risk display → Late-risk model: uses predictions
- Streamlit app → Incident interface: offers incidents
app/streamlit_app.py - Incident interface → Incident workflow: manages incident
src/supplychain_copilot/ui/incidents.py - Incident workflow → Cortex Agent client: drafts response
src/supplychain_copilot/incidents/service.py - Incident workflow → Audit event store: appends events
src/supplychain_copilot/incidents/service.py - Incident workflow → n8n approval: posts approval
src/supplychain_copilot/incidents/service.py - n8n approval → Slack: notifies approver
- n8n approval → Incident callback API: sends callback
- Answer evaluation → Cortex Agent client: evaluates answers
src/supplychain_copilot/evaluation/runner.py - Answer evaluation → Snowflake Cortex: checks SQL results