Getting Started
This guide covers the fastest path to get LabSense running locally for development, testing, and dashboard generation.
Read These Setup Guides First (Required)
Before running dashboard scripts, complete these pages in order:
- LabSense Server Setup
- SQL Server setup and connectivity
- MQTT broker setup
- required
Labsense_SQL/.envvariables
- LabSense Sensors Setup
- Raspberry Pi sensor host setup
- sensor-side
.envconfiguration
- ChemInventory Setup and Pipeline
- ChemInventory API key/token requirements
- SQL sync flow used by ChemInventory dashboard
- Waste Generation Pipeline
- hazardous waste extraction, HP-code allocation, and waste dashboard outputs
- Water Monitoring Setup
- water sensor wiring, collection script behavior, and dashboard dependencies
- Fumehood Monitoring Setup
- distance and light sensor configuration on Raspberry Pi
- sash opening calibration and dashboard generation
- Electricity Monitoring
- emonPi2/emonCMS data collection and idle baseline methodology
The Run Core Dashboards commands below assume these setup steps are already complete.
Prerequisites
- Git
- Conda (recommended, based on project environment file)
- Access to required external systems if running full pipelines:
- SQL Server instance
- MQTT broker
- ChemInventory API token
Clone and Create Environment
git clone https://github.com/yourusername/labsense.git
cd labsense
conda env create -f environment.yml
conda activate labsense
Configure Environment Variables
Create or update environment files used by scripts:
- Labsense_SQL/.env for SQL and processing scripts
- Labsense_Sensors/.env for hardware sensor scripts
Use these docs to confirm values before running pipelines:
- LabSense Server Setup for SQL Server, MQTT, and server-side env keys.
- ChemInventory Setup and Pipeline for
CHEMINVENTORY_CONNECTION_STRINGand ChemInventory sync requirements. - Waste Generation Pipeline for waste input file expectations and output/dashboard configuration.
- Water Monitoring Setup for water sensor pipeline configuration and MQTT payload path.
- Fumehood Monitoring Setup for fumehood sensor configuration and MQTT topics.
- Electricity Monitoring for emonCMS API retrieval and daily idle-baseline calculation assumptions.
Typical values include:
- EMONCMS_API_KEY
- EMONCMS_BASE_URL
- CHEMINVENTORY_CONNECTION_STRING
- MQTT_SERVER
- SQL_SERVER
- SQL_DATABASE
Run Core Dashboards
Generate the HTML dashboards and top-level summary page:
Prerequisite checks:
- SQL Server is reachable and populated with recent data.
- MQTT ingestion path is running for sensor-backed dashboards.
- ChemInventory token is configured and ChemInventory SQL sync has been run.
- Sensor-side setup has been completed for feeds used by your dashboards.
python Labsense_SQL/ChemInventory_dashboard.py
python Labsense_SQL/consumption_dashboard.py
python Labsense_SQL/Fumehood_dashboard.py
python Labsense_SQL/water_dashboard.py
python Waste/processWasteMaster.py
python create_main_dashboard.py
Generated outputs are written to the plots directory.
Run Tests
pytest
Build Documentation Locally
Install docs dependencies and build:
pip install -r docs/requirements.txt
mkdocs serve
The local docs site is then available at the URL shown by MkDocs (usually http://127.0.0.1:8000).