Skip to content

sohailshk/SuitSenseAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏒 SuitSenseAI - AI-Powered Real Estate Intelligence Platform

SuitSenseAI Logo

Conversational AI for Real Estate Analytics & Market Intelligence

Python Google Gemini LangChain Flask PostgreSQL License

🌟 What is SuitSenseAI?

SuitSenseAI is a cutting-edge conversational AI platform that revolutionizes real estate analytics. Users can ask questions in plain English and receive sophisticated insights, interactive visualizations, and professional reports about condominium markets.

✨ Key Features

  • πŸ€– Conversational Analytics - Ask questions in natural language, get intelligent answers
  • πŸ“Š Dynamic Visualizations - Auto-generated charts, graphs, and interactive maps
  • πŸ“‹ AI-Generated Reports - Professional PDF reports created on-demand
  • πŸ—ΊοΈ Location Intelligence - Google Maps integration with proximity analysis
  • πŸ“ˆ Market Analysis - Holding periods, sales volumes, and trend predictions
  • πŸ”’ Secure Code Execution - Safe AI-generated Python code execution
  • πŸ’¬ Memory-Aware - Maintains conversation context for complex analysis

πŸ’‘ Usage Examples

Queries

"Which buildings has the highest sale in collins"
"can u put this into HTML Table"
"Can u please generate a graph of this for me to analyze"
"can u please add a third row with avergae median sale"
"can u also show me the closest school distance to each of this building"
"can u show me on map the nearby schools around this property"
"can u also add a new column with average holding period"
"provide me a pdf report of the whole table to download"

πŸ—οΈ Architecture & Technology Stack

🧠 AI & Machine Learning

  • Google Gemini 2.0 Flash Experimental - Latest multimodal LLM
  • LangGraph ReAct Agent - Advanced reasoning and acting framework
  • FAISS Vector Database - Semantic search capabilities
  • Google Embeddings - High-quality text embeddings

πŸ—„οΈ Data & Backend

  • PostgreSQL - Production-grade database with geographic data
  • LangChain SQL Toolkit - Intelligent database interactions
  • Flask Web Framework - Lightweight and scalable web server
  • Session Management - Conversation history and user tracking

🌐 APIs & Integrations

  • Google Maps JavaScript API - Interactive mapping
  • Google Places API - Location search and discovery
  • Google Directions API - Distance calculations
  • Google Geocoding API - Address to coordinate conversion

πŸ“Š Visualization & Reporting

  • Chart.js - Dynamic chart generation
  • ReportLab - PDF report creation
  • Google Maps Advanced Markers - Custom map visualizations
  • Markdown Processing - Rich text formatting

πŸš€ Quickstart Guide

1. πŸ”Ή Clone the Repository

git clone https://github.com/sohailshk/suitsense-ai.git
cd suitsense-ai

2. 🐍 Create Virtual Environment

python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate

3. πŸ—„οΈ Setup PostgreSQL Database

-- From PostgreSQL shell (psql)
CREATE DATABASE suitsense_ai;
CREATE USER readonly_user WITH PASSWORD 'your_secure_password';
GRANT CONNECT ON DATABASE suitsense_ai TO readonly_user;
GRANT USAGE ON SCHEMA public TO readonly_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly_user;

4. πŸ” Configure Environment Variables

Windows (PowerShell):

$env:GPLACES_API_KEY="your_google_places_api_key"
$env:GEMINI_API_KEY="your_gemini_api_key"
$env:FLASK_SECRET="your_flask_secret_key"
$env:PG_USER="readonly_user"
$env:PG_PASSWORD="your_secure_password"
$env:PG_PORT="5432"
$env:PG_DB="suitsense_ai"

macOS/Linux (Bash):

export GPLACES_API_KEY="your_google_places_api_key"
export GEMINI_API_KEY="your_gemini_api_key"
export FLASK_SECRET="your_flask_secret_key"
export PG_USER="readonly_user"
export PG_PASSWORD="your_secure_password"
export PG_PORT="5432"
export PG_DB="suitsense_ai"

5. πŸ“ƒ Load Sample Data

psql -d suitsense_ai < sample_db.sql

6. βš–οΈ Install Dependencies

pip install -r requirements.txt

7. πŸ§ͺ Test Your Setup

python test_gemini.py

You should see all green checkmarks βœ…

8. 🚦 Run the Application

python server.py

Visit http://localhost:5000 and start asking questions! πŸŽ‰


image image image image

πŸ”‘ API Keys Setup

Google APIs (Required)

  1. Google Cloud Console: https://console.cloud.google.com/
  2. Enable APIs:
    • Google Places API
    • Google Maps JavaScript API
    • Google Geocoding API
    • Google Directions API
  3. Create API Key and restrict it to your domains

Google Gemini AI (Required)

  1. Google AI Studio: https://aistudio.google.com/
  2. Get API Key for Gemini 2.0
  3. Set Usage Limits as needed

