Skip to main content

Python library to export data from and interact with the Ohm AI Platform

Project description

Ohm AI Library Documentation

Welcome to the Ohm library documentation!

This Python library provides tools for interacting with the Ohm API, allowing you to access and analyze your battery data.

Key Features

  • Data Retrieval: Easily fetch battery observation metrics, dataset cycle data, and metadata.
  • Filtering: Refine your data retrieval using flexible filter options.
  • Data Handling: Work with data in a structured format using pandas DataFrames.

Installation

pip install ohm-ai

Usage

1. Initialization:

from ohm_ai import OhmClient, OhmFilter, OhmFilterOperator, OhmFilterGroup, OhmFilterGroupType

# For synchronous operations
ohm_client = OhmClient(api_key="YOUR_API_TOKEN")

2. Data Retrieval:

  • Get Battery Observation Metrics:
# Get all battery observation metrics
observation_data = ohm_client.get_observation_data()
  • Get Battery Dataset Cycle Data:
# Get all battery dataset cycle data
cycle_data = ohm_client.get_dataset_cycle_data()
  • Get Battery Metadata:
# Get all battery metadata
metadata = ohm_client.get_metadata()

3. Filtering:

# Create filters using OhmFilterOperator enumerable or their string values direcly
filter_1 = OhmFilter(column="voltage", operator=OhmFilterOperator.EQ, value=3.5)
filter_2 = OhmFilter(column="voltage", operator="equals", value=3.5)

# Create a filter group using the OhmFilterGroupType or their string values directly
filter_group_1 = OhmFilterGroup([filter_1, filter_2], type=OhmFilterGroupType.AND)
filter_group_2 = OhmFilterGroup([filter_1, filter_2], type="and")

# OhmFilterGroup objects can be nested to create complex logic
filter_group_3 = OhmFilterGroup([filter_group_1, filter_group_2], type="or")

# Retrieve a chunk of filtered observation data -> Returns a pandas dataframe object
# Use either a list of filters or a OhmFilterGroup object
filtered_observation_data = ohm_client.get_observation_data(filters=[filter_1, filter_2])
filtered_observation_data = ohm_client.get_observation_data(filters=filter_group_3)

# Retrieve a chunk of filtered dataset cycle data -> Returns a pandas dataframe object
filtered_cycle_data = ohm_client.get_dataset_cycle_data(filters=[filter_1, filter_2])
filtered_cycle_data = ohm_client.get_dataset_cycle_data(filters=filter_group_3)

# Retrieve a chunk of filtered metadata -> Returns a pandas dataframe object
filtered_metadata = ohm_client.get_metadata(filters=[filter_1, filter_2])
filtered_metadata = ohm_client.get_metadata(filters=filter_group_3)

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

ohm_ai-1.0.7.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

ohm_ai-1.0.7-py2.py3-none-any.whl (9.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ohm_ai-1.0.7.tar.gz.

File metadata

  • Download URL: ohm_ai-1.0.7.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ohm_ai-1.0.7.tar.gz
Algorithm Hash digest
SHA256 861eeff7335d34c3b345168d4ce7ee3a6d8429557064c17d2c192a237173cdc3
MD5 5aa503854658c30d5b3952eb298c6b62
BLAKE2b-256 26ca9797110bb170ad8e954b563b3a25f83812cf6d36b7a04f1c980b1c770eae

See more details on using hashes here.

File details

Details for the file ohm_ai-1.0.7-py2.py3-none-any.whl.

File metadata

  • Download URL: ohm_ai-1.0.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for ohm_ai-1.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e88d77c01f8e3155b5571c4f2b9d7918769cdea2cafc59b068d3b5569fcdc02e
MD5 bbe4e65d7bda3ecb2b5d7f5e252a3db3
BLAKE2b-256 01477194c346a47b150e162058318a924c81602bbe1974ca37c7f7bac40b6a6c

See more details on using hashes here.

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