Skip to content

FROWNINGdev/BazarMonitoring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

51 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿช BazarMonitoring - Bazaar Monitoring System for Uzbekistan

License: MIT Python Flask Docker Open Source

Modern web platform for monitoring and managing a network of bazaars across Uzbekistan with interactive maps, statistics, and analytics.

๐Ÿ“‹ Table of Contents

โœจ Features

๐ŸŽฏ Monitoring and Management

  • โœ… Real-time monitoring - track status of all bazaars online/offline
  • โœ… Interactive map - visualize bazaars on Uzbekistan map with regional boundaries
  • โœ… Detailed statistics - analytics on cameras, ROI (regions of interest), statuses
  • โœ… Automatic logging - complete history of status changes and events

๐Ÿ“Š Analytics and Reports

  • ๐Ÿ“ˆ General statistics - bazaars, cameras, availability
  • ๐Ÿ“Š Regional statistics - data breakdown by regions of Uzbekistan
  • ๐Ÿ“„ Excel export - detailed reports with data for each bazaar
  • ๐ŸŽฅ Camera information - count, status (online/offline), ROI

๐Ÿ› ๏ธ Administrative Functions

  • โž• Add bazaars - simple interface for adding new services
  • โœ๏ธ Edit - modify bazaar data (contacts, coordinates, ports)
  • ๐Ÿ—‘๏ธ Delete - manage bazaar list
  • ๐Ÿ“ž Contact information - store Click and SCC contacts

๐ŸŽจ User Interface

  • ๐ŸŒ™ Dark/light theme - toggle between themes
  • ๐ŸŒ Multi-language - support for Russian, Uzbek, and English
  • ๐Ÿ“ฑ Responsive design - works on all devices
  • โšก Fast performance - optimized performance

๐Ÿ› ๏ธ Technology Stack

Backend

  • Python 3.11 - main programming language
  • Flask - web framework
  • SQLAlchemy - ORM for database operations
  • Flask-Migrate - database migration management
  • Flask-RESTX - REST API with Swagger documentation
  • SQLite - database

Frontend

  • HTML5/CSS3 - markup and styling
  • JavaScript (ES6+) - interactivity
  • Leaflet.js - interactive maps
  • Chart.js - charts and diagrams
  • SheetJS (XLSX) - Excel export

DevOps

  • Docker - containerization
  • Docker Compose - container orchestration
  • Nginx - web server for frontend

๐Ÿš€ Quick Start

Prerequisites

Run with Docker (recommended)

# Clone the repository
git clone https://github.com/FROWNINGdev/bazarmonitoring.git
cd bazarmonitoring

# Run the application
docker-compose up --build

# Application will be available at:
# Frontend: http://localhost:80
# Backend API: http://localhost:5000
# API Docs: http://localhost:5000/docs/

Local Installation

# 1. Clone the repository
git clone https://github.com/FROWNINGdev/bazarmonitoring.git
cd bazarmonitoring

# 2. Install backend dependencies
cd backend
pip install -r requirements.txt

# 3. Initialize database
python reset_migrations.py

# 4. Run backend
python app.py

# 5. In another terminal, run frontend
cd frontend
python -m http.server 8080

๐Ÿ“– Installation

Step-by-step Installation

  1. Clone repository

    git clone https://github.com/FROWNINGdev/bazarmonitoring.git
    cd bazarmonitoring
  2. Configure environment variables (optional)

    # Create .env file in backend/
    SQLALCHEMY_DATABASE_URI=sqlite:///instance/bazar_monitoring.db
    FLASK_ENV=development
  3. Build and run Docker containers

    docker-compose up --build -d
  4. Verify installation

    # Check API
    curl http://localhost:5000/api/health
    
    # Check frontend
    curl http://localhost/

๐ŸŽฎ Usage

Web Interface

  1. Open browser and navigate to http://localhost:80
  2. Use filters to search for bazaars
  3. Click on a bazaar on the map to view detailed information
  4. Use menu to access:
    • General statistics
    • System logs
    • Administrative panel

API Usage

# Get list of all bazaars
curl http://localhost:5000/api/bazars

# Get statistics
curl http://localhost:5000/api/statistics

# Get logs
curl http://localhost:5000/api/logs?limit=50

# Add new bazaar
curl -X POST http://localhost:5000/api/services \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Bazaar Name",
    "city": "City",
    "ip": "192.168.1.100",
    "port": 80,
    "backend_port": 8200,
    "pg_port": 5400
  }'

๐Ÿ“š API Documentation

Full API documentation is available through Swagger UI:

  • URL: http://localhost:5000/docs/
  • Interactive API endpoint testing
  • Description of all parameters and responses

Main Endpoints

Method Endpoint Description
GET /api/bazars Get list of all bazaars
GET /api/status Get status from database
GET /api/statistics General statistics
GET /api/cameras/statistics Camera statistics
GET /api/logs Get logs
POST /api/services Add new service
PUT /api/services/<id> Update service
DELETE /api/services/<id> Delete service

๐Ÿ“ฆ GitHub Packages

The project automatically publishes packages to GitHub Packages:

  • ๐Ÿณ Docker Images - ready-to-use backend and frontend containers
  • ๐Ÿ“ฆ npm Package - frontend components for npm
  • ๐Ÿ Python Package - backend API for pip

Detailed usage instructions: PACKAGES.md

Quick Install via Docker

# Backend
docker pull ghcr.io/frowningdev/bazarmonitoring-backend:latest

# Frontend
docker pull ghcr.io/frowningdev/bazarmonitoring-frontend:latest

๐Ÿ“ Project Structure

bazarmonitoring/
โ”œโ”€โ”€ backend/                 # Backend application
โ”‚   โ”œโ”€โ”€ app.py              # Main Flask application file
โ”‚   โ”œโ”€โ”€ init_db.py          # Database initialization
โ”‚   โ”œโ”€โ”€ migrate.py           # Migration script
โ”‚   โ”œโ”€โ”€ reset_migrations.py # Migration reset
โ”‚   โ”œโ”€โ”€ docker-entrypoint.sh # Docker entrypoint
โ”‚   โ”œโ”€โ”€ requirements.txt    # Python dependencies
โ”‚   โ”œโ”€โ”€ Dockerfile          # Docker image for backend
โ”‚   โ””โ”€โ”€ instance/           # SQLite database
โ”‚
โ”œโ”€โ”€ frontend/                # Frontend application
โ”‚   โ”œโ”€โ”€ index.html          # Main page
โ”‚   โ”œโ”€โ”€ script.js           # JavaScript logic
โ”‚   โ”œโ”€โ”€ styles.css          # Styles
โ”‚   โ”œโ”€โ”€ nginx.conf          # Nginx configuration
โ”‚   โ”œโ”€โ”€ Dockerfile          # Docker image for frontend
โ”‚   โ””โ”€โ”€ Uzb/                # GeoJSON data for map
โ”‚
โ”œโ”€โ”€ docker-compose.yml      # Docker Compose configuration
โ”œโ”€โ”€ README.md               # This file
โ”œโ”€โ”€ LICENSE                 # MIT License
โ””โ”€โ”€ CONTRIBUTING.md         # Contributor guide

๐Ÿค Contributing

We welcome any contributions to the project! Please read CONTRIBUTING.md for details.

See also PAIR_EXTRAORDINAIRE.md for information about collaborative development.

How to Contribute

  1. Fork the repository
  2. Create a branch for your feature (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

Code Style

  • Python: follow PEP 8
  • JavaScript: use ESLint configuration
  • Commits: use clear messages in English

๐Ÿ‘ฅ Authors

  • FROWNINGdev - Lead Developer - GitHub
  • asadullokhn - Co-Developer - GitHub

See also the list of contributors who participated in this project.

๐Ÿ“ License

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

๐Ÿ™ Acknowledgments

  • Leaflet.js for excellent mapping library
  • Flask for simple and powerful framework
  • Open source community for inspiration and support

๐Ÿ“ž Contact

โญ Project Status

GitHub stars GitHub forks GitHub issues GitHub pull requests


โญ If this project was helpful, please give it a star on GitHub!

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors