How aditya-pratap-bose/bhudrishti works
Purpose and Entry Points
This is a geospatial parcel-management platform with a Python API, browser dashboard, satellite/drone imagery workflows, and AI-assisted segmentation. The backend starts at app/main.py; API version routing is centralized in app/api/v1/router.py. Static browser entry pages are frontend/login.html, frontend/dashboard.html, and frontend/workspace.html.
API and Request Boundary
Versioned HTTP endpoints divide the domain into authentication, parcel management, imagery, and drone operations:
• app/api/v1/auth.py
• app/api/v1/parcel.py
• app/api/v1/satellite.py
• app/api/v1/drone.py
app/api/v1/router.py composes these modules into the application-facing API contract. The frontend calls this boundary through frontend/js/api.js, with page-specific behavior in frontend/js/dashboard.js and frontend/js/map.js.
Identity, Security, and Persistence
User identity and authorization are represented by app/models/user.py, request/response structures by app/schemas/auth.py, and security primitives by app/core/security.py. Database lifecycle/configuration belongs to app/core/database.py; environment-driven settings are in app/core/config.py.
This layer separates authenticated API operations from underlying user and parcel records.
Parcel Domain and Spatial Records
Parcels are the core managed entity, persisted through app/models/parcel.py and exposed through app/schemas/parcel.py. Parcel endpoints in app/api/v1/parcel.py connect authenticated clients to parcel creation, retrieval, and spatial-analysis workflows. app/services/ulpin_generator.py provides a domain-specific identifier-generation capability for parcels.
GIS Acquisition and Transformation
GIS services isolate external geospatial data and format handling:
• app/services/gis/stac_service.py handles STAC-oriented satellite catalog/search access.
• app/services/gis/raster_service.py processes raster imagery.
• app/services/gis/vector_service.py processes vector/geometric data.
Satellite API requests enter at app/api/v1/satellite.py, flow through these services, and return data suitable for map display or downstream segmentation. This is the principal boundary between the application and remote geospatial catalog/imagery infrastructure.
AI Segmentation Pipeline
AI functionality is separated from route handlers:
• app/services/ai/sam_engine.py
• app/services/ai/post_processing.py
Drone or satellite imagery can be supplied to the segmentation engine, likely producing raw masks or regions, then passed through post-processing to create usable geospatial results. app/api/v1/drone.py is the likely API control point for drone-image-driven analysis. The setup guidance in setup/COLAB_SAM_SERVER.md indicates SAM inference may run as a separately provisioned service/runtime rather than entirely inside the main API process.
Deployment and Client Runtime
The backend is containerized via Dockerfile and docker_compose.yml, with Python dependencies declared in requirements.txt. The frontend is a lightweight static HTML/CSS/JavaScript client (frontend/js/auth.js, frontend/js/export.js, frontend/css/style.css) rather than a bundled SPA framework. Environment variables are documented by .env.example; local and administrator provisioning are supported by setup/LOCAL_SETUP.md and setup/create_admin.py.
Main entry points: router.py v1 API router · parcel.py Parcel endpoints · satellite.py Satellite endpoints · sam_engine.py SAM inference
Components 19
Browser client
- Static pages · Login, dashboard, and workspace pages.
frontend/login.html - API client
frontend/js/api.js - Dashboard & map UI
frontend/js/map.js
Python API
- Application entry
app/main.py - v1 API router
app/api/v1/router.py - Auth endpoints
app/api/v1/auth.py - Parcel endpoints
app/api/v1/parcel.py - Satellite endpoints
app/api/v1/satellite.py - Drone endpoints
app/api/v1/drone.py
Domain & persistence
- Security primitives
app/core/security.py - User identity
app/models/user.py - Parcel records
app/models/parcel.py - ULPIN generator
app/services/ulpin_generator.py
GIS workflows
- STAC access · External satellite catalog and imagery boundary.
app/services/gis/stac_service.py - Raster processing
app/services/gis/raster_service.py - Vector processing
app/services/gis/vector_service.py
AI segmentation
- SAM inference · May run as separately provisioned inference runtime.
app/services/ai/sam_engine.py - Mask post-processing · Converts raw masks into usable geospatial results.
app/services/ai/post_processing.py - SAM runtime setup
setup/COLAB_SAM_SERVER.md
Connections 22
- Static pages → API client: loads
- Static pages → Dashboard & map UI: loads
- API client → v1 API router: v1 HTTP calls
- Dashboard & map UI → API client: uses
- Application entry → v1 API router: mounts
- v1 API router → Auth endpoints: composes
- v1 API router → Parcel endpoints: composes
- v1 API router → Satellite endpoints: composes
- v1 API router → Drone endpoints: composes
- Auth endpoints → Security primitives: authenticates with
- Auth endpoints → User identity: manages
- Parcel endpoints → Security primitives: requires
- Parcel endpoints → Parcel records: manages
- Parcel endpoints → ULPIN generator: generates IDs
- Satellite endpoints → STAC access: searches
- Satellite endpoints → Raster processing: processes imagery
- Satellite endpoints → Vector processing: processes geometry
- Drone endpoints → SAM inference: submits imagery
- Raster processing → SAM inference: supplies imagery
- SAM inference → Mask post-processing: raw masks
- Mask post-processing → Vector processing: geospatial results
- SAM runtime setup → SAM inference: provisions