feat: migrate transform to 3-layer architecture with per-layer schemas

Remove raw/ layer — staging models now read landing JSON directly.
Rename all model schemas from padelnomics.* to staging.*/foundation.*/serving.*.
Web app queries updated to serving.planner_defaults via SERVING_DUCKDB_PATH.
Supervisor gets daily sleep interval between pipeline runs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-02-22 19:04:40 +01:00
parent 53e9bbd66b
commit 2db66efe77
19 changed files with 306 additions and 301 deletions

View File

@@ -3,7 +3,7 @@
-- Cities without Eurostat coverage (US, non-EU) are derived from venue clusters.
MODEL (
name padelnomics.dim_cities,
name foundation.dim_cities,
kind FULL,
cron '@daily',
grain city_code
@@ -16,7 +16,7 @@ eurostat_cities AS (
country_code,
population,
ref_year
FROM padelnomics.stg_population
FROM staging.stg_population
QUALIFY ROW_NUMBER() OVER (PARTITION BY city_code ORDER BY ref_year DESC) = 1
),
-- Venue counts per (country_code, city) from dim_venues
@@ -27,7 +27,7 @@ venue_counts AS (
COUNT(*) AS venue_count,
AVG(lat) AS centroid_lat,
AVG(lon) AS centroid_lon
FROM padelnomics.dim_venues
FROM foundation.dim_venues
WHERE city IS NOT NULL AND city != ''
GROUP BY country_code, city
),

View File

@@ -4,7 +4,7 @@
-- Proximity dedup uses haversine approximation: 1 degree lat ≈ 111 km.
MODEL (
name padelnomics.dim_venues,
name foundation.dim_venues,
kind FULL,
cron '@daily',
grain venue_id
@@ -22,7 +22,7 @@ WITH all_venues AS (
postcode,
NULL AS tenant_type,
extracted_date
FROM padelnomics.stg_padel_courts
FROM staging.stg_padel_courts
WHERE country_code IS NOT NULL
UNION ALL
@@ -38,7 +38,7 @@ WITH all_venues AS (
postcode,
tenant_type,
extracted_date
FROM padelnomics.stg_playtomic_venues
FROM staging.stg_playtomic_venues
WHERE country_code IS NOT NULL
),
-- Rank venues so Playtomic records win ties in proximity dedup