Skip to content

This project provides an interactive dashboard for visualizing, comparing, and analyzing hive sensor data (BroodMinder sensors and DIY sensors) using MongoDB and Streamlit.

Notifications You must be signed in to change notification settings

SamRao01/Apiary-Data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hive Sensor Data Dashboard

This project provides an interactive dashboard for visualizing, comparing, and analyzing hive sensor data (BroodMinder sensors and DIY sensors) using MongoDB and Streamlit.


Technology Stack

We have used a combination of the following technologies:

  1. MongoDB – a document database used for storing sensor data in both regular and time series collections, enabling efficient storage and flexible querying of large volumes of time-stamped hive sensor data.
  2. Streamlit – a Python-based open-source app framework for rapidly building interactive web dashboards and data visualization tools. It allows us to create user-friendly, real-time data exploration and reporting interfaces without complex frontend code.
  3. Pandas – a powerful Python data analysis library used for data cleaning, transformation, and aggregation, making it easy to manipulate sensor datasets and prepare them for visualization.
  4. Plotly – a graphing library for Python that enables the creation of interactive, publication-quality charts and graphs within the Streamlit dashboard.
  5. PyMongo – a Python driver for MongoDB, used to connect the Streamlit app to the MongoDB database, perform queries, and retrieve or insert sensor data programmatically.

Setup Instructions

1. Install Python

Make sure Python 3.8+ is installed.
Check in terminal/cmd: python --version
or
python3 --version

2. Clone or Download the Project Files

Obtain all project scripts (dashboard.py, DIYSensorTimeSeries.py, HiveSensorTimeSeries.py), and your cleaned CSVs.

3. Install MongoDB

Download MongoDB Community Edition and follow the install instructions for your OS.

Start the MongoDB server: mongod

4. Create and Activate a Virtual Environment

python -m venv .venv
On Windows:
.venv\Scripts\activate
On Mac/Linux:
source .venv/bin/activate

5. Install Python Dependencies

pip install streamlit pymongo pandas plotly

6. Ingest Your Data into MongoDB as TimeSeries

python source/DIYSensorTimeSeries.py
python source/HiveSensorTimeSeries.py

7. Run the Streamlit Dashboard

streamlit run frontend/dashboard.py


Project Summary

Backend

  1. Used MongoDB Time Series Collection to ingest the 6 files in the data directory into the database.

Frontend

Developed a highly modular and flexible dashboard.py script that:

  1. Connects to MongoDB and loads sensor data for Hives B,C and E, and sensor types BroodMinder and DIY.

  2. Converts key measurement columns (temperature, humidity) to numeric types.

  3. Converts timestamp columns to timezone-aware datetime objects (UTC).

  4. Drops any rows with invalid or missing timestamps or measurement values.

  5. Sorts the data by timestamp and resamples temperature data to 15-minute intervals and computes the mean for each interval, making it possible to align and compare readings from different sensors even if they weren't recorded at exactly the same time.

  6. Joins (merges) the DIY and BroodMinder temperature datasets on timestamp to create a "matched" dataset for direct comparison.

  7. Provides a user-friendly UI with the following statistics:

    • Hive temperature and hive humidity plots along with minimum temperature alerts and brood-rearing days.
    • Hive battery statistics like monthly average battery life and battery life plots per hive for a given date range
    • Comparison between BroodMinder and DIY sensors with error reporting.

Some Results

  1. Minimum Temperature Violations and Brood Rearing days statistics of Hive C in the Hive Environment Statistics tab:
    alt text

  2. Average Monthly Battery Life per Hive bar graph plot:
    alt text

  3. Battery Life of each hive sensor within the time period of 2024/12/12 – 2024/12/13:
    alt text alt text

  4. BroodMinder vs DIY Temperature and Humidity Sensor Comparison of Hive E within the time period of 2024/11/26 – 2024/12/02:
    alt text alt text

About

This project provides an interactive dashboard for visualizing, comparing, and analyzing hive sensor data (BroodMinder sensors and DIY sensors) using MongoDB and Streamlit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages