fix(score): Opportunity Score v7 — calibration fix for saturated markets

Two fixes:
1. dim_locations now sources venues from dim_venues (deduplicated OSM + Playtomic)
   instead of stg_padel_courts (OSM only). Playtomic-only venues are no longer
   invisible to spatial lookups.
2. Country-level supply saturation dampener on supply deficit component.
   Saturated countries (Spain 7.4/100k) get dampened supply deficit (x0.30 → 12 pts max).
   Emerging markets (Germany 0.24/100k) nearly unaffected (x0.98 → ~39 pts).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-03-09 18:03:14 +01:00
parent cce3c466ba
commit e39dd4ec0b
2 changed files with 34 additions and 11 deletions

View File

@@ -9,7 +9,7 @@
-- foundation.dim_countries → country_name_en, country_slug, median_income_pps
-- stg_nuts2_boundaries + stg_regional_income → EU NUTS-2/NUTS-1 income (spatial join)
-- stg_income_usa → US state-level income (PPS-normalised)
-- stg_padel_courts → padel venue count + nearest court distance (km)
-- foundation.dim_venues → padel venue count + nearest court distance (km)
-- stg_tennis_courts → tennis court count within 25km radius
--
-- Income resolution cascade:
@@ -137,10 +137,12 @@ us_income AS (
PARTITION BY m.admin1_code ORDER BY s.ref_year DESC
) = 1
),
-- Padel court lat/lon for distance and density calculations
-- Padel venue lat/lon for distance and density calculations.
-- Uses dim_venues (deduplicated OSM + Playtomic) instead of stg_padel_courts (OSM only)
-- so Playtomic-only venues are visible to spatial lookups.
padel_courts AS (
SELECT lat, lon, country_code
FROM staging.stg_padel_courts
FROM foundation.dim_venues
WHERE lat IS NOT NULL AND lon IS NOT NULL
),
-- Nearest padel court distance per location (bbox pre-filter → exact sphere distance)