How flameingmoy/perishability_management_system works
Project Type and Purpose
• This is a full‑stack, agent‑driven perishability management system for supply chains.
• It runs three AI agents (demand forecast, inventory monitoring, environmental monitoring) over CSV data sources, exposes a Streamlit front end with dashboards and a chat interface, and uses LangChain + Ollama for LLM calls and embeddings.
File Structure
• Top‑level files:
• README.md / SCM Scenarios.pdf – documentation
• app.py / main.py – Streamlit entrypoints or orchestrators
• config.py – central configuration for data paths, LLM endpoints, embeddings
• agents/ – three agent scripts, each encapsulating a LangChain chain or workflow
• components/ – chat_interface.py for the conversational UI layer
• models/ – data model definitions (e.g., Pydantic or dataclasses)
• utils/ – data_loader, time_series_utils, visualization helpers
• data/ – CSV files for IoT, plant, product, sales, supplier, perishability
Extract Additional Insights from README
• Tech Stack:
• LangChain for agent orchestration
• Ollama (granite3.3:8b) for LLM inference
• Snowflake Arctic v2 for vector embeddings
• Streamlit + Plotly for the UI and dashboards
Main Components and Their Interactions
a. Frontend (Streamlit)
• app.py / main.py spins up Streamlit, renders dashboards (components/visualization) and chat UI (components/chat_interface.py).
b. Agent Layer
• demand_prediction_agent.py, inventory_monitoring_agent.py, environmental_monitoring_agent.py
• Each uses LangChain chains, pulls data via utils/data_loader.py, transforms it via utils/time_series_utils.py, and outputs results.
c. Data Layer
• data/*.csv is loaded by utils/data_loader.py. Data models are defined in models/data_models.py.
d. LLM & Embedding Services (External)
• Ollama endpoint for granite3.3:8b LLM
• Snowflake Arctic v2 as the embedding store
e. Orchestration / Configuration
• config.py holds API keys, model names, data paths, and other settings.
Architectural Patterns & Design Principles
• Agent‑oriented modularity: each agent encapsulates its own workflow.
• Separation of concerns: UI vs. data loading vs. ML logic vs. visualization.
• Config‑driven deployment: config.py centralizes environment variables and endpoints.
• Use of external services to offload LLM inference and embedding storage.
Relationships and Data Flows
• User input → Chat Interface → LangChain Agents
• Each Agent → Data Loader → CSV Data
• Each Agent → Ollama LLM / Embedding Store → Agent Logic → Visualization
• Results → Streamlit Dashboard (Plotly)
• Feedback loops if agents write back to any store or trigger downstream agents.
Final Advice
• Pathways: user → UI → agent → data/LLM → response.
• Don’t overthink: break the system into the maximal number of logical components you identified.