This project provides an interactive dashboard for visualizing, comparing, and analyzing hive sensor data (BroodMinder sensors and DIY sensors) using MongoDB and Streamlit.
We have used a combination of the following technologies:
- 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.
- 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.
- 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.
- Plotly – a graphing library for Python that enables the creation of interactive, publication-quality charts and graphs within the Streamlit dashboard.
- 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.
Make sure Python 3.8+ is installed.
Check in terminal/cmd:
python --version
or
python3 --version
Obtain all project scripts (dashboard.py, DIYSensorTimeSeries.py, HiveSensorTimeSeries.py), and your cleaned CSVs.
Download MongoDB Community Edition and follow the install instructions for your OS.
Start the MongoDB server:
mongod
python -m venv .venv
On Windows:
.venv\Scripts\activate
On Mac/Linux:
source .venv/bin/activate
pip install streamlit pymongo pandas plotly
python source/DIYSensorTimeSeries.py
python source/HiveSensorTimeSeries.py
streamlit run frontend/dashboard.py
- Used MongoDB Time Series Collection to ingest the 6 files in the data directory into the database.
Developed a highly modular and flexible dashboard.py script that:
-
Connects to MongoDB and loads sensor data for Hives B,C and E, and sensor types BroodMinder and DIY.
-
Converts key measurement columns (temperature, humidity) to numeric types.
-
Converts timestamp columns to timezone-aware datetime objects (UTC).
-
Drops any rows with invalid or missing timestamps or measurement values.
-
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.
-
Joins (merges) the DIY and BroodMinder temperature datasets on timestamp to create a "matched" dataset for direct comparison.
-
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.
-
Minimum Temperature Violations and Brood Rearing days statistics of Hive C in the Hive Environment Statistics tab:

-
Battery Life of each hive sensor within the time period of 2024/12/12 – 2024/12/13:

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

