Revenue Data Validator
by canyouseeus
Identifies and filters test/dummy revenue data from real customer transactions across all revenue streams (affiliates, gallery, subscriptions).
Skill Details
Repository Files
1 file in this skill directory
name: revenue-data-validator description: Identifies and filters test/dummy revenue data from real customer transactions across all revenue streams (affiliates, gallery, subscriptions).
Revenue Data Validator Skill
This skill helps identify test/dummy data vs. real customer revenue across the platform.
Problem Statement
The platform currently shows inflated revenue numbers because test data exists in:
- Affiliates table: Test earnings showing $9,609.49
- Photo orders: Test gallery purchases
- Subscriptions: Admin account subscription ($9.99/month)
Current Reality: $0 in actual revenue, but dashboard shows thousands in test data.
Solution: Revenue Validation Rules
1. Affiliate Revenue Validation
Test Data Indicators:
- Earnings created before official launch date
- Affiliate accounts with test/dummy email patterns (e.g.,
test@,admin@,demo@) - Round number earnings (e.g., $100.00, $500.00, $1000.00)
- Earnings without corresponding click/conversion records
- Affiliate IDs that match known test accounts
SQL to Identify Test Affiliates:
-- Find test affiliate accounts
SELECT id, email, total_earnings, created_at
FROM affiliates
WHERE
email LIKE '%test%'
OR email LIKE '%demo%'
OR email LIKE '%admin%'
OR total_earnings::numeric % 100 = 0 -- Round numbers
OR created_at < '2026-01-01' -- Before launch
ORDER BY total_earnings DESC;
SQL to Get Real Affiliate Revenue:
-- Get only real affiliate revenue
SELECT COALESCE(SUM(total_earnings), 0) as real_revenue
FROM affiliates
WHERE
email NOT LIKE '%test%'
AND email NOT LIKE '%demo%'
AND email NOT LIKE '%admin%'
AND created_at >= '2026-01-01' -- Adjust to actual launch date
AND total_earnings > 0;
2. Gallery Revenue Validation
Test Data Indicators:
- Orders from test email addresses
- Orders created during development/testing phase
- Orders with test payment IDs (PayPal sandbox transactions)
- Orders from admin/developer accounts
SQL to Identify Test Gallery Orders:
-- Find test photo orders
SELECT id, email, total_amount_cents, payment_status, created_at
FROM photo_orders
WHERE
email LIKE '%test%'
OR email LIKE '%demo%'
OR email LIKE '%admin%'
OR created_at < '2026-01-01' -- Before launch
ORDER BY total_amount_cents DESC;
SQL to Get Real Gallery Revenue:
-- Get only real gallery revenue (in dollars)
SELECT COALESCE(SUM(total_amount_cents), 0) / 100.0 as real_revenue
FROM photo_orders
WHERE
email NOT LIKE '%test%'
AND email NOT LIKE '%demo%'
AND email NOT LIKE '%admin%'
AND created_at >= '2026-01-01' -- Adjust to actual launch date
AND payment_status = 'completed';
3. Subscription Revenue Validation
Test Data Indicators:
- Admin account subscriptions
- Test user subscriptions
- Subscriptions created during development
SQL to Identify Test Subscriptions:
-- Find test subscriptions
SELECT ps.id, ps.user_id, u.email, ps.tier, ps.created_at
FROM platform_subscriptions ps
JOIN auth.users u ON u.id = ps.user_id
WHERE
u.email LIKE '%test%'
OR u.email LIKE '%demo%'
OR u.email LIKE '%admin%'
OR ps.created_at < '2026-01-01' -- Before launch
ORDER BY ps.created_at DESC;
Implementation in Dashboard
Update Admin.tsx Revenue Calculation
Add a launch date constant and filter logic:
// Add at top of file
const PLATFORM_LAUNCH_DATE = '2026-01-15'; // Adjust to actual launch date
// In the revenue calculation section:
const isTestEmail = (email: string) => {
const testPatterns = ['test', 'demo', 'admin', 'dev', 'staging'];
return testPatterns.some(pattern =>
email?.toLowerCase().includes(pattern)
);
};
// Filter affiliates
if (affiliates) {
affiliateRevenueTotal = affiliates
.filter(a => {
// Add email field to the select query first
return !isTestEmail(a.email) &&
new Date(a.created_at) >= new Date(PLATFORM_LAUNCH_DATE);
})
.reduce((sum, a) => {
const earnings = typeof a.total_earnings === 'string'
? parseFloat(a.total_earnings)
: (a.total_earnings || 0);
return sum + (isNaN(earnings) ? 0 : earnings);
}, 0);
}
// Filter gallery orders
if (orders) {
galleryRevenueTotal = orders
.filter(o => {
// Add email field to the select query first
return !isTestEmail(o.email) &&
new Date(o.created_at) >= new Date(PLATFORM_LAUNCH_DATE) &&
o.payment_status === 'completed';
})
.reduce((sum, o) => sum + (o.total_amount_cents || 0), 0) / 100;
}
Update Supabase Queries
Modify the queries to include email and created_at fields:
// Affiliate query
const { data: affiliates, error: affError } = await supabase
.from('affiliates')
.select('total_earnings, email, created_at');
// Gallery orders query
const { data: orders, error: ordersError } = await supabase
.from('photo_orders')
.select('total_amount_cents, email, created_at, payment_status');
Quick Cleanup Commands
Option 1: Mark Test Data (Recommended)
Add a is_test_data boolean column to track test records:
-- Add column to affiliates
ALTER TABLE affiliates ADD COLUMN IF NOT EXISTS is_test_data BOOLEAN DEFAULT false;
-- Mark test affiliates
UPDATE affiliates
SET is_test_data = true
WHERE
email LIKE '%test%'
OR email LIKE '%demo%'
OR email LIKE '%admin%'
OR created_at < '2026-01-01';
-- Add column to photo_orders
ALTER TABLE photo_orders ADD COLUMN IF NOT EXISTS is_test_data BOOLEAN DEFAULT false;
-- Mark test orders
UPDATE photo_orders
SET is_test_data = true
WHERE
email LIKE '%test%'
OR email LIKE '%demo%'
OR email LIKE '%admin%'
OR created_at < '2026-01-01';
Then filter in queries:
.eq('is_test_data', false)
Option 2: Delete Test Data (Use with Caution)
-- BACKUP FIRST!
-- Delete test affiliate data
DELETE FROM affiliates
WHERE
email LIKE '%test%'
OR email LIKE '%demo%'
OR email LIKE '%admin%';
-- Delete test gallery orders
DELETE FROM photo_orders
WHERE
email LIKE '%test%'
OR email LIKE '%demo%'
OR email LIKE '%admin%';
Monitoring & Alerts
Add alerts when test data is detected:
// In Admin.tsx alerts generation
if (affiliateRevenueTotal > 0) {
// Check if any test data exists
const hasTestData = affiliates?.some(a => isTestEmail(a.email));
if (hasTestData) {
newAlerts.push({
id: Date.now() + 100,
type: 'warning',
message: 'Test affiliate data detected - revenue may be inflated',
time: 'Just now',
read: false
});
}
}
Best Practices
- Always use launch date filtering - Set
PLATFORM_LAUNCH_DATEto when you actually started accepting real customers - Mark, don't delete - Use
is_test_dataflag instead of deleting test records (useful for debugging) - Email pattern matching - Maintain a list of test email patterns
- Regular audits - Periodically check for new test data that slipped through
- Separate test environment - Use different Supabase projects for dev/staging/production
Current Action Items
- ✅ Set
PLATFORM_LAUNCH_DATE = '2026-01-15'(or actual launch date) - ✅ Update affiliate query to include
email, created_at - ✅ Update gallery query to include
email, created_at, payment_status - ✅ Add
isTestEmail()helper function - ✅ Add filtering logic to revenue calculations
- ⏳ Run SQL to mark test data with
is_test_data = true - ⏳ Verify dashboard shows $0.00 for all revenue streams
Related Skills
Xlsx
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas
Clickhouse Io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Clickhouse Io
ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.
Analyzing Financial Statements
This skill calculates key financial ratios and metrics from financial statement data for investment analysis
Data Storytelling
Transform data into compelling narratives using visualization, context, and persuasive structure. Use when presenting analytics to stakeholders, creating data reports, or building executive presentations.
Kpi Dashboard Design
Design effective KPI dashboards with metrics selection, visualization best practices, and real-time monitoring patterns. Use when building business dashboards, selecting metrics, or designing data visualization layouts.
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Sql Optimization Patterns
Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.
Anndata
This skill should be used when working with annotated data matrices in Python, particularly for single-cell genomics analysis, managing experimental measurements with metadata, or handling large-scale biological datasets. Use when tasks involve AnnData objects, h5ad files, single-cell RNA-seq data, or integration with scanpy/scverse tools.
Xlsx
Spreadsheet toolkit (.xlsx/.csv). Create/edit with formulas/formatting, analyze data, visualization, recalculate formulas, for spreadsheet processing and analysis.
