File size: 1,548 Bytes
ca1a2dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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