πŸ—οΈ Project Structure

SuitSenseAI/
β”œβ”€β”€ πŸ“„ main.py              # Core AI processing logic
β”œβ”€β”€ 🌐 server.py            # Flask web application
β”œβ”€β”€ πŸ› οΈ tools.py             # AI tools and integrations
β”œβ”€β”€ πŸ“ prefix.py            # AI system prompts and instructions
β”œβ”€β”€ πŸ”§ boilerplate.py       # Code templates and snippets
β”œβ”€β”€ πŸ§ͺ test_gemini.py       # Integration testing
β”œβ”€β”€ πŸ—„οΈ init_db.py           # Database initialization
β”œβ”€β”€ πŸ“Š sample_db.sql        # Sample real estate data
β”œβ”€β”€ πŸ“‹ requirements.txt     # Python dependencies
β”œβ”€β”€ πŸ“– GEMINI_MIGRATION.md  # Migration guide from OpenAI
β”œβ”€β”€ πŸ“ templates/           # HTML templates
β”‚   └── 🏠 index.html       # Main web interface
β”œβ”€β”€ πŸ“ static/              # Static assets
β”‚   β”œβ”€β”€ πŸ–ΌοΈ images/          # Logo and images
β”‚   └── πŸ“„ README.md        # Static files documentation
└── πŸ“ __pycache__/         # Python cache files

🧠 How It Works

1. Natural Language Processing

User questions are processed by Google Gemini 2.0 Flash Experimental, which understands real estate terminology and context.

2. Intelligent Tool Selection

The AI agent autonomously selects appropriate tools:

  • SQL queries for database analysis
  • Google Maps for location services
  • Vector search for semantic matching
  • Code generation for reports

3. Dynamic Content Generation

Based on the analysis, the system generates:

  • Interactive charts using Chart.js
  • Google Maps with custom markers
  • Professional PDF reports
  • Rich markdown responses

4. Security & Safety

All AI-generated code is scanned for malicious patterns before execution, ensuring a secure environment.


🎯 Advanced Features

πŸ” Semantic Search

Uses FAISS vector database with Google embeddings for intelligent property name and address matching.

πŸ“Š Complex Analytics

  • Holding Period Analysis: Calculate investment holding periods
  • Market Segmentation: Analyze by unit type, building, or location
  • Geographic Intelligence: Distance calculations and proximity analysis
  • Trend Prediction: Historical analysis and forecasting

πŸ—ΊοΈ Interactive Mapping

  • Advanced Google Maps Integration: Custom markers and clustering
  • School Proximity Analysis: Find nearby educational institutions
  • Distance Calculations: Multi-point route optimization
  • Boundary Visualization: Market area definitions

πŸ“‹ Report Generation

  • PDF Creation: Executive-level reports with charts and analysis
  • Custom Layouts: Professional formatting with ReportLab
  • Data Visualization: Embedded charts and maps in reports

πŸ”§ Configuration Options

Database Settings

# Modify in main.py for custom database connections
POSTGRES_USER = os.getenv("PG_USER")
POSTGRES_PASSWORD = os.getenv("PG_PASSWORD")
POSTGRES_PORT = os.getenv("PG_PORT")
POSTGRES_DB = os.getenv("PG_DB")

AI Model Configuration

# Modify in main.py for different Gemini models
llm = ChatGoogleGenerativeAI(
    model="gemini-2.0-flash-exp",  # or "gemini-pro", "gemini-2.0-flash"
    temperature=0.1,  # Adjust for creativity vs. consistency
)

Conversation Memory

# Modify in server.py for conversation history length
MAX_CONTEXT_LENGTH = 3  # Number of previous exchanges to remember

πŸ§ͺ Testing & Development

Run Tests

# Test database connection
python test_db.py

# Test Gemini integration
python test_gemini.py

# Test Google Places API
python sandbox.py

Development Mode

# Run with debug mode
export FLASK_ENV=development
python server.py

πŸš€ Deployment

Production Setup

  1. Use environment variables for all sensitive configuration
  2. Set up proper database user permissions
  3. Configure CORS for your domain
  4. Use HTTPS for secure communication
  5. Set up monitoring and logging

Docker Deployment (Optional)

# Example Dockerfile structure
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "server:app"]

🀝 Contributing

We welcome contributions! Please see our contributing guidelines:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add tests for new features
  • Update documentation
  • Ensure security best practices

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Google AI for Gemini 2.0 and embeddings
  • LangChain for the agent framework
  • Google Maps Platform for location services
  • PostgreSQL for robust data storage
  • Open Source Community for amazing tools and libraries

πŸ“ž Support & Contact


⭐ Star this repository if you find it helpful!

πŸ”„ Fork it to contribute or customize for your needs

πŸ“’ Share with others who might benefit from AI-powered real estate analytics


Made with ❀️ for the Real Estate & AI Community

About

An intelligent assistant for querying and analyzing real estate condo data in Miami.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published