How deepika-1020/leaklens works
LeakLens is a Streamlit decision-support application for investigating e-commerce revenue leakage. A user submits a business question; the router classifies its intent and filters, the engine dispatches deterministic analysis over unified order data, and the reasoner turns calculated facts into a grounded briefing. The UI presents findings and evidence, then requires reviewer approval or rejection before recording an audit entry. The README also documents refund, delivery, discount, product, customer, and trend investigations. Some analytics modules are present but their runtime dispatch is not shown in the excerpts.
Main entry points: leaklens_engine.py Investigation engine · data_loader.py Data preparation · app.py Decision UI · revenue_investigator.py Revenue investigation
Components 18
User experience
- Decision UI
app.py
Query orchestration
- Investigation engine
src/leaklens_engine.py - Intent router
src/query_router.py
Deterministic analytics
- Data preparation
src/data_loader.py - Business CSVs
data - Revenue trends
src/trend_analyzer.py - Revenue investigation
src/revenue_investigator.py - Product leakage
src/product_analyzer.py - Customer analysis
src/customer_analyzer.py - Evidence extraction
src/evidence_engine.py - Investigation analysis
src/investigator.py - Leakage detection
src/leakage_detector.py - Base decisions
src/decision_engine.py
Reasoning and governance
- Grounded reasoner
src/reasoner.py - Audit logger
src/audit_logger.py - Persistent audit trail
audit_trail.json
Other components
- Business user
- Gemini API
Connections 17
- Business user → Decision UI: asks question
README.md - Decision UI → Investigation engine: submits query
app.py - Investigation engine → Intent router: classifies intent
src/leaklens_engine.py - Investigation engine → Data preparation: loads unified data
src/leaklens_engine.py - Data preparation → Business CSVs: reads CSVs
src/data_loader.py - Investigation engine → Revenue investigation: dispatches trend
src/leaklens_engine.py - Revenue investigation → Revenue trends: compares periods
src/revenue_investigator.py - Investigation engine → Product leakage: dispatches product
src/leaklens_engine.py - Investigation engine → Customer analysis: dispatches customer
src/leaklens_engine.py - Investigation engine → Evidence extraction: extracts evidence
src/leaklens_engine.py - Investigation engine → Grounded reasoner: synthesizes facts
src/leaklens_engine.py - Grounded reasoner → Gemini API: requests synthesis
- Decision UI → Audit logger: records decision
app.py - Audit logger → Persistent audit trail: persists entry
src/audit_logger.py - Investigation analysis → Data preparation: loads data
src/investigator.py - Leakage detection → Data preparation: loads data
src/leakage_detector.py - Base decisions → Data preparation: loads data
src/decision_engine.py