🌍 WorldPulseAI - The Global Sentiment App

🚀 Inspiration

Every day, the world's most critical headlines flood our screens, yet the collective, global feeling on issues like war, education, or climate remains scattered and elusive. Data is fragmented across languages, newsrooms, and reports. WorldPulseAI was born from a simple question: "Why can't I see the planet's collective emotional and analytical mood in one glance?"

Inspired by the idea of giving the world a literal, measurable heartbeat, WorldPulseAI uses cutting-edge AI to instantly measure and visualize global sentiment, transforming overwhelming complexity into immediate clarity.

💡 What It Does

WorldPulseAI is a global sentiment intelligence platform powered by Google Gemini and a high-performance FastAPI backend. It provides real-time emotional and analytical trends across 100+ countries, mapping them directly onto a stunning, interactive 3D Earth visualization.

Core User Journey:

Topic Analysis: Users enter any critical topic (e.g., education, climate change, inflation). Global Visualization: The interactive 3D globe updates live, coloring each country based on its synthesized sentiment score: * 🟢 Stable / Improving (Score ≥ 0.5): Indicating strong positive momentum. * 🟡 Mixed / Uncertain (Score 0.0 – 0.5): Requires cautious monitoring. * 🟠 High Concern (Score –0.5 – 0.0): Immediate attention warranted. * 🔴 Crisis (Score < –0.5): Signifying a critical situation. Deep Dive Insight: Clicking any country instantly pulls a detailed report featuring: A concise, Gemini-generated summary of the national mood. The precise Sentiment Score. Three distilled, actionable Keywords summarizing the trend. Policy Tracking: Users can dynamically bookmark and compare up to two nations side by side for comparative policy analysis.

🧠 How We Built It

Tech Stack Overview

🧩 Backend:** FastAPI (Python) for asynchronous request handling, deployed on Google Cloud Run for scalability. ⚙️ AI Engine: Gemini 2.5 Flash models, leveraged via the Vertex AI REST API for reliable, structured JSON output. 🌐 Frontend: Pure Vanilla JavaScript and Globe.GL (Three.js) library, engineered for high-performance, real-time 3D Earth visualization. 📊 Data Flow: Asynchronous batch sentiment processing allows for simultaneous inference across 100 countries. 💾 Storage: In-memory JSON mapping manages the live dataset, complemented by browser localStorage for personalized user history and bookmarks.

High-Throughput Workflow

  1. The user's topic query triggers a single API call to the FastAPI backend.
  2. FastAPI concurrently fans out 100 optimized, asynchronous Gemini requests, one tailored for the specific topic and geographic context of each country.
  3. Each Gemini call returns a clean, highly structured JSON object, ensuring predictable data intake: json { "country": "Finland", "topic": "education", "sentiment_score": 0.85, "summary": "Globally recognized for equity and quality teachers.", "keywords": ["equity", "teachers", "student-centered"] }
  4. Crucially, as results stream back to the client, the 3D globe updates live (dynamic rendering), lighting up countries progressively rather than waiting for the entire batch to complete.

⚡ Challenges I Ran Into

The main hurdles were achieving high-speed concurrency and ensuring data consistency across disparate systems.

  1. Name Mismatch between AI and GeoJSON:

    Problem: Map data (GeoJSON) uses formal identifiers (e.g., "Tanzania, United Republic of"), which clashed with the colloquial names returned by Gemini (e.g., "Tanzania"). This broke the map highlighting system. ✅ Solution: We implemented a robust normalization dictionary in JavaScript to alias common variations: const NAME_ALIASES = { "Côte d’Ivoire": "Ivory Coast", "Tanzania, United Republic of": "Tanzania", ... }; This simple layer ensures every AI response aligns perfectly with its map feature.

  2. Dynamic Data Loading & Responsiveness:

    Problem: The initial design was blocking the user, resulting in the user having to wait up to a minute for all 100 country results to load before the map could render, resulting in a poor user experience. ✅ Solution: We rewrote the client-side fetch pipeline to utilize partial rendering and progressive updates. The map now glows dynamically as data arrives country-by-country, dramatically improving perceived latency.

  3. Latency in Gemini Calls (The Bottleneck):

    Problem: Despite batching, initial global inference calls were too slow, often taking two minutes for the full 100-country analysis. ✅ Solution: We fine-tuned the backend concurrency using ThreadPoolExecutor alongside asyncio.Semaphore to precisely limit the simultaneous active calls to Gemini (to 8 concurrent calls). This drastically improved speed while maintaining stability.

🏆 Accomplishments That We're Proud Of

  • Scalable AI Concurrency: Successfully building a distributed pipeline capable of performing 100 concurrent AI inference tasks without backend failure, delivering a complete global dataset in seconds.
  • Real-Time Data Visualization: Integrating the data flow directly with the Globe.GL engine to create a seamless, cinematic experience where the world map progressively colors itself in real time.
  • Structured Output Reliance: Mastering the use of Gemini APIs with a strict JSON schema output, ensuring the data consumed by the front-end is always clean, validated, and immediately usable.
  • Intuitive UX Design: Crafting a clear, emotionally intuitive UI where every color, transition, and animation instantly communicates the meaning and gravity of the underlying data.

🧩 What We Learned

AI Data Structuring: The power and necessity of using structured JSON schema output with Gemini to control the quality and format of high-volume inference results. FastAPI Concurrency: Advanced techniques for leveraging Python's asyncio and ThreadPoolExecutor to handle high-throughput, latency-bound AI tasks efficiently. Geospatial Normalization: The critical importance of data normalization (alias mapping) when merging disparate data sources (LLM output vs. formal geospatial datasets). Frontend Optimization: The art of improving user engagement by rendering partial AI responses progressively, making the application feel "alive."

🌐 What's Next for WorldPulseAI

Our roadmap focuses on expanding depth, breadth, and foresight:

  1. Global Expansion: Scaling coverage from 100 to all 195 UN-recognized countries to achieve complete global sentiment mapping.
  2. Trend Timeline & Graphs: Integrating longitudinal analysis features, allowing users to select a country and view sentiment charts over time, is crucial for policy evaluation.
  3. Drilldown Analytics: Enhancing the country modal to show detailed trend graphs, localized keyword clouds, and links to source articles.
  4. Predictive Forecasting: Implementing initial predictive models (e.g., using regression) to forecast short-term sentiment change for key metrics.
  5. User Personalization: Enabling topic subscriptions and automated daily briefings (e.g., "Today’s Global Pulse") delivered directly to the user.

WorldPulse is more than an app. It’s the world’s heartbeat, visualized. 🌍💫

Built With

Share this project:

Updates