Skip to content

ChatGPT486/INFRA-TRACK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 InfraTrack Global

Real-time Infrastructure Monitoring & Community Reporting Platform

InfraTrack Global is a comprehensive web application that empowers communities in developing nations to report, track, and monitor infrastructure issues including power outages, water supply problems, and internet connectivity disruptions. Built with transparency and accountability at its core, the platform enables citizens to share real-time updates and hold service providers accountable.

InfraTrack Banner Status Version


πŸ“‹ Table of Contents


✨ Features

Core Functionality

  • πŸ“± Real-time Issue Reporting - Report power, water, and internet infrastructure problems
  • πŸ—ΊοΈ Interactive Map View - Visualize all reported issues on an interactive map using Leaflet.js
  • πŸ“° Live Reports Feed - Browse and filter community-submitted reports in real-time
  • βœ… Community Verification - Upvote/downvote reports to verify their accuracy
  • πŸ† Trust Score System - Advanced algorithm that calculates user credibility based on:
    • Account verification status
    • Rating average
    • Task completion rate
    • Dispute ratio
    • Timeliness
    • Community feedback
    • System behavior

User Features

  • πŸ‘€ User Authentication - Secure registration and login system with JWT tokens
  • πŸ“Š Personal Dashboard - Track your reports, verifications, and statistics
  • πŸ”” Real-time Notifications - Get instant updates about infrastructure issues
  • πŸ“· Image Upload - Attach photos to reports for better documentation
  • πŸ“ Geolocation - Auto-detect or manually enter location information

Admin Features

  • πŸ›‘οΈ Admin Dashboard - Comprehensive admin panel for platform management
  • πŸ‘₯ User Management - Verify, moderate, and manage user accounts
  • πŸ“ˆ Analytics & Statistics - View platform-wide metrics and trends
  • πŸ“₯ Data Export - Export reports to CSV for analysis
  • πŸ”¨ Report Moderation - Update status, verify, or delete reports

Additional Features

  • 🌐 Multi-language Support - English and French (expandable)
  • πŸ“± Responsive Design - Fully optimized for mobile, tablet, and desktop
  • πŸ”Œ Real-time Updates - Socket.IO integration for live updates
  • 🎨 Modern UI/UX - Beautiful gradient backgrounds with glassmorphism effects

πŸ› οΈ Technology Stack

Frontend

  • HTML5 - Semantic markup
  • CSS3 - Custom styling with modern features (glassmorphism, animations)
  • JavaScript (ES6+) - Client-side logic
  • Leaflet.js - Interactive maps
  • Socket.IO Client - Real-time communication
  • Font Awesome & Bootstrap Icons - Icon libraries

Backend

  • Node.js - Runtime environment
  • Express.js - Web application framework
  • PostgreSQL - Relational database
  • Socket.IO - WebSocket server
  • JWT - Authentication tokens
  • bcryptjs - Password hashing
  • Multer - File upload handling

Libraries & Tools

  • pg - PostgreSQL client
  • cors - Cross-origin resource sharing
  • dotenv - Environment variable management

πŸ“ Project Structure

InfraTrack-Global/
β”‚
β”œβ”€β”€ server.js                 # Main backend server
β”œβ”€β”€ package.json             # Node.js dependencies
β”œβ”€β”€ .env                     # Environment variables
β”‚
β”œβ”€β”€ uploads/                 # Uploaded images directory
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ homepage.html        # Main landing page
β”‚   β”œβ”€β”€ login.html          # Authentication page
β”‚   β”œβ”€β”€ report.html         # Submit new report
β”‚   β”œβ”€β”€ report_feeds.html   # Browse all reports
β”‚   β”œβ”€β”€ map.html            # Interactive map view
β”‚   β”œβ”€β”€ Account.html        # User profile & settings
β”‚   β”œβ”€β”€ Admin.html          # Admin dashboard
β”‚   β”œβ”€β”€ aboutUs.html        # About the platform
β”‚   β”œβ”€β”€ Account.css         # Account page styles
β”‚   └── image/              # Team photos
β”‚       β”œβ”€β”€ paul.jpeg
β”‚       β”œβ”€β”€ lea.jpeg
β”‚       β”œβ”€β”€ simon.jpeg
β”‚       β”œβ”€β”€ gety.jpeg
β”‚       └── richard.jpeg
β”‚
└── database/
    └── schema.sql          # PostgreSQL database schema

πŸš€ Installation

Prerequisites

  • Node.js (v14 or higher)
  • PostgreSQL (v12 or higher)
  • npm or yarn

Step 1: Clone the Repository

git clone https://github.com/yourusername/infratrack-global.git
cd infratrack-global

Step 2: Install Dependencies

npm install

Step 3: Set Up Database

  1. Create a PostgreSQL database named InfraTrack
  2. Run the database schema:
