Skip to content

jakdan99/carp_mobility_package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

112 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CARP Mobility Package

A comprehensive Flutter package for conducting standardized mobility assessments using smartphone and wearable sensors. This package provides clinical-grade mobility tests commonly used in healthcare and research settings to assess physical function, balance, and fall risk.

Features

Mobility Tests

  • Timed Up and Go (TUG) Test: Comprehensive assessment of mobility, balance, and fall risk
  • Walking Test (10-Meter Walk Test): Measures walking speed and gait performance
  • Sit-to-Stand Test (STS): Evaluates lower body strength and functional mobility
  • Shoulder Range of Motion (SROM) Tests: Assesses shoulder flexibility and range of motion
    • Flexion/Extension movements
    • Abduction movements
    • Internal/External rotation

Sensor Support

  • Smartphone Sensors: Built-in accelerometer, gyroscope, and magnetometer
  • Movesense Devices: External wearable sensors for enhanced precision
  • Flexible Sensor Placement: Support for various body locations (chest, waist, thigh, etc.)

Advanced Features

  • Real-time sensor data processing and analysis
  • Automatic event detection (stand-up, sit-down, turns, steps)
  • Calibration procedures for accurate measurements
  • Multi-language support with localization
  • Comprehensive result reporting with timing metrics
  • Research Package integration for structured test workflows

Getting Started

Prerequisites

  • Flutter SDK 3.7.2 or higher
  • Android/iOS device with motion sensors
  • (Optional) Movesense device for enhanced sensor capabilities

Installation

Add this package to your pubspec.yaml:

dependencies:
  carp_mobility_package: ^0.1.0

Run:

flutter pub get

Permissions

Add the following permissions to your app:

Android (android/app/src/main/AndroidManifest.xml):

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

iOS (ios/Runner/Info.plist):

<key>NSBluetoothAlwaysUsageDescription</key>
<string>This app uses Bluetooth to connect to Movesense devices</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app uses location services for Bluetooth device discovery</string>

Usage

Basic TUG Test Implementation

import 'package:carp_mobility_package/carp_mobility_package.dart';
import 'package:research_package/research_package.dart';

class MobilityTestScreen extends StatefulWidget {
  @override
  _MobilityTestScreenState createState() => _MobilityTestScreenState();
}

class _MobilityTestScreenState extends State<MobilityTestScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: RPUITask(
        task: TugTask(identifier: 'tug_assessment'),
        onSubmit: (RPTaskResult result) {
          // Handle test results
          print('TUG Test completed: ${result.toString()}');
        },
      ),
    );
  }
}

Walking Test with Custom Parameters

import 'package:carp_mobility_package/carp_mobility_package.dart';

// Create a custom walking test with specific step count
final wtMeasure = WTMeasure(
  type: 'wt',
  name: 'Custom Walk Test',
  numberOfSteps: 20, // Custom step count
);

final walkingTask = WTTask(
  identifier: 'walking_assessment',
  measure: wtMeasure,
);

// Use in RPUITask
RPUITask(
  task: walkingTask,
  onSubmit: (result) {
    final wtResult = result.results['wt_test'] as WTResult?;
    if (wtResult != null) {
      print('Walking time: ${wtResult.time} seconds');
    }
  },
)

Sit-to-Stand Test

import 'package:carp_mobility_package/carp_mobility_package.dart';

final stsTask = StsTask(identifier: 'sts_assessment');

RPUITask(
  task: stsTask,
  onSubmit: (result) {
    final stsResult = result.results['sts_test'] as StsResult?;
    if (stsResult != null) {
      print('STS repetitions: ${stsResult.repetitions}');
      print('Test duration: ${stsResult.duration}');
    }
  },
)

Shoulder Range of Motion Tests

import 'package:carp_mobility_package/carp_mobility_package.dart';

// Flexion test
final flexionTask = FlexionTask(identifier: 'shoulder_flexion');

// Abduction test
final abductionTask = AbductionTask(identifier: 'shoulder_abduction');

// External rotation test
final externalRotationTask = ExternalRotationTask(identifier: 'shoulder_external_rotation');

Test Descriptions

Timed Up and Go (TUG) Test

The TUG test measures the time it takes for a person to stand up from a chair, walk a short distance, turn around, walk back, and sit down. It includes:

  • Stand-up detection using accelerometer data
  • Turn detection using gyroscope integration
  • Sit-down detection with timing validation
  • Calibration phase for accurate turn angle measurement

Walking Test (10-Meter Walk Test)

Measures walking speed and step detection over a specified distance:

  • Real-time step counting using accelerometer peaks
  • Configurable step targets (default: 15 steps)
  • Walking time measurement for speed calculation
  • Optimized for various sensor placements

Sit-to-Stand Test

Evaluates lower body strength through repeated standing motions:

  • 30-second test duration
  • Automatic repetition counting
  • Stand/sit cycle detection
  • Performance metrics calculation

Shoulder Range of Motion Tests

Assess shoulder joint flexibility and mobility:

  • Flexion/Extension: Forward and backward arm movements
  • Abduction: Arm movement away from body
  • Internal/External Rotation: Rotational movements
  • Gyroscope-based angle measurement

Configuration Options

Sensor Locations

  • SensorLocation.chest - Chest mounted (recommended for TUG)
  • SensorLocation.waist - Waist/belt mounted
  • SensorLocation.pocket - Smartphone in pocket
  • SensorLocation.thigh - Thigh mounted
  • SensorLocation.upperArm - Upper arm (for SROM tests)

Sampling Rates

  • Accelerometer: 26Hz, 52Hz, 104Hz, 208Hz
  • Gyroscope: 26Hz, 52Hz, 104Hz, 208Hz
  • Magnetometer: 26Hz, 52Hz, 104Hz, 208Hz

Example App

A complete example application is available in the /example directory, demonstrating:

  • All mobility test implementations
  • Sensor selection interfaces
  • Result processing and display
  • Best practices for integration

To run the example:

cd example
flutter run

Localization

The package supports multiple languages:

  • English (en)
  • Danish (da)
  • Hungarian (hu)

Add custom translations by extending the localization files in assets/lang/.

Research Integration

This package is designed for clinical research and integrates with:

Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests for any improvements.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this package in research, please cite:

CARP Mobility Package. (2025). Copenhagen Research Platform (CARP).

Support

Related Packages

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages