Skip to main content

ORPHE ANALYTICIS SDK for Python

Project description

ORPHE ANALYTICS SDK for Python


ORPHE ANALYTICIS SDK for Python is a client library that accesses the ORPHE ANALYTICS resource API and real-time API.

Install

You can install ORPHE ANALYTICIS SDK for Python (hereafter orphe-py) using PyPI. Install with the following command.

$ pip install orphe

If you are using Python 3, you can install it with the following command.

$ pip3 install orphe

Usage

To start using ORPHE ANALYTICIS SDK, create a client. To create a client, use the URL of the connection destination and the credentials of the edge account (token or user name/password combination). See intdash client for other available parameters.

import orphe

analytics = orphe.Analytics(
    url = "https://example.analytics.orphe.ai",
    token = "your_token",
)

Example: An example for retrieving and storing a value is given below.

import orphe

# Generate a client with a URL and an edge token
analytics = orphe.Analytics(
    url = "https://example.analytics.orphe.ai",
    token= "your_token"
)
# Get data by specifying the measurement UUID
analyzed = analytics.load(
    measurement_uuid = "e07cdf8c-83e6-46cf-8a03-e315eef6162a",
)

# Extract, analyze and display values from stored data (channel 1 -> plantar left, channel 2 -> plantar right)
for gait in analyzed.gait.stored[1]:
    print(f"Plantar left/{gait.time}/{gait.quaternion_w}/{gait.quaternion_x}/{gait.quaternion_y}/{gait.quaternion_z}")

for gait in analyzed.gait.stored[2]:
    print(f"Plantar right/{gait.time}/{gait.quaternion_w}/{gait.quaternion_x}/{gait.quaternion_y}/{gait.quaternion_z}")
    
# If you want to take out the value of gait analysis, you can filter it by [gait.analyzed] from stored data (channel 3 -> Instep left, channel 4 -> Instep right)
for gait in analyzed.gait.stored[3]:
    if not gait.analyzed:
        continue
    print(f"Instep left/{gait.time}/{gait.stride}/{gait.cadence}/{gait.duration}")

for gait in analyzed.gait.stored[4]:
    if not gait.analyzed:
        continue
    print(f"Instep right/{gait.time}/{gait.stride}/{gait.cadence}/{gait.duration}")

# To save the value, use [orphe.Unit]
units = []
for gait in analyzed.gait.stored[1]:
    units.append(orphe.Unit(
        time = gait.time,
        id = "Height",
        value = 160
    ))

# Save the data by specifying the measurement UUID and the list of [orphe.Unit].
analytics.save(
    measurement_uuid="e07cdf8c-83e6-46cf-8a03-e315eef6162a",
    units=units
)

After analytics.load is performed, the retrieved valuesanalyzed will contain the values retrieved from ORPHE CORE and the values analyzed by ANALYTICS. By gait, the data of gait analysis is retrieved, and left and right data can be retrieved respectively.

In addition, if you want to perform real-time analysis, you can use the following method.

import orphe

# Generate a client with a URL and an edge token
analytics = orphe.Analytics(
    url = "https://example.analytics.orphe.ai",
    token= "your_token"
)

# Defines a callback for realtime. [value] will contain the raw and parsed data.
# New real-time data can be sent by returning list[Unit].
# * Real-time data transmission is sent to a separate edge specified by [upstream_edge_uuid].
def callback(value: AnalyticsValue) -> list[Unit]:
    if value.gait.left.stride != None:
        print(value.gait.left.stride)
    if value.gait.left.euler_x != None:
        print(value.gait.left.euler_x)
        
    units = []
    time = value.pose.realtime.time
    val = random.randint(0, 100)
    units.append(Unit(
        time=time,
        channel=3,
        id="RANDOM",
        value=val,
    ))
    return units

# Start real-time acquisition by specifying the callback and the ID of the edge.
# Specify the EdgeUUID to get the real-time data being measured in [downstream_edge_uuid].
# Specify the EdgeUUID for sending real-time values from the SDK in [upstream_edge_uuid].
analytics.realtime(
    callback = callback,
    downstream_edge_uuid="08058fc6-3374-407a-b9ed-fcbe81217ac9",
    upstream_edge_uuid="2e21f332-fb85-4679-ba55-e07e36c12667"
)

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

orphe-0.1.10.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

orphe-0.1.10-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file orphe-0.1.10.tar.gz.

File metadata

  • Download URL: orphe-0.1.10.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for orphe-0.1.10.tar.gz
Algorithm Hash digest
SHA256 f6e5aba84031e3a626950edb24281435236f937322bd38c6ecc611b2a62b5c20
MD5 2569c1e8dc725dc37159d1a51bf47331
BLAKE2b-256 d1aed686ce6b267eb7fa0aeb5836cfb56da19ff526a2bea6632f75690b3270c7

See more details on using hashes here.

File details

Details for the file orphe-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: orphe-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for orphe-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 56ef1e481fc498faba3efe6e37c0471606b8f8a2681dcb2ef1e8f465b8343c70
MD5 5d6ebcdd8c0f24f63fb986e14bf02451
BLAKE2b-256 2095501d34608e5516c76744eb15820239dea17de18a02a2e56dfbdc2e26c481

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