Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Sensor Dashboard

This project implements a real-time sensor data dashboard using FastAPI for the backend and Server-Sent Events (SSE) to push data to a simple HTML frontend. The dashboard visualizes simulated sensor readings.

dashboard

Features

  • Real-time sensor data visualization.
  • Backend built with FastAPI, providing a RESTful API and SSE endpoint.
  • Frontend uses HTML, CSS (DaisyUI/TailwindCSS), and JavaScript to display dynamic charts.
  • Automated testing with pytest.

Project Structure

sensor-dashboard/
├── .venv/                  # Python virtual environment
├── app.py                  # FastAPI application entry point
├── utils.py                # Utility functions and data models (SensorData, recent_readings)
├── test_app.py             # Pytest unit tests for the application
├── templates/              # HTML templates
│   ├── base.html           # Base HTML structure
│   ├── index.html          # Main dashboard page
│   └── chart_data.html     # Partial HTML for chart data updates
├── pyproject.toml          # Project dependencies and metadata
├── uv.lock                 # UV lock file for dependencies
└── README.md               # This README file

Setup and Installation

Follow these steps to set up and run the project locally:

  1. Navigate to the project directory:

    cd sensor-dashboard
  2. Install dependencies using uv:

    If you don't have uv installed, you can install it via pip:

    pip install uv

    Then, install the project dependencies:

    uv pip install -r requirements.txt
    # (Note: If requirements.txt is not present, uv will install from pyproject.toml)

    Self-correction: The project uses pyproject.toml and uv.lock for dependency management. uv pip install without -r will install from pyproject.toml.

  3. Run the application:

    uvicorn app:app --reload --port 8000

    The application will be accessible at http://127.0.0.1:8000.

Running Tests

To run the unit tests for the application, ensure you have pytest and httpx installed (they should be installed with the main dependencies if using uv):

uv run pytest test_app.py

This will execute the tests defined in test_app.py.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages