# Reporting Highlevel Interface
[![Build Status](https://github.com/frequenz-floss/frequenz-reporting-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/frequenz-floss/frequenz-reporting-python/actions/workflows/ci.yaml)
[![PyPI Package](https://img.shields.io/pypi/v/frequenz-reporting-python)](https://pypi.org/project/frequenz-reporting-python/)
[![Docs](https://img.shields.io/badge/docs-latest-informational)](https://frequenz-floss.github.io/frequenz-reporting-python/)
## Introduction
A highlevel interface for the reporting API
## Supported Platforms
The following platforms are officially supported (tested):
- **Python:** 3.11
- **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](CONTRIBUTING.md).
### Installation
```bash
# Choose the version you want to install
VERSION=0.1.0
pip install frequenz-reporting-python==$VERSION
```
### Initialize the client
```python
from datetime import datetime
from frequenz.client.common.metric import Metric
from frequenz.client.reporting import ReportingApiClient
from frequenz.reporting._reporting import cumulative_energy
# Change server address if needed
SERVICE_ADDRESS = "reporting.api.frequenz.com:443"
API_KEY = open('api_key.txt').read().strip()
client = ReportingApiClient(service_address=SERVICE_ADDRESS, key=API_KEY)
```
### Calculate cumulative energy for a single microgrid and component:
If the component does not measure `Metric.AC_ACTIVE_ENERGY`, set `use_active_power=True`
to utilize `Metric.AC_ACTIVE_POWER` instead.
A resampling period can be set that alters how NaNs are handled, resulting in varying
results. NaN values are ignored in sums, which may lead to significant data loss
if many are present in the raw data. There is no universally correct method for
handling NaNs, as their causes can vary.
```python
energy_reading = await cumulative_energy(
client=client,
microgrid_id=1,
component_id=100,
start_time=datetime.fromisoformat("2024-09-01T00:00:00"),
end_time=datetime.fromisoformat("2024-09-30T00:00:00"),
use_active_power=True,
resampling_period=timedelta(seconds=10),
)
print(energy_reading)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "frequenz-reporting-python",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.11",
"maintainer_email": null,
"keywords": "frequenz, python, lib, library, reporting, highlevel, tooling, api",
"author": null,
"author_email": "Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>",
"download_url": "https://files.pythonhosted.org/packages/f2/01/5770a952a588feddb8d0b84018ff4f19acb480e9f9ef3e6b5afde0012945/frequenz_reporting_python-0.2.0.tar.gz",
"platform": null,
"description": "# Reporting Highlevel Interface\n\n[![Build Status](https://github.com/frequenz-floss/frequenz-reporting-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/frequenz-floss/frequenz-reporting-python/actions/workflows/ci.yaml)\n[![PyPI Package](https://img.shields.io/pypi/v/frequenz-reporting-python)](https://pypi.org/project/frequenz-reporting-python/)\n[![Docs](https://img.shields.io/badge/docs-latest-informational)](https://frequenz-floss.github.io/frequenz-reporting-python/)\n\n## Introduction\n\nA highlevel interface for the reporting API\n\n## Supported Platforms\n\nThe following platforms are officially supported (tested):\n\n- **Python:** 3.11\n- **Operating System:** Ubuntu Linux 20.04\n- **Architectures:** amd64, arm64\n\n## Contributing\n\nIf you want to know how to build this project and contribute to it, please\ncheck out the [Contributing Guide](CONTRIBUTING.md).\n\n\n### Installation\n\n```bash\n# Choose the version you want to install\nVERSION=0.1.0\npip install frequenz-reporting-python==$VERSION\n```\n\n\n### Initialize the client\n\n```python\nfrom datetime import datetime\n\nfrom frequenz.client.common.metric import Metric\nfrom frequenz.client.reporting import ReportingApiClient\nfrom frequenz.reporting._reporting import cumulative_energy\n\n# Change server address if needed\nSERVICE_ADDRESS = \"reporting.api.frequenz.com:443\"\nAPI_KEY = open('api_key.txt').read().strip()\nclient = ReportingApiClient(service_address=SERVICE_ADDRESS, key=API_KEY)\n```\n\n### Calculate cumulative energy for a single microgrid and component:\n\nIf the component does not measure `Metric.AC_ACTIVE_ENERGY`, set `use_active_power=True`\nto utilize `Metric.AC_ACTIVE_POWER` instead.\n\nA resampling period can be set that alters how NaNs are handled, resulting in varying\nresults. NaN values are ignored in sums, which may lead to significant data loss\nif many are present in the raw data. There is no universally correct method for\nhandling NaNs, as their causes can vary.\n\n```python\nenergy_reading = await cumulative_energy(\n\t\t\tclient=client,\n microgrid_id=1,\n component_id=100,\n start_time=datetime.fromisoformat(\"2024-09-01T00:00:00\"),\n end_time=datetime.fromisoformat(\"2024-09-30T00:00:00\"),\n use_active_power=True,\n resampling_period=timedelta(seconds=10),\n )\n\nprint(energy_reading)\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A highlevel interface for the reporting API",
"version": "0.2.0",
"project_urls": {
"Changelog": "https://github.com/frequenz-floss/frequenz-reporting-python/releases",
"Documentation": "https://frequenz-floss.github.io/frequenz-reporting-python/",
"Issues": "https://github.com/frequenz-floss/frequenz-reporting-python/issues",
"Repository": "https://github.com/frequenz-floss/frequenz-reporting-python",
"Support": "https://github.com/frequenz-floss/frequenz-reporting-python/discussions/categories/support"
},
"split_keywords": [
"frequenz",
" python",
" lib",
" library",
" reporting",
" highlevel",
" tooling",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4c3f18b9b8289ade9821ea4dbe13517488d402614250176e8ef42cdd357de6fd",
"md5": "afb94376e0e72b6ea77b8e5492da0ae4",
"sha256": "afb33ec00baf9bffd7b53313064473ed7598bf2343e49e5f9787f270728bd490"
},
"downloads": -1,
"filename": "frequenz_reporting_python-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "afb94376e0e72b6ea77b8e5492da0ae4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.11",
"size": 7949,
"upload_time": "2024-12-13T08:18:41",
"upload_time_iso_8601": "2024-12-13T08:18:41.307186Z",
"url": "https://files.pythonhosted.org/packages/4c/3f/18b9b8289ade9821ea4dbe13517488d402614250176e8ef42cdd357de6fd/frequenz_reporting_python-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f2015770a952a588feddb8d0b84018ff4f19acb480e9f9ef3e6b5afde0012945",
"md5": "313ddf13e16ac71cfad9bcbd364fb593",
"sha256": "304966fc4e5944838f8c80242ae2732728c8c7af1a08f225104ecdc66cfe6745"
},
"downloads": -1,
"filename": "frequenz_reporting_python-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "313ddf13e16ac71cfad9bcbd364fb593",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.11",
"size": 10783,
"upload_time": "2024-12-13T08:18:42",
"upload_time_iso_8601": "2024-12-13T08:18:42.649813Z",
"url": "https://files.pythonhosted.org/packages/f2/01/5770a952a588feddb8d0b84018ff4f19acb480e9f9ef3e6b5afde0012945/frequenz_reporting_python-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-13 08:18:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "frequenz-floss",
"github_project": "frequenz-reporting-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "frequenz-reporting-python"
}