How vidyutchakrabarti/rail-madad works
Project type and purpose
• This is a full-stack, role-based complaint management web app built with Streamlit.
• It provides separate dashboards for passengers, staff, supervisors, analysts, and admins; integrates AI agents for complaint routing/analysis; and uses external APIs (Google Gemini, Indian Railway API, Google Search).
File structure
• Top-level UI entrypoints:
• main_app.py – the full RBAC app
• app.py – a minimal demo version
• app_pages/ – per-role page modules (admin_dashboard.py, passenger_dashboard.py, etc.)
• auth/ – RBAC helpers and credentials files (credentials_example.yaml, rbac_utils.py)
• agents.py, tasks.py, main.py – orchestration of AI agents (complaint analysis, routing)
• helperfunctions.py – complaint storage (log_file.json), analytics helper functions
• tools.py – wrappers for external services (train status, web search, wiki)
• vars.py – configuration mappings (departments, routing hints)
• Configuration: .streamlit/config.toml, secrets_template.toml, environment variables
README for additional insights
• Confirms AI complaint analysis/workflow, multi-department routing, dashboards, and live chat assistant
• Details required API keys (Gemini, RapidAPI, Serper) and secrets management
• Mentions JSON log_file.json as primary data store
a. Main components:
• Presentation Layer (Streamlit UI)
• Business Logic Layer (RBAC auth module, page controllers, AI agents orchestrator)
• Data Layer (log_file.json, credentials.yaml, local config)
• External Services (Google Gemini, RapidAPI IRCTC, Serper Search)
b. Relationships/Interactions:
• UI pages call backend controllers in app_pages → invoke helperfunctions or AI agents
• RBAC auth module mediates access to each page
• Agents orchestrate complaint analysis and routing via tools.py (calls external APIs)
• helperfunctions persist complaints to log_file.json and aggregate analytics
c. Architectural patterns/design principles:
• Layered architecture (UI → controllers → services → data store)
• Modular page-per-role for separation of concerns
• Dependency injection of credentials via environment or Streamlit secrets
• External API adapter pattern in tools.py
d. Relevant technologies:
• Python 3, Streamlit framework for UI
• JSON file as lightweight datastore
• YAML for credentials
• Google Generative AI (Gemini), RapidAPI IRCTC, Serper search
• UI → Auth Module (login flow)
• UI → Controllers → AI Agents → External APIs → Agents → helperfunctions → Data Store
• UI ← helperfunctions (for dashboard analytics)