Skip to content
Achalnawal2745Public

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

106 Commits

Folders and files

Repository files navigation

🌊 Float Chat -ARGO OCEAN INTELLIGENCE SYSTEM

AI-Powered Conversational Interface for ARGO Oceanographic Data

Float Chat is an intelligent chatbot that lets you explore ocean data from ARGO floats using natural language. Ask questions in plain English and get instant visualizations, charts, and insights about ocean temperature, salinity, and float trajectories.

License: MIT Python 3.11+ FastAPI Streamlit

✨ Features

  • πŸ€– Natural Language Queries - Ask questions like "Show floats in Indian Ocean" or "Compare temperature of floats 1902669 and 1902670"
  • πŸ—ΊοΈ Interactive Maps - Visualize float trajectories and locations with Folium
  • πŸ“Š Dynamic Charts - Compare temperature, salinity, pressure, and depth profiles with Plotly
  • πŸ’Ύ Automated Data Pipeline - Download and ingest ARGO NetCDF files automatically
  • 🧠 3-Layer AI System - Intelligent query routing with Google Gemini 2.5 Flash
  • 🎯 Smart Query Understanding - Handles complex multi-step queries with AI orchestration
  • πŸ“ˆ Real-time Analytics - SQL-based aggregations for statistical queries

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • PostgreSQL database
  • Google Gemini API key
  • Supabase account (optional, for vector search)

Installation

  1. Clone the repository

    git clone https://github.com/Achalnawal2745/floatchat.git
    cd floatchat
  2. Install dependencies

    pip install -r requirements.txt
  3. Configure environment

    Create a .env file in the project root:

    DATABASE_URL=postgresql://user:password@localhost:5432/argo_db
    GEMINI_API_KEY=your_gemini_api_key_here
    SUPABASE_URL=your_supabase_url
    SUPABASE_KEY=your_supabase_key
  4. Start the application

    Windows:

    start.bat

    Linux/Mac:

    # Terminal 1 - Backend
    python backend16.py
    
    # Terminal 2 - Frontend
    streamlit run app.py
  5. Open your browser

    Navigate to http://localhost:8501

πŸ’¬ Example Queries

Try these natural language queries:

  • "Show all floats in the Indian Ocean"
  • "What's the temperature profile for float 2900565?"
  • "Compare salinity between floats 1902669 and 1902670"
  • "Show me the path of float 2900565"
  • "How many floats are in the Arabian Sea?"
  • "Average temperature at 100m depth for float 2900565"

πŸ“– Usage Guide

Adding New Floats

Via Web Interface:

  1. Open the sidebar in the Streamlit app
  2. Navigate to "Admin Panel"
  3. Enter the float ID (e.g., 2900565)
  4. Click "Download & Ingest"

Via API:

# Download float data
curl -X POST http://127.0.0.1:8000/admin/download-float \
  -H "Content-Type: application/json" \
  -d '{"float_id": "2900565"}'

# Ingest into database
curl -X POST http://127.0.0.1:8000/admin/ingest-float \
  -H "Content-Type: application/json" \
  -d '{"float_id": "2900565"}'

πŸ—οΈ Architecture

Float Chat uses a sophisticated 3-layer AI system:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Streamlit UI                         β”‚
β”‚            (Chat Interface + Visualizations)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
                     ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  FastAPI Backend                        β”‚
β”‚                                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚  β”‚ Layer 1  β”‚β†’ β”‚ Layer 2  β”‚β†’ β”‚    Layer 3       β”‚       β”‚
β”‚  β”‚Direct    β”‚  β”‚Complex   β”‚  β”‚SQL Generation    β”‚       β”‚
β”‚  β”‚Tool Call β”‚  β”‚Orchestr. β”‚  β”‚& Fallback        β”‚       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        ↓                         ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  PostgreSQL  β”‚          β”‚ Gemini AI    β”‚
β”‚  Database    β”‚          β”‚ (2.5 Flash)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Layer System

  • Layer 1: Direct tool execution for simple queries (e.g., "show float 2900565")
  • Layer 2: AI orchestration for complex multi-step queries (e.g., "temperature of all floats in Indian Ocean")
  • Layer 3: SQL generation for analytical queries (e.g., "average temperature at 100m depth")

πŸ“ Project Structure

float-chat/
β”œβ”€β”€ app.py                 # Streamlit frontend
β”œβ”€β”€ backend16.py           # FastAPI backend with 3-layer AI system
β”œβ”€β”€ argo_ingestion.py      # Data ingestion module
β”œβ”€β”€ download_floats.py     # Float download utility
β”œβ”€β”€ ingest_floats.py       # Batch ingestion script
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ start.bat             # Windows startup script
β”œβ”€β”€ .env                  # Environment configuration
β”œβ”€β”€ README.md             # This file
└── QUICKSTART.md         # Quick start guide

πŸ”Œ API Endpoints

Query Endpoint

POST /query
Content-Type: application/json

{
  "query": "show floats in indian ocean",
  "session_id": "optional-session-id"
}

Admin Endpoints

POST /admin/download-float
POST /admin/ingest-float
GET /health
GET /floats

See API Documentation for full details.

πŸ› οΈ Technologies

Category Technologies
Backend FastAPI, Python 3.11+, asyncpg
Frontend Streamlit, Folium, Plotly
Database PostgreSQL, ChromaDB
AI Google Gemini 2.5 Flash
Data Format NetCDF4, ARGO float data

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“§ Contact

For questions, issues, or feature requests, please open an issue on GitHub.


Made with ❀️ for ocean data exploration

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages