dispel.providers.generic.tasks.sbt_utt.sbt module#

Static Balance Test module.

A module containing the functionality to process the Static Balance test (SBT).

class dispel.providers.generic.tasks.sbt_utt.sbt.BehaviouralFlagsGroup[source]#

Bases: ProcessingStepGroup

A ProcessingStepGroup concatenating BehaviouralFlagsGroup steps.

kwargs: Dict[str, Any] = {'task_name': Static Balance Test (sbt)}#
steps: List[ProcessingStep] = [<dispel.providers.generic.flags.le_flags.PlacementClassificationGroup object>, <dispel.providers.generic.flags.le_flags.FlagNonBeltSBT object>, <dispel.providers.generic.flags.le_flags.FlagAdjustmentNonBeltSBT object>, <dispel.providers.generic.flags.le_flags.FlagStabilisationExcessiveMotion object>, <dispel.providers.generic.flags.le_flags.FlagPostAdjustExcessiveMotion object>]#
class dispel.providers.generic.tasks.sbt_utt.sbt.DetectExcessiveMotionGroup[source]#

Bases: ProcessingStepGroup

A ProcessingStepGroup concatenating DetectExcessiveMotionGroup steps.

steps: List[ProcessingStep] = [<dispel.providers.generic.tasks.sbt_utt.sbt.FlagExcessiveMotion object>, <dispel.providers.generic.tasks.sbt_utt.sbt.TransformMergeValidSegments object>, <dispel.providers.generic.tasks.sbt_utt.sbt.ExtractValidSegmentCoverage object>]#
class dispel.providers.generic.tasks.sbt_utt.sbt.ExtractCircleArea[source]#

Bases: SBTBoutExtractStep

Extract circle Area.

For details about the algorithm, check equation (eq.12) by Prieto(1996) https://doi.org/10.1109/10.532130

Parameters:

data_set_ids – The data set ids that will be considered to extract Circle Area measures.

__init__(data_set_ids, **kwargs)[source]#
Parameters:

data_set_ids (List[str]) –

class dispel.providers.generic.tasks.sbt_utt.sbt.ExtractEllipseArea[source]#

Bases: SBTBoutExtractStep

Extract Ellipse Area.

For details about the algorithm, check equation eq.18 of Schubert(2014) https://doi.org/10.1016/j.gaitpost.2013.09.001)

Parameters:

data_set_ids – The data set ids that will be considered to extract Ellipse Area measures.

__init__(data_set_ids, **kwargs)[source]#
Parameters:

data_set_ids (List[str]) –

class dispel.providers.generic.tasks.sbt_utt.sbt.ExtractSpatioTemporalMeasuresBatch[source]#

Bases: ProcessingStepGroup

Extract postural adjustment measures given a bout strategy.

__init__(bout_strategy, **kwargs)[source]#
Parameters:

bout_strategy (SBTBoutStrategyModality) –

class dispel.providers.generic.tasks.sbt_utt.sbt.ExtractSpatioTemporalMeasuresGroup[source]#

Bases: ProcessingStepGroup

A ProcessingStepGroup concatenating ExtractSpatioTemporalMeasuresBatch steps.

steps: List[ProcessingStep] = [<dispel.providers.generic.tasks.sbt_utt.sbt.ExtractSpatioTemporalMeasuresBatch object>, <dispel.providers.generic.tasks.sbt_utt.sbt.ExtractSpatioTemporalMeasuresBatch object>, <dispel.providers.generic.tasks.sbt_utt.sbt.ExtractSpatioTemporalMeasuresBatch object>]#
class dispel.providers.generic.tasks.sbt_utt.sbt.ExtractSwayJerk[source]#

Bases: SBTBoutExtractStep

Extract Sway Jerk.

For details about the algorithm, check Table 2 by Mancini(2012), https://doi.org/10.1186/1743-0003-9-59 It is a complementary measure to the sway areas, as it covers also the amount of sway occurred within a given geometric area. It takes special relevance when algorithms to remove outliers are applied and the timeseries span used for different measures is different. In other words, a normalised version of the sway total excursion. See an example of concomitant use with sway total excursion in Mancini(2012)

Parameters:

data_set_ids – The data set ids that will be used to extract Sway Jerk measures.

__init__(data_set_ids, **kwargs)[source]#
Parameters:

data_set_ids (List[str]) –

class dispel.providers.generic.tasks.sbt_utt.sbt.ExtractSwayTotalExcursion[source]#

Bases: SBTBoutExtractStep

Extract Sway Total Excursion.

For details about the algorithm, check equation (eq.8) by Prieto(1996) https://doi.org/10.1109/10.532130

Parameters:

data_set_ids – The data set ids that will be used to extract Sway Total Excursion measures.

__init__(data_set_ids, **kwargs)[source]#
Parameters:

data_set_ids (List[str]) –

class dispel.providers.generic.tasks.sbt_utt.sbt.ExtractValidSegmentCoverage[source]#

Bases: ExtractStep

Extract segments of data without excessive motion.

The coverage is defined as a ratio, with numerator the length of the valid data (not flagged as invalid) and, denominator being the length of the data contained originally in the recording. This value is standardized to a percentage (0-100) %. It has value between 0 and 100 %.

data_set_ids: str | Iterable[str] = 'flagged_motion'#

An iterable of data sets to be being processed

definition: ValueDefinition | ValueDefinitionPrototype | None = <dispel.data.measures.MeasureValueDefinitionPrototype object>#

The specification of the measure definition

transform_function()#

Compute the portion of data covered by a binary flag over signal length.

Parameters:

data (Series) – A binary Series flag (0/1) that flags some behaviour of interest.

Returns:

A value between 0 and 1 that represents how much of the data flag signal covers the totality of the recording.

Return type:

float

class dispel.providers.generic.tasks.sbt_utt.sbt.FlagExcessiveMotion[source]#

Bases: TransformStep

TransformStep that creates a flag signal to mark excessive motion.

The flagging segments the accelerometer norm which can be considered an excessive motion (w.r.t, normal sway during balance, e.g., belt placing or re-gaining balance after tripping, based on the amplitude. Developed using the SBT_flag_scenarios.

data_set_ids: str | Iterable[str] = 'jerk_norm'#

An iterable of data sets to be being processed

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: flag (Excessive Motion Segments)>]#
static detect_excessive_motion(data, fixed_threshold=0.1, kernel_width=151)[source]#

Flag segments of excessive motion in accelerometer jerk during sway.

Output is a raw_dataset with 0 (not excessive motion) or 1 (excessive motion)

Parameters:
  • data (DataFrame) – A data frame with the jerk_norm.

  • fixed_threshold (float) – A threshold to cap the amplitude of the jerk that we consider normal to look only in that kind of data for the statistical threshold definition.

  • kernel_width (int) – The width of the running window used to median filter the excessive_motion mask. This is to prevent spikes from appearing when the signal surpasses the statistical_threshold for few instances.

Returns:

A Series with flagged_motion which becomes a new raw_dataset

Return type:

Series

new_data_set_id: str = 'flagged_motion'#
class dispel.providers.generic.tasks.sbt_utt.sbt.FlagMinSegmentCoverage[source]#

Bases: FlagDataSetStep

Flag minimum length of valid recording without excessive motion.

Parameters:

acceptance_threshold (float) – The threshold below which the data set is to be flagged. If the fed signal does not last for more than acceptance_threshold of the total recorded test length, then the associated level is flagged. Should be within [0, 100] %.

acceptance_threshold: float = 80.0#
data_set_ids: str | Iterable[str] = ['flagged_motion']#

An iterable of data sets to be being processed

flag_name: AV | str = Too short sway (sway_too_short)#

The name of the flag

flag_severity: FlagSeverity | str = 1#
flag_type: FlagType | str = 2#

The type of the flag

get_flag_targets(reading, level=None, **kwargs)[source]#

Get flag targets.

Parameters:
Return type:

Iterable[Reading | Level | RawDataSet | MeasureValue | LevelEpoch]

reason: str = 'After removing segments with excessive motion(i.e., behavioural flag bouts) the remaining data is too short {percentage_valid} % of the total, i.e., less than {threshold} %'#

The detailed reason of the flag

class dispel.providers.generic.tasks.sbt_utt.sbt.FormattingGroup[source]#

Bases: ProcessingStepGroup

A ProcessingStepGroup concatenating Formatting steps.

steps: List[ProcessingStep] = [<dispel.providers.generic.sensor.TransformUserAcceleration object>]#
class dispel.providers.generic.tasks.sbt_utt.sbt.PreProcessingStepsGroup[source]#

Bases: ProcessingStepGroup

A ProcessingStepGroup concatenating PreProcessingStepsGroup steps.

