harrynull / crowdedness-monitor

Monitor the busyness of public locations through Wi-Fi packets!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crowdedness Monitor

SE 101 Project

For a demo, see https://cm.harrynull.tech.

Structure

.
├── backend
│   ├── app/:           source code of the app
│   ├── config/:        configurations
│   ├── migrations/
│   ├── requirements.txt:`pip install -r requirements.txt`
│   ├── var/            database for testing/developing purpose. you need to create one for yourself.
│   │   └── test.db
│   └── venv            `venv/Scripts/activate`
├── embedded/
│   ├── .env:           put your environment variables here
│   ├── bootstrap.sh:   this will be put in crontab to run after system boots
│   ├── log:            log generated by the program
│   ├── read_packet.py: module that reads packet generated by tshark
│   ├── report.py:      report data to the backend server
│   ├── run.sh:         this will be put in crontab to run every five minutes
│   ├── setup.sh:       this should be run once only
├── frontend/
└── README.md

Install

Embedded

sudo apt update && sudo apt install vim tshark # select allow non-superuser to use wireshark
sudo usermod -a -G wireshark pi

Add the following line to sudo visudo:

pi ALL= NOPASSWD: /home/pi/crowdedness-monitor/embedded/bootstrap.sh

Add the following line to crontab -e:

*/5 * * * * cd /home/pi/crowdedness-monitor/embedded/ && ./run.sh
@reboot sleep 30 && cd /home/pi/crowdedness-monitor/embedded/ && sudo ./bootstrap.sh

Lastly, edit embedded/.env.

  • bootstrap.sh will be run every time the system boots.
  • run.sh will be run every 5 minutes (a fixed interval).
  • .env stores relevant variables.
  • log stores logs.

Backend

apt update && apt install libmysqlclient-dev
cd backend
python3 -m venv venv
venv/Scripts/activate
pip3 install -r requirements.txt
touch var/test.db
flask db upgrade
flask run

Recommended IDE: PyCharm Professional

Frontend

Frontend

License

The MIT License.

About

Monitor the busyness of public locations through Wi-Fi packets!

License:MIT License


Languages

Language:Jupyter Notebook 88.4%Language:JavaScript 6.5%Language:Python 4.7%Language:Shell 0.2%Language:HTML 0.1%Language:Mako 0.1%Language:CSS 0.0%