Skip to content

Designer Assignment

The designer assignment system links designers to product tags via macrodata_artifact (kind: agent_assignment), then aggregates metrics per designer. This enables the Creative team to understand which designers’ work is generating the strongest sales performance.

Goal: Attribute sales metrics to individual designers via their assignment records in macrodata_artifact (kind: agent_assignment).

MethodPathSpecDescription
GET/creative-ops/agent-assignmentscreative-ops.yamlList all designer-to-tag assignments (filterable by agent_name, tag_name)
POST/creative-ops/agent-assignmentscreative-ops.yamlCreate a designer assignment (returns 409 on duplicate)
DELETE/creative-ops/agent-assignments/{assignment_id}creative-ops.yamlRemove (soft-archive) a designer assignment
MethodPathSpecDescription
GET/macrodata-artifactsmacrodata.yamlList artifacts (filter by kind=agent_assignment)
GET/macrodata-artifacts/{artifact_id}macrodata.yamlGet a single artifact
GET/tagsproduct.yamlList available tags for assignment
GET/analytics/commerce/productsanalytics.yamlProduct performance data for attribution

Legacy endpoints (internal, being replaced by creative-ops spec)

Section titled “Legacy endpoints (internal, being replaced by creative-ops spec)”
MethodPathDescription
GET/api/designersAll designers with assigned tags and aggregated metrics
GET/api/designers/namesList of unique designer names
POST/api/designers/assignCreate designer assignment (tag to designer)
DELETE/api/designers/unassignRemove a designer assignment
DELETE/api/designers/:designerNameDelete designer and all their assignments
TableModuleRole
macrodata_artifact (kind: agent_assignment)MacrodataCRUD: designer-to-tag assignment records
productProductRead: products linked to assigned tags
product_tagProductRead: tag-to-product links
measurement.sales (R2 Iceberg)AnalyticsRead: sales metrics for attribution
ResourceTypePurpose
dashboard-apiCF Worker (internal)Designer assignment CRUD + metric queries
measurement.salesR2 Iceberg tableSales metric source for attribution
PlanetScale (Hyperdrive)Managed PostgresAssignment + product + tag data
ActorRole
Staff user (Creative lead)Assigns/unassigns tags to designers, reviews metrics
Dashboard API WorkerServes designer assignment CRUD and metric queries
PlanetScaleStore for assignments, computes aggregates
sequenceDiagram
    participant User as Creative Lead
    participant API as Dashboard API
    participant DB as PlanetScale

    User->>API: POST /creative-ops/agent-assignments
    API->>DB: INSERT macrodata_artifact (kind: agent_assignment)
    DB-->>API: { uid, agent_name, tag_name }
    API-->>User: Assignment created

    User->>API: GET /creative-ops/agent-assignments
    API->>DB: JOIN macrodata_artifact (agent_assignment) + product + measurement.sales (R2)
    DB-->>API: Designers with tags and metrics
    API-->>User: Aggregated designer performance
interface DesignerWithMetrics {
designerName: string;
tags: Array<{
tagName: string;
tagId: string;
assignedAt: string;
totalUnits: number; // Lifetime sales
units30d: number; // 30-day window
productCount: number; // Product count
}>;
totalUnits: number; // Aggregated metrics
units30d: number;
totalProducts: number;
}

Designer performance metrics are computed by joining:

  1. macrodata_artifact (kind: agent_assignment) — which tags belong to which designer
  2. product — which products have those tags (via product_tag)
  3. measurement.sales on R2 — sales metrics for those products

The aggregation sums totalUnits, units30d, and counts distinct products per tag, then rolls up to per-designer totals.

The macrodata_artifact table with kind: agent_assignment stores assignments. The spec JSONB column holds:

FieldTypeConstraint
agent_namestringDesigner name
tag_namestringTag identifier
assigned_atISO timestampDefault: creation time
UNIQUE (agent_name, tag_name) enforced at application level
  • Creating a designer assignment produces a unique (designer, tag) association
  • Duplicate assignment (same designer + tag) is rejected gracefully (409)
  • Designer list includes correct aggregated metrics from measurement.sales on R2
  • Deleting a designer removes all their assignments
  • Unassigning a tag updates the designer’s metric totals on next query