← Projects
Personal project Production deployed Live

Procurement & Margin Intelligence Dashboard

Full-stack BI platform for a multi-location manufacturer — nightly ERP ingest, BOM-level costing, live commodity signals, role-based views. Built solo and running in production.

The problem

A multi-location manufacturer had no unified view of product margin. Cost data was scattered across ERP tables with no consistent reconciliation methodology — production costs, stock ledger costs, and intercompany transfers all diverged, making it impossible to compare margins across product lines or fiscal years. The business ran on ERP exports and spreadsheets with no IT department to fix it.

What I built

A full-stack BI platform built solo — nightly ETL from an on-premises ERP (via pyodbc) into SQLite, a FastAPI backend with 12 route groups, and a React SPA with 7 role-gated views covering executive summary, product profitability, margin simulation, commodity tracking, supplier intelligence, customer intelligence, and quote benchmarking. The core technical challenge was a four-tier cost reconciliation hierarchy that dynamically selects the best available cost source per product per period, with a single source-of-truth function ensuring UI labels and query logic never drift apart. Live commodity price tracking via metals.dev feeds into Z-score timing signals for purchasing decisions. Deployed on Windows Server via a service wrapper; ingests nightly at 3am unattended.

Tech stack

Python FastAPI SQLite pandas numpy statsmodels React 19 Recharts Vite JWT pyodbc metals.dev API

Architecture

Data Source
On-premises ERP SQL Server
Ingestion
Nightly ETL pyodbc + pandas, nightly refresh purchase, sales, stock ledger, BOM, production costs
Storage
SQLite ~500k+ rows
API
FastAPI 12 route groups, JWT auth
cost_method() 4-tier cost reconciliation
Commodity cache copper, alum., currency pricing
BOM explosion recursive, with caching
Frontend
Executive Summary
Product Explorer
Supplier Intelligence
Commodity Tracker Z-score signals
Margin Simulator what-if
Quote Benchmarker
Customer Intelligence

The hard part

Multi-source cost reconciliation across incomplete data. The ERP holds four distinct cost sources that vary in availability and precision by product, location, and fiscal period. The solution was a single cost_method(fy, quarter) function that returns the best available tier and generates the corresponding SQL — so every endpoint, UI label, and coverage note derives from the same logic and can never drift out of sync. A second significant challenge was filtering intercompany transactions: sales have a database flag; purchases do not, requiring supplier name pattern matching — an asymmetry baked into the ERP's data model, not a bug to fix but a constraint to encode cleanly.

Screenshots

Margin Intelligence Dashboard — executive summary Margin Intelligence Dashboard — product explorer Margin Intelligence Dashboard — commodity tracker

Outcomes

  • Deployed in production; nightly ingest runs unattended across multiple fiscal years of data
  • Sub-second API responses across 500k+ transaction rows
  • Commodity timing signals (Z-score vs rolling 252-day window) for copper and aluminium purchasing decisions
  • Role-based access for executive, marketing, and procurement teams with page-level guards
  • Annual team KPIs are now formally set and tracked through the dashboard