Centralized Pydantic models for the CoolAI ecosystem.
Single source of truth for data structures across all CoolAI packages. Version number defines API compatibility.
- 🎯 Platform-Agnostic: Generic models work everywhere
- 🔌 Platform-Specific: Xandr, Meta variations when needed
- ✅ Type-Safe: Full Pydantic validation
- 📦 Modular: One module per model type
- 🔄 Versionable: Semantic versioning for API compatibility
# 1. Configure pip for private server (one-time setup)
./setup_pip.sh <server_ip> <username> <password>
# Example:
./setup_pip.sh 192.168.1.100 admin mypassword
# 2. Install package
pip install coolai-data-modelsgit clone https://github.com/Insticator/coolai-data-models.git
cd coolai-data-models
pip install -e .from coolai_data_models import Campaign, KPI, Audience, Creative
# Create campaign
campaign = Campaign(
campaign_id='CAMP_001',
name='Q4 Campaign',
advertiser='Acme Corp',
vertical='technology',
objective='traffic',
kpi=KPI(type='ctr', target=0.15),
start_date='2025-10-01',
end_date='2025-12-31'
)
# Add components
campaign.audiences = [Audience(...)]
campaign.creatives = [Creative(...)]Generic:
KPI- Key performance indicatorCampaignBase- Base campaign definitionCampaign- Complete campaign with components
Platform-Specific:
XandrCampaign- Xandr insertion ordersMetaCampaign- Meta ad campaigns
from coolai_data_models import Campaign, XandrCampaign, MetaCampaignGeneric:
Audience- Age, gender, interests, geography with performance ranks
Platform-Specific:
XandrAudience- Profile-based targeting with segmentsXandrSegment- Segment definitionMetaAudience- Custom/lookalike audiences
from coolai_data_models import Audience, XandrAudience, MetaAudienceGeneric:
Creative- Ad format, size, engagement score
Platform-Specific:
XandrCreative- Banner/video with audit statusMetaCreative- Multi-asset ads (carousel, video)MetaCreativeAsset- Individual asset in Meta creative
from coolai_data_models import Creative, XandrCreative, MetaCreativeGeneric:
BudgetRecommendation- Min/max/recommended with confidence
from coolai_data_models import BudgetRecommendationGeneric:
LineItem- Audience + Creative + budget allocation
Platform-Specific:
XandrLineItem- Revenue type, daily/lifetime budgetMetaAdSet- Optimization goal, billing event
from coolai_data_models import LineItem, XandrLineItem, MetaAdSetGeneric:
PerformanceRecord- ETL and analytics data
from coolai_data_models import PerformanceRecordcoolai_data_models/
├── campaign.py # Campaign, KPI models
├── audience.py # Audience models
├── creative.py # Creative models
├── budget.py # Budget models
├── line_items.py # Line item models
└── performance.py # Performance data models
| Version | Changes |
|---|---|
| 0.1.0 | Initial release - all base models |
| Platform | Campaign | Audience | Creative | Line Item |
|---|---|---|---|---|
| Generic | ✅ | ✅ | ✅ | ✅ |
| Xandr | ✅ | ✅ | ✅ | ✅ |
| Meta | ✅ | ✅ | ✅ | ✅ |
| 🔜 | 🔜 | 🔜 | 🔜 |
# In your package's pyproject.toml
dependencies = [
"coolai-data-models>=0.1.0,<0.2.0", # Pin to compatible version
]git clone https://github.com/Insticator/coolai-data-models.git
cd coolai-data-models
pip install -e ".[dev]"
pytestProprietary - Insticator Inc.