Page 1 - Always-code/Analytical-dashboard GitHub Wiki

Overview

This document explains the python code required to build and run the analytical dashboard in python. To build and run the dashboard refer to the user guide provided with this demo.

This demo uses Visual Studio Code Integrated Development Environment (IDE). This demo contains 6 python files. Each python file is a python code that accomplishes a specific function, explained as follows:

  • sensorDataHandler.py creates a data table in PostgreSQL database.
  • publisher.py reads temperature, pressure, humidity, roll, pitch and yaw values from Raspberry Pi-4 controller.
  • subscriber.py collects temperature, pressure, humidity, roll, pitch and yaw values from Message Queuing Telemetry Transport (MQTT) broker and sends the values to data table in PostgreSQL database.
  • apiHandler.py defines Representational State Transfer Application Programming Interfaces (REST API).
  • dataRetriever.py retrieves data from data table in PostgreSQL database based on Uniform Resource Locators (URL).
  • dashboard.py constructs the dashboard.

The demo is implemented in 2 steps, explained as follows:

  1. Server side implementation
  • sensorDataHandler.py
  • publisher.py
  • subscriber.py
  • apiHandler.py
  1. Client side implementation
  • dataRetriever.py
  • dashboard.py

NOTE: .gitignore and requirements.txt are files required to deploy the demo on Heroku cloud. .gitignore contains folders and files that should be ignored while deploying the demo on Heroku cloud. Heroku application reads this file and ignores the content in it. requirements.txt contains all python libraries required to run the demo. Heroku application reads this file and installs the python libraries in it.