Skip to content

Tracking water and electricity usage can help households and businesses manage their resources more effectively. This project aims to develop a water and electricity tracking app that monitors consumption, provides insights on usage patterns, and helps users optimize their resource consumption.

Notifications You must be signed in to change notification settings

ashesbloom/Water-and-Electricity-Tracking-application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GridSync

A web application for AI‑enhanced tracking of water (L) and electricity (kWh) usage. GridSync helps users log daily readings, visualize consumption patterns, and receive insights to optimize resource use.

Table of Contents

  1. Overview
  2. Core Features
  3. Technology Stack
  4. Project Structure
  5. Installation & Setup
  6. Operational Guide
  7. Future Enhancements
  8. Contribution Guidelines

Overview

GridSync unifies manual data entry with AI‑driven recommendations, promoting cost savings and sustainability through detailed consumption insights.

Core Features

  • Authentication: Secure registration, login, hashed passwords, session management.
  • Usage Input: Timestamped water and electricity readings via add_usage.php.
  • Dashboard: Interactive charts (Chart.js) showing hourly/daily usage (electTodayUse.php, waterTodayUse.php).
  • Profile Management: Username/password updates and avatar uploads (profile.php β†’ htdocs/asset/uploads/).
  • AI Assistant: Chat interface backed by Node.js for usage analysis (chatbot.php, ai_backend/).
  • Theming: Light/dark mode toggle stored in localStorage.
  • 3D Globe: Placeholder Three.js visualization in Statistics.php.
  • MVC‑Style Backend: Controllers in src/controllers/ for maintainable code.

Technology Stack

  • Backend (PHP): PHPΒ 8.x, PDO, MySQL/MariaDB, Composer (optional)
  • AI Backend: Node.jsΒ 16+, Express, dotenv, OpenAI (or equivalent)
  • Frontend: HTML5, TailwindΒ 3.x, VanillaΒ JS (ES6+), Chart.js, Three.js
  • Build Tools: npm, Tailwind CLI
  • Server: Apache/Nginx with URL rewriting

Project Structure

. β”œβ”€β”€ ai_backend/ # Node.js AI chatbot service
β”‚ β”œβ”€β”€ server.js
β”‚ β”œβ”€β”€ package.json
β”‚ └── .env.example # env template for API keys & PORT
β”œβ”€β”€ config/ # Global configuration
β”‚ β”œβ”€β”€ database.php # PDO connection setup
β”‚ └── schema.sql # users & usage_records tables
β”œβ”€β”€ htdocs/ # Public web root
β”‚ β”œβ”€β”€ index.php # Front controller
β”‚ β”œβ”€β”€ asset/ # Static assets
β”‚ β”‚ β”œβ”€β”€ logo.png
β”‚ β”‚ └── uploads/ # User‐uploaded avatars
β”‚ β”œβ”€β”€ views/ # PHP templates
β”‚ β”‚ β”œβ”€β”€ partials/ # headers, footers, etc.
β”‚ β”‚ └── *.php # page‑specific files
β”‚ β”œβ”€β”€ js/ # Frontend scripts
β”‚ β”œβ”€β”€ css/ # Compiled CSS (Tailwind output)
β”‚ └── .htaccess # URL rewrite rules
β”œβ”€β”€ src/ # Application source (MVC)
β”‚ β”œβ”€β”€ controllers/ # Request handlers
β”‚ β”œβ”€β”€ models/ # Data layer (optional)
β”‚ β”œβ”€β”€ input.css # Tailwind source
β”‚ └── output.css # Tailwind build artifact
β”œβ”€β”€ vendor/ # Composer dependencies
β”œβ”€β”€ composer.json # PHP package manifest
β”œβ”€β”€ package.json # Node.js/Tailwind manifest
└── README.md # Project documentation

Installation & Setup

Clone and PHP backend

git clone https://github.com/your-username/gridsync.git
cd gridsync
composer install                     # if needed
mysql -u user -p gridsync_db < config/schema.sql

AI backend

cd ai_backend
npm install
cp .env.example .env                # configure API_KEY and PORT
npm start

Tailwind CSS (optional)

npm install                         # in project root
npx tailwindcss -i ./src/input.css -o ./src/output.css --watch

Permissions

chmod -R 755 htdocs/asset/uploads/

Operational Guide

  • Register at /signup and Login at /signin.
  • Add Usage: Use the Add Usage form to log daily usage readings.
  • Dashboard: Visit /homepage or Statistics for graphical usage data.
  • Chatbot: Chat with the AI via /chatbot for smart energy insights.
  • Profile: Update your user info on /profile.
  • Theme: Toggle light/dark mode from the header.

Future Enhancements

  • Bind AI chatbot to actual usage data for tailored insights.
  • Implement backend logic for Contact and Feedback forms.
  • Fetch live news or updates from external APIs.
  • Replace placeholder globes with live energy or usage stats.
  • Build detailed usage breakdown and goal tracking pages.
  • Add password recovery via email or OTP.
  • Improve validation, error handling, and testing workflows.
  • Persist goal-setting data in the database for continuity.

Contribution Guidelines

We welcome contributions from the community!

  • Fork the repository.
  • Create a new feature branch.
  • Open a pull request describing your changes.
  • Report bugs or suggest features through the issue tracker.

Thanks for helping us improve!

About

Tracking water and electricity usage can help households and businesses manage their resources more effectively. This project aims to develop a water and electricity tracking app that monitors consumption, provides insights on usage patterns, and helps users optimize their resource consumption.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •