Skip to main content

A Python toolkit for analysis of graphomotor data collected via Curious

Project description

Graphomotor Study Toolkit

A Python toolkit for analysis of graphomotor data collected via Curious.

DOI

Build codecov Ruff stability-experimental LGPL--2.1 License Documentation

Welcome to graphomotor, a specialized Python library for analyzing graphomotor data collected via Curious. This toolkit provides comprehensive tools for processing, analyzing, and visualizing data from various graphomotor assessment tasks including spiral drawing, trails making, alphabetic writing, digit symbol substitution, and the Rey-Osterrieth Complex Figure Test.

Development Progress

⚠️ This package is under active development. Currently, the focus is on the Spiral task. After finalizing feature extraction, the next steps will involve implementing both preprocessing and visualization for this task. Once these parts are in place, we plan to extend support to other tasks.

Task Preprocessing Feature Extraction Visualization
Spiral Spiral: Preprocessing Pending Spiral: Feature Extraction In Progress Spiral: Visualization Pending
Rey-Osterrieth Complex Figure Rey-Osterrieth: Preprocessing Pending Rey-Osterrieth: Feature Extraction Pending Rey-Osterrieth: Visualization Pending
Alphabetic Writing Alphabetic Writing: Preprocessing Pending Alphabetic Writing: Feature Extraction Pending Alphabetic Writing: Visualization Pending
Digit Symbol Substitution Digit Symbol Substitution: Preprocessing Pending Digit Symbol Substitution: Feature Extraction Pending Digit Symbol Substitution: Visualization Pending
Trails Making Trails Making: Preprocessing Pending Trails Making: Feature Extraction Pending Trails Making: Visualization Pending

Data Format Requirements

⚠️ This implementation requires data to adhere to a specific format matching the standard output from Curious drawing responses.

When exporting drawing data from Curious, you typically receive the following files:

  • report.csv: Contains the participants' actual responses.
  • activity_user_journey.csv: Logs the entire journey through the activity, including button actions like "Next", "Skip", "Back", and "Undo", regardless of whether a response was provided.
  • drawing-responses-{date}.zip: A ZIP archive with raw drawing response CSV files for each participant (e.g., drawing-responses-Mon May 29 2023.zip).
  • media-responses-{date}.zip: A ZIP archive containing SVG files for the drawing responses (e.g., media-responses-Mon May 29 2023.zip).
  • trails-responses-{date}.zip: A ZIP archive with raw trail making response CSV files (if there are any) for each participant (e.g., trails-responses-Mon May 29 2023.zip).

For Spiral tasks, the toolkit uses only the CSV files from the drawing responses ZIP. Support for additional tasks will be added in future releases.

File Naming Convention

Your spiral data files must follow this naming convention:

[5123456]a7f3b2e9-d4c8-f1a6-e5b9-c2d7f8a3e6b4-spiral_trace1_Dom.csv

Where:

  • Participant ID: Must be enclosed in brackets [] and be a 7-digit number starting with 5 (e.g., [5123456]) that matches the target_secret_id column in the report.csv file.
  • Activity Submission ID: Must be a 32-character hexadecimal string (e.g., 18f2-45ea-a1e4-2334e07cc706) that matches the id column in the report.csv file.
  • Task: Must be one of the following that matches the item column in the report.csv file:
    • spiral_trace1_Dom through spiral_trace5_Dom (dominant hand tracing tasks)
    • spiral_trace1_NonDom through spiral_trace5_NonDom (non-dominant hand tracing tasks)
    • spiral_recall1_Dom through spiral_recall3_Dom (dominant hand recall tasks)
    • spiral_recall1_NonDom through spiral_recall3_NonDom (non-dominant hand recall tasks)

Data Format

Your spiral data CSV file must contain the following columns:

line_number, x, y, UTC_Timestamp, seconds, epoch_time_in_seconds_start

This format represents the standard output from Curious drawing responses data dictionary.

Feature Extraction Capabilities

The toolkit extracts clinically relevant metrics from digitized drawing data. Currently implemented features include:

  • Temporal Features: Task completion duration.
  • Velocity Features: Velocity analysis including linear, radial, and angular velocity components with statistical measures (sum, median, variation, skewness, kurtosis).
  • Distance Features: Spatial accuracy measurements using Hausdorff distance metrics with temporal normalizations and segment-specific analysis.
  • Drawing Error Features: Area under the curve (AUC) calculations between drawn paths and ideal reference trajectories to quantify spatial accuracy.

Installation

Install the graphomotor package from PyPI:

pip install graphomotor

Or install the latest development version directly from GitHub:

pip install git+https://github.com/childmindresearch/graphomotor

Quick Start

Currently, graphomotor is available as an importable Python library. CLI functionality is planned for future releases.

Extracting Features from Spiral Drawing Data

from graphomotor.core import orchestrator

# Path to your spiral drawing data file
input_file = "path/to/your/spiral_data.csv"

# Directory where extracted features will be saved
output_dir = "path/to/output/directory"

# Run the analysis pipeline
features = orchestrator.run_pipeline(
    input_path=input_file,
    output_path=output_dir
)

# Features are returned as a dictionary and saved as CSV
print(f"Successfully extracted {len(features)} feature categories")

For detailed configuration options and additional parameters, refer to the run_pipeline documentation.

Note: Currently, only single file processing is supported, with batch processing planned for future releases.

Future Directions

The Graphomotor Study Toolkit is under active development. For more detailed information about upcoming features and development plans, please refer to our GitHub Issues page.

Contributing

We welcome contributions from the community! If you're interested in contributing, please review our Contributing Guidelines for information on how to get started, coding standards, and the pull request process.

References

  1. Messan, K. S., Kia, S. M., Narayan, V. A., Redmond, S. J., Kogan, A., Hussain, M. A., McKhann, G. M. II, & Vahdat, S. (2022). Assessment of Smartphone-Based Spiral Tracing in Multiple Sclerosis Reveals Intra-Individual Reproducibility as a Major Determinant of the Clinical Utility of the Digital Test. Frontiers in Medical Technology, 3, 714682. https://doi.org/10.3389/fmedt.2021.714682

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

graphomotor-0.1.1.tar.gz (190.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphomotor-0.1.1-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file graphomotor-0.1.1.tar.gz.

File metadata

  • Download URL: graphomotor-0.1.1.tar.gz
  • Upload date:
  • Size: 190.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for graphomotor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e08ecd55b7c64a36d12ed5b8aa6cdadd6f4b421938bbff1c368810881e0526ef
MD5 8d675b6f73e4b5d6b35e9a90d8520be7
BLAKE2b-256 3aaaa2a202fbea793643d1db94536fcc6b2414b711d1478e3601f4f2be4d1417

See more details on using hashes here.

Provenance

The following attestation bundles were made for graphomotor-0.1.1.tar.gz:

Publisher: pypi.yaml on childmindresearch/graphomotor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graphomotor-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: graphomotor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for graphomotor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bad25c8cab366eb00d9b2a1cdd02ef49a36091546a75287c0155e9e48a33eb01
MD5 d7d58a0eee3b366d88463ddf0d98732f
BLAKE2b-256 07ff8e3cafe77e9a3ad37e968d098ff85c4a89ee7da022ca630590bad09ce7bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for graphomotor-0.1.1-py3-none-any.whl:

Publisher: pypi.yaml on childmindresearch/graphomotor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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