-- Create users table
CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    username VARCHAR(50) UNIQUE NOT NULL,
    full_name VARCHAR(100) NOT NULL,
    email VARCHAR(100) UNIQUE NOT NULL,
    password_hash VARCHAR(255) NOT NULL,
    phone_number VARCHAR(20),
    country VARCHAR(50),
    city VARCHAR(50),
    verified BOOLEAN DEFAULT FALSE,
    total_reports INTEGER DEFAULT 0,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Create reports table
CREATE TABLE reports (
    id SERIAL PRIMARY KEY,
    user_id INTEGER REFERENCES users(id),
    service_type VARCHAR(20) NOT NULL,
    title VARCHAR(100) NOT NULL,
    description TEXT,
    status VARCHAR(20) DEFAULT 'outage',
    severity VARCHAR(20) DEFAULT 'medium',
    country VARCHAR(50) NOT NULL,
    city VARCHAR(50) NOT NULL,
    location_address TEXT,
    location_latitude DECIMAL(10, 8),
    location_longitude DECIMAL(11, 8),
    image_path VARCHAR(255),
    upvotes INTEGER DEFAULT 0,
    downvotes INTEGER DEFAULT 0,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Create notifications table
CREATE TABLE notifications (
    id SERIAL PRIMARY KEY,
    user_id INTEGER REFERENCES users(id),
    title VARCHAR(100),
    message TEXT,
    is_read BOOLEAN DEFAULT FALSE,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Create verifications table (optional)
CREATE TABLE verifications (
    id SERIAL PRIMARY KEY,
    user_id INTEGER REFERENCES users(id),
    report_id INTEGER REFERENCES reports(id),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Step 4: Configure Environment Variables

Create a .env file in the root directory:

PORT=3000
JWT_SECRET=infratrack-secret-key-2025
DB_USER=postgres
DB_HOST=localhost
DB_NAME=InfraTrack
DB_PASSWORD=Group
DB_PORT=5432
NODE_ENV=development

βš™οΈ Configuration

Database Connection

Update database credentials in .env file:

DB_USER=your_postgres_username
DB_PASSWORD=your_postgres_password
DB_NAME=InfraTrack

Admin Access

Default admin code: INFRATRACK2025

To change the admin code, update it in:

  • server.js (if implementing server-side validation)
  • login.html (line with const ADMIN_CODE)

πŸƒ Running the Application

Start the Backend Server

node server.js

Server will run on http://localhost:3000

Access the Frontend

Open your browser and navigate to:

http://localhost:3000/homepage.html

Or use a local development server for the frontend files.

Test Accounts

Regular User:

  • Email: john@example.com
  • Password: password123

Admin User:

  • Email: admin@example.com
  • Password: password123
  • Admin Code: INFRATRACK2025

πŸ“‘ API Documentation

Base URL

http://localhost:3000/api

Authentication Endpoints

Register User

POST /api/auth/register
Content-Type: application/json

{
  "username": "string",
  "full_name": "string",
  "email": "string",
  "password": "string",
  "phone_number": "string",
  "country": "string",
  "city": "string"
}

Login

POST /api/auth/login
Content-Type: application/json

{
  "email": "string",
  "password": "string"
}

User Endpoints

Get All Users

GET /api/users

Get User by ID

GET /api/users/:id

Update User

PUT /api/users/:id
Content-Type: application/json

{
  "full_name": "string",
  "phone_number": "string",
  "country": "string",
  "city": "string",
  "verified": boolean
}

Delete User

DELETE /api/users/:id

Get User Statistics

GET /api/users/:id/stats

Report Endpoints

Get All Reports

GET /api/reports?service_type=power&status=outage&limit=50&offset=0

Create Report

POST /api/reports
Content-Type: multipart/form-data

{
  "user_id": integer,
  "service_type": "power|water|internet",
  "title": "string",
  "description": "string",
  "status": "outage|partial|restored",
  "severity": "low|medium|high|critical",
  "country": "string",
  "city": "string",
  "location_address": "string",
  "location_latitude": decimal,
  "location_longitude": decimal,
  "image": file
}

Get Report by ID

GET /api/reports/:id

Update Report (Upvote/Downvote/Status)

PUT /api/reports/:id
Content-Type: application/json

{
  "action": "upvote|downvote",
  "status": "outage|partial|restored"
}

Delete Report

DELETE /api/reports/:id

Notification Endpoints

Get User Notifications

GET /api/notifications/:userId

Mark Notification as Read

PUT /api/notifications/:id/read

Mark All Notifications as Read

PUT /api/notifications/:userId/read-all

πŸ—„οΈ Database Schema

Users Table

- id (SERIAL PRIMARY KEY)
- username (VARCHAR UNIQUE)
- full_name (VARCHAR)
- email (VARCHAR UNIQUE)
- password_hash (VARCHAR)
- phone_number (VARCHAR)
- country (VARCHAR)
- city (VARCHAR)
- verified (BOOLEAN)
- total_reports (INTEGER)
- created_at (TIMESTAMP)
- updated_at (TIMESTAMP)

Reports Table

- id (SERIAL PRIMARY KEY)
- user_id (INTEGER FOREIGN KEY)
- service_type (VARCHAR)
- title (VARCHAR)
- description (TEXT)
- status (VARCHAR)
- severity (VARCHAR)
- country (VARCHAR)
- city (VARCHAR)
- location_address (TEXT)
- location_latitude (DECIMAL)
- location_longitude (DECIMAL)
- image_path (VARCHAR)
- upvotes (INTEGER)
- downvotes (INTEGER)
- created_at (TIMESTAMP)
- updated_at (TIMESTAMP)

Notifications Table

- id (SERIAL PRIMARY KEY)
- user_id (INTEGER FOREIGN KEY)
- title (VARCHAR)
- message (TEXT)
- is_read (BOOLEAN)
- created_at (TIMESTAMP)

πŸ‘₯ User Roles

Regular Users

  • Submit infrastructure reports
  • Browse and filter reports
  • Upvote/downvote reports
  • View interactive map
  • Manage personal profile
  • Receive notifications

Admin Users

  • All regular user permissions
  • Access admin dashboard
  • Verify user accounts
  • Moderate reports (update status, delete)
  • View platform analytics
  • Export data to CSV
  • Manage all users
  • Send broadcast notifications

πŸ“Έ Screenshots

Homepage

Homepage

Interactive Map

Map View

Reports Feed

Reports Feed

Admin Dashboard

Admin Panel


πŸ‘¨β€πŸ’» Team

Development Team - Software Engineering Students

TABI PAUL AGWE
Scrum Master
Software Engineering Student

YUYAR LEA-BABARA
Product Owner
Software Engineering Student

SIMON AKUMA ASONGWE
Chief Technology Officer
Software Engineering Student

NDZEKA GETRUDE BERINYUY
Front End Developer
Software Engineering Student

TANDIE FOMEKONG RISCHARD
Chief Financial Officer
Software Engineering Student


🎯 Vision & Mission

Mission

InfraTrack Global was born from a simple observation: communities in developing nations deserve better infrastructure accountability. We're building a platform that gives power back to the people β€” a transparent, real-time system where every citizen can report infrastructure issues, verify others' reports, and hold service providers accountable.

Vision

We envision a world where infrastructure transparency is the norm, not the exception. By 2030, we aim to be operating in 50+ developing nations, with millions of active users creating a global network of infrastructure accountability.


πŸ“Š Trust Score Algorithm

The platform uses a comprehensive trust scoring system:

Formula: (10Γ—V) + (6Γ—R) + (20Γ—C) - (15Γ—D) + (10Γ—T) + (5Γ—FΓ—100) + (10Γ—B)

Components:

  • V - Verification (0-1): Account verification status
  • R - Rating (1-5): Average user rating
  • C - Completion (0-1): Task completion rate
  • D - Disputes (0-1): Dispute ratio (negative weight)
  • T - Timeliness (0-1): On-time report rate
  • F - Feedback (-1 to +1): Community feedback ratio
  • B - Behavior (0-1): System behavior score

Trust Levels:

  • 0-39: Low Trust ⭐
  • 40-69: Moderate Trust ⭐⭐⭐
  • 70-89: Trusted ⭐⭐⭐⭐
  • 90-100: Elite ⭐⭐⭐⭐⭐

πŸ”’ Security Features

  • JWT Authentication - Secure token-based authentication
  • Password Hashing - bcrypt with salt rounds
  • Input Validation - Server-side validation for all inputs
  • SQL Injection Protection - Parameterized queries
  • XSS Prevention - Input sanitization
  • CORS Configuration - Controlled cross-origin requests
  • File Upload Restrictions - Type and size validation

🚧 Known Issues & Future Enhancements

Known Issues

  • None currently reported

Planned Features

  • Email verification system
  • SMS notifications
  • Mobile applications (iOS/Android)
  • Advanced analytics dashboard
  • API rate limiting
  • Multi-language support expansion
  • Report comments/discussion threads
  • Service provider dashboard
  • Automated report resolution tracking

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

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


πŸ“ž Contact & Support

For support, questions, or feedback:


πŸ™ Acknowledgments

  • OpenStreetMap for mapping data
  • Leaflet.js for map visualization
  • Font Awesome & Bootstrap Icons
  • The open-source community

Built with ❀️ by Software Engineering Students

Empowering communities through infrastructure transparency

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors