TiDB Cloud account Email: ahsanehtesham110@gmail.com

Inspiration

Accessing WHO health data is often complicated, requiring domain knowledge, APIs, and SQL.
We wanted to simplify this by creating an AI-powered query layer that allows anyone to ask natural questions and instantly get insights from global health datasets.

What it does

  • Automates ingestion of WHO life expectancy data into TiDB Cloud.
  • Uses n8n workflows for ELT and AI orchestration.
  • Converts natural language queries → safe SQL queries via Groq LLM.
  • Returns clean JSON answers to users in real time.
  • Provides a simple form interface for submitting queries.

How we built it

  • Data Ingestion: WHO API → n8n → TiDB (batch load of 50+ records).
  • Database Layer: TiDB handles structured life expectancy data (country, year, sex, numeric value, ranges).
  • AI Query Layer: n8n + Groq LLM for text-to-SQL conversion.
  • User Interface: Lovable form for submitting queries, Notion database for storing query logs.

Challenges we ran into

  • Mapping raw WHO JSON fields into a normalized schema.
  • Ensuring column names matched JSON keys in TiDB to avoid null errors.
  • Handling batch inserts (looping through 50+ records in n8n).
  • Designing safe, read-only SQL prompts for the LLM.

Accomplishments that we're proud of

  • Fully automated end-to-end data pipeline (WHO API → TiDB).
  • Functional AI layer that translates human questions into SQL.
  • Built entirely with open-source tools and cloud services in under tight time constraints.
  • Easy-to-use form-based query system for non-technical users.

What we learned

  • How to integrate n8n with TiDB for seamless ELT workflows.
  • Crafting effective system prompts for AI → SQL conversion.
  • The importance of schema alignment for smooth data insertion.
  • How to combine automation + AI + databases into a practical solution.

What's next for AI HealthCare Life Expectancy

  • Add support for more WHO indicators (beyond life expectancy).
  • Build a dashboard/visualization layer for results (charts & trends).
  • Enhance the AI layer with multi-step reasoning for complex queries.
  • Deploy a public demo with live query results.
  • Explore partnerships with researchers and healthcare orgs.

Built With

Share this project:

Updates