Skip to main content

RiseDatabase Python Library

The RiseDatabase Python library provides tools to download, process, and visualize accelerometer datasets collected from structural monitoring systems. The library interacts with a Flask-based API backend to securely fetch datasets stored in a private Google Drive repository. It includes features for downloading datasets, applying baseline correction to signals, and plotting time-series accelerometer data.

Features

  • Dataset Management: List available datasets and download them with a progress bar.
  • Signal Processing: Perform baseline correction (mean subtraction or polynomial fitting).
  • Visualization: Plot time-series data from accelerometer recordings.

Flask API Backend

The API backend is built using Flask and is hosted on Heroku. It provides secure access to datasets stored in a private Google Drive folder. The API includes the following key endpoints:

  • GET /list: Returns a list of available datasets, including their unique IDs and names.
  • GET /download/<file_id>: Streams the requested dataset file based on its ID.

The backend uses a Google Cloud service account to authenticate with Google Drive. To protect the private repository, API access is restricted using API keys, rate limiting, and custom user-agent verification. The JSON key file for the service account is encoded and stored as a Heroku environment variable to ensure security.

Example API Response (List Datasets)

{
    "files": [
        {"id": "1-B6wOK-axIJ69-Wn46VimuF9S5oi6e9J", "name": "39R-Bridge.zip"},
        {"id": "1-7bd1YH4C2TpXOvkFX7oFA7JUDMJ4RZX", "name": "T7-Bridge.zip"}
    ]
}

Installation

To install the library, run the following command:

pip install rise-database

The installation will automatically handle all necessary dependencies.

Usage

1. Initialize the Library

from rise_database import RiseDatabase

db = RiseDatabase()

2. List Available Datasets

print("Available datasets:", db.databases)

Example output:

{
    '1-B6wOK-axIJ69-Wn46VimuF9S5oi6e9J': '39R-Bridge.zip',
    '1-7bd1YH4C2TpXOvkFX7oFA7JUDMJ4RZX': 'T7-Bridge.zip'
}

3. Download and Extract a Dataset

valid_id = list(db.databases.keys())[0]  # Get the first dataset ID
db.download_dataset(valid_id)

This will download and extract the dataset to the data/ directory.

API Setup Overview

The Flask API backend performs the following tasks:

  1. List Datasets: Provides metadata about available datasets stored in Google Drive.
  2. Download Dataset: Streams requested datasets directly from Google Drive to the client.
  3. Secure Access: Utilizes Google Cloud service accounts for authentication and applies API keys, rate limiting, and user-agent verification to protect the data.

The backend is designed to be scalable and secure, leveraging Heroku for deployment and Google Cloud for storage integration.

Contributing

Contributions are welcome! If you'd like to add features or fix issues, please submit a pull request.

Metadata

Release files for rise-database 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rise-database 0.1.0
File Size Uploaded
rise_database-0.1.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rise-database 0.1.0
File Interpreter ABI Platform
rise_database-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / rise_database-0.1.0.tar.gz

Download URL rise_database-0.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
62a425f2c11cd7eb8f8227d51ec773e68bf3a4d327bb3ed031d35925c3321571
BLAKE2b-256 checksum
How to use checksums
1f1e13c63608fda82ddb1824f30a93b6c13ea481c22951714f7a442002b94372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / rise_database-0.1.0-py3-none-any.whl

Download URL rise_database-0.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b263d5a8f1408ef113563f99761136be8bf87d5e23c1f9180dd27889370f34f8
BLAKE2b-256 checksum
How to use checksums
c37130517d0b7955e972b63d46665ec8e7bd285dd3261b79e4a14c301fdbe7d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page