Adds the full Django application layer on top of sportstime_parser: - core: Sport, Team, Stadium, Game models with aliases and league structure - scraper: orchestration engine, adapter, job management, Celery tasks - cloudkit: CloudKit sync client, sync state tracking, sync jobs - dashboard: staff dashboard for monitoring scrapers, sync, review queue - notifications: email reports for scrape/sync results - Docker setup for deployment (Dockerfile, docker-compose, entrypoint) Game exports now use game_datetime_utc (ISO 8601 UTC) instead of venue-local date+time strings, matching the canonical format used by the iOS app. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
"""Import/Export resources for scraper models."""
|
|
from import_export import resources, fields
|
|
from import_export.widgets import ForeignKeyWidget
|
|
|
|
from core.models import Sport
|
|
from .models import ScraperConfig, ScrapeJob, ManualReviewItem
|
|
|
|
|
|
class ScraperConfigResource(resources.ModelResource):
|
|
sport = fields.Field(
|
|
column_name='sport',
|
|
attribute='sport',
|
|
widget=ForeignKeyWidget(Sport, 'code')
|
|
)
|
|
|
|
class Meta:
|
|
model = ScraperConfig
|
|
import_id_fields = ['sport', 'season']
|
|
fields = [
|
|
'sport', 'season', 'is_active', 'is_enabled',
|
|
'scrape_interval_hours', 'primary_source',
|
|
]
|
|
export_order = fields
|
|
|
|
|
|
class ScrapeJobResource(resources.ModelResource):
|
|
sport = fields.Field(attribute='config__sport__code', readonly=True)
|
|
season = fields.Field(attribute='config__season', readonly=True)
|
|
|
|
class Meta:
|
|
model = ScrapeJob
|
|
fields = [
|
|
'id', 'sport', 'season', 'status',
|
|
'games_found', 'games_new', 'games_updated', 'games_unchanged',
|
|
'started_at', 'finished_at', 'errors', 'created_at',
|
|
]
|
|
export_order = fields
|
|
|
|
|
|
class ManualReviewItemResource(resources.ModelResource):
|
|
sport = fields.Field(
|
|
column_name='sport',
|
|
attribute='sport',
|
|
widget=ForeignKeyWidget(Sport, 'code')
|
|
)
|
|
|
|
class Meta:
|
|
model = ManualReviewItem
|
|
import_id_fields = ['id']
|
|
fields = [
|
|
'id', 'sport', 'item_type', 'raw_value', 'matched_value',
|
|
'status', 'confidence', 'reason', 'source_url',
|
|
'check_date', 'created_at',
|
|
]
|
|
export_order = fields
|