An intelligent ad fraud detection system that combines traditional machine learning with advanced AI analysis to identify and block fraudulent advertising traffic in real-time.
The system uses a two-tier detection approach:
- Tier 1 (ML): Fast XGBoost-based screening for immediate decisions (<100ms)
- Tier 2 (AI): Deep analysis using Amazon Bedrock/Claude for sophisticated fraud patterns (1-3s)
- AWS CLI configured with appropriate credentials
- AWS SAM CLI installed (optional, for easier deployment)
- Python 3.11
- AWS Account with permissions for:
- API Gateway
- Lambda
- DynamoDB
- S3
- SageMaker
- Bedrock
.
├── template.yaml # AWS SAM template
├── samconfig.toml # SAM configuration
├── docs/ # Additional documentation
├── src/
│ ├── ingestion/ # Ingestion handler Lambda
│ ├── orchestrator/ # Fraud orchestrator Lambda
│ └── ai_analyzer/ # AI analysis Lambda
└── README.md
-
Install AWS SAM CLI (if not already installed):
# macOS brew install aws-sam-cli # Or using pip pip install aws-sam-cli
-
Build the application:
sam build
-
Deploy to AWS:
sam deploy --guided
-
Get API endpoint and key: After deployment, check the CloudFormation outputs for:
- API URL
- API Key
# Start local API
sam local start-api
# Invoke function locally
sam local invoke IngestionHandler --event events/event.jsonSet up your .env file with:
- AWS credentials
- API keys for Bedrock
- Other configuration
Additional documentation is available in the /docs folder:
- Product Requirements:
ad-fraud-detection-prd.md - Integration Guides:
- Storage:
STORAGE.md - Testing:
TESTING_BEDROCK.md - Development:
BRANCH_STRATEGY.md
Module-specific documentation:
- Dashboard:
dashboard/README.mdanddashboard/DEPLOYMENT.md - Scripts:
scripts/README.md - Components: See README files in respective
src/subdirectories
- API Gateway: REST API endpoint for fraud detection
- Lambda Functions:
- Ingestion Handler: Parse and store events
- Fraud Orchestrator: Route to ML/AI analysis
- AI Analyzer: Deep fraud analysis using Bedrock
- DynamoDB: Real-time event storage
- S3: Long-term data storage and training data
- SageMaker: XGBoost model endpoint
- Bedrock: Claude 3 Sonnet for AI analysis
- Implement Lambda functions
- Train and deploy XGBoost model
- Configure Bedrock access
- Build Streamlit dashboard
- Set up monitoring and alerting
Proprietary - All rights reserved