SOXAI Data Science Library
Project description
soxai_data Python Package
This package provides a data loader for SOXAI ring users to access and analyze their data.
Installation
Install the package using pip:
pip install soxai_data
Usage
First, obtain your token by logging into the SOXAI Platform. After logging in, generate your token and use it to load the data.
Initialize DataLoader
from soxai_data import DataLoader
# Initialize the DataLoader with your token
sx_data = DataLoader(token='your_token')
Get Daily Data
You can retrieve daily data and plot it as follows:
# Retrieve daily data
df = sx_data.getDailyData()
# Plot the data
df.plot()
Get Account Information
To get your account information:
# Retrieve account information
my_info = sx_data.getMyInfo()
print(my_info)
Get Organization Users
If you have an organization ID, you can get the users associated with it:
# Retrieve organization users
my_org_id = my_info['myOrg']['orgId']
org_df = sx_data.getMyOrgUsers(my_org_id)
print(org_df)
Merge DataFrames
You can merge the data with organization user information based on a common field:
# Merge daily data with organization user data
merged_df = df.merge(org_df, on='uid', how='left')
print(merged_df)
Get Detail Data
To retrieve detailed data within a specified date range:
# Retrieve detailed data
detail_df = sx_data.getDetailData(start_date='2023-01-01', end_date='2023-01-31')
print(detail_df)
Get Daily Info Data (V2)
To retrieve daily info data for specific users using the V2 API:
# Retrieve daily info data for specified uids
daily_info_df = sx_data.getDailyInfoV2(
start_date='2026-01-01',
end_date='2026-01-07',
uid_list=['uid1', 'uid2']
)
print(daily_info_df)
Get Daily Detail Data (V2)
To retrieve daily detail data for specific users with datetime-level precision using the V2 API.
The datetime must be in YYYY-MM-DDThh:mm:ss+HH:MM format with a timezone offset:
# Retrieve daily detail data for specified uids within a datetime range
daily_detail_df = sx_data.getDailyDataV2(
start_datetime='2026-01-20T00:00:00+09:00',
end_datetime='2026-01-20T02:00:00+09:00',
uid_list=['uid1', 'uid2']
)
print(daily_detail_df)
Complete Example
Here's a complete example that includes retrieving and merging data:
from soxai_data import DataLoader
# Initialize the DataLoader
sx_data = DataLoader(token='your_token')
# Get daily data
df = sx_data.getDailyData()
# Get account information
my_info = sx_data.getMyInfo()
my_org_id = my_info['myOrg']['orgId']
# Get organization users
org_df = sx_data.getMyOrgUsers(my_org_id)
# Merge data
merged_df = df.merge(org_df, on='uid', how='left')
# Display the merged DataFrame
print(merged_df)
Methods
DataLoader.getMyInfo()
Retrieves the account information.
Returns:
dict: My personal information.
DataLoader.getMyOrgUsers(org_id=None)
Retrieves the users associated with the specified organization.
Parameters:
org_id(str, optional): The ID of the organization. If not provided, the method will use the default organization ID.
Returns:
pandas.DataFrame: The DataFrame containing the users associated with the specified organization.
DataLoader.getDailyData(start_date=None, end_date=None, convert_to_local_time=True)
Retrieves daily data from the SOXAI database within the specified date range.
Parameters:
start_date(str, optional): The start date of the data range. Defaults to '-7d'.end_date(str, optional): The end date of the data range. Defaults to 'now()'.convert_to_local_time(bool, optional): Whether to convert the time to local time. Defaults to True.
Returns:
pandas.DataFrame: A DataFrame containing the retrieved data.
DataLoader.getDetailData(start_date=None, end_date=None, convert_to_local_time=True)
Retrieves detailed data from the SOXAI database within the specified date range.
Parameters:
start_date(str, optional): The start date of the data range. Defaults to '-1d'.end_date(str, optional): The end date of the data range. Defaults to 'now()'.convert_to_local_time(bool, optional): Whether to convert the time to local time. Defaults to True.
Returns:
pandas.DataFrame: A DataFrame containing the retrieved data.
DataLoader.getDailyInfoV2(start_date=None, end_date=None, uid_list=[], timeout=60.0)
Retrieves daily info data from the SOXAI v2 API for the specified users and date range.
Parameters:
start_date(str, optional): The start date inYYYY-MM-DDformat. Defaults to 7 days before today.end_date(str, optional): The end date inYYYY-MM-DDformat. Defaults to today.uid_list(list): List of uids to fetch data for.timeout(float, optional): Timeout in seconds. Defaults to 60.0.
Returns:
pandas.DataFrame: A DataFrame containing the retrieved data, or None if no data or an error occurred.
Raises:
ValueError: If the date format is invalid or start_date is after end_date.
DataLoader.getDailyDataV2(start_datetime, end_datetime, uid_list=[], timeout=60.0)
Retrieves daily detail data from the SOXAI v2 API for the specified users and datetime range.
Unlike getDailyInfoV2, this method accepts datetime strings with time and timezone information, enabling hour-level data retrieval.
Parameters:
start_datetime(str): The start datetime inYYYY-MM-DDThh:mm:ss+HH:MMformat (timezone required). e.g.2026-01-20T00:00:00+09:00end_datetime(str): The end datetime inYYYY-MM-DDThh:mm:ss+HH:MMformat (timezone required). e.g.2026-01-20T02:00:00+09:00uid_list(list): List of uids to fetch data for.timeout(float, optional): Timeout in seconds. Defaults to 60.0.
Returns:
pandas.DataFrame: A DataFrame containing the retrieved data, or None if no data or an error occurred.
Raises:
ValueError: If the datetime format is invalid, timezone is missing, or start_datetime is not before end_datetime.
Additional Notes
- Ensure your token is valid and has not expired.
- Handle exceptions and errors gracefully while making API calls.
- Utilize Pandas' powerful data manipulation capabilities to analyze and visualize your data efficiently.
By following this guide, you should be able to effectively use the soxai_data package to retrieve, analyze, and visualize data from the SOXAI platform.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file soxai_data-0.0.4.tar.gz.
File metadata
- Download URL: soxai_data-0.0.4.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14aebef71ab12d754d8f23b40e373a7ab712e3b20a5fe87bc13869e8517a9a4b
|
|
| MD5 |
acb4b0c691068e19f0c97bcfc03ac41f
|
|
| BLAKE2b-256 |
61e8e86f3538106a4d3b5df4666c4fcbe74124e98fd782f6fc24eb5acff1683d
|
Provenance
The following attestation bundles were made for soxai_data-0.0.4.tar.gz:
Publisher:
release.yml on soxaidev/soxai_data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
soxai_data-0.0.4.tar.gz -
Subject digest:
14aebef71ab12d754d8f23b40e373a7ab712e3b20a5fe87bc13869e8517a9a4b - Sigstore transparency entry: 1008346098
- Sigstore integration time:
-
Permalink:
soxaidev/soxai_data@3c6a595e6b06cef816ed5eef7b6620df9c2fa707 -
Branch / Tag:
refs/heads/release - Owner: https://github.com/soxaidev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3c6a595e6b06cef816ed5eef7b6620df9c2fa707 -
Trigger Event:
push
-
Statement type:
File details
Details for the file soxai_data-0.0.4-py3-none-any.whl.
File metadata
- Download URL: soxai_data-0.0.4-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baa4b458c1e650157b42ae567138aa32eeae00af20776038f91a3f8355228c2b
|
|
| MD5 |
3127d92539722bc3e76ed5c43eb00ba4
|
|
| BLAKE2b-256 |
b5cc70bd3fd4d6c739471f6daf6b71f7c424ef52151ed01b50397ebc28dee179
|
Provenance
The following attestation bundles were made for soxai_data-0.0.4-py3-none-any.whl:
Publisher:
release.yml on soxaidev/soxai_data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
soxai_data-0.0.4-py3-none-any.whl -
Subject digest:
baa4b458c1e650157b42ae567138aa32eeae00af20776038f91a3f8355228c2b - Sigstore transparency entry: 1008346099
- Sigstore integration time:
-
Permalink:
soxaidev/soxai_data@3c6a595e6b06cef816ed5eef7b6620df9c2fa707 -
Branch / Tag:
refs/heads/release - Owner: https://github.com/soxaidev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3c6a595e6b06cef816ed5eef7b6620df9c2fa707 -
Trigger Event:
push
-
Statement type: