DLD_Analytics DLD_transaction DLD_rents
Go to file
2025-11-05 10:39:06 +05:30
.cursor/rules v0.0.1 2025-10-30 12:13:02 +05:30
image/IMPLEMENTATION_SUMMARY v0.0.1 2025-10-30 12:13:02 +05:30
node_modules webhook hit commit 2025-11-04 13:17:18 +05:30
public property end point craeted 2025-11-05 10:39:06 +05:30
src property end point craeted 2025-11-05 10:39:06 +05:30
tests v0.0.1 2025-10-30 12:13:02 +05:30
.env v0.0.1 2025-10-30 12:13:02 +05:30
.gitignore gitignore created 2025-11-04 15:06:55 +05:30
2.sql v0.0.1 2025-10-30 12:13:02 +05:30
brokers_cleaned.json v0.0.1 2025-10-30 12:13:02 +05:30
buildings_cleaned.json v0.0.1 2025-10-30 12:13:02 +05:30
configure_db.sh webhook hit commit 2025-11-04 13:17:18 +05:30
CONTEXT_AWARE_QUERIES.md v0.0.1 2025-10-30 12:13:02 +05:30
docker-compose.yml v0.0.1 2025-10-30 12:13:02 +05:30
Dubai_DLD_Analytics_API_Complete.postman_collection.json v0.0.1 2025-10-30 12:13:02 +05:30
Dubai_DLD_Properties_API_Complete.postman_collection.json property end point craeted 2025-11-05 10:39:06 +05:30
FINAL_SUMMARY.md v0.0.1 2025-10-30 12:13:02 +05:30
IMPLEMENTATION_COMPLETE.md v0.0.1 2025-10-30 12:13:02 +05:30
IMPLEMENTATION_SUMMARY.md v0.0.1 2025-10-30 12:13:02 +05:30
lands_cleaned.json v0.0.1 2025-10-30 12:13:02 +05:30
load_sample_data.js v0.0.1 2025-10-30 12:13:02 +05:30
nodejs_chartjs_prompt.md v0.0.1 2025-10-30 12:13:02 +05:30
package-lock.json v0.0.1 2025-10-30 12:13:02 +05:30
package.json v0.0.1 2025-10-30 12:13:02 +05:30
POSTMAN_COLLECTION_GUIDE.md v0.0.1 2025-10-30 12:13:02 +05:30
project_en.csv v0.0.1 2025-10-30 12:13:02 +05:30
projects_cleaned.json v0.0.1 2025-10-30 12:13:02 +05:30
QUERY_CAPABILITIES_VERIFICATION.md v0.0.1 2025-10-30 12:13:02 +05:30
QUICK_START.md v0.0.1 2025-10-30 12:13:02 +05:30
README.md v0.0.1 2025-10-30 12:13:02 +05:30
rents_cleaned.json v0.0.1 2025-10-30 12:13:02 +05:30
Rents_Only_Paginated.postman_collection.json summary added in response 2025-11-04 14:53:34 +05:30
Rents_Only.postman_collection.json summary added in response 2025-11-04 14:53:34 +05:30
setup_docker.sh webhook hit commit 2025-11-04 13:17:18 +05:30
SETUP_GUIDE.md v0.0.1 2025-10-30 12:13:02 +05:30
setup.sh webhook hit commit 2025-11-04 13:17:18 +05:30
test_api.sh webhook hit commit 2025-11-04 13:17:18 +05:30
transactions_cleaned.json v0.0.1 2025-10-30 12:13:02 +05:30
Transactions_Only_Paginated.postman_collection.json Ui updated 2025-10-30 12:27:26 +05:30
Transactions_Only.postman_collection.json v0.0.1 2025-10-30 12:13:02 +05:30
valuations_cleaned.json v0.0.1 2025-10-30 12:13:02 +05:30

Dubai Land Department Analytics API

A comprehensive Node.js API that processes natural language queries about Dubai real estate data and returns structured responses optimized for Chart.js visualization.

Features

  • Natural Language Processing: Parse complex queries using NLP libraries
  • Chart.js Integration: Generate data formatted for frontend visualization
  • Multiple Query Types: Support for trends, comparisons, summaries, and analytics
  • Dubai-Specific: Tailored for Dubai real estate terminology and areas
  • RESTful API: Clean, well-documented endpoints

Quick Start

Prerequisites

  • Node.js 16+
  • MySQL 8.0+
  • Dubai Land Department database schema

Installation

  1. Clone and install dependencies:
npm install
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your database credentials
  1. Set up the database:
# Import the provided SQL schema
mysql -u root -p < 2.sql
  1. Start the server:
# Development
npm run dev

# Production
npm start

API Endpoints

Main Query Endpoint

POST /api/query
Content-Type: application/json

{
  "query": "Give me the last 6 months rental price trend for Business Bay"
}

Predefined Queries

  • GET /api/queries/rental-trend/:area - Rental trends for specific area
  • GET /api/queries/top-areas - Top areas with most transactions
  • GET /api/queries/project-summary - Project summaries
  • GET /api/queries/commercial-leasing - Commercial leasing analysis
  • GET /api/queries/residential-leasing - Residential leasing analysis

Utility Endpoints

  • GET /health - Health check
  • GET /api/database/info - Database statistics
  • GET /api/queries/available - Available query types

Supported Query Types

Rental Analysis

  • "Give me the last 6 months rental price trend for Business Bay"
  • "Summarise by week" (refinement)
  • "Apartments only" (further refinement)

Project Analysis

  • "Brief about the Project"
  • "List of fast moving projects in last 6 months"
  • "Which area is seeing uptick in off-plan projects in last 6 months"

Area Performance

  • "Which area is having more rental transactions?"
  • "Top 5 areas for Commercial leasing and why?"
  • "Top 5 areas for Residential leasing and why?"
  • "Avg price of 3BHK apartment by area in last 6 months"

Response Format

{
  "success": true,
  "data": {
    "text": "Rental price trend for Business Bay over the last 6 months",
    "visualizations": [
      {
        "type": "line",
        "title": "Monthly Rental Price Trend",
        "data": {
          "labels": ["2024-01", "2024-02", "2024-03"],
          "datasets": [{
            "label": "Average Rental Price (AED)",
            "data": [85000, 87000, 89000],
            "borderColor": "rgb(75, 192, 192)",
            "backgroundColor": "rgba(75, 192, 192, 0.2)"
          }]
        }
      }
    ],
    "cards": [
      {
        "title": "Average Price",
        "value": "92,500 AED",
        "subtitle": "Last 6 months",
        "trend": "+15.3%"
      }
    ],
    "sql_queries": ["SELECT ..."],
    "metadata": {
      "query": "original query",
      "intent": "trend",
      "result_count": 6
    }
  }
}

Chart.js Integration

The API returns data in Chart.js compatible format:

  • Line Charts: For time series trends
  • Bar Charts: For area comparisons
  • Pie Charts: For distribution analysis
  • Cards: For summary statistics

Database Schema

The API works with these main tables:

  • transactions - Real estate transactions
  • rents - Rental contracts (Ejari)
  • projects - Development projects
  • buildings - Building registry
  • lands - Land registry
  • valuations - Property valuations
  • brokers - Real estate brokers

Development

Project Structure

src/
├── controllers/     # Request handlers
├── services/        # Business logic
│   ├── nlpService.js      # NLP processing
│   ├── sqlGenerator.js    # SQL generation
│   └── chartFormatter.js  # Chart.js formatting
├── models/          # Database models
├── middleware/      # Express middleware
├── routes/          # API routes
└── utils/           # Utility functions

Testing

# Test predefined queries
curl http://localhost:3000/api/queries/top-areas

# Test custom query
curl -X POST http://localhost:3000/api/query \
  -H "Content-Type: application/json" \
  -d '{"query": "Give me the last 6 months rental price trend for Business Bay"}'

Environment Variables

# Server Configuration
PORT=3000
NODE_ENV=development

# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_NAME=dubai_dld
DB_USER=root
DB_PASSWORD=your_password

# API Configuration
RATE_LIMIT=100

License

MIT License - see LICENSE file for details.