Sprint 2 Progress - Kaleemunnisa/CS691-Spring2025-Team6 GitHub Wiki

🏁 Sprint 2 - Dynamic Event and Business Recommendation Platform

🎯 Sprint Goal

• Implement a personalized event recommendation system that fetches event data based on the user's requested city and location. • Integrate local businesses (restaurants, hotels, attractions) to enhance user experience. • Improve UI for better usability.


Sprint 2: Completed Tasks

TASK-007: Fetch Events by City & Location

Summary:
Integrate with event APIs (e.g., Ticketmaster, Eventbrite) to retrieve events based on user input.

Code Snippet:

// Step 1: Fetch events for the detected country (including music, sports, etc.)
const eventRes = await axios.get(
  `https://app.ticketmaster.com/discovery/v2/events.json`,
  {
    params: {
      countryCode: countryCode, // Use the detected country code if needed
      stateCode: stateCode,
      apikey: TICKETMASTER_API_KEY,
      city: city, // Filter by the entered city
      size: 30, // Fetch more events to ensure variety
    },
  }
);
const allEvents = eventRes.data._embedded?.events || [];

TASK-008: Develop Recommendation Algorithm

export const fetchCitySuggestions = async (text: any) => {
  if (!text) return [];

  try {
    const response = await fetch(
      `https://api.geoapify.com/v1/geocode/autocomplete?text=${text}&type=city&limit=5&apiKey=${GEOAPIFY_KEY}`
    );
    const data = await response.json();

    return data.features
      ? data.features.map((feature: any) => ({
          // All required fields
        }))
      : [];
  } catch (error) {
    console.error("Error fetching city suggestions:", error);
    return [];
  }
};

TASK-009: Local Business API Integration

export const fetchFoodPlaces = async (CITY_ID) => {
  try {
    const response = await fetch(
      `https://api.geoapify.com/v2/places?categories=catering.fast_food,catering.cafe,catering.food_court,catering.bar,catering.pub,catering.ice_cream&filter=place:${CITY_ID}&limit=50&apiKey=${GEOAPIFY_KEY}`
    );
    const data = await response.json();
    return data.features || [];
  } catch (error) {
    return [];
  }
};

export const fetchEntertainmentPlaces = async (CITY_ID) => {
  try {
    const response = await fetch(
      `https://api.geoapify.com/v2/places?categories=entertainment&filter=place:${CITY_ID}&limit=50&apiKey=${GEOAPIFY_KEY}`
    );
    const data = await response.json();
    return data.features || [];
  } catch (error) {
    return [];
  }
};

TASK-010: UI for Personalized Events & Places

Summary:
Design a UI component to display recommended events and local businesses.

Code Snippet:

//Events displaying using customized event card
{
  cityEvents.length > 0 ? (
    cityEvents.map((event: any, index: any) => (
      <View key={index} style={styles.eventCard}>
        {event.image && (
          <Image source={{ uri: event.image }} style={styles.eventImage} />
        )}
        <Text style={styles.eventTitle}>{event.name}</Text>
        <Text style={styles.eventDetails}>📅 {event.dateTime}</Text>
        <Text style={styles.eventDetails}>
          📍 {event.venue}, {event.city}, {event.state}
        </Text>
        <Text style={styles.eventCategory}>🎟️ {event.category}</Text>
      </View>
    ))
  ) : (
    <Text>No events found in {city}.</Text>
  );
}

// Places marking on Map
<MapView
  style={styles.map}
  region={region}
  onRegionChangeComplete={(newRegion) => setRegion(newRegion)}
>
  {places.map((place, index) => {
    const categoryId = place.properties?.category ?? "restaurant"; // Default category
    const iconName = getIconForCategory(categoryId);
    return (
      <Marker
        key={index}
        coordinate={{
          latitude: place.geometry.coordinates[1],
          longitude: place.geometry.coordinates[0],
        }}
        onPress={() => onMarkerPress(place)}
        pinColor={iconColor}
      >
        {/* Dynamically set icon based on category */}
      </Marker>
    );
  })}
</MapView>;

TASK-011: Testing & Debugging

Summary:
Ensure event fetching, recommendation accuracy, and API responses work correctly.

  • Everything as been working as Expected
---

Results for Sprint 2

EVENTS SCREEN PLACES SCREEN WITH FOOD SPOTS PLACES SCREEN WITH ENTERTAINMENT SPOTS DETAILS VIEW OF PLACES

⚠️ **GitHub.com Fallback** ⚠️