steps: List[ProcessingStep] = [<dispel.providers.generic.preprocessing.PreprocessingSteps object>, <dispel.providers.generic.preprocessing.FilterSensorNoise object>, <dispel.providers.generic.preprocessing.FilterPhysiologicalNoise object>]#
class dispel.providers.generic.tasks.sbt_utt.sbt.SBTProcessingSteps[source]#

Bases: ProcessingStepGroup

All processing steps to extract SBT measures.

kwargs: Dict[str, Any] = {'task_name': Static Balance Test (sbt)}#
level_filter: LevelFilter = <LevelIdFilter: level id in [sbt]>#
Parameters:

levels (Iterable[Level]) –

Return type:

Set[Level]

steps: List[ProcessingStep] = [<dispel.providers.generic.tasks.sbt_utt.sbt.TechnicalFlagsGroup object>, <dispel.providers.generic.tasks.sbt_utt.sbt.FormattingGroup object>, <dispel.providers.generic.tasks.sbt_utt.sbt.PreProcessingStepsGroup object>, <dispel.providers.generic.tasks.sbt_utt.sbt.TremorAndAxesGroup object>, <dispel.providers.generic.tasks.sbt_utt.sbt.DetectExcessiveMotionGroup object>, <dispel.providers.generic.tasks.sbt_utt.sbt.ExtractSpatioTemporalMeasuresGroup object>, <dispel.providers.generic.tasks.sbt_utt.sbt.BehaviouralFlagsGroup object>]#
class dispel.providers.generic.tasks.sbt_utt.sbt.SBTTremorMeasuresGroup[source]#

Bases: ProcessingStepGroup

Tremor measure for the SBT from accelerometer.

__init__(data_set_id, **kwargs)[source]#
class dispel.providers.generic.tasks.sbt_utt.sbt.TechnicalFlagsGroup[source]#

Bases: ProcessingStepGroup

A ProcessingStepGroup concatenating TechnicalFlagsGroup steps.

steps: List[ProcessingStep] = [<dispel.providers.generic.flags.generic.FrequencyLowerThanSBTThres object>, <dispel.providers.generic.flags.generic.MaxTimeIncrement object>]#
class dispel.providers.generic.tasks.sbt_utt.sbt.TransformAxisNames[source]#

Bases: TransformStep

A raw data set transformation processing step to change axis names.

This step is done to match Martinez et al 2012.

get_definitions()[source]#

Get the data set definitions.

Return type:

List[RawDataValueDefinition]

new_data_set_id: str = 'martinez_accelerations'#
transform_function()#

Transform accelerometer axis from X,Y,Z to AP,ML, and v.

Parameters:

data (DataFrame) –

Return type:

DataFrame

class dispel.providers.generic.tasks.sbt_utt.sbt.TransformJerkNorm[source]#

Bases: TransformStep

Transform AP/ML acceleration into jerk norm.

data_set_ids: str | Iterable[str] = 'martinez_accelerations'#

An iterable of data sets to be being processed

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: jerk_norm (Jerk norm (AP/ML))>]#
jerk_norm(data)[source]#

Compute the jerk norm.

Parameters:

data (DataFrame) –

Return type:

Series

new_data_set_id: str = 'jerk_norm'#
class dispel.providers.generic.tasks.sbt_utt.sbt.TransformMergeValidSegments[source]#

Bases: TransformStep

Mask the AP-ML acceleration, under the flagged_motion.

The output contains only segments of AP-ML acceleration which were not identified as an excessive motion. Outputs the merged valid AP/ML/Vertical acceleration data.

data_set_ids: str | Iterable[str] = ['martinez_accelerations', 'flagged_motion']#

An iterable of data sets to be being processed

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: v (Continuous valid acceleration V data merged)>, <RawDataValueDefinition: ml (Continuous valid acceleration ML data merged)>, <RawDataValueDefinition: ap (Continuous valid acceleration AP data merged)>]#
new_data_set_id: str = 'concat_valid_martinez_acc'#
class dispel.providers.generic.tasks.sbt_utt.sbt.TremorAndAxesGroup[source]#

Bases: ProcessingStepGroup

A ProcessingStepGroup concatenating TremorAndAxesGroup steps.

steps: List[ProcessingStep] = [<dispel.providers.generic.tasks.sbt_utt.sbt.SBTTremorMeasuresGroup object>, <dispel.providers.generic.tasks.sbt_utt.sbt.TransformAxisNames object>, <dispel.providers.generic.tasks.sbt_utt.sbt.TransformJerkNorm object>]#