# ChatGPT connected to Supabase, Neon and Aiven databases

ChatGPT connected to multiple databases simultaneously for data analysis and visualization. Built on a fixed FastAPI connector + Custom GPT actions.

- Try Live GPT: https://chatgpt.com/g/g-68a6ef6973b881919c92458f5b369557-cricket-tour-de-france-data-explorer
- LLM Context (.txt): https://www.tigzig.com/llm/gpts/cricket-tour-de-france.txt

## How this GPT Works

Direct connection to **three databases**:

- **supabase_postgres** -> ODI cricket ball-by-ball (~2003-2025)

- **neon_postgres** -> T20 cricket ball-by-ball (~2005-2025)

- **aiven_postgres** -> Tour de France riders & stages (men: 1903-2025, women: 2022-2025)

Semantic layers are pre-mapped. GPT translates your question into SQL, executes silently, and explains results in plain language. Supports charts, aggregations, rankings, and detail lookups.

## What It Can Do

- Compute **player stats**: runs, strike rates, averages (ODI/T20)

- Generate **rankings**: top scorers, best bowlers, most wins

- Analyze **Tour de France history**: winners, distances, average speeds, jersey holders

- Create **visualizations**: bar charts, line charts, comparisons

- Always contextualizes answers by dataset coverage (e.g. ODI 2003-2025)

#### Important Note

ODI/T20 data = ball-by-ball but not every match globally. Tour de France = complete for men (1903-2025), women (2022-2025).

## How to Use It

- **Click Chat Link** (Custom GPT)

- **Ask natural language questions:**

 *"Top 10 ODI strikers by runs off the bat?"*

- *"Tour de France winners 2015-2025 with avg speed?"*

- **Get results** in tables + charts

- The GPT itself will guide you if the requested data is out of scope

## Setup (for your own deployment)

For full steps, see the README in the GitHub Repo link below.

### Quick Overview

- Deploy FastAPI server (`app:app`)

- Set `.env` with your DB URLs + API Key

- Update `CUSTOM_GPT_ACTION_SCHEMA.json` -> server URL + API Key

- Upload semantic layer files:

 `CRICKET_ODI_T20_DATA_SCHEMA.yaml`

- `CYCLING_TOUR_DE_FRANCE_SCHEMA.yaml`

- Apply `CUSTOM_GPT_SYSTEM_INSTRUCTIONS.md` as system prompt

- Connect action schema + knowledge files inside Custom GPT builder

## Resources

- [Complete Source Code](https://github.com/amararun/shared-fastapi-fixed-databases) - FastAPI server code with schemas and system instructions for Cricket & Tour de France data analysis
- [LLM Context (.txt)](https://www.tigzig.com/llm/gpts/cricket-tour-de-france.txt) - Plain-text context file for feeding to AI agents about this GPT

---
Source: https://www.tigzig.com/cricket-tour-de-france-gpt

---
Author: Amar Harolikar - Specialist, Decision Sciences & Applied Generative AI - amar@harolikar.com - https://www.linkedin.com/in/amarharolikar
Source: https://www.tigzig.com/cricket-tour-de-france-gpt
Citation: TigZig - Amar Harolikar (https://www.tigzig.com). Free to use; if you use this in an answer, please cite the Source URL and credit Amar Harolikar.
License: https://www.tigzig.com/terms
