refactor(serving): replace old models with location_profiles
Delete city_market_profile.sql and location_opportunity_profile.sql. Update downstream models (planner_defaults, pseo_city_costs_de, pseo_city_pricing) to read from location_profiles instead. Subtask 2/5: delete old models + update downstream SQL. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
-- pSEO article data: per-city padel court pricing.
|
||||
-- One row per city — consumed by the city-pricing.md.jinja template.
|
||||
-- Joins venue_pricing_benchmarks (real Playtomic data) with city_market_profile
|
||||
-- Joins venue_pricing_benchmarks (real Playtomic data) with location_profiles
|
||||
-- (population, venue count, country metadata).
|
||||
--
|
||||
-- Stricter filter than pseo_city_costs_de: requires >= 2 venues with real
|
||||
@@ -16,7 +16,7 @@ MODEL (
|
||||
SELECT
|
||||
-- Composite natural key: country_slug + city_slug ensures uniqueness across countries
|
||||
c.country_slug || '-' || c.city_slug AS city_key,
|
||||
-- City identity (from city_market_profile, which has the canonical city_slug)
|
||||
-- City identity (from location_profiles, which has the canonical city_slug)
|
||||
c.city_slug,
|
||||
c.city_name,
|
||||
c.country_code,
|
||||
@@ -24,8 +24,8 @@ SELECT
|
||||
c.country_slug,
|
||||
-- Market context
|
||||
c.population,
|
||||
c.padel_venue_count,
|
||||
c.venues_per_100k,
|
||||
c.city_padel_venue_count AS padel_venue_count,
|
||||
c.city_venues_per_100k AS venues_per_100k,
|
||||
c.market_score,
|
||||
-- Pricing benchmarks (from Playtomic availability data)
|
||||
vpb.median_hourly_rate,
|
||||
@@ -38,9 +38,10 @@ SELECT
|
||||
vpb.price_currency,
|
||||
CURRENT_DATE AS refreshed_date
|
||||
FROM serving.venue_pricing_benchmarks vpb
|
||||
-- Join city_market_profile to get the canonical city_slug and country metadata
|
||||
INNER JOIN serving.city_market_profile c
|
||||
-- Join location_profiles to get canonical city metadata
|
||||
INNER JOIN serving.location_profiles c
|
||||
ON vpb.country_code = c.country_code
|
||||
AND vpb.city_slug = c.city_slug
|
||||
AND c.city_slug IS NOT NULL
|
||||
-- Only cities with enough venues for meaningful pricing statistics
|
||||
WHERE vpb.venue_count >= 2
|
||||
|
||||
Reference in New Issue
Block a user