Relational schema and stage schemas

Verified on 7 November 2026 against release 20261107T004657842984Z-549a75f2 and build code b663171.

Storage and interpretation

The pipeline stores CSV, Excel and Parquet files and uses pandas to enforce selected identity, uniqueness and join contracts. The diagram describes the logical relational model implemented by those transformations. Its PK markers identify logical row keys. Database foreign-key constraints require a database implementation.

Club labels and normalized season strings are the join identifiers used by the maintained transformations. The historical source also contains team_id and season_id fields. Those upstream IDs are available in standings.csv, while the current panel joins and exported schemas use Team and Season. Stadium is represented by its name and seasonal club association.

The prior lineage document maps fields to transformations. This document adds table grain, relationships, keys, types, nullability and intermediate-stage schemas. The shapes and observed null counts below describe the verified release.

Relational model

erDiagram
    STANDINGS_REFERENCE o|..o{ SILVER_PANEL : "Team and Season"
    ATTENDANCE_DECISION o|..o{ SILVER_PANEL : "Team and Season"
    SILVER_PANEL ||..|| GOLD_PANEL : "Observation_ID"
    CLUB_CITY ||..o{ GOLD_PANEL : "Team"
    STADIUM_REFERENCE o|..o{ GOLD_PANEL : "Team Season Tier"
    CAPACITY_GAP_FILL o|..o{ GOLD_PANEL : "Team Season Tier"
    EVENT_BASELINE ||..|{ GOLD_PANEL : "Relegation_Event_ID"
    EVENT_GROUP ||..|{ GOLD_PANEL : "Relegation_Event_ID"
    SILVER_PANEL ||..o| ATTENDANCE_AUDIT : "event and relative year"

    STANDINGS_REFERENCE {
        string Team PK
        string Season PK
        int Tier_History
        int Position_History
        int Games_Played_History
        int Points_History
    }
    ATTENDANCE_DECISION {
        string Team PK
        string Season PK
        int Canonical_Attendance
        string Validation_Status
        string SourceURL
    }
    SILVER_PANEL {
        string Observation_ID PK
        string Relegation_Event_ID
        string Team
        string Season
        int Year_vs_Relegation
        int Attendance
        int Tier
    }
    GOLD_PANEL {
        string Observation_ID PK
        string Relegation_Event_ID
        string Team
        string Season
        int Tier
        int Baseline_Attendance
        string Outcome_Group
    }
    CLUB_CITY {
        string Team PK
        string Club_City
    }
    STADIUM_REFERENCE {
        string Team PK
        string Season PK
        int Tier PK
        string Stadium
        int Capacity
        string City
    }
    CAPACITY_GAP_FILL {
        string Team PK
        string Season PK
        int Tier PK
        string Stadium
        int Capacity
        string SourceURL
    }
    EVENT_BASELINE {
        string Relegation_Event_ID PK
        string Event_Season
        int Baseline_Attendance
        int Baseline_Year_Used
    }
    EVENT_GROUP {
        string Relegation_Event_ID PK
        string Outcome_Group
    }
    ATTENDANCE_AUDIT {
        string Relegation_Event_ID PK
        int Year_vs_Relegation PK
        string Team
        string Season
        int Source_Attendance
        int Canonical_Attendance
        boolean Applied
    }

Only key fields and selected attributes appear in the diagram. The complete schemas follow below. EVENT_BASELINE and EVENT_GROUP are temporary calculation tables. STANDINGS_REFERENCE is the normalized combined historical extract and patch. STADIUM_REFERENCE is the selected season-specific stadium reference used by gold.

An optional parent at a relationship’s left end means a panel row can have zero or one matching lookup record. Every gold row requires a club-city match. Each validated event contributes exactly four exported panel rows. The silver-to-gold Observation_ID relationship is one-to-one. Attendance decisions may apply to several overlapping event windows.

Stage overview

Stage or artifact Grain Logical key Shape in this release Persistence
Attendance workbook Source worksheet row; substantive rows describe an event Team plus normalized event Season after cleaning 107 rows, 15 columns; 100 accepted events Excel source snapshot
Historical standings Source club-season standing Upstream key_id; normalized Team/Season used by silver 9,740 rows, 18 columns CSV source snapshot
Standings supplement Selected club-season standing team_name and season after normalization 15 rows, 9 columns CSV source snapshot
Normalized standings reference Club-season Team and Season 9,755 rows, 9 selected columns In memory
Tidy attendance panel Event and relative year Relegation_Event_ID and Year_vs_Relegation 400 rows, 5 columns In memory
Outcome helper panel Event and relative year including Y+3 Relegation_Event_ID and Year_vs_Relegation 500 rows before helper removal In memory
Silver panel Event-year Observation_ID; equivalent event/relative-year pair 400 rows, 14 columns CSV and Parquet
Stadium source dimension Club-season-tier stadium association Team, Season and Tier 2,197 rows, 15 columns Saved CSV source snapshot
Event baseline One relegation event Relegation_Event_ID 100 rows In memory
Event outcome group One relegation event Relegation_Event_ID 100 rows In memory
Gold panel Event-year Observation_ID; equivalent event/relative-year pair 400 rows, 44 columns CSV and Parquet
Release manifest and pointer One release and its artifact inventory Release ID and relative artifact path One selected release JSON metadata

Across retained releases, a versioned panel record is identified by Release_ID plus Observation_ID. Release_ID is supplied by its enclosing release folder and manifest. It is outside the panel’s columns.

Source schemas

Attendance workbook

The first sheet has the following 15 columns. Cell types can mix season labels, numeric counts, flags and source placeholders.

Season, Relegated Team, Position,
Year Before, Year Before Div, Year Before Was Covid, Year Before Att,
Attendance, Covid Year,
Year After, Year After Division, Attendance year after,
2 years after, 2 Years After Div, Attendance 2 years after

The four season/attendance pairs become the tidy panel below. Workbook position and division annotations remain source context. The exported Tier and Position fields come from the standings join. Seven known summary/header/template rows are excluded with reasons.

Historical standings and supplement

The historical CSV has 18 fields.

key_id, season_id, season, tier, division, subdivision, position,
team_id, team_name, played, wins, draws, losses,
goals_for, goals_against, goal_difference, points, point_adjustment

The supplement has nine fields.

team_name, season, position, played, wins,
goals_for, goals_against, points, tier

Silver concatenates them and selects the following normalized reference schema.

Field Logical type Role
Team Text, populated Composite key, normalized club name
Season Text, YYYY-YY Composite key, consecutive season label
Position_History Nullable integer League position
Games_Played_History Nullable integer Played total
Wins_History Nullable integer Wins total
Goals_For_History Nullable integer Goals for total
Goals_Against_History Nullable integer Goals against total
Points_History Nullable integer Supplied points total
Tier_History Nullable integer Division tier

Duplicate normalized Team/Season keys are rejected before the many-to-one enrichment join. Conflicting duplicate rows also fail. The historical and supplement CSVs have different source schemas, which are reconciled through the selected fields above.

Lookup and dimension schemas

Attendance decisions

File attendance_reconciliation.csv has one row per Team/Season and currently contains two pending decisions.

Field Logical type Requirement
Team Text Populated composite key
Season Text, YYYY-YY Populated consecutive-season composite key
Canonical_Attendance Nullable integer Blank for pending; whole number 1 to 120,000 for provisional/validated
Validation_Status Text enum pending, provisional or validated
Observed_Attendance_Values Text Supporting review note in the current input; ignored by the transformation
SourceURL Nullable text Populated for validated decisions
Notes Nullable text Review rationale

The transformation requires the Team, Season, Canonical_Attendance, Validation_Status, SourceURL and Notes columns. It checks duplicate keys and decision validity. Applying a choice updates every matching event-window observation and records the source values in the audit.

Club-city lookup

File club_city_lookup.csv has 171 entries.

Field Logical type Requirement
Team Text Populated unique key
Club_City Text Populated club home locality

Gold checks key uniqueness, performs a many-to-one join on Team and requires every panel club to match.

Capacity and stadium gap-fill lookup

File stadium_capacity_lookup_template.csv has 52 records at Team/Season/Tier grain.

Field Logical type Requirement
Team Text Populated composite key
Season Text, YYYY-YY Populated consecutive-season composite key
Tier Integer Composite key in 1, 2, 3, 4
Stadium Text Populated
Capacity Integer Whole number from 500 to 150,000
SourceURL Nullable text Optional provenance column
Notes Nullable text Optional explanatory column

Gold rejects duplicate composite keys and invalid required values. Stadium and Capacity fill blank target fields independently. Reviewed corrections to already populated disputed capacities remain a separate implementation task.

Saved stadium dimension

File gold_dim_stadiums_pyramid.csv stores one club’s stadium association within a season and tier. The verified snapshot has unique, populated Team/Season/Tier keys. Gold also selects the most populated Stadium/Capacity record when repeated source keys are supplied, then joins the selected reference many-to-one.

Field Logical type Meaning
Team Text Club label, composite key
Season Text Season label normalized before the join, composite key
Tier Integer Division tier, composite key
Stadium Nullable text Season-specific venue name
Location Nullable text Scraped source location
Capacity_raw Nullable text Original capacity representation
Country Text Acquisition country/competition context
SourceURL Nullable text Scraped page URL
Capacity Nullable integer Parsed capacity
City Nullable text Stadium locality
GeoPlace Nullable text Venue-oriented geocoding label in the source dimension
MapLabel Nullable text Scraper display label
City_SourceURL Nullable text City donor evidence
City_Donor_Season Nullable text Supporting donor season
City_Imputed Nullable Boolean Indicates a city supplied from agreeing observed donors

Gold selects Team, Season, Tier, Stadium, Capacity, City, GeoPlace, SourceURL and available city-provenance fields from this input. It can additionally accept field-specific Stadium_SourceURL, Capacity_SourceURL and Location_SourceURL columns when present. Location, Capacity_raw, Country and MapLabel are retained in the source snapshot. The panel’s GeoPlace is constructed from Club_City and United Kingdom.

Reviewed alias mapping

REVIEWED_CLUB_ALIASES in attendance_validation.py is an eight-entry mapping from source label to canonical club name. Exact whitespace/case normalization is evaluated against the standings reference first. The mapping is stored in code and its applied results are recorded in silver_team_name_map.csv.

Silver schema

Silver has one row per relegation event and relative year. Observation_ID is unique and populated. Relegation_Event_ID plus Year_vs_Relegation is the equivalent composite key. Each event has exactly -1, 0, +1 and +2. Team/Season can repeat across overlapping event windows.

The dtype column below records the actual Parquet-backed pandas representation. Nullable is the data dictionary’s logical allowance. Nulls counts the verified release’s missing values.

Field Logical type Stored dtype Nullable Nulls
Observation_ID string str No 0
Relegation_Event_ID string str No 0
Team string str No 0
Season string str No 0
Tier integer Int64 Yes 3
Position integer Int64 Yes 3
Attendance integer Int64 Yes 15
Year_vs_Relegation integer int64 No 0
Year_End_Outcome string str Yes 12
Games_Played_History integer Int64 Yes 3
Wins_History integer Int64 Yes 3
Goals_For_History integer Int64 Yes 3
Goals_Against_History integer Int64 Yes 3
Points_History integer Int64 Yes 3

Intermediate calculation schemas

Tidy panel and outcome helper

Relegation_Event_ID  text
Team                 text
Season               text, normalized YYYY-YY
Attendance           nullable integer-valued count
Year_vs_Relegation   integer

The four explicit source slices produce 400 rows. Reconciliation operates at this stage. Temporary Y+3 rows add 100 helper observations with missing Attendance so the next-season Tier can classify Y+2. Helpers are removed before silver export. Silver processing also creates temporary Tier_Next_Year and Tier_Change fields for outcome inference, and an internal Data_Availability_Flag with observed/future_not_available labels. The final 14-column selection exports the derived outcome and measurements while omitting those helper fields.

Event baseline relation

Gold derives one baseline row per event using Y0 and Y-1 attributes. It joins the following selected fields back to the panel by Relegation_Event_ID.

Relegation_Event_ID             text, logical key
Event_Season                    text, normalized YYYY-YY
Baseline_Attendance             nullable integer
Baseline_Year_Used              integer, 0 or -1
Baseline_Substitution_Reason    nullable text
Covid_Baseline_Not_Comparable   Boolean
Covid_Baseline_Review_Flag      Boolean

Event outcome relation

Relegation_Event_ID  text, logical key
Outcome_Group        nullable text

Outcome_Group takes Y+1’s Year_End_Outcome. It repeats on all four gold rows. Year_End_Outcome remains the outcome of each individual row’s season. Both intermediate relations are created in memory during gold processing.

Gold schema

Gold preserves the 14 silver fields with their row IDs and adds the following 30 fields. It has 400 rows and 44 columns at the same event-year grain. The release validator checks that the silver fields agree exactly between the panels.

Added field Logical type Stored dtype Nullable Nulls
Club_City string string No 0
Stadium string string Yes 3
Capacity integer Int64 Yes 3
City string str Yes 67
GeoPlace string string No 0
SourceURL string string Yes 3
City_Imputed boolean object Yes 58
City_SourceURL string str Yes 385
City_Donor_Season string str Yes 385
Stadium_Lookup_Applied boolean bool[pyarrow] No 0
Capacity_Lookup_Applied boolean bool No 0
Stadium_Capacity_Lookup_Notes string string Yes 345
Stadium_SourceURL string string Yes 345
Capacity_SourceURL string string Yes 345
Is_Covid_Affected boolean bool No 0
Event_Season string str No 0
Baseline_Attendance integer Int64 Yes 12
Baseline_Year_Used integer int64 No 0
Baseline_Substitution_Reason string str Yes 388
Covid_Baseline_Not_Comparable boolean bool No 0
Covid_Baseline_Review_Flag boolean bool No 0
Pct_Change_vs_Baseline number Float64 Yes 24
Pct_Change_vs_Baseline_Display number Float64 Yes 24
Pct_Change_Analysis number Float64 Yes 215
Outcome_Group string str Yes 12
Goals_For_Per_Game number Float64 Yes 3
Points_Per_Game number Float64 Yes 3
Is_Structural_Anomaly boolean bool No 0
Plot_Group_Label string str Yes 12
Is_Baseline_Substituted boolean bool No 0

CSV carries text representations. A reader infers types unless it is given an explicit schema. For example, an entirely blank SourceURL column in the pending-decision CSV can be inferred as float64, while its logical type is nullable text. Gold’s nullable City_Imputed currently has pandas object representation. These storage representations should be considered when importing to a typed database or semantic model.

Audit and metadata schemas

All audit keys below are scoped to their enclosing release.

Output Grain and logical key Rows Schema or purpose
attendance_reconciliation_audit.csv Matched event-year, key Relegation_Event_ID and Year_vs_Relegation 4 Team, Season, Source_Attendance, Canonical_Attendance, Validation_Status, SourceURL, Notes, Applied plus the event/relative-year key
silver_team_name_map.csv Source club label, key raw_team 49 raw_team, mapped_team, method, suggestions
silver_excluded_workbook_rows.csv Excluded source worksheet row 7 Original 15 fields plus Exclusion_Reason. Source worksheet row number is outside the exported schema.
quarantine_covid_template_rows.csv Known duplicated source worksheet row 3 Original 15 workbook fields
silver_run_log.csv One stage execution within the release 1 rows, events, generated_at, tier_merge_coverage
stadium_event_comparison.csv Gold observation in an event with missing stadium information, key Observation_ID 148 Event/club/season keys, stadium/location and field provenance, application flags, Missing_Fields and Row_Status
missing_fields_by_team_season.csv Club-season, key Team and Season 82 Tier, Observation_Count, Missing_Fields, Missing_Field_Counts, Observation_IDs and Relegation_Event_IDs plus the club-season key
manifest.json One validated release with a file inventory 1 Release ID, status, code/runtime identity, decision statuses, output schemas/counts and path-to-hash/byte identities
current.json One selected release in a publication root 1 schema_version, release_id, manifest_sha256

The data dictionary is a 44-row reference keyed by field, with introduced_in, logical_type, nullable, unit, description and missing_value_notes. Quarantines produced by failed candidates belong to those candidate directories and are outside the selected successful panel schema.

Integrity and review boundaries

Identity, chronological offsets, duplicate standings/decision/lookup keys, panel keys and selected joins have explicit Python checks. The release validator also checks required artifacts, CSV/Parquet agreement and matching silver attributes in gold. Raw stadium duplicates follow the documented selection rule before the checked join.

Canonical attendance decisions can reconcile overlapping club-season values. The two current decisions remain pending. Populated disputed capacity corrections and their additional decision/audit relation remain outstanding. Source evidence and the correctness of plausible values require manual review.

The article and Power BI consume the wide gold panel. This file-level relational model describes the maintained Python pipeline. Inspecting the Power BI model’s native relationship definitions requires its editable project or a model connection.