← All projectsProject / Campaign automation

Service for generating creatives from sports events

An operations workspace that connects sports feeds, creative generation and advertising-platform lifecycle management.

PythonCeleryRedisFastAPIPostgreSQLPlaywrightDuckDBAngular
Project overview

What the service does

An operator configures an advertising campaign once. The service checks a sports data feed, picks an eligible upcoming match, fills a text and image template, renders the image, then creates or updates the creative in the advertising platform. If there is no suitable match, the related live creative can be paused.

Campaign content changes with real-world events. Manually selecting events, preparing assets and reconciling advertising state makes the workflow difficult to maintain as the number of campaigns grows.

Who uses it

Advertising operations and media teams managing many campaigns whose text or image should follow changing sports events.

Input
  • Campaign format, language, audience and event-selection rules.
  • Sports feed data such as teams, start time and event status.
  • Text and HTML image templates plus their assets.
Output
  • Rendered text and image assets for an eligible event.
  • A created or updated creative in the advertising platform.
  • A pause or retry state when no event or an external request is available.
System requirements
  • Campaigns have different audiences, languages and creative formats.
  • Requests to the sports feed and ad platform follow their rate limits.
  • If no match is available, the current creative can be paused.
  • Operators can review campaign metrics and task errors in one interface.
01 / How the service works

Sports match → creative → advertising campaign

Process mapSolid line: normal flow · dashed line: retry or return
Process map: pushA process map showing the sequence of work, decisions and alternate routes.
INPUTCampaign settingsFormat, language and event rules
SERVICELoad sports feedShared cache and provider limits
DECISIONSuitable event?Time window, team codes and priorities
RESULTPause current creativeNo eligible event was found
STEPFill text and templateLocalized copy and escaped template values
SERVICERender imageBrowser converts HTML template to PNG
SERVICECreate and uploadCall the advertising platform
DECISIONPublication resultSuccess or external API failure
RESULTCreative activeLocal campaign state is synchronized
STEPUndo created objectBest-effort compensation after failure
  1. INPUTCampaign settings

    Format, language and event rules

    ContinueLoad sports feed
  2. SERVICELoad sports feed

    Shared cache and provider limits

    ContinueSuitable event?
  3. DECISIONSuitable event?

    Time window, team codes and priorities

    yesFill text and template
    no eventPause current creative
  4. RESULTPause current creative

    No eligible event was found

  5. STEPFill text and template

    Localized copy and escaped template values

    ContinueRender image
  6. SERVICERender image

    Browser converts HTML template to PNG

    ContinueCreate and upload
  7. SERVICECreate and upload

    Call the advertising platform

    ContinuePublication result
  8. DECISIONPublication result

    Success or external API failure

    createdCreative active
    failedUndo created object
  9. RESULTCreative active

    Local campaign state is synchronized

  10. STEPUndo created object

    Best-effort compensation after failure

    retryCreate and upload
Arrows show the direction of work; labeled branches show decisions, errors and retries.
02 / System architecture

Main components and their roles

Campaign configuration

Define the campaign

An operator chooses the audience, language, format and regeneration rules.

How it works

The backend supports campaign create/update/copy operations and spreadsheet-based batch creation.

Redis / shared cache

Load the feed

Workers obtain the current sports data without needlessly repeating the same request.

How it works

The cache combines simultaneous requests for the same feed. A Redis limiter coordinates request rate and count across workers.

Time / team priorities

Select an event

The campaign selects an event that fits its time window and priorities.

How it works

Team-code availability, include/exclude windows and ordered priority groups constrain candidate selection. A missing event is distinct from a provider failure.

Templates / Chromium

Build the creative

Localized text and a matching image are assembled from the chosen event.

How it works

Sports copy uses placeholders and length checks. HTML templates escape inserted values and render to PNG in Chromium. Promotional copy has a separate generator API path.

External ad API

Synchronize assets

The system creates the remote creative, uploads its assets and activates it.

How it works

The service creates the ad, uploads its image and connects it to the local campaign.

Celery / reconciliation

Keep state relevant

Changed events trigger regeneration; missing suitable events can pause creatives.

How it works

Task history and the selected event determine when to update, pause or reactivate a creative.

Analytics / notifications

Review operations

Operators review campaign metrics and task failures.

How it works

DuckDB and Pandas prepare campaign reports. Task logs and notifications show retries and final errors.

03 / Implementation details

Engineering decisions

01

Coordinate provider load

Shared admission control and single-flight caching address limits across workers, rather than per-process counters alone.

02

Model the creative lifecycle

Selection, regeneration, pause and reactivation are explicit parts of the campaign workflow.

03

Separate generation paths

Sports templates and browser-rendered images have different behavior from the promotional text generator integration.

Software development for business

Have a project in mind?

Tell me what the application should do, how the team works today and which requirements or deadlines matter.