Inspiration
We were inspired by the real-world problem of fraud in supply chains and logistics. When we saw the HackUTD challenge about a potion factory with dishonest witches, we realized this was the perfect opportunity to build a fraud detection system that accounts for physics! The magical theme made it fun, but the underlying math and data science are serious — this same algorithm could detect fraud in oil pipelines, water distribution, or any system with continuous flow during collection.
What it does
Truth Serum is a fraud detection dashboard that catches dishonest courier witches who misreport potion amounts. It:
- Analyzes minute-by-minute cauldron level data from the HackUTD API
- Calculates unique fill rates for each of 12 cauldrons using time-series analysis
- Detects drainage events and matches them to transport tickets
- Accounts for continuous potion inflow during collection (the key insight!)
- Flags suspicious tickets with 10–25% discrepancies and fraudulent tickets with >25% errors
- Tracks witch trust scores (starting at 100, losing points for fraud)
- Visualizes everything in a beautiful React dashboard with interactive maps
How we built it
Backend (Python/Flask)
- Built a
DataProcessorclass that calculates per-cauldron fill rates from historical data using NumPy - Created a
FraudDetectorclass that finds daily drain events (peak-to-valley analysis) - Implemented the critical formula:
Expected = Visible Drain + (Fill Rate × Drain Duration) - Handled edge cases like multiple witches visiting the same cauldron per day
- Served everything through a Flask API with endpoints for tickets, witches, and analysis
Frontend (React)
- Created 4 tabs: Overview, Tickets, Witches, and Factory Map
- Used Recharts for data visualization and Leaflet for an interactive factory map
- Implemented real-time data fetching with auto-refresh capability
- Designed a purple factory-themed UI with smooth animations and clean layout
Algorithm Design
- Debugged and fixed the “Expected > 100” issue by dividing total drainage by the number of daily tickets
- Tuned validation thresholds (10% / 25%) and trust penalties (-2 / -8)
- Verified that all data comes from live API calls, not hardcoded assumptions
Challenges we ran into
- The "Expected > 100" Problem: Our algorithm initially produced unrealistic expected amounts. We discovered overlapping witch visits and corrected it by adjusting for ticket counts.
- Gradual vs Sudden Drains: We had to switch from discrete drain detection to daily peak-to-valley analysis.
- All Witches at 0 Trust: Early penalties were too harsh; even honest witches lost all trust. Rebalanced to -2/-8.
- Understanding Continuous Flow: Accounting for potion inflow during drainage was tricky but essential.
- First-Time Coder: Learning React, Flask, and deployment simultaneously was a massive but rewarding challenge!
Accomplishments that we're proud of
✅ Mathematically sound algorithm that models real-world physics (continuous flow)
✅ Realistic fraud detection — 61% valid, 17% suspicious, 21% fraudulent
✅ Trust scores that evolve logically based on behavior
✅ Visually appealing UI with interactive maps and charts
✅ Modular design — data processing, fraud detection, and API layers are cleanly separated
✅ Robust handling of edge cases and real-time API integration
✅ Built a complex full-stack system
What we learned
Technical Skills
- Designing algorithms that account for physical systems
- Performing time-series analysis and anomaly detection in Python
- Structuring RESTful APIs and handling real-time data
- Building dynamic React dashboards with state management
- Using visual cues (color coding, charts) for clarity in data representation
- Balancing detection thresholds for accurate results
Problem-Solving
- Sometimes “bugs” are real-world insights (expected > 100)
- Learned iterative debugging with detailed logging and test scripts
- Validated models with real data, not assumptions
Soft Skills
- Explained complex math simply for judges and teammates
- Documented everything clearly (README + QUICKSTART)
- Learned to reverse-engineer from challenge specs to algorithmic design
What's next for Truth Serum
Bonus Challenge — Route Optimization
- Find the minimum number of witches needed to prevent cauldron overflow
- Create a scheduling algorithm using travel-time data
- Factor in 15-minute unload times at the market
- Visualize optimized routes on the map
Enhanced Features
- Historical playback: visualize potion levels over time
- Predictive analytics: forecast potential overflows
- Fraud clustering: detect behavioral patterns among witches
- Exportable PDF fraud reports
- Sound alerts for fraud events
- Dark mode toggle
Real-World Applications
- Apply to oil pipeline or water distribution fraud detection
- Use for warehouse inventory or shipping verification systems
- Any domain involving continuous flow + periodic collection!

Log in or sign up for Devpost to join the conversation.