Commit graph

6 commits

Author SHA1 Message Date
DJP
b20119b383 Add complete mapping system and automated Box.com monitoring service
Major Features:
- Complete Ferrero ↔ CreativeX mapping system with 93 brands
- Automated Box.com folder monitoring service
- Email notifications with score breakdowns
- Database integration for result storage

Mapping System (v2.0.0):
- mappings.json: 93 brand mappings, 44+ channel mappings
- core/mapping_resolver.py: Translates Ferrero codes to CreativeX format
- scripts/validate_mappings.py: Validation tool for brand/channel support
- scripts/generate_brand_mappings.py: Auto-mapping tool
- scripts/download_reports.py: Scorecard PDF download tool
- Updated scripts/upload.py: Integrated mapping validation
- Updated scripts/check_status.py: Added detailed score display with guidelines

Documentation:
- Updated README.md: Complete user guide with mapping system
- Updated STATUS.md: Production-ready status with test results
- MAPPINGS_GUIDE.md: Complete mapping documentation
- MAPPING_IMPLEMENTATION.md: Implementation summary
- BRAND_MAPPINGS_REVIEW.md: Brand mapping validation guide
- PRODUCTION_BRANDS_SUMMARY.md: Production brand catalog
- PRODUCTION_MAPPING_COMPLETE.md: Mapping completion summary

Automation Service (New):
- creativex-automation/: Complete automated Box monitoring service
- Monitors Box Ferrero-In folder (363284027140) for new files
- Automatically uploads to CreativeX
- Polls for completion (30 min intervals)
- Extracts scores and stores in PostgreSQL creativex_scores table
- Sends formatted emails to file uploader + daveporter@oliver.agency
- Moves processed files to Processed subfolder

Service Components:
- automation/box_monitor.py: Box folder monitoring with uploader detection
- automation/upload_processor.py: CreativeX upload integration
- automation/status_poller.py: CreativeX status polling
- automation/result_handler.py: Score extraction and email sending
- automation/orchestrator.py: Service coordination
- automation/processing_queue.py: JSON-based processing queue
- service.py: Main service entry point
- config.py: Service configuration loader
- requirements.txt: All dependencies
- deployment/systemd/: Systemd service unit file
- Updated shared/notifier.py: Added creativex_upload_complete and creativex_upload_failed templates

Testing:
- Supports --dry-run mode for configuration testing
- Supports --scan-once mode for Box folder testing
- Manual run mode for development/testing
- Comprehensive logging with rotation (10MB, 28 backups)

Database Integration:
- Uses existing creativex_scores table (no migrations needed)
- Compatible with existing Ferrero-Opentext workflows
- Stores full CreativeX API responses in JSONB

Email Templates:
- Matches Ferrero-Opentext styling (#9c27b0 purple for CreativeX)
- Includes score, tier, guidelines breakdown, scorecard URL
- Recipients: Box uploader + CC to daveporter@oliver.agency

Deployment:
- Runs locally for dev/testing
- Systemd service for production
- Auto-restart on failure
- Complete documentation in creativex-automation/README.md

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-29 09:51:16 -05:00
DJP
78e19ca82d Add error status handling and detailed error logging
Changes:
- Detect 'error' status from API
- Mark upload as failed when error status received
- Display full error response for debugging
- Log error details to help diagnose issues
2026-01-09 14:50:36 -05:00
DJP
3f8351dff6 Fix: Correct preflight payload structure
The API expects:
- name, brand_name, market_name, channel at top level
- creatives array with only source_url

Changes:
- Moved name and channel to top level
- Changed asset_url to source_url in creatives
- Updated API client validation to match

This fixes the 'channel is missing, name is missing, source_url is missing' error.
2026-01-09 14:46:41 -05:00
DJP
7b506ba449 Fix: Update preflight payload to match API requirements
The CreativeX API expects specific field names and structure:
- brand_name (not brand)
- market_name (not market)
- creatives array containing asset details

Changes:
- Updated preflight metadata structure in upload.py
- Updated create_preflight validation in api_client.py
- Updated state_manager to use correct field names
- Payload now includes creatives array with name, asset_url, channel

This fixes the 'brand_name, market_name, creatives are missing' error.
2026-01-09 14:45:26 -05:00
DJP
ccb5203948 Fix: Pass filename parameter to presigned_url endpoint
The CreativeX API requires a 'filename' parameter when requesting presigned URLs.

Changes:
- Updated get_presigned_url() to accept filename parameter
- Pass filename to API as query parameter
- Updated upload script to pass filename when requesting URL
- Updated test_connection to use test filename

This fixes the 'filename is missing' error.
2026-01-09 14:42:23 -05:00
DJP
72e9b54ff6 Initial commit: CreativeX API integration for Ferrero assets
- Ferrero filename parser with NEW format support
- CreativeX API client with retry logic
- State persistence with resume capability
- Upload and status checking scripts
- Comprehensive documentation
- Virtual environment support
2026-01-09 14:33:00 -05:00