Data Model
Entity relationships, fields & D1 schema
Entity Relationships
Core entities and their relationships. VegasEvent is the central entity; all others reference it or artist enrichment data.
erDiagram
VegasEvent ||--o{ TablePricing : has
VegasEvent ||--o{ ImageMetadata : has
VegasEvent ||--o{ EnrichmentStatus : has
VegasEvent ||--o{ ArtistStats : enriches
TablePricing ||--|{ TablePricingTier : contains
ImageMetadata ||--o{ ImageSize : has
ArtistStats ||--o{ StreamingLinks : includes
ArtistStats ||--o{ SocialLinks : includes
VegasEvent {
string event_id PK
date event_date
string performer
string venue
string url
datetime scraped_at
string artist_bio
string venue_url
}
TablePricing {
string event_id FK
string tier_id PK
datetime fetched_at
boolean is_available
}
TablePricingTier {
string tier_id PK
string tier_name
integer min_spend
integer pay_now
integer guests
integer available_count
}
ImageMetadata {
string image_id PK
string event_id FK
string artist_slug
string image_type
string r2_bucket
}
ImageSize {
string image_id FK
string preset
string r2_url
integer width
integer height
}
ArtistStats {
string artist_slug PK
string spotify_id
string genres
integer popularity
integer follower_count
}
StreamingLinks {
string artist_slug FK
string spotify
string apple_music
string youtube
string soundcloud
}
SocialLinks {
string artist_slug FK
string instagram
string tiktok
string beatport
string resident_advisor
}
EnrichmentStatus {
string event_id FK
boolean spotify
boolean tracklists
boolean resident_advisor
string errors
}
Entity Legend
Each entity type plays a distinct role in the data model. Color coding indicates entity category.
Composite Key
Primary Key Format
VegasEvent uses a stable, human-readable composite key:
{date}-{performer_slug}-{venue_slug}
Example: 2026-05-02-dom-dolla-liv-las-vegas
This key remains stable across re-scrapes, enabling idempotent updates and URL-friendly references.
{date}-{performer_slug}-{venue_slug}
Example: 2026-05-02-dom-dolla-liv-las-vegas
This key remains stable across re-scrapes, enabling idempotent updates and URL-friendly references.
Field Reference
Complete field inventory for all entities. PK = primary key, FK = foreign key.
| Entity | Key Fields | Notes |
|---|---|---|
| VegasEvent |
event_id (PK) event_date performer venue url scraped_at |
Core entity storing event metadata, URLs, and enrichment (bio, venue_url). Composite key format: date-performer_slug-venue_slug |
| TablePricing |
event_id (FK) tier_id (PK) fetched_at |
Stores VIP table pricing from venue APIs (LIV, TAO). Per-event pricing tiers with availability. |
| TablePricingTier |
tier_id (PK) tier_name min_spend pay_now guests available_count |
Individual pricing tier details (bottle minimums, payment options, guest counts). |
| ImageMetadata |
image_id (PK) event_id (FK) artist_slug image_type r2_bucket |
Multi-size images on R2 (main=500px, hd=1500px). Dedup key: (venue_tag, artist_slug, size). |
| ImageSize |
image_id (FK) preset (main|hd) r2_url width, height |
Per-preset metadata (URL, dimensions, file size). |
| ArtistStats |
artist_slug (PK) spotify_id genres popularity follower_count |
Enrichment data from Spotify, Resident Advisor. Keyed by artist slug. |
| StreamingLinks |
artist_slug (FK) spotify apple_music youtube soundcloud |
Streaming platform URLs for artist discovery. |
| SocialLinks |
artist_slug (FK) tiktok beatport resident_advisor |
Social profiles and DJ databases for artist discovery. |
| EnrichmentStatus |
event_id (FK) spotify (bool) tracklists (bool) resident_advisor (bool) errors (dict) |
Tracks enrichment completion per event. Bool flags indicate success; errors dict logs failures. |