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:
@@ -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"],
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
autocomplete="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="off"
|
||||
placeholder="-- SELECT * FROM serving.city_market_profile -- WHERE country_code = 'DE' -- ORDER BY marktreife_score DESC -- LIMIT 20"
|
||||
placeholder="-- SELECT * FROM serving.location_profiles -- WHERE country_code = 'DE' AND city_slug IS NOT NULL -- ORDER BY market_score DESC -- LIMIT 20"
|
||||
></textarea>
|
||||
|
||||
<div class="query-controls">
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user