Skip to content

Lokeshg29/sentinelchain-ai

Repository files navigation

๐Ÿ›ก๏ธ SentinelChain AI - Supply Chain Risk Intelligence Platform

AI-powered supply chain risk detection and monitoring system with blockchain verification on Algorand.

๐ŸŽฏ Overview

SentinelChain AI is an enterprise-grade platform that combines:

  • AI Risk Detection - Machine learning + rule-based risk analysis
  • Agentic AI - Three specialized agents (Delay, Escalation, Recovery)
  • Trust Scoring - Dynamic actor reputation system
  • Blockchain Verification - Immutable audit trail on Algorand
  • Role-Based Dashboards - Tailored views for each stakeholder

๐Ÿ—๏ธ Architecture

Frontend (React + Vite)
    โ†“
Backend API (FastAPI)
    โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Monitoring Engine                  โ”‚
โ”‚  โ†“                                  โ”‚
โ”‚  Risk Engine (Rules + ML)           โ”‚
โ”‚  โ†“                                  โ”‚
โ”‚  Agent Coordinator                  โ”‚
โ”‚  โ”œโ”€ Delay Agent                     โ”‚
โ”‚  โ”œโ”€ Escalation Agent                โ”‚
โ”‚  โ””โ”€ Recovery Agent                  โ”‚
โ”‚  โ†“                                  โ”‚
โ”‚  Trust Engine                       โ”‚
โ”‚  โ†“                                  โ”‚
โ”‚  Blockchain (if HIGH risk)          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • npm or yarn

Backend Setup

cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000

Backend will start at: http://localhost:8000

Frontend Setup

cd frontend
npm install
npm run dev

Frontend will start at: http://localhost:5173

๐Ÿ“Š Features

1. Role-Based Dashboards

Supplier Dashboard

  • View shipments created by supplier
  • Monitor carrier trust scores
  • Create new shipments
  • Track risk alerts

Carrier Dashboard

  • View assigned shipments
  • Monitor own trust score
  • Track performance metrics
  • View route information

Distributor Dashboard

  • View incoming shipments
  • Monitor supplier trust scores
  • Track delivery status
  • Quality issue alerts

Admin Dashboard

  • System-wide overview
  • All shipments and actors
  • Network health metrics
  • Blockchain logs

2. AI Agent Recommendations

Three specialized AI agents analyze each shipment:

Delay Agent

  • Predicts future delays
  • Analyzes historical patterns
  • Provides ETA estimates

Escalation Agent

  • Monitors trust score trends
  • Flags high-risk actors
  • Recommends alternative carriers

Recovery Agent

  • Suggests mitigation strategies
  • Provides action items
  • Risk recovery plans

3. Trust Scoring System

Dynamic reputation system for all actors:

  • Reliable (85-100): Green status
  • Monitor (70-84): Blue status
  • High Risk (50-69): Amber status
  • Critical (0-49): Red status

Trust scores update based on:

  • Risk events (LOW/MEDIUM/HIGH)
  • Delivery performance
  • Quality issues
  • Historical behavior

4. Blockchain Verification

Only HIGH-risk events are logged to blockchain:

  • Immutable audit trail
  • Algorand network integration
  • Transaction ID tracking
  • Transparent verification

๐ŸŽฎ User Roles

Login Credentials (Demo)

Role Actor ID Trust Score Shipments
Supplier SUP01 55.8 3 shipments
Carrier CAR01 69.6 4 shipments
Distributor DIS01 90.2 3 shipments
Admin ADMIN01 N/A All shipments

๐Ÿ“ก API Endpoints

Core Endpoints

  • GET /shipments - All shipments
  • GET /actors - All actors with trust scores
  • GET /shipment/{id} - Shipment details
  • GET /shipment/{id}/recommendations - AI recommendations
  • GET /blockchain - Blockchain logs

Role-Specific Endpoints

  • GET /supplier/{id}/shipments - Supplier's shipments
  • GET /carrier/{id}/shipments - Carrier's shipments
  • GET /distributor/{id}/shipments - Distributor's shipments
  • GET /actor/{id}/trust - Actor's trust score
  • GET /stats/system - System statistics

Analysis Endpoints

  • POST /shipments/booking-analysis - Pre-booking risk analysis

๐Ÿงช Testing

Test Different Roles

  1. Login as Supplier

  2. Login as Carrier

    • Select "Carrier"
    • See only your 4 assigned shipments
    • Trust score: 69.6
  3. Login as Distributor

    • Select "Distributor"
    • See only your 3 incoming shipments
    • Trust score: 90.2
  4. Login as Admin

    • Select "Admin"
    • See all 10 shipments
    • View system statistics

Test AI Recommendations

  1. Login as any role
  2. Click "View" on a HIGH-risk shipment
  3. Scroll to "AI Agent Recommendations"
  4. See 3 agent cards with:
    • Confidence scores
    • Severity levels
    • Action items

๐Ÿ“ Project Structure

