Skip to content

DoNguyenAnhTuan/carbon_eiu2

Repository files navigation

# 🌿 carbon_eiu2

**Interactive dashboard để giám sát tiêu thụ năng lượng & phát thải carbon tại các tòa nhà, kèm dự báo thông minh sử dụng ML.**

## ⚙️ Tính năng nổi bật

- **Lấy dữ liệu daily/hourly** từ hệ thống QEnergy (API endpoint `/all`).
- **Tính tổng actual usage & carbon emission**, hiển thị theo block và toàn bộ.
- **Dự báo phát thải carbon** (3 ngày tương lai + 7 ngày gần nhất) sử dụng XGBoost.
- **Cập nhật tự động**: chạy Python scripts định kỳ để regen JSON.
- **Backend**: ExpressJS + WebSocket + cron trong Node để làm mới dữ liệu.
- **Frontend**: React + TailwindCSS + Recharts để hiển thị live dashboard & forecast.

## 🚀 Cài đặt & Chạy

### 1. Clone repo

```bash
git clone https://github.com/DoNguyenAnhTuan/carbon_eiu2.git
cd carbon_eiu2

2. Cài đặt dependencies

npm install

3. Cài đặt Python & Packages

pip install pandas requests xgboost scikit-learn

4. Chạy ứng dụng (development mode)

npm run dev

Quá trình này sẽ:

  1. Chạy Python scripts để lấy dữ liệu:

    • fetch_site_data.py
    • fetch_all_blocks_daily.py
    • bar_data.py
  2. Khởi động server tại http://localhost:3000

  3. Cung cấp API /api/actual, /api/dashboard, /assets/data/...

  4. Bật WebSocket để đẩy dữ liệu live lên UI


🗂 Kết quả đầu ra

File Mô tả
site_all_daily.json Dữ liệu lịch sử daily consumption
forecast_carbon.json Dự báo carbon (7 ngày gần nhất + 3 ngày tương lai)
bar_data.json Dữ liệu hiển thị biểu đồ theo giờ
actual_blocks.json Tổng actual / emission theo từng block

🛠 Trình độ & Công cụ

  • Phát triển bởi: Do Nguyen Anh Tuan (Thạc sĩ CNTT)

  • Server chạy Node.js + Express + WebSocket + Cron

  • Python cho data pipeline + ML (XGBoost)

  • Frontend: ReactJS + TailwindCSS + Recharts

  • Công cụ nổi bật:

    ![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)
    ![C++](https://img.shields.io/badge/C++-00599C?style=for-the-badge&logo=c%2B%2B&logoColor=white)
    ![PyTorch](https://img.shields.io/badge/PyTorch-EE4C2C?style=for-the-badge&logo=pytorch&logoColor=white)
    ![OpenCV](https://img.shields.io/badge/OpenCV-5C3EE8?style=for-the-badge&logo=opencv&logoColor=white)
    ![Pandas](https://img.shields.io/badge/Pandas-150458?style=for-the-badge&logo=pandas&logoColor=white)
    ![NumPy](https://img.shields.io/badge/NumPy-013243?style=for-the-badge&logo=numpy&logoColor=white)
    ![Scikit‑Learn](https://img.shields.io/badge/scikit--learn-F7931E?style=for-the-badge&logo=scikitlearn&logoColor=white)
    ![XGBoost](https://img.shields.io/badge/XGBoost-AA4466?style=for-the-badge)

🧭 Hướng phát triển (Roadmap)

  • Fine-tune XGBoost để cải thiện dự đoán
  • Phát triển API mới hỗ trợ lọc theo ngày/tháng/năm
  • Thêm màn hình dashboard chi tiết block, hỗ trợ lịch sử theo ngày
  • Deploy lên hosting công khai (Vercel / Heroku / VPS)
  • Viết tài liệu sử dụng và demo video

📝 License

MIT License © 2025 – Do Nguyen Anh Tuan


Releases

No releases published

Packages

 
 
 

Contributors