help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
real-estate-bot
RSK World
real-estate-bot
Real Estate Bot - Python + Flask + OpenAI + SQLite + Property Search + AI Chatbot + Viewing Scheduler
real-estate-bot
  • __pycache__
  • data
  • src
  • static
  • templates
  • tests
  • .env608 B
  • .env.example608 B
  • .gitignore2.5 KB
  • AR_VR_FEATURES.md4.2 KB
  • CREATE_RELEASE.md2.1 KB
  • FEATURES.md6.1 KB
  • INSTALL.md2 KB
  • LICENSE1.3 KB
  • README.md7.8 KB
  • RELEASE_NOTES_v1.0.0.md7.3 KB
  • SETUP_GUIDE.md10.4 KB
  • STATUS_REPORT.md11.8 KB
  • requirements-optional.txt984 B
  • requirements.txt284 B
  • run.py2.7 KB
start-frontend.batREADME.mdmanagement.pystock_info.jsonneighborhood_analyzer.pyINSTALL.md
README.md
Raw Download

README.md

# Real Estate Bot

**AI-Powered Real Estate Assistant**

Author: RSK World (https://rskworld.in)
Founded by: Molla Samser
Designer & Tester: Rima Khatun
Contact: info@rskworld.com, +91 93305 39277
Year: 2026

## ๐Ÿ  Description

Real Estate Bot is an intelligent chatbot application designed to help users search for properties, schedule viewings, and get comprehensive information about real estate listings. Built with Python, Flask, and OpenAI API, this bot provides a conversational interface for property discovery and management.

## โœจ Features

- **๐Ÿ” Property Search**: Find properties based on location, price range, property type, bedrooms, and other criteria
- **๐Ÿ“… Viewing Scheduling**: Schedule property viewings with preferred dates and times
- **๐Ÿ’ฌ Property Inquiries**: Get detailed information about specific properties
- **๐Ÿ“ Location Information**: Learn about neighborhoods and areas
- **๐Ÿค– AI-Powered Chat**: Natural language processing with OpenAI GPT
- **๐Ÿ’พ Database Management**: SQLite database for properties, appointments, and user data
- **๐ŸŒ Web Interface**: Modern, responsive web UI with real-time chat
- **๐Ÿ“ฑ Mobile Friendly**: Fully responsive design for all devices

## ๐Ÿ› ๏ธ Technologies Used

- **Backend**: Python 3.8+, Flask
- **AI/ML**: OpenAI GPT API
- **Database**: SQLite
- **Frontend**: HTML5, CSS3, JavaScript (ES6+)
- **UI Framework**: Bootstrap 5
- **Icons**: Font Awesome
- **HTTP Client**: Requests
- **Environment Management**: python-dotenv

## ๐Ÿ“‹ Requirements

- Python 3.8 or higher
- pip package manager
- OpenAI API key
- Modern web browser

## ๐Ÿš€ Installation

1. **Clone the repository**
```bash
git clone <repository-url>
cd real-estate-bot
```

2. **Create virtual environment**
```bash
python -m venv venv

# Windows
venv\Scripts\activate

# macOS/Linux
source venv/bin/activate
```

3. **Install dependencies**
```bash
pip install -r requirements.txt
```

4. **Set up environment variables**
```bash
cp .env.example .env
```

Edit `.env` file and add your API keys:
```env
OPENAI_API_KEY=your_openai_api_key_here
SECRET_KEY=your_secret_key_here
```

5. **Initialize the database**
The database will be automatically created when you run the application for the first time.

## ๐Ÿƒโ€โ™‚๏ธ Running the Application

1. **Start the Flask application**
```bash
python src/app.py
```

2. **Open your web browser**
Navigate to `http://localhost:5000`

3. **Start chatting!**
The bot will be ready to help you find properties and answer your real estate questions.

## ๐Ÿ“ Project Structure

```
real-estate-bot/
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ app.py # Main Flask application
โ”‚ โ”œโ”€โ”€ chatbot.py # Chatbot logic and AI integration
โ”‚ โ”œโ”€โ”€ database.py # Database management
โ”‚ โ””โ”€โ”€ property_search.py # Property search engine
โ”œโ”€โ”€ templates/
โ”‚ โ””โ”€โ”€ index.html # Main web interface
โ”œโ”€โ”€ static/
โ”‚ โ”œโ”€โ”€ css/
โ”‚ โ”‚ โ””โ”€โ”€ style.css # Custom styles
โ”‚ โ””โ”€โ”€ js/
โ”‚ โ””โ”€โ”€ chat.js # Frontend JavaScript
โ”œโ”€โ”€ data/
โ”‚ โ””โ”€โ”€ real_estate_bot.db # SQLite database
โ”œโ”€โ”€ tests/
โ”‚ โ””โ”€โ”€ test_*.py # Unit tests
โ”œโ”€โ”€ requirements.txt # Python dependencies
โ”œโ”€โ”€ .env # Environment variables
โ””โ”€โ”€ README.md # This file
```

## ๐Ÿ’ฌ Usage Examples

### Property Search
- "Show me apartments in Mumbai under 50 lakhs"
- "Find 3-bedroom houses in Delhi"
- "I'm looking for a 2BHK flat in Bangalore with parking"

### Schedule Viewings
- "Schedule a viewing for property 123"
- "I want to visit the apartment in Pune tomorrow"
- "Book an appointment for the house in Chennai"

### Property Information
- "Tell me about property 456"
- "What's the price of the 3BHK in Mumbai?"
- "What amenities are available in the Bangalore property?"

### Location Queries
- "Tell me about the neighborhood in Delhi"
- "What schools are near the property in Pune?"
- "How is the connectivity in Mumbai?"

## ๐Ÿ”ง Configuration

### Environment Variables

- `OPENAI_API_KEY`: Your OpenAI API key (required)
- `SECRET_KEY`: Flask secret key for sessions
- `DATABASE_URL`: Database connection URL (default: SQLite)
- `REAL_ESTATE_API_KEY`: External real estate API key (optional)
- `REAL_ESTATE_API_URL`: External real estate API URL (optional)

### Database Schema

The application uses SQLite with the following tables:

- **properties**: Property listings and details
- **users**: User information and preferences
- **appointments**: Scheduled property viewings
- **inquiries**: Property-related inquiries
- **chat_history**: Conversation logs

## ๐Ÿงช Testing

Run the test suite:
```bash
python -m pytest tests/
```

Or run individual tests:
```bash
python -m pytest tests/test_chatbot.py
python -m pytest tests/test_database.py
python -m pytest tests/test_property_search.py
```

## ๐Ÿ”Œ API Endpoints

### Chat API
- `POST /api/chat` - Send message to chatbot
- `GET /api/chat/history` - Get conversation history

### Property API
- `POST /api/properties/search` - Search properties
- `GET /api/properties/<id>` - Get property details
- `GET /api/properties/<id>/similar` - Get similar properties

### Appointment API
- `POST /api/appointments/schedule` - Schedule viewing
- `GET /api/appointments/<user_id>` - Get user appointments

### Inquiry API
- `POST /api/inquiries/submit` - Submit property inquiry

## ๐ŸŽจ Customization

### Adding New Property Types
Edit the `property_types` dictionary in `src/chatbot.py` to add new property types and keywords.

### Modifying Search Criteria
Update the search logic in `src/property_search.py` to add new search filters and criteria.

### Customizing UI
Modify the HTML templates and CSS files in the `templates/` and `static/css/` directories.

## ๐Ÿš€ Deployment

### Production Deployment with Gunicorn
```bash
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 src.app:app
```

### Docker Deployment
```dockerfile
FROM python:3.9-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .
EXPOSE 5000

CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "src.app:app"]
```

### Environment Variables for Production
- Set `FLASK_ENV=production`
- Use a strong `SECRET_KEY`
- Configure proper database connections
- Set up proper logging

## ๐Ÿ”’ Security Considerations

- Keep your OpenAI API key secure and never commit it to version control
- Use environment variables for sensitive configuration
- Implement rate limiting for API endpoints
- Validate and sanitize all user inputs
- Use HTTPS in production
- Regularly update dependencies

## ๐Ÿค Contributing

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

## ๐Ÿ“ License

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

## ๐Ÿ“ž Support

For support and inquiries:

- **Email**: info@rskworld.com
- **Phone**: +91 93305 39277
- **Website**: https://rskworld.in
- **Support**: support@rskworld.com

## ๐Ÿ™ Acknowledgments

- OpenAI for the powerful GPT API
- Flask team for the excellent web framework
- Bootstrap for the responsive UI components
- Font Awesome for the beautiful icons

---

**ยฉ 2026 RSK World. All rights reserved.**

*Developed by Molla Samser*
*Designed & Tested by Rima Khatun*

*Content used for educational purposes only. View [Disclaimer](https://rskworld.in/disclaimer.php)*
src/neighborhood_analyzer.py
Raw Download
Find: Go to:
"""
Neighborhood Insights and Crime Rate Analysis
Author: RSK World (https://rskworld.in)
Founded by: Molla Samser
Designer & Tester: Rima Khatun
Contact: info@rskworld.com, +91 93305 39277
Year: 2026
"""

import os
import requests
import json
from typing import Dict, Any, List
from datetime import datetime
import numpy as np

class NeighborhoodAnalyzer:
    def __init__(self):
        self.api_keys = {
            'google_places': os.getenv('GOOGLE_PLACES_API_KEY'),
            'crime_api': os.getenv('CRIME_API_KEY')
        }
    
    def analyze_neighborhood(self, location: str) -> Dict[str, Any]:
        """Comprehensive neighborhood analysis"""
        return {
            'safety_score': self._get_safety_score(location),
            'amenities': self._get_nearby_amenities(location),
            'schools': self._get_school_ratings(location),
            'transport': self._get_transport_info(location),
            'demographics': self._get_demographics(location)
        }
    
    def _get_safety_score(self, location: str) -> float:
        """Get safety score for location (0-10 scale)"""
        # This would typically use crime data APIs
        # For now, return a mock score based on location
        location_lower = location.lower()
        
        # Higher safety scores for major metropolitan areas
        if any(city in location_lower for city in ['mumbai', 'bangalore', 'pune', 'hyderabad']):
            return 7.5
        elif any(city in location_lower for city in ['delhi', 'chennai', 'kolkata']):
            return 7.0
        else:
            return 6.5  # Default score
    
    def _get_nearby_amenities(self, location: str) -> List[Dict[str, Any]]:
        """Get nearby amenities for location"""
        # This would typically use Google Places API
        # For now, return mock data
        amenities = [
            {'type': 'hospital', 'name': 'Nearby Hospital', 'distance': '2 km', 'rating': 4.5},
            {'type': 'school', 'name': 'Local School', 'distance': '1 km', 'rating': 4.2},
            {'type': 'shopping', 'name': 'Shopping Mall', 'distance': '3 km', 'rating': 4.3},
            {'type': 'restaurant', 'name': 'Restaurant Hub', 'distance': '1.5 km', 'rating': 4.4},
            {'type': 'park', 'name': 'Community Park', 'distance': '0.5 km', 'rating': 4.6}
        ]
        return amenities
    
    def _get_school_ratings(self, location: str) -> Dict[str, Any]:
        """Get school ratings for location"""
        # Mock data - would use education APIs in production
        return {
            'primary_schools': [
                {'name': 'Local Primary School', 'rating': 4.3, 'distance': '1 km'},
                {'name': 'Community Primary', 'rating': 4.1, 'distance': '1.5 km'}
            ],
            'secondary_schools': [
                {'name': 'Local Secondary School', 'rating': 4.5, 'distance': '2 km'},
                {'name': 'High School', 'rating': 4.4, 'distance': '2.5 km'}
            ],
            'colleges': [
                {'name': 'Nearby College', 'rating': 4.2, 'distance': '5 km'}
            ],
            'average_rating': 4.3
        }
    
    def _get_transport_info(self, location: str) -> Dict[str, Any]:
        """Get transportation information for location"""
        # Mock data - would use transit APIs in production
        location_lower = location.lower()
        
        has_metro = any(city in location_lower for city in ['delhi', 'bangalore', 'mumbai', 'chennai', 'kolkata', 'hyderabad'])
        
        return {
            'metro_available': has_metro,
            'metro_stations': [
                {'name': 'Nearest Metro Station', 'distance': '2 km', 'line': 'Blue Line'}
            ] if has_metro else [],
            'bus_stops': [
                {'name': 'Bus Stop 1', 'distance': '0.3 km'},
                {'name': 'Bus Stop 2', 'distance': '0.5 km'}
            ],
            'railway_station': {
                'name': 'Nearest Railway Station',
                'distance': '5 km',
                'available': True
            },
            'airport_distance': '25 km',
            'connectivity_score': 8.5 if has_metro else 7.0
        }
    
    def _get_demographics(self, location: str) -> Dict[str, Any]:
        """Get demographic information for location"""
        # Mock demographic data - would use census/statistics APIs in production
        return {
            'population_density': 'Medium',
            'average_age': 32,
            'family_composition': {
                'families_with_children': 65,
                'young_professionals': 25,
                'senior_citizens': 10
            },
            'income_level': 'Upper Middle Class',
            'languages_spoken': ['Hindi', 'English', 'Local Language'],
            'religious_diversity': 'High',
            'education_level': 'Above Average'
        }
    
    def get_location_rating(self, location: str) -> Dict[str, Any]:
        """Get overall location rating with factors"""
        analysis = self.analyze_neighborhood(location)
        
        # Calculate overall rating
        safety_score = analysis['safety_score']
        connectivity_score = analysis['transport'].get('connectivity_score', 7.0)
        amenities_count = len(analysis['amenities'])
        schools_rating = analysis['schools'].get('average_rating', 4.0)
        
        overall_rating = (
            (safety_score / 10) * 0.3 +
            (connectivity_score / 10) * 0.25 +
            (min(amenities_count, 10) / 10) * 0.25 +
            (schools_rating / 5) * 0.2
        ) * 10
        
        return {
            'location': location,
            'overall_rating': round(overall_rating, 2),
            'safety_rating': round(safety_score, 2),
            'connectivity_rating': round(connectivity_score, 1),
            'amenities_rating': round((amenities_count / 10) * 10, 1),
            'schools_rating': round((schools_rating / 5) * 10, 1),
            'factors': analysis,
            'recommendation': 'Excellent' if overall_rating >= 8 else 'Good' if overall_rating >= 7 else 'Average'
        }
147 linesโ€ข6.1 KB
python
INSTALL.md
Raw Download

INSTALL.md

# Installation Guide

## Quick Setup

### 1. Prerequisites
- Python 3.8 or higher
- pip package manager
- OpenAI API key

### 2. Installation Steps

```bash
# Clone or navigate to the project directory
cd real-estate-bot

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Copy environment file
copy .env.example .env

# Edit .env file and add your OpenAI API key
# OPENAI_API_KEY=your_actual_openai_api_key_here

# Run the application
python run.py
```

### 3. Access the Application
Open your web browser and navigate to:
- http://localhost:5000

### 4. Troubleshooting

#### Common Issues:

1. **ModuleNotFoundError: No module named 'src'**
- Make sure you're in the correct directory
- Try running: `python run.py` from the project root

2. **OpenAI API Key Error**
- Ensure your OpenAI API key is correctly set in .env file
- Check that the API key has sufficient credits

3. **Database Error**
- The database will be created automatically on first run
- Ensure the `data/` directory exists and is writable

4. **Port Already in Use**
- Change port in .env file: `FLASK_PORT=5001`
- Or kill the process using port 5000

#### Dependencies Check:
```bash
# Verify all packages are installed
pip list

# Reinstall if needed
pip install -r requirements.txt --force-reinstall
```

### 5. Development Mode
For development with auto-reload:
```bash
# Set environment variable
set FLASK_DEBUG=True

# Or edit .env file
FLASK_DEBUG=True
```

### 6. Production Deployment
For production deployment:
```bash
# Install production server
pip install gunicorn

# Run with gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 src.app:app
```

---

**Need Help?**
- Email: info@rskworld.com
- Phone: +91 93305 39277
- Website: https://rskworld.in
๐Ÿš€ Support RSK World

Subscribe to our YouTube channel for latest tutorials & updates!



Click subscribe & support our work โค๏ธ

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer