|
def format_trip_summary(record: dict) -> str: |
|
name = record.get("name", "Someone") |
|
city = record.get("destinationName") or record.get("locationName") |
|
start = record.get("startDate") |
|
end = record.get("endDate") |
|
start_str = start.strftime("%Y-%m-%d") if start else "" |
|
end_str = end.strftime("%Y-%m-%d") if end else "" |
|
date_range = f"{start_str} to {end_str}" |
|
|
|
rating = record.get("rating") |
|
accommodation = record.get("accommodation") |
|
companion = record.get("companionType") |
|
budget = record.get("budgetStyle") |
|
highlights = record.get("highlights") |
|
food = record.get("memorableFood") |
|
impression = record.get("deepestImpressionSpot") |
|
tips = record.get("travelTips") |
|
itinerary = record.get("dailyBriefItinerary") |
|
tags = ", ".join(record.get("keywordTags", [])) |
|
|
|
summary = f"**{name}'s Trip to {city}**\n" |
|
summary += f"Date: {date_range}\n" |
|
if rating: summary += f"⭐ Rating: {rating}/5\n" |
|
if accommodation: summary += f"🏨 Stayed at: {accommodation}\n" |
|
if companion: summary += f"🧑🤝🧑 With: {companion}\n" |
|
if budget: summary += f"💰 Budget Style: {budget}\n" |
|
if tags: summary += f"🏷️ Tags: {tags}\n" |
|
if highlights: summary += f"\n✨ Highlights:\n{highlights}\n" |
|
if food: summary += f"\n🍜 Memorable Food:\n{food}\n" |
|
if impression: summary += f"\n📍 Impression Spot:\n{impression}\n" |
|
if tips: summary += f"\n📝 Tips:\n{tips}\n" |
|
if itinerary: summary += f"\n📅 Itinerary:\n{itinerary}\n" |
|
|
|
return summary |