Transform messy, unstructured procurement text data into a clean, intelligent cost database that enables data-driven decision-making, cost optimization, and supplier performance management.
- Project Overview
- Features
- Tech Stack
- Folder Structure
- Setup Instructions
- Usage Guide
- Data Architecture
- Dashboard Features
- Demo Walkthrough
- Business Impact
HPCL's procurement data is scattered across multiple systems with:
- Inconsistent item descriptions (same item written 5+ different ways)
- Price variations without clear patterns or anomaly detection
- Lost insights due to manual data handling
- No standardized cost tracking across regions and suppliers
A visual intelligence platform that:
- ✅ Standardizes messy item descriptions automatically
- ✅ Analyzes cost patterns and trends
- ✅ Detects price anomalies in real-time
- ✅ Predicts future price movements
- ✅ Enables region-wise and supplier-wise benchmarking
- ✅ Provides actionable procurement intelligence
Status: Production-Ready Prototype. Modern React UI. AI-Powered Backend. Enterprise-Scalable Architecture.
- Raw item descriptions → Canonical item codes
- Confidence scoring (0-100%) for each mapping
- Duplicate item reduction tracking
- Before/After comparison view
- Price trend visualization (6-month history)
- Regional price comparison
- Supplier-wise benchmarking
- Min/Max/Avg/StdDev analysis
- Automatic flagging of unusual prices
- Severity classification (Critical/High/Medium)
- Human-readable anomaly reasons
- Color-coded severity indicators
- Trend-based 3-month price predictions
- Dashed line visualization for forecasts
- Budget planning recommendations
- Confidence intervals
- Multi-tab interface (no endless scrolling)
- Free-text item search
- Region & Department filters
- Real-time filtered CSV downloads
- Executive summary KPIs
- Interactive Plotly charts
- Clean, modern UI with gradients
- Responsive design
- Accessibility-friendly colors
| Component | Technology |
|---|---|
| Framework | React 18.2+ |
| Build Tool | Vite 5.0+ |
| UI Library | Tailwind CSS |
| Animations | Framer Motion |
| Charts | Recharts |
| Icons | Lucide React |
| Routing | React Router DOM |
| Component | Technology |
|---|---|
| Framework | Flask (Python) |
| API | RESTful API |
| CORS | Flask-CORS |
| Data Processing | Pandas, NumPy |
| Component | Technology |
|---|---|
| NLP | Sentence Transformers, Transformers |
| ML | scikit-learn |
| Text Processing | Custom embeddings & clustering |
| Analytics | Pandas, NumPy, SciPy |
| Component | Technology |
|---|---|
| Storage | CSV files (scalable to DB) |
| Visualization | Recharts (frontend), Plotly (analytics) |
- ✅ Modern, professional UI with React
- ✅ Fast development with Vite
- ✅ Responsive & mobile-friendly design
- ✅ Scalable architecture (frontend/backend separation)
- ✅ Real AI/ML capabilities for standardization
- ✅ Production-ready deployment options
intelligent-cost-database/
│
├── data/
│ ├── raw/
│ │ └── purchase_orders_raw.csv # Raw procurement data
│ │
│ ├── processed/
│ │ ├── standardized_items.csv # AI-standardized items
│ │ ├── cost_analytics.csv # Cost insights & trends
│ │ └── anomalies.csv # Detected price anomalies
│ │
│ └── uploads/
│ └── template_purchase_orders.csv # Upload template
│
├── schemas/
│ └── data_schema.md # Data model documentation
│
├── ai_standardization/
│ ├── text_cleaning.py # Text preprocessing
│ ├── embeddings.py # Sentence embeddings
│ ├── clustering.py # Item clustering
│ ├── category_tagging.py # Auto-categorization
│ ├── attribute_extraction.py # Extract specs
│ ├── item_code_generator.py # Generate item codes
│ └── run_standardization.py # Main pipeline
│
├── ai_analytics/
│ ├── load_data.py # Data loader
│ ├── price_cleaning.py # Price validation
│ ├── aggregation.py # Cost aggregation
│ ├── trend_analysis.py # Trend detection
│ ├── anomaly_detection.py # Anomaly flagging
│ └── run_analytics.py # Analytics pipeline
│
├── backend/
│ ├── api.py # Flask REST API
│ └── requirements.txt # Python dependencies
│
├── frontend-react/
│ ├── src/
│ │ ├── App.jsx # Main React app
│ │ ├── index.css # Global styles
│ │ ├── pages/ # Page components
│ │ └── components/ # Reusable components
│ ├── index.html # HTML entry point
│ ├── package.json # Node dependencies
│ ├── vite.config.js # Vite configuration
│ └── tailwind.config.js # Tailwind config
│
├── demo/
│ └── screenshots/ # Demo screenshots
│
├── ppt/
│ └── presentation materials # Presentation files
│
├── requirements.txt # Python dependencies
├── run_pipeline.py # Full pipeline runner
│
└── README.md # This file
- Python 3.8+ (for backend & AI pipelines)
- Node.js 18+ and npm (for React frontend)
- pip package manager
- Windows/Mac/Linux
# Navigate to project directory
cd intelligent-cost-database
# Create virtual environment (recommended)
python -m venv .venv
# Activate virtual environment
# On Windows:
.venv\Scripts\activate
# On Mac/Linux:
source .venv/bin/activate
# Install Python dependencies
pip install -r requirements.txt
# Install backend-specific dependencies
pip install -r backend/requirements.txt# Navigate to React frontend directory
cd frontend-react
# Install Node dependencies
npm install
# Build for production (optional)
npm run buildOption A: Development Mode (Recommended for testing)
# Terminal 1: Start Backend API
cd backend
python api.py
# Backend runs on http://localhost:5000
# Terminal 2: Start React Dev Server
cd frontend-react
npm run dev
# Frontend runs on http://localhost:5173Option B: Production Mode
# Build React app
cd frontend-react
npm run build
# Serve with backend
cd ../backend
python api.py --production
# Access at http://localhost:5000# Standardize new data
python ai_standardization/run_standardization.py
# Generate analytics
python ai_analytics/run_analytics.py
# Or run full pipeline
python run_pipeline.py- Frontend: http://localhost:5173 (dev) or http://localhost:5000 (production)
- API Docs: http://localhost:5000/api/health
- Auto-reload: Both frontend and backend support hot reload in dev mode
The React frontend provides a modern, intuitive interface:
- Executive KPI Cards:
- Total Items Standardized
- Unique Items (after deduplication)
- Cost Savings Identified
- Anomalies Detected
- Interactive Charts:
- Cost trends over time
- Regional price comparisons
- Supplier performance metrics
- Quick Actions: Upload data, run analysis, export reports
- Before/After Comparison: Visual transformation of messy → clean data
- Confidence Scores: AI confidence ratings for each mapping
- Search & Filter: Find specific items quickly
- Bulk Actions: Review and approve standardizations
- Price Trend Charts: 6-month historical analysis with Recharts
- Regional Heatmaps: Geographic price variations
- Supplier Comparison: Performance benchmarking
- Statistical Summary: Min/Max/Avg/StdDev per item
- Export Data: Download filtered analytics
- Severity Classification: Critical/High/Medium flags
- Detailed Reports: Transaction-level anomaly reasons
- Visual Indicators: Color-coded severity badges
- Action Items: Recommended next steps
- Price Forecasts: 3-month ahead predictions
- Trend Indicators: Upward/downward/stable trends
- Budget Planning: Procurement recommendations
- Confidence Intervals: Forecast reliability scores
- Drag & Drop Upload: CSV file upload with validation
- Template Download: Get the correct format
- Processing Status: Real-time pipeline progress
- History: View past uploads and results
The Flask backend exposes RESTful APIs:
GET /api/health - Health check
GET /api/overview - Dashboard KPIs
GET /api/standardized - Standardized items
GET /api/analytics - Cost analytics data
GET /api/anomalies - Detected anomalies
GET /api/predictions - Price forecasts
POST /api/upload - Upload CSV file
POST /api/run-standardization - Run AI standardization
POST /api/run-analytics - Run analytics pipeline
GET /api/export/:type - Export data as CSV
- Global Search: Search across all items, suppliers, and codes
- Multi-Select Filters: Filter by region, department, date range
- Real-Time Updates: Charts and tables update instantly
- Persistent State: Filters maintained across page navigation
Raw POs (CSV upload)
↓
[Text Cleaning] → normalize, remove noise
↓
[Embeddings] → sentence transformers (384-dim vectors)
↓
[Clustering] → DBSCAN/K-Means grouping
↓
[Category Tagging] → auto-assign categories
↓
[Attribute Extraction] → extract specs (quantity, unit, etc.)
↓
[Item Code Generation] → canonical codes
↓
Standardized Items (confidence scores)
↓
[Price Cleaning] → validate, remove outliers
↓
[Aggregation] → group by item, region, supplier
↓
[Trend Analysis] → time-series patterns
↓
[Anomaly Detection] → statistical outliers
↓
Cost Analytics + Anomalies + Predictions
↓
[Flask API] → JSON endpoints
↓
[React Frontend] → Interactive UI
Text Standardization (ai_standardization/):
- text_cleaning.py: Remove special chars, normalize whitespace, lowercase
- embeddings.py: Generate semantic vectors using sentence-transformers
- clustering.py: Group similar items using cosine similarity
- category_tagging.py: Assign industry categories (e.g., "Lubricants", "Steel")
- attribute_extraction.py: Parse quantities, units, specs
- item_code_generator.py: Create canonical item codes (e.g., "ITEM_001")
Analytics Pipeline (ai_analytics/):
- load_data.py: Load and merge standardized + raw data
- price_cleaning.py: Validate prices, remove outliers (Z-score)
- aggregation.py: Calculate min/max/avg/stddev per item
- trend_analysis.py: Detect trends (upward/downward/stable)
- anomaly_detection.py: Flag statistical anomalies (>2σ from mean)
For detailed schema documentation, see schemas/data_schema.md
Key Files:
- purchase_orders_raw.csv: Original procurement data (9 columns)
- standardized_items.csv: AI mappings (5 columns + confidence)
- cost_analytics.csv: Aggregated insights (10 columns)
- anomalies.csv: Flagged items (6 columns + reasons)
- Responsive Design: Works on desktop, tablet, mobile
- Dark/Light Mode: User preference support (planned)
- Smooth Animations: Framer Motion transitions
- Intuitive Navigation: React Router for seamless page changes
- Accessibility: WCAG 2.1 compliant components
All charts built with Recharts:
- Line Charts: Price trends with tooltips and zoom
- Bar Charts: Regional & supplier comparisons
- Pie Charts: Category distribution
- Area Charts: Cumulative cost analysis
- Scatter Plots: Anomaly visualization
- Responsive: Auto-resize on window changes
- Live Search: Instant results as you type
- Dynamic Filters: Charts update without page reload
- Progress Indicators: Upload & processing status
- Toast Notifications: Success/error messages
- Auto-Refresh: Polls for new data (optional)
- CSV Export: Download filtered datasets
- PDF Reports: Generate executive summaries (planned)
- Excel Format: Multi-sheet exports (planned)
- API Access: Programmatic data retrieval
- Batch Upload: Process multiple files
- Comparison Mode: Before/after side-by-side
- Favorites: Save frequently used filters
- Sharing: Generate shareable dashboard links (planned)
- Audit Trail: Track all data changes
Slide 1: Title & Mission (30 sec)
- "HPCL Intelligent Cost Database"
- Problem: Messy procurement data
- Solution: AI-powered standardization & analytics
Slide 2: Overview Tab (45 sec)
- Show KPIs: 26 POs → 11 unique items (58% dedup)
- Highlight: 94.4% average confidence
- Point: 3 anomalies detected for negotiation
Slide 3: Item Standardization (45 sec)
- Show raw descriptions (messy)
- Show canonical items (clean)
- Highlight confidence scores
- Explain: "Same item, 5 different ways"
Slide 4: Cost Analytics (45 sec)
- Show price trends chart
- Highlight region-wise variations
- Point to supplier performance
- Insight: "North region pays 8% more for hydraulic oil"
Slide 5: Anomaly Detection (30 sec)
- Show the 3 flagged items
- Highlight critical anomaly (53% overpayment)
- Recommendation: Renegotiate with supplier
Slide 6: Price Prediction (30 sec)
- Show 3-month forecast
- Highlight upward trends
- Recommendation: "Buy now for steel pipes, wait for hydraulic oil"
Slide 7: Business Impact (15 sec)
- Cost savings potential
- Process efficiency gains
- Next steps: Pilot roll-out
- Duplicate Item Consolidation: 58% fewer SKUs to manage
- Supplier Negotiation: Identified 3 overpriced orders (₹2,800 vs ₹1,825 for steel pipes)
- Bulk Optimization: Missed bulk discounts identified
- Regional Arbitrage: Price differences across regions (up to 8%)
- Time Reduction: 90% faster item lookup
- Error Elimination: No manual data entry errors
- Transparency: Complete visibility into spend
- Benchmarking: Real-time supplier performance tracking
- Data-Driven: Decisions based on facts, not intuition
- Scalable: Works for any number of items/suppliers
- Auditable: Full traceability & compliance
- Sustainable: Continuous improvement cycle
- Year 1: 5-8% procurement cost reduction
- Year 2+: Additional 3-5% from supplier optimization
- Payback: < 6 months
- Via UI: Use the Upload page in React frontend
- Via File: Drop CSV in
data/uploads/folder - Run Pipelines:
python run_pipeline.py # Or separately: python ai_standardization/run_standardization.py python ai_analytics/run_analytics.py - Auto-Refresh: Frontend polls for updates
cd frontend-react
# Edit React components
src/pages/ # Page-level components
src/components/ # Reusable UI components
src/App.jsx # Main app structure
src/index.css # Global styles
# Hot reload during development
npm run dev # Changes appear instantly# Edit backend/api.py
# Add new endpoint
@app.route('/api/custom-endpoint', methods=['GET'])
def custom_endpoint():
# Your logic here
return jsonify({"data": "value"})
# Modify existing endpoints
# Backend auto-reloads in dev mode# ai_standardization/clustering.py
SIMILARITY_THRESHOLD = 0.85 # Adjust clustering sensitivity
# ai_analytics/anomaly_detection.py
Z_SCORE_THRESHOLD = 2.0 # Adjust anomaly sensitivity
# ai_standardization/embeddings.py
MODEL_NAME = "sentence-transformers/all-MiniLM-L6-v2" # Change embedding model// frontend-react/tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
primary: '#your-color', // Change brand colors
secondary: '#your-color',
}
}
}
}
// frontend-react/src/index.css
/* Custom CSS overrides */// frontend-react/src/App.jsx
import NewPage from './pages/NewPage';
// Add route
<Route path="/new-page" element={<NewPage />} />
// Create component
// frontend-react/src/pages/NewPage.jsx
export default function NewPage() {
return <div>New Page Content</div>;
}- ✅ Real AI/ML standardization (sentence transformers)
- ✅ Full-stack architecture (React + Flask)
- ✅ RESTful API design
- ✅ Responsive UI with modern frameworks
- ✅ File upload & processing
- ✅ Statistical anomaly detection
- ✅ Trend analysis & forecasting
- ✅ Data export functionality
- Data stored in CSV (suitable for <500K records)
- Forecasts use statistical trends (not deep learning)
- No user authentication (can be added)
- No real-time collaboration
- Limited to English text processing
Phase 1 (Current): CSV-based prototype
- ✅ 100-10K records
- ✅ Single-user
- ✅ File-based storage
Phase 2 (Next 3 months): Database Integration
- 🔄 PostgreSQL/MongoDB backend
- 🔄 Multi-user support
- 🔄 User authentication (OAuth2)
- 🔄 Role-based access control
Phase 3 (6 months): Enterprise Features
- 📋 SAP/Oracle API integration
- 📋 Advanced ML models (LSTM, Transformers)
- 📋 Real-time collaboration
- 📋 Audit logging & compliance
Phase 4 (12 months): Scale & Optimize
- 📋 Microservices architecture
- 📋 Multi-language support
- 📋 Mobile apps (iOS/Android)
- 📋 Advanced analytics (what-if scenarios)
- Currency: Indian Rupees (₹) - configurable
- Date Format: ISO 8601 (YYYY-MM-DD)
- Language: English (can extend to Hindi/regional)
- Data Quality: 70%+ completeness required
- Update Frequency: Daily/weekly batch uploads
- Architecture: schemas/data_schema.md
- AI Standardization: ai_standardization/ai_standardization_readme.md
- Quick Start: QUICKSTART.md
- Frontend Guide: FRONTEND_GUIDE.md
- React Setup: REACT_SETUP_GUIDE.md
- Deployment: DEPLOYMENT_GUIDE.md
- Health Check:
GET /api/health - Data Endpoints:
/api/overview,/api/standardized,/api/analytics - Upload:
POST /api/upload(multipart/form-data) - Export:
GET /api/export/standardized(returns CSV)
Backend won't start:
# Check Python version
python --version # Should be 3.8+
# Reinstall dependencies
pip install -r requirements.txt -r backend/requirements.txt
# Check port availability
netstat -ano | findstr :5000Frontend won't start:
# Check Node version
node --version # Should be 18+
# Clear cache and reinstall
cd frontend-react
rm -rf node_modules package-lock.json
npm installAI pipeline errors:
# Install ML dependencies
pip install torch sentence-transformers scikit-learn
# Check CUDA availability (optional)
python -c "import torch; print(torch.cuda.is_available())"- Review error logs in terminal
- Check
data/folder permissions - Ensure CSV files match expected schema
- Verify API endpoints with browser/Postman
- React Docs: https://react.dev
- Flask Docs: https://flask.palletsprojects.com
- Tailwind CSS: https://tailwindcss.com
- Recharts: https://recharts.org
- Sentence Transformers: https://www.sbert.net
Hackathon Project: HPCL Procurement Transformation & Digitalisation
Built with:
- React: https://react.dev
- Vite: https://vitejs.dev
- Tailwind CSS: https://tailwindcss.com
- Flask: https://flask.palletsprojects.com
- Sentence Transformers: https://www.sbert.net
- Recharts: https://recharts.org
- Framer Motion: https://www.framer.com/motion
- Pandas: https://pandas.pydata.org
- scikit-learn: https://scikit-learn.org
Version: 2.0 (React Frontend + AI Backend) Last Updated: January 2026 Status: Production-Ready Prototype
- React Official: https://react.dev
- Vite Guide: https://vitejs.dev/guide
- Tailwind CSS: https://tailwindcss.com/docs
- Recharts Examples: https://recharts.org/en-US/examples
- Framer Motion: https://www.framer.com/motion/introduction
- Flask Tutorial: https://flask.palletsprojects.com/tutorial
- RESTful API Design: https://restfulapi.net
- Flask-CORS: https://flask-cors.readthedocs.io
- Sentence Transformers: https://www.sbert.net
- scikit-learn: https://scikit-learn.org/stable/tutorial
- NLP Basics: https://www.nltk.org/book
- Clustering: https://towardsdatascience.com/clustering-algorithms
- Recharts API: https://recharts.org/en-US/api
- D3.js Tutorials: https://d3-graph-gallery.com
- Chart Design: https://www.data-to-viz.com
- React + Flask: https://blog.miguelgrinberg.com/post/how-to-create-a-react--flask-project
- Modern Web Dev: https://web.dev/learn
- ✅ Run Locally: Follow setup instructions above
- ✅ Upload Sample Data: Use the template in
data/uploads/ - ✅ Test AI Pipeline: Run standardization and analytics
- ✅ Explore Dashboard: Navigate through all pages
- ✅ Customize: Adjust branding and parameters
- 📋 Environment Setup: Configure production environment variables
- 📋 Build Frontend:
npm run buildin frontend-react - 📋 Database Integration: Migrate from CSV to PostgreSQL
- 📋 Docker Container: Create production Dockerfile
- 📋 Cloud Deployment: Deploy to Azure/AWS/GCP
- 📋 Security Audit: Add authentication & authorization
- 📋 Performance Testing: Load test with 100K+ records
- 📋 SAP Integration: Connect to existing ERP systems
- 📋 User Training: Create training materials & videos
- 📋 Pilot Rollout: Start with one department/region
- 📋 Feedback Loop: Collect user feedback & iterate
- 🔄 Real-time Processing: Stream data from live systems
- 🔄 Advanced ML: Implement deep learning models
- 🔄 Multi-language: Support Hindi, regional languages
- 🔄 Mobile Apps: Native iOS/Android applications
- 🔄 Collaboration: Real-time multi-user editing
- 🔄 Notifications: Email/SMS alerts for anomalies
![]() Utkarsh Shukla Full Stack Engineer 💻 |
![]() Sumit Pandey AI/ML Engineer 1 🤖 |
![]() Ashirwad Sinha AI/ML Engineer 2 🤖 |
Thank you for exploring HPCL Intelligent Cost Database! 🎉
"Procure with Precision | Analyze with Intelligence"



