A full-stack intelligent system that turns natural language queries into GIS workflows using chain-of-thought LLM reasoning, integrating MySQL, MongoDB, Spring Boot, FastAPI, and Ollama.
ChainLLM enables users to describe complex geospatial analysis tasks (e.g., “Map flood zones near Brahmaputra river within 10km radius of schools”) in plain English. It uses LLMs (like Mistral via Ollama) to generate step-by-step GIS workflows, passes them to a Python-powered GIS execution engine, and provides results—all tied to a unique taskId.
graph TD
A[Frontend Next.js] -->|/llm/ask| B[Spring Boot API]
B -->|Generate taskId + trigger LLM| C[Ollama Mistral]
C -->|LLM Response + taskId| D[FastAPI GIS Engine]
D -->|Process GIS task| E[MongoDB]
B -->|Track task metadata and Authentication| F[MySQL]
E -->|Result files| G[Frontend polls/view]
| Layer | Tech |
|---|---|
| Frontend | Next.js, TailwindCSS |
| API Gateway | Spring Boot (Java) |
| Auth/Task DB | MySQL |
| LLM | Ollama (locally hosted, e.g. Mistral) |
| GIS Engine | FastAPI (Python) |
| GIS Output DB | MongoDB |
-
User submits prompt on frontend (
/llm/ask). -
Spring Boot:
- Generates and returns a unique
taskIdimmediately. - Sends prompt to Ollama (LLM inference).
- Generates and returns a unique
-
LLM Response is sent to the FastAPI GIS server with the same
taskId. -
Python GIS Engine:
- Parses LLM output.
- Executes GIS operations (GeoPandas, Rasterio, etc.).
- Stores logs/output in MongoDB.
-
Frontend polls or fetches final results using
taskId.
chainllm/
├── frontend/ # Next.js frontend
├── backend/ # Java Spring Boot
│ ├── controller/
│ ├── service/
│ └── model/ (MySQL entities)
├── gis-engine/ # FastAPI Python service
│ ├── routes/
│ ├── services/
│ └── models/ (MongoDB schemas)
| System | Purpose |
|---|---|
| MySQL (Java) | User auth, taskId tracking |
| MongoDB (Python) | GIS output, logs, CoT steps |
🧩 Prerequisites Node.js (v18+ recommended) + npm → for running the Next.js frontend
Java 17+ and Maven → for the Spring Boot backend
Python 3.10+ and pip → for the FastAPI GIS engine
MySQL and MongoDB running locally → MySQL for Spring Boot, MongoDB for GIS logs
Ollama installed → run with ollama run mistral
Docker (optional) → for containerized setup (optional)
cd backend
./mvnw spring-boot:runcd python GIS
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run dev“Generate a flood risk map for Guwahati with buffers around water bodies and elevation analysis.”
➡️ Returns:
- Chain-of-Thought JSON
- GIS logs
- Downloadable raster/vector results
- 🔐 JWT-based login (Next.js + Spring Boot)
- 🧠 Real-time LLM response via Ollama
- 🛰️ Automated GIS analysis with reasoning logs
- 📈 Result tracking via
taskId - 💽 Dual database architecture
- OpenStreetMap (OSM)
- Bhoonidhi
- Sentinel-2, SRTM, etc.
Install Ollama: https://ollama.com Run locally:
ollama run mistral| Endpoint | Method | Description |
|---|---|---|
/llm/ask |
POST | Submit prompt, get taskId |
/api |
POST | Called internally by Java app |
/auth/login |
POST | Auth endpoint |
/api/task/:taskId/ |
GET | (Optional) fetch processed data |
- ✅ Frontend dashboard with result previews
- 🔁 Retry failed GIS jobs
- 🗃️ Archive & replay prompt history
- 🧾 Visual Chain-of-Thought logs
- 📊 GIS metric comparison dashboard
| Name | Role | GitHub |
|---|---|---|
| Debashis Mitra | Team Lead, Java Backend, DevOps | @Debashismitra01 |
| Debankur Dutta | Python Backend, GIS | @Debankur04 |
| Susovan Sinhababu | Frontend Developer | @Susovan700 |
| Anuska Kapuria | Documentation, PPTs & Presentation | @Anuska1312 |
© 2025 Team Ashwamedh. All rights reserved. This source code is proprietary and intended solely for evaluation purposes by the ISRO BAH committee. Any reproduction, distribution, or use without explicit permission is strictly prohibited.