Skip to main content

Streamlit Library for reporting and solar monitoring

Project description

Frequenz CS Reporting Library

Build Status PyPI Package Docs

Overview

Streamlit library that ships a ready-to-use client reporting UI. It fetches data from the Frequenz reporting API, applies the energy reporting utilities from frequenz-lib-notebooks, and renders dashboards, tables, and plots with reusable Streamlit components.

Features

  • Pre-built Streamlit app with navigation, landing page, and reporting view.
  • Connects to the Frequenz reporting API to fetch microgrid measurements.
  • Ready-made dashboards (metrics, plots, and tables) powered by frequenz-lib-notebooks.
  • Reusable components (sidebar filters, charts, tables) for your own pages.

Quick start

  1. Install the library (Python 3.12):
    pip install "frequenz-cs-reporting"
    
  2. Provide environment variables (see below). A .env file works with Streamlit:
    REPORTING_API_URL=https://your-reporting-endpoint
    API_KEY=your-api-key
    API_SECRET=your-api-secret
    MICROGRID_CONFIG_DIR=toml_directory/
    
  3. Add .toml files to the toml_directory.
  4. Run the bundled UI from the repo root:
    streamlit run app.py
    
    Use the sidebar to pick a microgrid, date range, timezone, and resolution.

Configuration

Environment

  • REPORTING_API_URL (required): Base URL for the Frequenz reporting API.
  • API_KEY and API_SECRET (required): Credentials used by the data client.
  • MICROGRID_CONFIG_DIR (optional): Directory containing TOML microgrid configs. Defaults to toml_directory/.

Microgrid configs

Microgrid definitions are loaded from TOML files in MICROGRID_CONFIG_DIR.

Running the Streamlit app

The app entry point is app.py. When you run streamlit run app.py, it:

  • Discovers pages from frequenz.cs_reporting.app_pages (the default build ships Home and Reporting pages).
  • Loads microgrid configs from MICROGRID_CONFIG_DIR and lists available IDs.
  • Fetches data via the reporting API.

Running in Deepnote

  • Running in Deepnote is supported; required environment variables can be injected via the Deepnote integration.
  • Add this library as a requirement in requirements.txt
  • Add the docker image from dockerhub (currently named: CS-Reporting in deepnote).
  • Copy the app.py to the folder structure in Deepnote.
  • Click on create_streamlit_application in Deepnote UI to create the app.

Library usage

Fetch microgrid data programmatically (sync wrapper shown):

from datetime import datetime, timedelta
from frequenz.cs_reporting.services.data_service import get_microgrid_data

df = get_microgrid_data(
    microgrid_id=241,
    start_date=datetime(2024, 1, 1),
    end_date=datetime(2024, 1, 2),
    resolution=timedelta(minutes=15),
)

Build your own Streamlit page and add it to the navigation by defining a PageSpec in frequenz.cs_reporting.app_pages:

# app_pages/custom.py
from frequenz.cs_reporting.rep_cs_core.page_spec import PageSpec
import streamlit as st

def render() -> None:
    st.title("Custom view")
    st.write("Add your own charts or tables here.")

PAGE = PageSpec(key="custom", title="Custom", icon="🛠️", order=10, render=render)

Development

  • Install dev tools: pip install -e ".[dev]".
  • Run tests: nox -l to see sessions, e.g. nox -s tests.
  • Build docs with MkDocs (README.md is the landing page). After installing the mkdocs extra you can use the docs nox session (if available) or run mkdocs serve.

Supported Platforms

The following platforms are officially supported (tested):

  • Python: 3.12
  • Operating System: Ubuntu Linux 20.04
  • Architectures: amd64, arm64

Contributing

If you want to know how to build this project and contribute to it, please check out the Contributing Guide.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frequenz_cs_reporting-0.2.9.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frequenz_cs_reporting-0.2.9-py3-none-any.whl (3.2 MB view details)

Uploaded Python 3

File details

Details for the file frequenz_cs_reporting-0.2.9.tar.gz.

File metadata

  • Download URL: frequenz_cs_reporting-0.2.9.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for frequenz_cs_reporting-0.2.9.tar.gz
Algorithm Hash digest
SHA256 304b6b86e894657f0e9519bee287b6dbf22bec08399de92d11e76d7340bc4fdd
MD5 d725a34da9f9652197458e058ea889b5
BLAKE2b-256 e4d246b0627557dc9ea6a9ff488bac2332ce6656abe772d731b86e0adc31d5da

See more details on using hashes here.

Provenance

The following attestation bundles were made for frequenz_cs_reporting-0.2.9.tar.gz:

Publisher: ci.yaml on frequenz-floss/frequenz-cs-reporting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file frequenz_cs_reporting-0.2.9-py3-none-any.whl.

File metadata

File hashes

Hashes for frequenz_cs_reporting-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 187cfcca432c6178cddb5cbdf3255478df51b5ee4f59c5689e4703a9e2f0b9ba
MD5 7d760608d2989029d2aaa00f2abb3fcc
BLAKE2b-256 0826b8ab0aa556e17a1ad292db2a1e5f32d68eee947d9831209f5a61dc4189f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for frequenz_cs_reporting-0.2.9-py3-none-any.whl:

Publisher: ci.yaml on frequenz-floss/frequenz-cs-reporting

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page