How anjishnum/geode works
Project Type and Purpose
• Geode is a full-stack geospatial question answering agent built with Python and Streamlit.
High-Level Component Analysis
• Frontend (app directory)
• app/app.py: Streamlit web interface for user queries and visualization
• app/style.py: UI styling definitions
• Backend Code-Generation Engine (codegen directory)
• generator.py: orchestrates LLM prompting to produce executable Python code
• base_prompt.txt: template prompt guiding code generation
• spec_gen.py: builds function specifications for the LLM
• serve.py: optional HTTP server wrapper around the generator
• Expert Modules (experts directory)
• base.py: abstract expert class and interface
• database_experts.py, functional_experts.py, model_experts.py: concrete expert implementations handling spatial queries, raster/vector operations, ML inference, etc.
• experts/.env: configuration for expert services (API keys, endpoints)
• Scripts (scripts directory)
• launch_v1.py, launch_v2.py: command-line entry points to spin up the system in different modes
• Third-Party Dependencies
• Streamlit: frontend framework
• PyTorch: ML models for specialized reasoning (model_experts)
• GeoPandas, Folium, SciPy, OSM: geospatial data handling and visualization
Component Relationships and Data Flows
• User → Streamlit UI: user submits a natural‐language query.
• Streamlit UI → Codegen Engine: query sent to generator or serve endpoint.
• Codegen Engine → LLM: builds prompt (base_prompt.txt + spec_gen) and receives generated Python code.
• Generated Code → Expert Modules: at runtime, calls expert functions (e.g., patch_location_expert, air_quality_expert).
• Expert Modules → External Data: fetch geospatial data from OpenStreetMap, perform raster/vector computations via GeoPandas, SciPy, ML inference via PyTorch.
• Expert Modules → Code Output: produce textual answers and GeoPatch objects.
• Codegen Engine → Streamlit UI: returns answer text and visualization objects.
• Streamlit UI → Browser: displays the answer and interactive map via Folium.
Architectural Patterns and Design Principles
• Modular Plugin Architecture: each expert implements a common interface, enabling easy addition of new spatial reasoning capabilities.
• Separation of Concerns: distinct layers for UI, code generation, domain logic, and data retrieval.
• Prompt-Driven Code Generation: decouples high-level queries from low-level implementation by leveraging LLMs.
• Micro-service-style Entry Points: serve.py provides an HTTP API for other systems, while scripts allow CLI invocation.