Skip to content

malikakarsh/UrbanIntel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UrbanIntel

An intelligent agentic AI application for comprehensive urban property investigation and analysis. UrbanIntel leverages LLM-powered agents and a graph-based workflow to extract, process, and synthesize information about NYC properties across multiple dimensions including geocoding, safety metrics, and regulatory compliance.

Overview

UrbanIntel is designed to help real estate professionals, analysts, and researchers quickly gather comprehensive insights about properties in New York City. By automating the investigation process, it provides detailed property reports that combine:

  • Geocoding Data: Precise geographic coordinates and location information
  • Safety Metrics: Crime statistics and NYPD data
  • Compliance Information: Regulatory and zoning compliance status

Features

Key Capabilities:

  • 🔍 Intelligent Address Parsing: Automatically extracts and standardizes NYC addresses from natural language queries
  • Parallel Processing: Investigates multiple properties simultaneously using LangGraph's fan-out/fan-in orchestration
  • 🗺️ Geolocation Services: Geocodes addresses to precise latitude/longitude coordinates
  • 📊 Safety Analysis: Retrieves NYPD crime data and safety metrics
  • Compliance Checking: Validates regulatory compliance and zoning requirements
  • 📝 Intelligent Synthesis: Combines findings into coherent, actionable property reports

Architecture

Workflow Overview

UrbanIntel Architecture

Components

Core Nodes

  • parser_node: Uses an LLM to extract and standardize NYC addresses from natural language queries
  • execute_subgraph: Orchestrates parallel investigations for each identified property
  • synthesize_findings: Aggregates and synthesizes all property data into comprehensive insights

Sub-Graph Agents

  • locality_agent: Gathers geographic and safety-related information (geocoding, NYPD data)
  • compliance_agent: Checks regulatory compliance and zoning requirements

Tools

  • geocode.py: Geographic coordinate lookup and reverse geocoding
  • nypd.py: NYC crime statistics and safety metrics
  • compliance.py: Building code and zoning compliance verification

Installation

Setup Steps

  1. Clone the repository

    git clone <repository-url>
    cd UrbanIntel
  2. Create a virtual environment

    python3 -m venv venv
    source venv/bin/activate 
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment variables

    cp .env.example .env

    Edit .env with your configuration (LLM model, API keys, etc.)

  5. Ensure Ollama is running

    ollama serve
    # In another terminal, pull a model:
    ollama pull mistral

Usage

Basic Usage

The primary interface is through the urban_intel_app graph, which processes property queries:

from src.agent.graph import urban_intel_app

# Define your query - can include multiple addresses
query = "I'm interested in properties in Manhattan: 350 5th Avenue, 200 Park Avenue. Also check out 1644 64th Street in Brooklyn."

# Run the investigation
result = urban_intel_app.invoke({
    "query": query,
    "target_addresses": [],
    "completed_reports": [],
    "final_analysis": ""
})

# Access the results
print(result["final_analysis"])
print(result["completed_reports"])

Query Format Examples

The system accepts flexible natural language queries:

# Single property
query = "What can you tell me about 1 East 42nd Street, Manhattan?"

# Multiple properties
query = "Compare these 3 buildings: 350 5th Ave, 200 Park Ave, and 1644 64 Street Brooklyn"

# With context
query = "I'm looking at commercial real estate in Brooklyn, particularly interested in 250 Water Street and 1 Metrotech Center. Any concerns I should know about?"

Accessing Results

The application returns a comprehensive report with:

result = urban_intel_app.invoke({"query": query, ...})

# Individual property reports
for report in result["completed_reports"]:
    print(f"Address: {report['address']}")
    print(f"Location: ({report['lat']}, {report['lon']})")
    print(f"Safety Summary: {report['safety_summary']}")
    print(f"Compliance Summary: {report['compliance_summary']}")

# Final synthesis
print(result["final_analysis"])

Project Structure

UrbanIntel/
├── README.md                 # This file
├── requirements.txt          # Python dependencies
├── .env                      # Environment configuration
├── notebooks/
│   ├── 01_test_parser.ipynb       # Test address parser
│   └── 02_test_graph_skeleton.ipynb # Test full graph
└── src/
    ├── main.py              # Application entry point
    ├── core/
    │   └── config.py        # Configuration management
    ├── api/                 # API layer (future)
    └── agent/
        ├── graph.py         # Master orchestration graph
        ├── state.py         # State definitions (Pydantic)
        ├── nodes/
        │   ├── parser.py    # Address extraction & parsing
        │   ├── workers.py   # Agent execution logic
        │   └── synthesizer.py # Report synthesis
        ├── subgraphs/
        │   └── investigation.py # Sub-graph definitions
        └── tools/
            ├── geocode.py   # Geocoding service
            ├── nypd.py      # NYPD data integration
            └── compliance.py # Compliance checker

Configuration

Environment Variables (.env)

# LLM Configuration
OLLAMA_BASE_URL=http://localhost:11434
LITE_LLM_MODEL=mistral

# API Keys (if using external services)
GEOCODING_API_KEY=your_key_here
NYPD_API_KEY=your_key_here

Configuration File (src/core/config.py)

The app uses a centralized Config class for all settings:

from src.core.config import Config

# Access configuration
print(Config.OLLAMA_BASE_URL)
print(Config.LITE_LLM_MODEL)

Development

Running Tests

# Run individual notebook tests
jupyter notebook notebooks/01_test_parser.ipynb
jupyter notebook notebooks/02_test_graph_skeleton.ipynb

Adding New Tools

  1. Create a new file in src/agent/tools/
  2. Implement your tool with proper typing
  3. Import and integrate into the relevant agent node

Extending the Graph

To add new processing steps:

  1. Create a new node function
  2. Add it to the graph builder in src/agent/graph.py
  3. Define edges for workflow orchestration

Data Output

PropertyReport Schema

{
    "address": str,              # Standardized NYC address
    "lat": float,                # Latitude coordinate
    "lon": float,                # Longitude coordinate
    "safety_summary": str,       # Safety metrics and crime data
    "compliance_summary": str    # Regulatory compliance status
}

Final Analysis

The synthesized output combines individual reports into narrative insights, including:

  • Property-specific findings
  • Comparative analysis across multiple properties
  • Risk assessments
  • Recommendations

Troubleshooting

Ollama Connection Error

Error: Connection refused to http://localhost:11434

Solution: Ensure Ollama is running: ollama serve

Address Parsing Issues

  • Ensure addresses follow NYC format conventions
  • Include borough names (Manhattan, Brooklyn, Queens, Bronx, Staten Island)
  • Use standard street abbreviations (St, Ave, Blvd)

Missing Dependencies

pip install -r requirements.txt --upgrade

Dependencies

  • langgraph: Graph-based workflow orchestration
  • langchain: LLM framework and tools
  • langchain-ollama: Local LLM integration
  • pydantic: Data validation and configuration
  • Additional tools for geocoding, compliance, and data integration

See requirements.txt for the complete dependency list with versions.

Contributing

Contributions are welcome! Please:

  1. Create a feature branch
  2. Add tests for new functionality
  3. Update documentation
  4. Submit a pull request

UrbanIntel - Making urban property intelligence accessible and automated.

About

An intelligent agentic AI application for comprehensive urban property investigation and analysis. UrbanIntel leverages LLM-powered agents and a graph-based workflow to extract, process, and synthesize information about NYC properties across multiple dimensions including geocoding, safety metrics, and regulatory compliance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors