3.8 KiB
3.8 KiB
🚀 Dubai DLD Analytics API - Setup Guide
Database Setup Required
Your MySQL database is not currently running. Here's how to set it up:
Option 1: Install MySQL (Recommended)
Ubuntu/Debian:
sudo apt update
sudo apt install mysql-server
sudo systemctl start mysql
sudo systemctl enable mysql
sudo mysql_secure_installation
CentOS/RHEL:
sudo yum install mysql-server
sudo systemctl start mysqld
sudo systemctl enable mysqld
sudo mysql_secure_installation
macOS (with Homebrew):
brew install mysql
brew services start mysql
mysql_secure_installation
Option 2: Use Docker (Quick Setup)
# Start MySQL with Docker
docker run --name dubai-mysql \
-e MYSQL_ROOT_PASSWORD=Admin@123 \
-e MYSQL_DATABASE=dubai_dld \
-p 3306:3306 \
-d mysql:8.0
# Wait for MySQL to start (30 seconds)
sleep 30
# Import the schema
docker exec -i dubai-mysql mysql -uroot -pAdmin@123 dubai_dld < 2.sql
Option 3: Use XAMPP/WAMP/MAMP
- Download and install XAMPP/WAMP/MAMP
- Start MySQL service
- Set root password to
Admin@123 - Create database
dubai_dld - Import
2.sqlfile
After MySQL is Running
1. Configure Database Connection
./configure_db.sh
2. Install Node.js Dependencies
npm install
3. Start the API Server
npm run dev
4. Test the API
./test_api.sh
Database Credentials
- Host: localhost
- Port: 3306
- Username: root
- Password: Admin@123
- Database: dubai_dld
Verification Steps
1. Test MySQL Connection
mysql -h localhost -u root -pAdmin@123 -e "SELECT 1;"
2. Check Database Exists
mysql -h localhost -u root -pAdmin@123 -e "SHOW DATABASES LIKE 'dubai_dld';"
3. Check Tables
mysql -h localhost -u root -pAdmin@123 dubai_dld -e "SHOW TABLES;"
Expected Tables
The database should contain these tables:
transactions(218,518 records)rents(4,041 records)projects(355 records)buildings(16,322 records)lands(186,796 records)valuations(3,560 records)brokers(37,332 records)developers(from schema)
Troubleshooting
MySQL Connection Issues
- Service not running: Start MySQL service
- Wrong password: Reset MySQL root password
- Port conflict: Check if port 3306 is available
- Firewall: Allow MySQL connections
Common Commands
# Start MySQL
sudo systemctl start mysql
# Stop MySQL
sudo systemctl stop mysql
# Restart MySQL
sudo systemctl restart mysql
# Check MySQL status
sudo systemctl status mysql
# Connect to MySQL
mysql -u root -p
# Reset root password
sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Admin@123';"
Once Database is Ready
Quick Test
# 1. Configure database
./configure_db.sh
# 2. Install dependencies
npm install
# 3. Start server
npm run dev
# 4. Test API (in another terminal)
curl http://localhost:3000/health
Full Test Suite
./test_api.sh
Features Ready to Test
✅ Context-Aware Queries
- Q1: "Give me the last 6 months rental price trend for Business Bay"
- Q2: "Summarise by week" (refinement)
- Q3: "Apartments only" (filter)
✅ All 10 Specific Queries
- Project summaries
- Fast moving projects
- Off-plan uptick areas
- Commercial/Residential leasing
- BHK apartment prices
✅ Chart.js Integration
- Line charts for trends
- Bar charts for comparisons
- Pie charts for distributions
- Summary cards
Next Steps
- Set up MySQL using one of the options above
- Run the configuration script:
./configure_db.sh - Start the API:
npm run dev - Test everything:
./test_api.sh - Open the dashboard:
public/index.html
Status: ⏳ Waiting for MySQL setup API: ✅ Ready to run Database: ⏳ Needs MySQL installation/startup