orphe


Nameorphe JSON
Version 0.1.9 PyPI version JSON
download
home_pagehttps://orphe.io/
SummaryORPHE ANALYTICIS SDK for Python
upload_time2024-03-21 01:34:41
maintainerNone
docs_urlNone
authorORPHE Inc.
requires_python>=3.5
licenseApache License 2.0
keywords orphe orphe analytics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
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.

```bash
$ pip install orphe
```

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

```bash
$ 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.

```python
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.

```python
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.

```python
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"
)
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://orphe.io/",
    "name": "orphe",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": "orphe, orphe analytics",
    "author": "ORPHE Inc.",
    "author_email": "support@orphe.io",
    "download_url": "https://files.pythonhosted.org/packages/5e/dc/5a204d44d75decc3140b8cd18e9021f6db673485797f890a9f97a2cb0ffb/orphe-0.1.9.tar.gz",
    "platform": null,
    "description": "\nORPHE ANALYTICIS SDK for Python is a client library that accesses the ORPHE ANALYTICS resource API and real-time API.\n\n## Install\n\nYou can install ORPHE ANALYTICIS SDK for Python (hereafter orphe-py) using PyPI. Install with the following command.\n\n```bash\n$ pip install orphe\n```\n\nIf you are using Python 3, you can install it with the following command.\n\n```bash\n$ pip3 install orphe\n```\n\n## Usage\n\nTo 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.\n\n```python\nimport orphe\n\nanalytics = orphe.Analytics(\n    url = \"https://example.analytics.orphe.ai\",\n    token = \"your_token\",\n)\n```\n\nExample:\nAn example for retrieving and storing a value is given below.\n\n```python\nimport orphe\n\n# Generate a client with a URL and an edge token\nanalytics = orphe.Analytics(\n    url = \"https://example.analytics.orphe.ai\",\n    token= \"your_token\"\n)\n# Get data by specifying the measurement UUID\nanalyzed = analytics.load(\n    measurement_uuid = \"e07cdf8c-83e6-46cf-8a03-e315eef6162a\",\n)\n\n# Extract, analyze and display values from stored data (channel 1 -> plantar left, channel 2 -> plantar right)\nfor gait in analyzed.gait.stored[1]:\n    print(f\"Plantar left/{gait.time}/{gait.quaternion_w}/{gait.quaternion_x}/{gait.quaternion_y}/{gait.quaternion_z}\")\n\nfor gait in analyzed.gait.stored[2]:\n    print(f\"Plantar right/{gait.time}/{gait.quaternion_w}/{gait.quaternion_x}/{gait.quaternion_y}/{gait.quaternion_z}\")\n    \n# 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)\nfor gait in analyzed.gait.stored[3]:\n    if not gait.analyzed:\n        continue\n    print(f\"Instep left/{gait.time}/{gait.stride}/{gait.cadence}/{gait.duration}\")\n\nfor gait in analyzed.gait.stored[4]:\n    if not gait.analyzed:\n        continue\n    print(f\"Instep right/{gait.time}/{gait.stride}/{gait.cadence}/{gait.duration}\")\n\n# To save the value, use [orphe.Unit]\nunits = []\nfor gait in analyzed.gait.left:\n    units.append(orphe.Unit(\n        time = gait.time,\n        id = \"Height\",\n        value = 160\n    ))\n\n# Save the data by specifying the measurement UUID and the list of [orphe.Unit].\nanalytics.save(\n    measurement_uuid=\"e07cdf8c-83e6-46cf-8a03-e315eef6162a\",\n    units=units\n)\n```\n\nAfter analytics.load is performed, the retrieved valuesanalyzed will contain the values retrieved from ORPHE CORE and the values analyzed by ANALYTICS.\nBy gait, the data of gait analysis is retrieved, and left and right data can be retrieved respectively.\n\nIn addition, if you want to perform real-time analysis, you can use the following method.\n\n```python\nimport orphe\n\n# Generate a client with a URL and an edge token\nanalytics = orphe.Analytics(\n    url = \"https://example.analytics.orphe.ai\",\n    token= \"your_token\"\n)\n\n# Defines a callback for realtime. [value] will contain the raw and parsed data.\n# New real-time data can be sent by returning list[Unit].\n# * Real-time data transmission is sent to a separate edge specified by [upstream_edge_uuid].\ndef callback(value: AnalyticsValue) -> list[Unit]:\n    if value.gait.left.stride != None:\n        print(value.gait.left.stride)\n    if value.gait.left.euler_x != None:\n        print(value.gait.left.euler_x)\n        \n    units = []\n    time = value.pose.realtime.time\n    val = random.randint(0, 100)\n    units.append(Unit(\n        time=time,\n        channel=3,\n        id=\"RANDOM\",\n        value=val,\n    ))\n    return units\n\n# Start real-time acquisition by specifying the callback and the ID of the edge.\n# Specify the EdgeUUID to get the real-time data being measured in [downstream_edge_uuid].\n# Specify the EdgeUUID for sending real-time values from the SDK in [upstream_edge_uuid].\nanalytics.realtime(\n    callback = callback,\n    downstream_edge_uuid=\"08058fc6-3374-407a-b9ed-fcbe81217ac9\",\n    upstream_edge_uuid=\"2e21f332-fb85-4679-ba55-e07e36c12667\"\n)\n```\n\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "ORPHE ANALYTICIS SDK for Python",
    "version": "0.1.9",
    "project_urls": {
        "Homepage": "https://orphe.io/"
    },
    "split_keywords": [
        "orphe",
        " orphe analytics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "64afa531da43e130982645b5df1b516f20f8d24aaba69cc61bb0ff8341595526",
                "md5": "19ca02c3029fa2c779c58a92b8f81f42",
                "sha256": "abd089c5b20fabb63db8b038bea18349ab7119462b062987aa0dd59c35e60a0c"
            },
            "downloads": -1,
            "filename": "orphe-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "19ca02c3029fa2c779c58a92b8f81f42",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 14780,
            "upload_time": "2024-03-21T01:34:39",
            "upload_time_iso_8601": "2024-03-21T01:34:39.139135Z",
            "url": "https://files.pythonhosted.org/packages/64/af/a531da43e130982645b5df1b516f20f8d24aaba69cc61bb0ff8341595526/orphe-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5edc5a204d44d75decc3140b8cd18e9021f6db673485797f890a9f97a2cb0ffb",
                "md5": "7c577ba3355cd3de161d800d361089ab",
                "sha256": "0501e73d93efbc83c8b63c00858d58c0fe4f4da477997297030b2f604e89ee69"
            },
            "downloads": -1,
            "filename": "orphe-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "7c577ba3355cd3de161d800d361089ab",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 14656,
            "upload_time": "2024-03-21T01:34:41",
            "upload_time_iso_8601": "2024-03-21T01:34:41.341462Z",
            "url": "https://files.pythonhosted.org/packages/5e/dc/5a204d44d75decc3140b8cd18e9021f6db673485797f890a9f97a2cb0ffb/orphe-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-21 01:34:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "orphe"
}
        
Elapsed time: 0.20436s