Skip to content

mo1998/Halal-Trace

Repository files navigation

HalalTrace AI – Enterprise AI Compliance Platform

HalalTrace AI is an AI-powered compliance platform designed to ensure Halal certification authenticity and supply chain integrity. The platform combines a React-based high-fidelity dashboard with a high-performance Python FastAPI backend to deliver enterprise-grade document verification and risk assessment capabilities.

🖼️ Screenshots

Here are screenshots of the running HalalTrace AI platform:

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4

Screenshot 5

Screenshot 6


🔐 Authentication & User Management

  • Secure User Registration & Login Role-based access control with JWT authentication

  • User Session Management Persistent sessions with automatic token refresh

  • Password Security Industry-standard bcrypt hashing for secure credential storage

  • User Profile Management Personalized dashboards and analysis history


🐍 Advanced AI Backend Architecture

Leveraging a unified Python backend to access sophisticated models and specialized AI libraries:

  1. High-Fidelity OCR Powered by pytesseract and Pillow, providing industrial-grade text extraction from complex certificate layouts.

  2. Server-Side NLP Uses Hugging Face transformers with the BART-large-mnli model for Zero-Shot Classification, delivering significantly higher accuracy than browser-based mobile models.

  3. LLM Integration Leverages Groq API with the Llama 3 70B model for advanced document analysis and field extraction.

  4. Risk Modeling Modular classification pipeline to detect suspect ingredients and compliance anomalies in real time.

  5. ML Operations ML health monitoring, performance tracking, and model retraining capabilities.

  6. Database Integration Persistent storage of user credentials and analysis results using SQLAlchemy ORM.


🚀 Key Features

📡 FastAPI Integration

  • Unified RESTful Endpoints Consolidated routes:

    • /analyze – Document Processing
    • /analyze-document – LLM Analysis
    • /api/ml-health – ML Monitoring
    • /health – System Status
  • Performance Monitoring Server-side inference latency (ms) measured per request and displayed in the UI.

  • Protected Endpoints Authentication-secured routes for sensitive operations.

  • Analysis History User-specific storage and retrieval of document analysis results.


📑 Document Intelligence

  • Hybrid Flow React handles file ingestion; Python handles intensive intelligence processing.

  • Entity Extraction Python-based heuristics and NER (Named Entity Recognition) to isolate suppliers, ingredients, and dates.

  • Dual Processing Supports both:

    • Local AI processing (OCR, transformers)
    • Cloud LLM processing (Groq API)
  • Accreditation Verification Automated extraction and validation of accreditation bodies, numbers, and validity periods.

  • Multi-Format Support PDFs, images (JPG, PNG), and text inputs.


📊 Professional Observability

  • Server Model Inspector Raw JSON metadata from the Python engine exposed in the Document Intelligence view.

  • Real-Time Backend Status Online/Offline indicators with auto-polling.

  • ML Health Monitoring Pipeline status and performance metrics.

  • Audit Trails Comprehensive audit logs for compliance verification.


🔒 Security & Compliance

  • JWT Authentication Secure token-based user authentication.

  • Encrypted Storage Passwords and sensitive data protected with industry-standard encryption.

  • Role-Based Access Control Differentiated access levels for administrators and users.

  • Session Management Automatic session expiration and secure logout.


💼 Use Cases

🏭 Food Manufacturing Companies

  • Challenge: Ensuring all ingredients meet Halal certification requirements
  • Solution: Upload certificates to verify authenticity and trace ingredient origins
  • Benefit: Reduced compliance risk and increased consumer trust

🌍 Import / Export Businesses

  • Challenge: Validating Halal certificates from international suppliers
  • Solution: Cross-reference accreditation bodies and verify certificate validity periods
  • Benefit: Mitigated fraud risk and regulatory compliance

🏢 Certification Bodies

  • Challenge: Managing large volumes of certification documents
  • Solution: Automated document analysis and risk assessment
  • Benefit: Streamlined verification and improved operational efficiency

🛒 Retail Chains

  • Challenge: Maintaining Halal integrity across supply chains
  • Solution: Track and verify certification authenticity at multiple levels
  • Benefit: Preserved product authenticity and customer confidence

🎯 Pain Points Addressed

⚠️ Fraudulent Certifications

  • Problem: Fake or expired Halal certificates
  • Solution: Automated accreditation and validity verification
  • Impact: Eliminates counterfeit certifications and protects brand reputation

🔍 Manual Verification Bottlenecks

  • Problem: Time-intensive manual reviews
  • Solution: AI-powered automated analysis
  • Impact: Verification reduced from hours to seconds

📋 Supply Chain Complexity

  • Problem: Multi-tier compliance tracking difficulty
  • Solution: End-to-end audit trails and historical analysis
  • Impact: Full transparency and compliance assurance

📊 Data Silos

  • Problem: Disconnected systems and fragmented insights
  • Solution: Centralized document intelligence platform
  • Impact: Unified compliance management and better decisions

🛠️ Tech Stack

  • Backend: Python 3.10, FastAPI, Uvicorn, Pytesseract, Hugging Face Transformers, Groq API, SQLAlchemy, JWT

  • Frontend: React 19, TypeScript, Lucide Icons, Recharts, D3.js

  • Authentication: JWT-based authentication with bcrypt password hashing

  • Database: SQLite (extensible to PostgreSQL / MySQL)


🚦 Getting Started (Local Development)

1. Environment Setup

Create a .env file in the root directory:

GROQ_API_KEY=your_groq_api_key_here

2. Install Dependencies

npm install
pip install -r requirements.txt

3. Start the Unified Python Backend

Ensure the tesseract binary is installed:

npm run start-backend
# or
python -m uvicorn backend.unified_backend:app --host 0.0.0.0 --port 8000

4. Run the Web App

npm run dev

The frontend runs on port 3000 and automatically connects to the unified backend:

  • API calls forwarded to http://localhost:8000
  • Authentication endpoints secured
  • User-specific analysis history stored and retrieved

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages