Skip to content

Smart India Hackathon-2023 Client Dashboard - Centralized Monitoring System for Street Light Fault Detection and Location Tracking (alpha)

Notifications You must be signed in to change notification settings

apachex692/sih-2023-client-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart India Hackathon-2023 Client Dashboard - Centralized Monitoring System for Street Light Fault Detection and Location Tracking (alpha)

A client dashboard built with Flask to manage street lights, linesman and create automations. This project is currently in its alpha build stage.

  • Author: Sakthi Santhosh
  • Created on: 26/10/2023

Pre-requisites

  • nginx
  • python3 and pip
  • virtualenv

Getting Started

  • Run the following in your shell to set-up a virtual environment in the project directory and install the required packages. Ensure virtualenv package is installed with apt or pip beforehand.
virtualenv -q ./venv/ && source ./venv/bin/activate
pip3 install -q -r ./requirements.txt
  • Invoke the Flask shell by running this command.
flask --app "app:create_app('development')" shell
  • Execute the following commands in the Flask shell interpreter to create a SQLite3 database file.
>>> from app import db_handle
>>>
>>> db_handle.create_all()
>>> exit()
  • Create a secrets file named ./.env with the following command and add your secrets to it.
cat ./env.example > ./.env
nano ./.env
  • Run the development server by running either of the following commands. Running the first command additionally exposes the app to the local network.
python3 ./run.py
flask --app "app:create_app('development')" run

Deployment

  • To run the app in a deployment environment, run the Flask app with Gunicorn and proxy it with Nginx with the following commands. If Nginx isn't installed in your system, you can install it with apt.
chmod +x ./shell/nginx_init.sh
sudo ./shell/nginx_init.sh deployment
sudo nginx -t
  • Alternatively, you can display a website-under-maintenance page by running the same command with different argument. This HTML page is available for modifications at ./nginx/maintenance/index.html.
sudo ./shell/nginx_init.sh maintenance
  • Now that Nginx is ready to proxy the Flask app, start the Flask app with Gunicorn with the following command.
gunicorn --workers 4 "app:create_app('development')"

Unimplemented Logic

  1. When a light is fixed (the light sends a 0 status code), there is no mechanism to update the responder's is_working state to False. This actually requires tracking of responder by storing them as a foriegn key to the Light database.
  2. The responder acknowledgement URL doesn't have any token mechanism to validate the legitimacy of it. This can be exploited.
  3. Email and SMS internationlization have not been performed yet.

About

Smart India Hackathon-2023 Client Dashboard - Centralized Monitoring System for Street Light Fault Detection and Location Tracking (alpha)

Topics

Resources

Stars

Watchers

Forks