berlin-picnic-api/app/routers/info.py

83 lines
3.3 KiB
Python

# app/routers/info.py
from fastapi import APIRouter, HTTPException
from app.services.berlin_data_service import BerlinDataService
router = APIRouter(tags=["info"])
# Services
berlin_data = BerlinDataService()
@router.get("/neighborhoods")
async def get_neighborhoods():
"""Get all Berlin neighborhoods with green space statistics."""
try:
neighborhoods = await berlin_data.get_neighborhood_stats()
return neighborhoods
except Exception as e:
raise HTTPException(status_code=500, detail=f"Failed to get neighborhoods: {str(e)}")
@router.get("/personalities")
async def get_personality_descriptions():
"""Get descriptions of all personality types and their preferences."""
return {
"personalities": [
{
"id": "little_adventurers",
"name": "Little Adventurers",
"description": "Families with kids seeking safe, fun spaces",
"key_factors": ["playgrounds", "safety", "toilets", "shade", "family_activities"],
"icon": "🧸"
},
{
"id": "date_night",
"name": "Date Night",
"description": "Couples seeking romantic, peaceful settings",
"key_factors": ["scenery", "quiet", "romantic_spots", "restaurants", "privacy"],
"icon": "💕"
},
{
"id": "squad_goals",
"name": "Squad Goals",
"description": "Friend groups needing space for gatherings",
"key_factors": ["large_space", "group_activities", "accessibility", "nearby_food"],
"icon": "🎉"
},
{
"id": "zen_masters",
"name": "Zen Masters",
"description": "Peace seekers wanting tranquil environments",
"key_factors": ["quietness", "nature", "meditation_spots", "low_crowds"],
"icon": "🧘"
},
{
"id": "active_lifestyle",
"name": "Active Lifestyle",
"description": "Fitness enthusiasts seeking exercise opportunities",
"key_factors": ["running_paths", "fitness_equipment", "cycling", "sports_areas"],
"icon": "🏃"
},
{
"id": "wildlife_lover",
"name": "Wildlife Lover",
"description": "Nature enthusiasts seeking animal encounters",
"key_factors": ["wildlife_diversity", "bird_watching", "natural_habitats", "quiet_observation"],
"icon": "🦋"
},
{
"id": "art_nerd",
"name": "Art Nerd",
"description": "Culture lovers seeking artistic inspiration",
"key_factors": ["museums_nearby", "artistic_installations", "cultural_venues", "creative_atmosphere"],
"icon": "🎨"
},
{
"id": "history_geek",
"name": "History Geek",
"description": "History buffs seeking sites with historical significance",
"key_factors": ["historical_sites", "monuments", "cultural_heritage", "educational_value"],
"icon": "🏛️"
}
]
}