refactor(web): update all references to location_profiles

Update api.py (3 endpoints), public/routes.py, analytics.py docstring,
pipeline_routes.py DAG, pipeline_query.html placeholder, and
test_pipeline.py fixtures to use the new unified model.

Subtask 3/5: web app references.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-03-06 11:41:42 +01:00
parent 81b556b205
commit 688f2dd1ee
6 changed files with 36 additions and 32 deletions

View File

@@ -111,13 +111,12 @@ _DAG: dict[str, list[str]] = {
"fct_daily_availability": ["fct_availability_slot", "dim_venue_capacity"],
# Serving
"venue_pricing_benchmarks": ["fct_daily_availability"],
"city_market_profile": ["dim_cities", "venue_pricing_benchmarks"],
"planner_defaults": ["venue_pricing_benchmarks", "city_market_profile"],
"location_opportunity_profile": ["dim_locations"],
"location_profiles": ["dim_locations", "dim_cities", "venue_pricing_benchmarks"],
"planner_defaults": ["venue_pricing_benchmarks", "location_profiles"],
"pseo_city_costs_de": [
"city_market_profile", "planner_defaults", "location_opportunity_profile",
"location_profiles", "planner_defaults",
],
"pseo_city_pricing": ["venue_pricing_benchmarks", "city_market_profile"],
"pseo_city_pricing": ["venue_pricing_benchmarks", "location_profiles"],
"pseo_country_overview": ["pseo_city_costs_de"],
}

View File

@@ -171,7 +171,7 @@
autocomplete="off"
autocorrect="off"
autocapitalize="off"
placeholder="-- SELECT * FROM serving.city_market_profile&#10;-- WHERE country_code = 'DE'&#10;-- ORDER BY marktreife_score DESC&#10;-- LIMIT 20"
placeholder="-- SELECT * FROM serving.location_profiles&#10;-- WHERE country_code = 'DE' AND city_slug IS NOT NULL&#10;-- ORDER BY market_score DESC&#10;-- LIMIT 20"
></textarea>
<div class="query-controls">

View File

@@ -13,7 +13,7 @@ Usage:
rows = await fetch_analytics("SELECT * FROM serving.planner_defaults WHERE city_slug = ?", ["berlin"])
cols, rows, error, elapsed_ms = await execute_user_query("SELECT city_slug FROM serving.city_market_profile LIMIT 5")
cols, rows, error, elapsed_ms = await execute_user_query("SELECT city_slug FROM serving.location_profiles LIMIT 5")
"""
import asyncio
import logging

View File

@@ -32,12 +32,14 @@ async def countries():
rows = await fetch_analytics("""
SELECT country_code, country_name_en, country_slug,
COUNT(*) AS city_count,
SUM(padel_venue_count) AS total_venues,
SUM(city_padel_venue_count) AS total_venues,
ROUND(AVG(market_score), 1) AS avg_market_score,
ROUND(AVG(opportunity_score), 1) AS avg_opportunity_score,
AVG(lat) AS lat, AVG(lon) AS lon
FROM serving.city_market_profile
FROM serving.location_profiles
WHERE city_slug IS NOT NULL
GROUP BY country_code, country_name_en, country_slug
HAVING SUM(padel_venue_count) > 0
HAVING SUM(city_padel_venue_count) > 0
ORDER BY total_venues DESC
""")
return jsonify(rows), 200, _CACHE_HEADERS
@@ -51,10 +53,11 @@ async def country_cities(country_slug: str):
rows = await fetch_analytics(
"""
SELECT city_name, city_slug, lat, lon,
padel_venue_count, market_score, population
FROM serving.city_market_profile
WHERE country_slug = ?
ORDER BY padel_venue_count DESC
city_padel_venue_count AS padel_venue_count,
market_score, opportunity_score, population
FROM serving.location_profiles
WHERE country_slug = ? AND city_slug IS NOT NULL
ORDER BY city_padel_venue_count DESC
LIMIT 200
""",
[country_slug],
@@ -102,9 +105,10 @@ async def opportunity(country_slug: str):
rows = await fetch_analytics(
"""
SELECT location_name, location_slug, lat, lon,
opportunity_score, nearest_padel_court_km,
opportunity_score, market_score,
nearest_padel_court_km,
padel_venue_count, population
FROM serving.location_opportunity_profile
FROM serving.location_profiles
WHERE country_slug = ? AND opportunity_score > 0
ORDER BY opportunity_score DESC
LIMIT 500

View File

@@ -80,7 +80,8 @@ async def opportunity_map():
abort(404)
countries = await fetch_analytics("""
SELECT DISTINCT country_slug, country_name_en
FROM serving.city_market_profile
FROM serving.location_profiles
WHERE city_slug IS NOT NULL
ORDER BY country_name_en
""")
return await render_template("opportunity_map.html", countries=countries)