Skip to content

Repository files navigation


Records Floats Agent Ready Offline




FloatChart Dashboard

🎯 What is this?

FloatChart turns the ARGO ocean observation network — 4,000+ autonomous floats, 46 million+ profiles of temperature, salinity, and depth — into something you can just talk to. No SQL, no NetCDF wrangling, no oceanography degree. Ask a question in plain English, get back a chart, a map, or a clean export.

"Show temperature trends in the Bay of Bengal for 2024" → done in under a second.

🔓
Open
🤖
Agent-Ready
📴
Offline-First
🔒
Privacy-First
🛡️
Safety-First
All data & code publicly accessible Versioned REST API built for LLMs Runs fully on-device after setup Zero telemetry, zero tracking 7-layer SQL sanitizer on every query

🏗️ How it fits together

FloatChart Architecture

✨ What you get

💬 AI Chat Interface

Natural language → SQL → chart, automatically.

  • 7 query types: statistics, proximity, profiles & more
  • Instant AI-written summaries
  • One-click CSV export

🗺️ Live Ocean Map

Click anywhere on Earth's oceans.

  • Nearby floats surface instantly
  • Real-time trajectory playback
  • Date-range filtering + hover details

📊 Analytics Dashboard

Pre-built views for real analysis.

  • Temperature time series
  • Salinity distributions
  • Vertical depth profiles

🤖 Developer API

Everything above, callable from code.

  • POST /api/v1/query
  • GET /api/v1/tools — agent manifest
  • Sub-second responses, no auth needed locally

⚡ Quick Start

git clone <your-repo-url>
cd FloatChart

python local_setup.py   # installs deps, configures DB, launches app

Opens automatically at http://localhost:5000 🎉

🔑 Prerequisites
Service Cost Get a key
NVIDIA NIM Varies build.nvidia.com
DeepSeek (optional) Cheap platform.deepseek.com
⚙️ Configuration (.env)
DATABASE_URL=postgresql://postgres:YOUR_PASSWORD@localhost:5432/floatchart
NVIDIA_API_KEY=nvapi-xxxxxxxxxxxxxxxxxxxxxxxx
NVIDIA_MODEL=meta/llama-3.3-70b-instruct

# Optional providers
# ANTHROPIC_API_KEY=sk-ant-...
# OPENAI_API_KEY=sk-...
# DEEPSEEK_API_KEY=...

🤖 Developer API

curl -X POST http://localhost:5000/api/v1/query \
  -H "Content-Type: application/json" \
  -d '{"query": "Show average temperature in Bay of Bengal for 2024"}'
{
  "success":      true,
  "answer":       "Average temperature in Bay of Bengal (2024): 28.4°C based on 3,201 measurements.",
  "chart_type":   "line",
  "query_type":   "Time-Series",
  "record_count": 365,
  "elapsed_ms":   218.4
}
Method Endpoint Description
POST /api/v1/query Natural language → structured ocean data
GET /api/v1/tools Machine-readable tool manifest for agents
POST /api/v1/validate-sql Run the safety sanitizer manually
GET /api/health Health check + DB status
GET /api/stats Database statistics

From Python:

import requests

def ask_ocean(question: str) -> dict:
    r = requests.post("http://localhost:5000/api/v1/query",
                       json={"query": question, "max_rows": 500})
    return r.json()

print(ask_ocean("Find the 5 nearest floats to Chennai")["answer"])

Built for agents: every tool is auto-discoverable via curl http://localhost:5000/api/v1/tools, so LLM agents (including anything speaking MCP) can call query_ocean_data, get_temperature_trend, get_depth_profile, and more without hand-written glue code.


🛡️ Safety Layer

Every AI-generated SQL query is checked before it ever reaches the database:

# Layer Blocks
1 Allowlist Anything that isn't SELECT / WITH
2 Keyword scan DROP, DELETE, INSERT, UPDATE, TRUNCATE, ALTER, GRANT
3 No stacking ;-chained injection attempts
4 No comment tricks -- and /* */ bypasses
5 LIMIT cap Runaway million-row queries
6 No system abuse pg_read_file, pg_sleep, COPY
7 Clear rejections Every block returns a human-readable reason
from sql_sanitizer import SQLSanitizer

SQLSanitizer.validate("SELECT AVG(temperature) FROM argo_data")
# → {"safe": True}

SQLSanitizer.validate("DROP TABLE argo_data;")
# → {"safe": False, "reason": "Blocked keyword detected: DROP"}

📁 Project Layout

FloatChart/
├── ARGO_CHATBOT/          # Main app — Flask server, LLM brain, SQL builder + sanitizer
│   └── static/            # Chat UI · Map UI · Dashboard UI
├── DATA_GENERATOR/        # Local ERDDAP data ingestion tool
├── local_setup.py         # One-click setup wizard
├── requirements.txt
├── .env.example
└── CONTRIBUTING.md

🛠️ Tech Stack

Layer Technology
Backend Python 3.9+ · Flask 2.0+
AI / LLM NVIDIA Llama 3.3 70B · DeepSeek · OpenAI · Claude · Gemini
Database PostgreSQL 15+ · SQLAlchemy
Frontend HTML5 · CSS3 · JavaScript
Visualization Chart.js · Leaflet.js

📚 Resources

Resource Link
🌊 ARGO Program argo.ucsd.edu
📡 ERDDAP Server erddap.ifremer.fr
🧠 NVIDIA NIM build.nvidia.com
🤝 Contributing CONTRIBUTING.md

📄 License

MIT — free to use, modify, and distribute. See LICENSE.


The open intelligence layer for ARGO ocean data 🌊

About

FloatChart is an open-source platform that lets you query ARGO ocean data (4,000+ floats, 46M+ profiles) using plain English. It converts natural language into safe, read-only SQL, then returns instant charts, maps, and data exports — no coding or oceanography background needed.RGO

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages