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:

  1. LabSense Server Setup
    • SQL Server setup and connectivity
    • MQTT broker setup
    • required Labsense_SQL/.env variables
  2. LabSense Sensors Setup
    • Raspberry Pi sensor host setup
    • sensor-side .env configuration
  3. ChemInventory Setup and Pipeline
    • ChemInventory API key/token requirements
    • SQL sync flow used by ChemInventory dashboard
  4. Waste Generation Pipeline
    • hazardous waste extraction, HP-code allocation, and waste dashboard outputs
  5. Water Monitoring Setup
    • water sensor wiring, collection script behavior, and dashboard dependencies
  6. Fumehood Monitoring Setup
    • distance and light sensor configuration on Raspberry Pi
    • sash opening calibration and dashboard generation
  7. 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:

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).