ai-supply-chain-risk-passport/
โ”œโ”€โ”€ backend/                         # Backend API and services
โ”‚   โ”œโ”€โ”€ agents/                      # AI agent modules
โ”‚   โ”‚   โ”œโ”€โ”€ delay_agent.py
โ”‚   โ”‚   โ”œโ”€โ”€ escalation_agent.py
โ”‚   โ”‚   โ””โ”€โ”€ recovery_agent.py
โ”‚   โ”œโ”€โ”€ data/
โ”‚   โ”‚   โ””โ”€โ”€ shipments.csv
โ”‚   โ”œโ”€โ”€ agent_coordinator.py
โ”‚   โ”œโ”€โ”€ blockchain_service.py
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ ml_model.py
โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”œโ”€โ”€ monitoring_engine.py
โ”‚   โ”œโ”€โ”€ risk_engine.py
โ”‚   โ”œโ”€โ”€ trust_engine.py
โ”‚   โ””โ”€โ”€ requirements.txt
โ”œโ”€โ”€ frontend/                        # React frontend application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ common/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ layout/
โ”‚   โ”‚   โ”œโ”€โ”€ context/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AuthContext.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ dashboards/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ BlockchainPage.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ LandingPage.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ LoginPage.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ShipmentDetailPage.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ShipmentsPage.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ TrustOverviewPage.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ api.js
โ”‚   โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ helpers.js
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx
โ”‚   โ”‚   โ””โ”€โ”€ main.jsx
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ vite.config.js
โ”œโ”€โ”€ README.md                        # This file
โ”œโ”€โ”€ HOW_TO_RUN.md                   # Setup and run instructions
โ”œโ”€โ”€ PROJECT_STRUCTURE.md            # Detailed project structure
โ”œโ”€โ”€ EXAMINER_GUIDE_COMPLETE.md      # Complete examiner guide
โ”œโ”€โ”€ FINAL_SYSTEM_SPECIFICATION.md   # System design specification
โ”œโ”€โ”€ ROLE_BASED_ARCHITECTURE.md      # Role-based architecture
โ”œโ”€โ”€ SYSTEM_ARCHITECTURE.md          # Technical architecture
โ””โ”€โ”€ FIXES_COMPLETED.md              # Latest fixes documentation

See PROJECT_STRUCTURE.md for detailed file organization.

๐Ÿ”ง Technology Stack

Backend

  • FastAPI - Modern Python web framework
  • Scikit-learn - Machine learning (Isolation Forest)
  • Pandas - Data processing
  • Pydantic - Data validation

Frontend

  • React 18 - UI framework
  • Vite - Build tool
  • TailwindCSS - Styling
  • React Router - Navigation
  • Axios - API calls
  • Lucide React - Icons

Blockchain

  • Algorand - Blockchain network (integration ready)

๐Ÿ“ˆ Key Metrics

  • 10 Shipments processed
  • 10 Actors tracked (4 suppliers, 3 carriers, 3 distributors)
  • 3 AI Agents providing recommendations
  • 2 HIGH-risk events logged to blockchain
  • 72.5 average network trust score

๐ŸŽฏ Demo Flow (3 Minutes)

  1. Landing Page (30s)

    • Show value proposition
    • Click "Login"
  2. Dashboard (30s)

    • Login as Supplier
    • Show KPIs and shipments
    • Explain color-coded risk badges
  3. AI Recommendations (90s) โญ

    • Click "View" on HIGH-risk shipment
    • Show 3 AI agent cards
    • Explain predictions and action items
    • Highlight confidence scores
  4. Blockchain Verification (30s)

    • Show blockchain badge
    • Navigate to Blockchain page
    • Show transaction logs

๐Ÿ” Security Notes

  • Authentication context manages user sessions
  • Role-based access control
  • Data filtering by actor ID
  • Blockchain for immutable audit trail

๐Ÿ“ License

This project is for demonstration purposes.

๐Ÿค Contributing

This is a hackathon project. For production use, additional features needed:

  • Real authentication (JWT)
  • Database integration (PostgreSQL)
  • Real-time monitoring (WebSocket)
  • Production blockchain integration
  • Enhanced security measures

๐Ÿ“š Documentation

Essential documentation files:

  • HOW_TO_RUN.md - Complete setup and run instructions
  • EXAMINER_GUIDE_COMPLETE.md - Comprehensive guide for examiners
  • FINAL_SYSTEM_SPECIFICATION.md - Official system design
  • ROLE_BASED_ARCHITECTURE.md - Role-based business logic
  • SYSTEM_ARCHITECTURE.md - Technical architecture
  • PROJECT_STRUCTURE.md - Detailed file organization
  • FIXES_COMPLETED.md - Latest improvements and fixes

๐Ÿ“ž Support

For questions or issues, please refer to the documentation files above.


Built with โค๏ธ for supply chain transparency and risk intelligence

About

AI-powered supply chain risk monitoring platform with blockchain verification, dynamic trust scoring, and role-based dashboards. Features 3 specialized AI agents, ML anomaly detection, and Algorand integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors