Streamlit Library for reporting and solar monitoring
Project description
Frequenz CS Reporting Library
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
- Install the library (Python 3.12):
pip install "frequenz-cs-reporting"
- Provide environment variables (see below). A
.envfile 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/
- Add .toml files to the toml_directory.
- 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_KEYandAPI_SECRET(required): Credentials used by the data client.MICROGRID_CONFIG_DIR(optional): Directory containing TOML microgrid configs. Defaults totoml_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 shipsHomeandReportingpages). - Loads microgrid configs from
MICROGRID_CONFIG_DIRand 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 -lto see sessions, e.g.nox -s tests. - Build docs with MkDocs (
README.mdis the landing page). After installing the mkdocs extra you can use thedocsnox session (if available) or runmkdocs 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frequenz_cs_reporting-0.2.8.tar.gz.
File metadata
- Download URL: frequenz_cs_reporting-0.2.8.tar.gz
- Upload date:
- Size: 3.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b120f583f9b94e4bb2a07939abe08b0c30c43ad34727c12db0c50160c375491a
|
|
| MD5 |
30b86009cb8d8b4eb6b9daa3934df3ff
|
|
| BLAKE2b-256 |
5e0da103218b0c841d909c9840eafaa4c3303ce4353c36e2cd4794afd2b28c77
|
Provenance
The following attestation bundles were made for frequenz_cs_reporting-0.2.8.tar.gz:
Publisher:
ci.yaml on frequenz-floss/frequenz-cs-reporting
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
frequenz_cs_reporting-0.2.8.tar.gz -
Subject digest:
b120f583f9b94e4bb2a07939abe08b0c30c43ad34727c12db0c50160c375491a - Sigstore transparency entry: 1361690679
- Sigstore integration time:
-
Permalink:
frequenz-floss/frequenz-cs-reporting@883d2b501dc3fca8f9a1c623a1c5fd12161869aa -
Branch / Tag:
refs/tags/v0.2.8 - Owner: https://github.com/frequenz-floss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@883d2b501dc3fca8f9a1c623a1c5fd12161869aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file frequenz_cs_reporting-0.2.8-py3-none-any.whl.
File metadata
- Download URL: frequenz_cs_reporting-0.2.8-py3-none-any.whl
- Upload date:
- Size: 3.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7ad17d6dd7cbe85f6421e29d97ea7d7b1e2565f2d28c74ba4008c1caf7afea2
|
|
| MD5 |
1004d770a461caaee0893bb900ac4c93
|
|
| BLAKE2b-256 |
33384afa5669c6cb7b96e52c87d5a486265c05b2d1971c768339f7c10d525817
|
Provenance
The following attestation bundles were made for frequenz_cs_reporting-0.2.8-py3-none-any.whl:
Publisher:
ci.yaml on frequenz-floss/frequenz-cs-reporting
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
frequenz_cs_reporting-0.2.8-py3-none-any.whl -
Subject digest:
c7ad17d6dd7cbe85f6421e29d97ea7d7b1e2565f2d28c74ba4008c1caf7afea2 - Sigstore transparency entry: 1361690685
- Sigstore integration time:
-
Permalink:
frequenz-floss/frequenz-cs-reporting@883d2b501dc3fca8f9a1c623a1c5fd12161869aa -
Branch / Tag:
refs/tags/v0.2.8 - Owner: https://github.com/frequenz-floss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@883d2b501dc3fca8f9a1c623a1c5fd12161869aa -
Trigger Event:
push
-
Statement type: