sensorfabric


Namesensorfabric JSON
Version 3.2.3 PyPI version JSON
download
home_pagehttps://github.com/UArizonaCB2/sensorfabric-py.git
SummaryPython library for UA Sensor Fabric
upload_time2025-07-28 21:42:46
maintainerNone
docs_urlNone
authorShravan Aras
requires_python>=3
licenseMIT
keywords sensors sensorfabric
VCS
bugtrack_url
requirements attrs awswrangler boto3 botocore certifi cffi charset-normalizer configparser cryptography flatten-json idna jmespath jsonschema jsonschema-specifications numpy packaging pandas pathlib pyarrow pycparser PyJWT python-dateutil pytz referencing requests rpds-py s3transfer setuptools six typing_extensions tzdata urllib3
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Package for Sensor Fabric

Welcome to the python package for SensorFabric. 

## What is SensorFabric?

SensorFabric is an initiative by University of Arizona's Center of Bioinformatics and Biostatistics (CB2)
to create homogenous layer for accessing, storing and processing sensor data.

## How to install it?

You can install the sensorfabric python library using `pip` as follows
```
pip install sensorfabric
```

## Getting Started

SensorFabric has several different modules. We try to give a basic overview here.

### Athena Module
The Athena module abstracts query execution and caching, by returning results from AWS Athena
as Pandas dataframes. </br>
**To run this locally you must have aws credentials configured using `aws configure`**

Example
```
from sensorfabric.athena import athena
import pandas as pd

# Create an object.
db = athena(database='MyExampleDatabase')

# Execute a query by performing a blocking operation.
frame = db.execQuery('SELECT "participantId" FROM "fitbit_hr" LIMIT 5')
# Print out the pandas frame.
print(frame.head())

# Queries can also be run async (callbacks are currently not supported)
executionId = db.startQueryExec('SELECT "participantId" FROM "fitbit_hr" LIMIT 5')
# Returns immidately, with the query execution ID. 

# Do some important work here

frame = db.queryResults(executionId)
# Returns the query result as a dataframe
print(frame.head()) 
```

**Enabling offline caching**
In order to enable offline caching for queries pass `offlineCache=True` to `Athena()`.
When caching is enabled a `.cache` folder is creating in the calling directory, and query
results are stored in it. Files are named using the md5 hash of the query string. 
Pass `cached=True` to `execQuery()` in order to use cached results. The following important
points need to be noted when using caching -
* Only exact query strings will cache to the same files.
* Both `offlineCache` and `cached` must be set true for this to work.
* There is currently no time limit on the cached results (This might change). 
* If you want to reset the cache you can delete the `.cache directory`.

Example
```
db = athena(database='MyBigDatabase', offlineCache=True)

# The first query will hit Athena but cache the local results in the .cache directory.
frame = db.execQuery('SELECT DISTINCT(pid) FROM temperature', cached=True)
print(frame.head())
# The second exact query will return results from the local cache.
frame = db.execQuery('SELECT DISTINCT(pid) FROM temperature', cached=True)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/UArizonaCB2/sensorfabric-py.git",
    "name": "sensorfabric",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": null,
    "keywords": "sensors sensorfabric",
    "author": "Shravan Aras",
    "author_email": "shravanaras@arizona.edu",
    "download_url": "https://files.pythonhosted.org/packages/d5/76/91e2d92243f79265bd6b1ffe8afe3e27f28087c0d6227a20ba85d3d2adf4/sensorfabric-3.2.3.tar.gz",
    "platform": null,
    "description": "# Python Package for Sensor Fabric\n\nWelcome to the python package for SensorFabric. \n\n## What is SensorFabric?\n\nSensorFabric is an initiative by University of Arizona's Center of Bioinformatics and Biostatistics (CB2)\nto create homogenous layer for accessing, storing and processing sensor data.\n\n## How to install it?\n\nYou can install the sensorfabric python library using `pip` as follows\n```\npip install sensorfabric\n```\n\n## Getting Started\n\nSensorFabric has several different modules. We try to give a basic overview here.\n\n### Athena Module\nThe Athena module abstracts query execution and caching, by returning results from AWS Athena\nas Pandas dataframes. </br>\n**To run this locally you must have aws credentials configured using `aws configure`**\n\nExample\n```\nfrom sensorfabric.athena import athena\nimport pandas as pd\n\n# Create an object.\ndb = athena(database='MyExampleDatabase')\n\n# Execute a query by performing a blocking operation.\nframe = db.execQuery('SELECT \"participantId\" FROM \"fitbit_hr\" LIMIT 5')\n# Print out the pandas frame.\nprint(frame.head())\n\n# Queries can also be run async (callbacks are currently not supported)\nexecutionId = db.startQueryExec('SELECT \"participantId\" FROM \"fitbit_hr\" LIMIT 5')\n# Returns immidately, with the query execution ID. \n\n# Do some important work here\n\nframe = db.queryResults(executionId)\n# Returns the query result as a dataframe\nprint(frame.head()) \n```\n\n**Enabling offline caching**\nIn order to enable offline caching for queries pass `offlineCache=True` to `Athena()`.\nWhen caching is enabled a `.cache` folder is creating in the calling directory, and query\nresults are stored in it. Files are named using the md5 hash of the query string. \nPass `cached=True` to `execQuery()` in order to use cached results. The following important\npoints need to be noted when using caching -\n* Only exact query strings will cache to the same files.\n* Both `offlineCache` and `cached` must be set true for this to work.\n* There is currently no time limit on the cached results (This might change). \n* If you want to reset the cache you can delete the `.cache directory`.\n\nExample\n```\ndb = athena(database='MyBigDatabase', offlineCache=True)\n\n# The first query will hit Athena but cache the local results in the .cache directory.\nframe = db.execQuery('SELECT DISTINCT(pid) FROM temperature', cached=True)\nprint(frame.head())\n# The second exact query will return results from the local cache.\nframe = db.execQuery('SELECT DISTINCT(pid) FROM temperature', cached=True)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python library for UA Sensor Fabric",
    "version": "3.2.3",
    "project_urls": {
        "Homepage": "https://github.com/UArizonaCB2/sensorfabric-py.git"
    },
    "split_keywords": [
        "sensors",
        "sensorfabric"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d57691e2d92243f79265bd6b1ffe8afe3e27f28087c0d6227a20ba85d3d2adf4",
                "md5": "2d1b6971fc5d0a871054740686f255fd",
                "sha256": "47c0a2d2f5004d34f47f2cbc43cc6aa0b9f3bdf4a540f59afb8514e1456c5dec"
            },
            "downloads": -1,
            "filename": "sensorfabric-3.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "2d1b6971fc5d0a871054740686f255fd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 32909,
            "upload_time": "2025-07-28T21:42:46",
            "upload_time_iso_8601": "2025-07-28T21:42:46.131022Z",
            "url": "https://files.pythonhosted.org/packages/d5/76/91e2d92243f79265bd6b1ffe8afe3e27f28087c0d6227a20ba85d3d2adf4/sensorfabric-3.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-28 21:42:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "UArizonaCB2",
    "github_project": "sensorfabric-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "attrs",
            "specs": [
                [
                    "==",
                    "25.3.0"
                ]
            ]
        },
        {
            "name": "awswrangler",
            "specs": [
                [
                    "==",
                    "3.12.0"
                ]
            ]
        },
        {
            "name": "boto3",
            "specs": [
                [
                    "==",
                    "1.38.22"
                ]
            ]
        },
        {
            "name": "botocore",
            "specs": [
                [
                    "==",
                    "1.38.22"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2025.4.26"
                ]
            ]
        },
        {
            "name": "cffi",
            "specs": [
                [
                    "==",
                    "1.17.1"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.4.2"
                ]
            ]
        },
        {
            "name": "configparser",
            "specs": [
                [
                    "==",
                    "7.2.0"
                ]
            ]
        },
        {
            "name": "cryptography",
            "specs": [
                [
                    "==",
                    "45.0.2"
                ]
            ]
        },
        {
            "name": "flatten-json",
            "specs": [
                [
                    "==",
                    "0.1.14"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.10"
                ]
            ]
        },
        {
            "name": "jmespath",
            "specs": [
                [
                    "==",
                    "1.0.1"
                ]
            ]
        },
        {
            "name": "jsonschema",
            "specs": [
                [
                    "==",
                    "4.24.0"
                ]
            ]
        },
        {
            "name": "jsonschema-specifications",
            "specs": [
                [
                    "==",
                    "2025.4.1"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "2.2.6"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "25.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "2.2.3"
                ]
            ]
        },
        {
            "name": "pathlib",
            "specs": [
                [
                    "==",
                    "1.0.1"
                ]
            ]
        },
        {
            "name": "pyarrow",
            "specs": [
                [
                    "==",
                    "20.0.0"
                ]
            ]
        },
        {
            "name": "pycparser",
            "specs": [
                [
                    "==",
                    "2.22"
                ]
            ]
        },
        {
            "name": "PyJWT",
            "specs": [
                [
                    "==",
                    "2.10.1"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.9.0.post0"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    "==",
                    "2025.2"
                ]
            ]
        },
        {
            "name": "referencing",
            "specs": [
                [
                    "==",
                    "0.36.2"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "rpds-py",
            "specs": [
                [
                    "==",
                    "0.25.1"
                ]
            ]
        },
        {
            "name": "s3transfer",
            "specs": [
                [
                    "==",
                    "0.13.0"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    "==",
                    "80.8.0"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.17.0"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "==",
                    "4.14.0"
                ]
            ]
        },
        {
            "name": "tzdata",
            "specs": [
                [
                    "==",
                    "2025.2"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.4.0"
                ]
            ]
        }
    ],
    "lcname": "sensorfabric"
}
        
Elapsed time: 0.75297s