Demo Dashboard
Professional-grade Streamlit dashboard for demonstrating and testing the fraud detection system.
Overview
The demo dashboard provides a visual interface for:
- Real-time transaction testing with attack simulation presets
- Score visualization with interactive gauges
- Analytics and decision history
- Policy inspection
Dashboard Sections
System Status (Sidebar)
The sidebar displays real-time system health:
| Indicator | Description |
|---|---|
| System Status | Overall health (Healthy/Degraded/Down) |
| Redis | Velocity counter store status |
| PostgreSQL | Evidence storage status |
| Policy | Policy engine loaded status |
| Policy Version | Current policy version number |
Also shows API endpoint information and last decision summary.
Transaction Simulator
Interactive form for submitting test transactions with pre-configured attack scenarios.
Attack Presets
| Preset | Description | Expected Decision |
|---|---|---|
| Normal Transaction | Typical legitimate $50 transaction | ALLOW |
| Card Testing Attack | Small $1 amount with datacenter IP | REVIEW/BLOCK |
| Velocity Attack | High-value $1500 from new account | FRICTION/REVIEW |
| Geographic Anomaly | US card transacting from Nigeria | REVIEW |
| Bot/Emulator Attack | Emulated device via Tor exit node | BLOCK |
| Friendly Fraud Risk | High-value from dispute-prone profile | FRICTION |
Customizable Fields
- Amount (dollars)
- Service ID (telco service identifier)
- Event Subtype (sim_activation, topup, device_upgrade, sim_swap)
- Card Token
- User ID / Subscriber ID
- Phone Number and IMEI (telco-specific)
- Device flags (Emulator, Rooted)
- Network flags (Tor, Datacenter, VPN)
Decision Result Display
When a transaction is submitted, the dashboard shows:
Decision Badge
Large colored badge indicating the decision:
- ALLOW (green) - Transaction approved
- FRICTION (yellow) - Additional verification required (3DS, OTP)
- REVIEW (orange) - Manual review queue
- BLOCK (red) - Transaction declined
Score Gauges
Four interactive gauges showing:
| Gauge | Description | Color Scale |
|---|---|---|
| Overall Risk | Combined risk score (0-100%) | Green to Red |
| Criminal | Criminal fraud probability | Green to Red |
| Friendly Fraud | Friendly fraud probability | Green to Red |
| Bot Score | Automation/bot probability | Green to Red |
Color thresholds:
- 0-30%: Green (low risk)
- 30-60%: Yellow (medium risk)
- 60-80%: Orange (elevated risk)
- 80-100%: Red (high risk)
Detailed Score Breakdown
Expandable section showing individual detector scores:
- Card Testing Score
- Velocity Score
- Geo Anomaly Score
- Confidence Level
Triggered Reasons
Each risk factor that contributed to the decision is displayed as a card:
[CRITICAL] BOT_EMULATOR
Device appears to be an emulator
[HIGH] BOT_TOR_EXIT
Transaction from Tor exit node
Severity levels: CRITICAL, HIGH, MEDIUM, LOW
Friction/Review Information
If friction is required, shows:
- Friction type (3DS, OTP, STEP_UP, CAPTCHA)
- User-facing message
If review is required, shows:
- Review priority (HIGH, MEDIUM, LOW)
- Review notes summarizing concerns
Analytics Dashboard
Visual analytics for the last 24 hours of transactions.
Key Metrics Row
| Metric | Description |
|---|---|
| Total Transactions | Count of decisions made |
| Avg Risk Score | Mean risk score |
| P95 Risk Score | 95th percentile risk score |
| Avg Latency | Mean processing time |
| P99 Latency | 99th percentile processing time |
Decision Distribution Chart
Donut chart showing breakdown of decisions:
- ALLOW (green)
- FRICTION (yellow)
- REVIEW (orange)
- BLOCK (red)
Hourly Transaction Volume
Bar chart showing transaction count per hour.
Latency Over Time
Line chart showing average latency per hour with 200ms target line.
Decision History
Query historical decisions from PostgreSQL evidence table.
Filters
- Limit: 25, 50, 100, or 250 records
- Decision type: Multi-select ALLOW/FRICTION/REVIEW/BLOCK
Table Columns
| Column | Description |
|---|---|
| Transaction ID | Unique transaction identifier |
| Decision | ALLOW/FRICTION/REVIEW/BLOCK |
| Amount | Transaction amount in dollars |
| Risk Score | Overall risk percentage |
| Latency | Processing time in milliseconds |
| Time | Timestamp of decision |
Summary Statistics
- Approval Rate (% ALLOW decisions)
- Block Rate (% BLOCK decisions)
- Avg Risk Score
- Avg Latency
Policy Inspector
View the current policy configuration without editing.
Policy Overview
- Version number
- Default action
- Description
Score Thresholds
Display of threshold configuration for each score type:
| Score Type | Block | Review | Friction |
|---|---|---|---|
| Risk | 90% | 70% | 50% |
| Criminal | 85% | 65% | 45% |
| Friendly | 95% | 60% | 40% |
Active Rules
Expandable list of all enabled rules showing:
- Rule name and priority
- Description
- Action (BLOCK, REVIEW, FRICTION)
- Friction type (if applicable)
- Conditions (JSON format)
Lists Summary
Count of entries in:
- Blocklists (Cards, Devices, IPs, Users)
- Allowlists (Cards, Users, Services)
Raw Policy
Expandable section showing full YAML configuration.
Policy Settings (v1.1)
Edit policy configuration with full version control and audit trail.
Current Version Info
Displays at the top:
- Current Version (semantic: MAJOR.MINOR.PATCH)
- Last Changed By
- Last Updated timestamp
- Policy Hash (for integrity)
Thresholds Tab
Interactive sliders for each score type (Risk, Criminal, Friendly):
- Friction Threshold (green zone)
- Review Threshold (yellow zone)
- Block Threshold (red zone)
Validation: Ensures friction < review < block. Invalid configurations are blocked.
Rules Tab
Existing Rules Display:
- Sorted by priority (lower = higher priority)
- Status indicators (enabled/disabled)
- Expandable details with conditions JSON
- Delete button for each rule
Add New Rule Form:
- Rule ID and Name
- Description
- Priority (1-1000)
- Enabled toggle
- Action (ALLOW, FRICTION, REVIEW, BLOCK)
- Friction Type (3DS, OTP, STEP_UP, CAPTCHA)
- Review Priority (LOW, MEDIUM, HIGH, URGENT)
- Conditions (JSON editor)
Blocklists Tab
Manage blocked entities:
| List Type | Description |
|---|---|
| Card Tokens | Permanently block specific cards |
| Device IDs | Block compromised devices |
| IP Addresses | Block malicious IPs |
| User IDs | Block fraudulent users |
Each item can be added or removed. Changes create new policy versions.
Allowlists Tab
Manage trusted entities that skip fraud checks:
| List Type | Description |
|---|---|
| Card Tokens | VIP or corporate cards |
| User IDs | Verified trusted subscribers |
| Service IDs | Whitelisted telco services |
Version History Tab
View complete policy change history:
- Version number with active indicator
- Change type (threshold, rule_add, rule_delete, rollback, etc.)
- Change summary
- Changed by (user)
- Created at timestamp
- Rollback button for non-active versions
Rollback creates a new version from old content (immutable history).
Running the Dashboard
Prerequisites
- Fraud API running on port 8000
- Redis running on port 6379
- PostgreSQL running on port 5432
Start Command
cd /Users/omega/Projects/FraudDetection
streamlit run dashboard.py --server.port 8501
Environment Variables
| Variable | Default | Description |
|---|---|---|
| FRAUD_API_URL | http://localhost:8000 | Fraud API endpoint |
| POSTGRES_URL | postgresql://fraud_user:fraud_pass@localhost:5432/fraud_detection | Database URL |
UI/UX Design
Color Scheme
| Element | Color | Usage |
|---|---|---|
| Primary | #3b82f6 | Buttons, links, active states |
| Success | #10b981 | ALLOW decisions, healthy status |
| Warning | #f59e0b | FRICTION decisions, degraded status |
| Danger | #ef4444 | BLOCK decisions, errors |
| Review | #f97316 | REVIEW decisions |
Typography
- Headers: System font, bold
- Body: System font, regular
- Metrics: Monospace for numbers
- Code: Monospace with background
Layout
- Responsive two-column layout for simulator
- Full-width charts for analytics
- Collapsible sections for detailed information
- Sticky sidebar for system status
Demo Workflow
Recommended Demo Sequence
-
Start with Normal Transaction
- Show ALLOW decision
- Point out low risk scores
- Highlight fast latency (<10ms)
-
Card Testing Attack
- Show detection of small amount + datacenter IP
- Explain velocity counter concept
-
Geographic Anomaly
- Show country mismatch detection
- Explain geo-risk scoring
-
Bot/Emulator Attack
- Show BLOCK decision
- Walk through multiple triggered reasons
- Point out CRITICAL severity flags
-
Analytics Dashboard
- Show decision distribution
- Highlight latency performance
- Explain 200ms target
-
Decision History
- Filter by BLOCK decisions
- Show evidence capture for disputes
-
Policy Inspector
- Explain threshold configuration
- Show rule priority system
- Demonstrate hot-reload capability
-
Policy Settings (v1.1)
- Adjust a threshold slider (show validation)
- Add a test rule (show version increment)
- View version history
- Demonstrate rollback capability
Troubleshooting
Dashboard Not Loading
Check that Streamlit is installed:
pip install streamlit plotly pandas
API Connection Failed
Verify API is running:
curl http://localhost:8000/health
Database Connection Failed
Check PostgreSQL connection:
docker-compose ps
Charts Not Displaying
Ensure Plotly is installed:
pip install plotly
Dashboard Version: 1.1 Last Updated: January 3, 2026 - Added Policy Settings tab with version control