LocaSentiment: Discovering Local Gems with AI-Powered Insights

Inspiration: Beyond Star Ratings

In today's world, online reviews are abundant, yet finding a local spot—be it a cafe, restaurant, or attraction—that truly resonates with our specific needs and preferences can still be a frustrating trawl through countless opinions. Simple star ratings often fail to capture the nuances, and manually reading every review is impractical. We were inspired to build LocaSentiment to address this challenge: to create a smarter, more insightful way to discover local places by understanding the meaning and sentiment hidden within the vast sea of user reviews. Our goal was to move beyond superficial metrics and provide users with recommendations that are genuinely relevant to them.

What LocaSentiment Does

LocaSentiment is an intelligent mobile application (built with Flutter) that empowers users to:

  • Search Semantically: Instead of just matching keywords, users can type natural language queries (e.g., "quiet Yogyakarta cafe with great coffee and fast wifi for work"). Our system, powered by vector embeddings and MongoDB Atlas Vector Search, understands the intent behind the query.
  • Understand True Sentiment: For each place, users see an overall sentiment score aggregated from all its reviews. Furthermore, individual reviews are analyzed by Google Cloud Natural Language API to display clear sentiment indicators (Positive, Neutral, Negative).
  • Get AI-Generated Summaries: Leveraging Google Cloud's Vertex AI Gemini model, LocaSentiment provides a concise 2-3 sentence AI-generated summary for each place, distilling key aspects, pros, and cons from all its user reviews (currently in Bahasa Indonesia, showcasing local language processing).
  • Track Sentiment Trends: Users can visualize how a place's public opinion has evolved quarterly through an intuitive line chart, helping them understand consistency or recent changes in quality.
  • Locate with Ease: Integrated Google Maps functionality allows users to quickly see the location of a place and plan their visit.
  • See Relevant Review Snippets: Search results highlight the most relevant review excerpts that match the user's query, along with a relevance score, offering immediate context.

How We Built It: Our Tech Journey

LocaSentiment is a full-stack application developed iteratively, focusing on a robust backend and an intuitive frontend.

1. Data Ingestion & AI Processing (Backend - Python & Google Cloud): * We started by creating a sample dataset of local places and user reviews (including review text and dates). * A Python script (process_data_main.py), structured into a modular data_processor package, was developed to: * Analyze the sentiment of each review using Google Cloud Natural Language API. * Generate vector embeddings for each review text using Sentence-Transformers (paraphrase-multilingual-MiniLM-L12-v2) to capture semantic meaning. * Calculate overall sentiment scores and quarterly sentiment trends for each place. * Generate an AI summary for each place by sending concatenated review texts to the Google Cloud Vertex AI Gemini API (e.g., gemini-2.0-flash-001`) with carefully crafted prompts. * Store all this enriched data (place details, reviews with sentiment and embeddings, sentiment trends, AI summaries) into MongoDB Atlas. * This processing pipeline is containerized using Docker and deployed as a Google Cloud Run Job, ensuring efficient and scalable data preparation. Secrets are managed using Google Secret Manager. Docker images are built via Google Cloud Build and stored in Google Artifact Registry.

2. API Development (Backend - Python & FastAPI): * A RESTful API was built using FastAPI to serve the processed data to the Flutter frontend. * Key endpoints include: * /search: Accepts a natural language query, converts it to an embedding, and performs a vector search on the reviews collection in MongoDB Atlas using Atlas Vector Search to find the most semantically similar reviews. It then aggregates these results to rank and return relevant places. * /places/{place_id}: Retrieves detailed information for a specific place, including all its reviews, sentiment trends, and the AI-generated summary. * This API is also containerized with Docker and deployed as a Google Cloud Run Service, making it publicly accessible and scalable.

3. Frontend Application (Mobile - Flutter): * The mobile application is built using Flutter and Dart, following Clean Architecture principles to separate UI, business logic, and data layers. * State Management: BLoC (flutter_bloc) is used for robust state management. * Dependency Injection: injectable and get_it are used for managing dependencies. * HTTP Communication: The dio package handles API calls to the FastAPI backend. * Data Models: freezed and json_serializable are used for creating immutable data models. * UI Components: * SearchScreen: Allows users to input queries and displays a list of relevant places. * PlaceDetailScreen: Shows comprehensive details of a selected place, including the AI summary, sentiment trend chart (using fl_chart), an integrated Google Map (google_maps_flutter), and a list of all user reviews with sentiment indicators.

4. Version Control & CI/CD (Planned): * GitLab is used for version control. We plan to implement GitLab CI/CD pipelines for automated building and deployment of backend services.

Challenges We Faced

  • SSL/TLS Connectivity: We encountered persistent SSL/TLS handshake errors when connecting PyMongo (both locally and initially in Cloud Run) to MongoDB Atlas. This required extensive debugging, including trying different Python base images in Docker, explicitly using certifi CA bundles, and ensuring network configurations were correct. Moving the data processing to a Cloud Run Job eventually provided a stable environment.
  • Vertex AI Model Availability & Naming: Finding the correct and available Gemini model ID for our specific GCP project and region (us-central1 for Gemini, while asia-southeast2 for most other services) required careful verification through Vertex AI Studio, as documentation or initial assumptions about model names (gemini-2.0-flash-001 vs. gemini-1.0-pro) led to "Model not found" errors.
  • Data Flow in Clean Architecture (Flutter): Ensuring data flowed correctly from Data Models (API DTOs) to Domain Entities and then to BLoC states required careful mapping and attention to detail, especially when adding new fields like AI summaries and sentiment trends.
  • Managing Asynchronous Operations: Handling multiple asynchronous calls (API requests, model loading) gracefully in both the Python backend startup and Flutter BLoCs was a key learning curve.

What We Learned

This hackathon has been an incredible learning experience. Key takeaways include:

  • End-to-End AI Application Development: From data processing and AI model integration (NLP, Embeddings, Generative AI) to deploying a full-stack application on Google Cloud.
  • Power of Vector Search: Deeply understanding and implementing semantic search with MongoDB Atlas Vector Search and sentence embeddings.
  • Leveraging Google Cloud Suite: Gaining hands-on experience with Cloud Run (Jobs & Services), Vertex AI Gemini, Natural Language API, Secret Manager, Artifact Registry, and Cloud Build.
  • Flutter for Cross-Platform UI: Appreciating the power of Flutter and BLoC for building responsive and well-structured mobile UIs.
  • Importance of Modular Design: The refactoring of process_data.py into a package underscored the benefits of modularity for maintainability.
  • Debugging in Cloud Environments: Learning to effectively use logs and troubleshoot issues in containerized cloud deployments.

What's Next for LocaSentiment

We see great potential for LocaSentiment. Future enhancements could include:

  • User accounts for saving favorite places and personalized recommendations.
  • Allowing users to submit their own reviews.
  • More advanced filtering options in search (e.g., by specific amenities, price range).
  • Expanding the AI summary to highlight specific pros and cons more explicitly.
  • Real-time updates or notifications for sentiment changes in favorited places.

We believe LocaSentiment offers a glimpse into the future of how AI can make local discovery more intuitive, insightful, and personalized.

Built With

  • docker
  • fastapi
  • flutter
  • generative-ai
  • gitlab
  • google-artifact-registry
  • google-cloud-build
  • google-cloud-natural-language-api
  • google-cloud-run
  • google-maps-paltform
  • google-secret-manager
  • mongodb-atlas
  • mongodb-atlas-vector-search
  • nlp-natural-language-processing
  • python
  • sentence-transformer
  • vector-embedding
  • vertex-ai-gemini-api
  • vs-code
Share this project:

Updates