Metadata-Version: 2.4
Name: odsbox
Version: 1.0.14rc436.post1
Summary: Toolbox for accessing ASAM ODS servers using the HTTP API
Keywords: asam,ods,measurement,data access,data science,data analysis
Author-email: Andreas Krantz <a.krantz@peak-solution.de>
Requires-Python: >=3.10.12
Description-Content-Type: text/markdown
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Information Analysis
License-File: LICENSE
Requires-Dist: protobuf>=5.27.0,<7.0.0
Requires-Dist: requests>=2.30.0,<3.0.0
Requires-Dist: pandas>=2.2.0,<3.0.0
Requires-Dist: grpcio>=1.59.3,<2.0.0 ; extra == "exd-data"
Requires-Dist: bandit[toml]==1.8.6 ; extra == "test"
Requires-Dist: black==25.11.0 ; extra == "test"
Requires-Dist: check-manifest==0.51 ; extra == "test"
Requires-Dist: flake8-bugbear==25.10.21 ; extra == "test"
Requires-Dist: flake8-docstrings ; extra == "test"
Requires-Dist: flake8-formatter_junit_xml ; extra == "test"
Requires-Dist: flake8 ; extra == "test"
Requires-Dist: flake8-pyproject ; extra == "test"
Requires-Dist: pre-commit==4.4.0 ; extra == "test"
Requires-Dist: pylint==4.0.3 ; extra == "test"
Requires-Dist: pylint_junit ; extra == "test"
Requires-Dist: pytest-cov==7.0.0 ; extra == "test"
Requires-Dist: pytest-mock<3.15.2 ; extra == "test"
Requires-Dist: pytest-runner ; extra == "test"
Requires-Dist: pytest==9.0.1 ; extra == "test"
Requires-Dist: pytest-github-actions-annotate-failures ; extra == "test"
Requires-Dist: pytest-xdist ; extra == "test"
Requires-Dist: shellcheck-py==0.11.0.1 ; extra == "test"
Project-URL: Documentation, https://peak-solution.github.io/odsbox
Project-URL: Homepage, https://github.com/peak-solution/odsbox/tree/main#readme
Project-URL: Repository, https://github.com/peak-solution/odsbox
Project-URL: Tracker, https://github.com/peak-solution/odsbox/issues
Provides-Extra: exd-data
Provides-Extra: test

# ASAM ODSBox

![PyPI Version](https://img.shields.io/pypi/v/odsbox)
![Python Versions](https://img.shields.io/pypi/pyversions/odsbox)
![License](https://img.shields.io/github/license/peak-solution/odsbox)

The [*ODSBox*](https://peak-solution.github.io/odsbox) is a lightweight Python wrapper on the standardized
[ASAM ODS REST API](https://www.asam.net/standards/detail/ods/wiki/). It simplifies the handling of ASAM ODS data
in Python by utilizing intuitive [JAQuel](https://peak-solution.github.io/odsbox/jaquel.html#examples) queries
and [pandas DataFrames](https://pandas.pydata.org/).

## Features

- Lightweight Python wrapper for the [ASAM ODS HTTP API](https://www.asam.net/standards/detail/ods/wiki/#TechnicalContent).
- Intuitive querying using [JAQuel](https://peak-solution.github.io/odsbox/jaquel.html#examples) Query Language.
- Seamless integration with pandas DataFrames for data analysis.
- Includes generated [ASAM ODS protobuf](https://github.com/asam-ev/ASAM-ODS-Interfaces) stubs.
- Supports authentication mechanisms via [requests](https://pypi.org/project/requests/).
- [Bulk helper](https://peak-solution.github.io/odsbox/odsbox.html#odsbox.con_i.ConI.bulk) for quantity data access as
  pandas DataFrames.

## Quick Start

1. Install ODSBox: `pip install odsbox`
2. Connect to an ASAM ODS server:
    ```python
    from odsbox.con_i import ConI

    with ConI(url="https://MY_SERVER/api", auth=("USERNAME", "PASSWORD")) as con_i:
        measurements = con_i.query(
            {
                "AoMeasurement": {"name": {"$like": "*"}},
                "$attributes": {"name": 1, "id": 1},
                "$options": {"$rowlimit": 50},
            }
        )
        print(measurements) # print pandas DataFrame
    ```

## Documentation

* [*ODSBox* documentation](https://peak-solution.github.io/odsbox)
* [Work with ASAM ODS server](https://peak-solution.github.io/data_management_learning_path/ods/query-asam-server.html)

## Communication

The ASAM ODS server communicates via HTTP calls as specified in the [ASAM ODS standard](https://www.asam.net/standards/detail/ods/wiki/#TechnicalContent), which defines a RESTful API for accessing and manipulating measurement data. This allows for standardized interactions, including operations like querying, creating, updating, and deleting entities such as measurements, tests, and results.

Data exchanged between the client (e.g., ODSBox) and the server is encoded and decoded using [Protocol Buffers (protobuf)](https://protobuf.dev/programming-guides/proto3/), a binary serialization format developed by Google. Protobuf ensures efficient, compact, and fast data transfer compared to text-based formats like JSON, making it ideal for handling large datasets in technical measurement scenarios. The official protobuf message definitions are available in the [ASAM-ODS-Interfaces repository](https://github.com/asam-ev/ASAM-ODS-Interfaces).

Requests use the custom content type `application/x-asamods+protobuf` to indicate protobuf-encoded payloads. ODSBox abstracts these low-level details, allowing developers to interact with the API using intuitive Python dictionaries and methods, while handling authentication (e.g., via username/password or tokens) and connection management seamlessly.

## JAQuel Queries

[JAQuel](https://peak-solution.github.io/odsbox/jaquel.html#examples) enables intuitive data querying, drawing inspiration from the [MongoDB Query Language (MQL)](https://www.mongodb.com/docs/manual/tutorial/query-documents/). Its JSON-based query expressions seamlessly integrate with Python as dictionaries, offering a powerful and user-friendly approach to data retrieval.

## Installation

*ODSBox* is available on PyPI and GitHub.

|               |                                                                                      |
| :------------ | :----------------------------------------------------------------------------------- |
| github        | [https://github.com/peak-solution/odsbox/](https://github.com/peak-solution/odsbox/) |
| PyPI          | [https://pypi.org/project/odsbox/](https://pypi.org/project/odsbox/)                 |
| github docs   | [https://peak-solution.github.io/odsbox](https://peak-solution.github.io/odsbox)     |

```shell
# access ASAM ODS server
pip install odsbox
# access ASAM ODS EXD-API plugin
pip install odsbox[exd-data]
```

## Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

## License

This project is licensed under the MIT License.

