Skip to main content

ORPHE ANALYTICIS SDK for Python

Project description

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.left:
    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"
)

Documentation

Documentation and links to additional resources are available at https://analytics.orphe.io

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.5.tar.gz (14.6 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.5-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: orphe-0.1.5.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for orphe-0.1.5.tar.gz
Algorithm Hash digest
SHA256 471918ac281d3116504c85f1fe5ad71377b70bf662eca933130f1dd217350467
MD5 1282d31b38ab9eb5a0473c1fa1da091b
BLAKE2b-256 0038fbde172ba93e7bd27d51b948b067886eb46e770fcd674c64a89f27b970e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: orphe-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for orphe-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6e9f9de99495ebb24193b0b3a1846dcb7c41daf3c2034c575c6b87abea634171
MD5 fbec0e054b710ada11daf37ec9ed034b
BLAKE2b-256 9fe82d1ffef7d7b521ad2d97ecd506b63df336503a5558df61bd1b619dd0de84

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