dispel.providers.generic.tasks.draw.steps module#

Drawing test related functionality.

This module contains functionality to extract measures for the Drawing test (DRAW).

class dispel.providers.generic.tasks.draw.steps.AddRawPacmanScore[source]#

Bases: ExtractStep, ValidPathAssertionMixin

Add the raw pacman score.

A target’s point is considered as ‘eaten’ if that point is within the radius range of any other user path’s point. The pacman score is the ratio between the number of ‘eaten’ points and the total number of target’s point.

__init__(level_filter, **kwargs)[source]#
Parameters:
Return type:

None

class dispel.providers.generic.tasks.draw.steps.AggregateAxesMeanDistance[source]#

Bases: AggregateMeasures

Aggregate mean corner max distance measure over all attempts.

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

The specification of the measure definition

hand = 2#
measure_ids: List[DefinitionIdType] = ['draw-left_sc_first-axes_over', 'draw-right_sc_first-axes_over', 'draw-left_sc_sec-axes_over', 'draw-right_sc_sec-axes_over', 'draw-left_scc_first-axes_over', 'draw-right_scc_first-axes_over', 'draw-left_scc_sec-axes_over', 'draw-right_scc_sec-axes_over', 'draw-left_inf_first-axes_over', 'draw-right_inf_first-axes_over', 'draw-left_inf_sec-axes_over', 'draw-right_inf_sec-axes_over', 'draw-left_spi_first-axes_over', 'draw-right_spi_first-axes_over', 'draw-left_spi_sec-axes_over', 'draw-right_spi_sec-axes_over']#
shape = 4#
class dispel.providers.generic.tasks.draw.steps.AggregateCornerMeanDistance[source]#

Bases: AggregateMeasures

Aggregate mean corner max distance measure over all attempts.

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

The specification of the measure definition

hand = 2#
measure_ids: List[DefinitionIdType] = ['draw-left_sc_first-corner', 'draw-right_sc_first-corner', 'draw-left_sc_sec-corner', 'draw-right_sc_sec-corner', 'draw-left_scc_first-corner', 'draw-right_scc_first-corner', 'draw-left_scc_sec-corner', 'draw-right_scc_sec-corner', 'draw-left_inf_first-corner', 'draw-right_inf_first-corner', 'draw-left_inf_sec-corner', 'draw-right_inf_sec-corner', 'draw-left_spi_first-corner', 'draw-right_spi_first-corner', 'draw-left_spi_sec-corner', 'draw-right_spi_sec-corner']#
shape = 4#
class dispel.providers.generic.tasks.draw.steps.AggregateDistanceThresholdByHandAndShape[source]#

Bases: DrawAggregateModalitiesByHandAndShape

Aggregate Distance threshold flag values by hand and shape.

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

The specification of the measure definition

class dispel.providers.generic.tasks.draw.steps.AggregateDuration[source]#

Bases: AggregateMeasures

Average duration of drawing on all shapes, attempts and hands.

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

The specification of the measure definition

hand = 2#
measure_ids: List[DefinitionIdType] = ['draw-left_sc_first-user_dur', 'draw-right_sc_first-user_dur', 'draw-left_sc_sec-user_dur', 'draw-right_sc_sec-user_dur', 'draw-left_scc_first-user_dur', 'draw-right_scc_first-user_dur', 'draw-left_scc_sec-user_dur', 'draw-right_scc_sec-user_dur', 'draw-left_inf_first-user_dur', 'draw-right_inf_first-user_dur', 'draw-left_inf_sec-user_dur', 'draw-right_inf_sec-user_dur', 'draw-left_spi_first-user_dur', 'draw-right_spi_first-user_dur', 'draw-left_spi_sec-user_dur', 'draw-right_spi_sec-user_dur']#
shape = 4#
class dispel.providers.generic.tasks.draw.steps.AggregateDurationByHand[source]#

Bases: DrawAggregateModalitiesByHand

Average duration of drawing by hand.

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

The specification of the measure definition

class dispel.providers.generic.tasks.draw.steps.AggregateInstantSpeed[source]#

Bases: AggregateRawDataSetColumn

Extract instant speed measures.

__init__()[source]#
Return type:

None

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

An iterable of data sets to be being processed

class dispel.providers.generic.tasks.draw.steps.AggregateIntersections[source]#

Bases: AggregateMeasures

Average the number of intersections globally.

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

The specification of the measure definition

hand = 2#
measure_ids: List[DefinitionIdType] = ['draw-left_sc_first-cross', 'draw-right_sc_first-cross', 'draw-left_sc_sec-cross', 'draw-right_sc_sec-cross', 'draw-left_scc_first-cross', 'draw-right_scc_first-cross', 'draw-left_scc_sec-cross', 'draw-right_scc_sec-cross', 'draw-left_inf_first-cross', 'draw-right_inf_first-cross', 'draw-left_inf_sec-cross', 'draw-right_inf_sec-cross', 'draw-left_spi_first-cross', 'draw-right_spi_first-cross', 'draw-left_spi_sec-cross', 'draw-right_spi_sec-cross']#
shape = 4#
class dispel.providers.generic.tasks.draw.steps.AggregateIntersectionsByHand[source]#

Bases: DrawAggregateModalitiesByHand

Average total number of intersections by hand.

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

The specification of the measure definition

class dispel.providers.generic.tasks.draw.steps.AggregateIntersectionsPerSeconds[source]#

Bases: AggregateMeasures

Average the number of intersections per second globally.

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

The specification of the measure definition

hand = 2#
measure_ids: List[DefinitionIdType] = ['draw-left_sc_first-cross_per_sec', 'draw-right_sc_first-cross_per_sec', 'draw-left_sc_sec-cross_per_sec', 'draw-right_sc_sec-cross_per_sec', 'draw-left_scc_first-cross_per_sec', 'draw-right_scc_first-cross_per_sec', 'draw-left_scc_sec-cross_per_sec', 'draw-right_scc_sec-cross_per_sec', 'draw-left_inf_first-cross_per_sec', 'draw-right_inf_first-cross_per_sec', 'draw-left_inf_sec-cross_per_sec', 'draw-right_inf_sec-cross_per_sec', 'draw-left_spi_first-cross_per_sec', 'draw-right_spi_first-cross_per_sec', 'draw-left_spi_sec-cross_per_sec', 'draw-right_spi_sec-cross_per_sec']#
shape = 4#
class dispel.providers.generic.tasks.draw.steps.AggregateIntersectionsPerSecondsByHand[source]#

Bases: DrawAggregateModalitiesByHand

Average the mean number of intersections per second by hand.

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

The specification of the measure definition

class dispel.providers.generic.tasks.draw.steps.AggregateSimilarity[source]#

Bases: AggregateMeasures

Average similarity values by hand.

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

The specification of the measure definition

hand = 2#
measure_ids: List[DefinitionIdType] = ['draw-left_sc_first-sim-mean', 'draw-right_sc_first-sim-mean', 'draw-left_sc_sec-sim-mean', 'draw-right_sc_sec-sim-mean', 'draw-left_scc_first-sim-mean', 'draw-right_scc_first-sim-mean', 'draw-left_scc_sec-sim-mean', 'draw-right_scc_sec-sim-mean', 'draw-left_inf_first-sim-mean', 'draw-right_inf_first-sim-mean', 'draw-left_inf_sec-sim-mean', 'draw-right_inf_sec-sim-mean', 'draw-left_spi_first-sim-mean', 'draw-right_spi_first-sim-mean', 'draw-left_spi_sec-sim-mean', 'draw-right_spi_sec-sim-mean']#
shape = 4#
class dispel.providers.generic.tasks.draw.steps.AggregateSimilarityByHand[source]#

Bases: DrawAggregateModalitiesByHand

Average similarity values by hand.

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

The specification of the measure definition

class dispel.providers.generic.tasks.draw.steps.AggregateSparc[source]#

Bases: AggregateMeasures

Average smoothness scores globally.

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

The specification of the measure definition

hand = 2#
measure_ids: List[DefinitionIdType] = ['draw-left_sc_first-smooth', 'draw-right_sc_first-smooth', 'draw-left_sc_sec-smooth', 'draw-right_sc_sec-smooth', 'draw-left_scc_first-smooth', 'draw-right_scc_first-smooth', 'draw-left_scc_sec-smooth', 'draw-right_scc_sec-smooth', 'draw-left_inf_first-smooth', 'draw-right_inf_first-smooth', 'draw-left_inf_sec-smooth', 'draw-right_inf_sec-smooth', 'draw-left_spi_first-smooth', 'draw-right_spi_first-smooth', 'draw-left_spi_sec-smooth', 'draw-right_spi_sec-smooth']#
shape = 4#
class dispel.providers.generic.tasks.draw.steps.AggregateSparcByHand[source]#

Bases: DrawAggregateModalitiesByHand

Average sparc values by hand.

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

The specification of the measure definition

class dispel.providers.generic.tasks.draw.steps.AggregateSpeedSimilarity[source]#

Bases: AggregateMeasures

Average speed/similarity globally.

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

The specification of the measure definition

hand = 2#
measure_ids: List[DefinitionIdType] = ['draw-left_sc_first-dur_acc-mean', 'draw-right_sc_first-dur_acc-mean', 'draw-left_sc_sec-dur_acc-mean', 'draw-right_sc_sec-dur_acc-mean', 'draw-left_scc_first-dur_acc-mean', 'draw-right_scc_first-dur_acc-mean', 'draw-left_scc_sec-dur_acc-mean', 'draw-right_scc_sec-dur_acc-mean', 'draw-left_inf_first-dur_acc-mean', 'draw-right_inf_first-dur_acc-mean', 'draw-left_inf_sec-dur_acc-mean', 'draw-right_inf_sec-dur_acc-mean', 'draw-left_spi_first-dur_acc-mean', 'draw-right_spi_first-dur_acc-mean', 'draw-left_spi_sec-dur_acc-mean', 'draw-right_spi_sec-dur_acc-mean']#
shape = 4#
class dispel.providers.generic.tasks.draw.steps.AggregateSpeedSimilarityByHand[source]#

Bases: DrawAggregateModalitiesByHand

Average speed/similarity values by hand.

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

The specification of the measure definition

class dispel.providers.generic.tasks.draw.steps.ContinuousLevel[source]#

Bases: LevelFilter

Filter for continuous drawing shape.

filter(levels)[source]#

Filter levels with continuous drawn shapes.

Parameters:

levels (Iterable[Level]) –

Return type:

Set[Level]

repr()[source]#

Get representation of the filter.

class dispel.providers.generic.tasks.draw.steps.CreatableShape[source]#

Bases: LevelFilter

A level filter to fetch level with creatable shapes only.

filter(levels)[source]#

Keep level with a creatable shape from level.

Parameters:

levels (Iterable[Level]) –

Return type:

Set | Set[Level]

repr()[source]#

Get representation of the filter.

Return type:

str

class dispel.providers.generic.tasks.draw.steps.CreatableShapeFlag[source]#

Bases: FlagLevelStep

A Transform step to determine if the shape is creatable in a level.

flag_name: AV | str = draw creatable shape (draw_creatable_shape)#

The name of the flag

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

The type of the flag

static flagging_function(level, **_kwargs)#

Assert that the shape can be created from the level.

Parameters:

level (Level) –

reason: str = 'The shape was impossible to create from the level. '#

The detailed reason of the flag

static shape_is_creatable(level, **_kwargs)[source]#

Assert that the shape can be created from the level.

Parameters:

level (Level) –

task_name: AV | str = Drawing test (DRAW)#

The task name

class dispel.providers.generic.tasks.draw.steps.CreateShapes[source]#

Bases: LevelProcessingStep

A LevelProcessingStep to create a DrawShape per level.

process_level(level, reading, **kwargs)[source]#

Process the provided Level.

Parameters:
  • level (Level) – The level to be processed

  • reading (Reading) – The reading to be processed

  • kwargs – Additional arguments passed by process_level().

Yields:

ProcessResultType – Passes through anything that is yielded from the process_level() function.

Return type:

Generator[ProcessingResult | ProcessingControlResult, None, None]

dispel.providers.generic.tasks.draw.steps.DRAWING_SIM_MEDIAN_MEAN = {'inf': 6.353, 'sc': 5.753, 'scc': 5.989, 'spi': 5.821}#

Mean of similarity median on healthy population for the different shape.

dispel.providers.generic.tasks.draw.steps.DRAWING_SIM_MEDIAN_Q95_MINUS_Q05 = {'inf': 8.096, 'sc': 8.641, 'scc': 8.952, 'spi': 6.674}#

The distance between quantile 95 and quantile 5 of similarity median on healthy population for the different shape.

dispel.providers.generic.tasks.draw.steps.DRAWING_USER_DURATION_MEAN = {'inf': 4004, 'sc': 3877, 'scc': 3985, 'spi': 5571}#

Mean of user duration on healthy population for the different shape.

dispel.providers.generic.tasks.draw.steps.DRAWING_USER_DURATION_Q95_MINUS_Q05 = {'inf': 6012, 'sc': 5699, 'scc': 5738, 'spi': 8671}#

The distance between quantile 95 and quantile 5 of user duration on healthy population for the different shape.

class dispel.providers.generic.tasks.draw.steps.DRAWProcessingStepsGroupAll[source]#

Bases: ProcessingStepGroup

Processing group for all aggregated levels.

__init__()[source]#
Return type:

None

class dispel.providers.generic.tasks.draw.steps.DrawAggregateModalitiesByHand[source]#

Bases: AggregateModalities

Base step to aggregate measures by hand for DRAW task.

From the definition of the measure, all the measures for the different shapes and attempts are retrieved (see get_modalities).

__init__(hand)[source]#
Parameters:

hand (HandModality) –

get_definition(**kwargs)[source]#

Get the definition.

Return type:

ValueDefinition

get_modalities()[source]#

Retrieve all modalities combinations for a given hand.

Return type:

List[List[str | AbbreviatedValue]]

class dispel.providers.generic.tasks.draw.steps.DrawAggregateModalitiesByHandAndShape[source]#

Bases: AggregateModalities

Base step to aggregate measures by hand and shape for DRAW task.

From the definition of the measure, all the measures for the different attempts are retrieved (see get_modalities).

__init__(hand, shape)[source]#
Parameters:
get_definition(**kwargs)[source]#

Get the definition.

Return type:

ValueDefinition

get_modalities()[source]#

Retrieve all modalities combinations for a given hand and shape.

Return type:

List[List[str | AbbreviatedValue]]

class dispel.providers.generic.tasks.draw.steps.DrawIntentionalTremorMeasures[source]#

Bases: ProcessingStepGroup

A group of drawing processing steps for tremor measures.

__init__()[source]#
Return type:

None

class dispel.providers.generic.tasks.draw.steps.DrawOppositeDirection[source]#

Bases: FlagLevelStep

Flag infinity shape drawn clockwise.

flag_name: AV | str = opposite direction (opp_direction)#

The name of the flag

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

The type of the flag

level_filter: LevelFilter = <LevelFilter: ((infinity shapes and Creatable shapes) and only continuously drawn shapes)>#
Parameters:

levels (Iterable[Level]) –

Return type:

Set[Level]

reason: str = 'The user is drawing in the opposite direction for the level {level_id}.'#

The detailed reason of the flag

task_name: AV | str = Drawing test (DRAW)#

The task name

class dispel.providers.generic.tasks.draw.steps.DrawOvershootRemoval[source]#

Bases: FlagLevelStep

Flag drawing for which we removed more than 10% of user path.

flag_name: AV | str = overshoot removal (excessive_overshoot_removal)#

The name of the flag

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

The type of the flag

level_filter: LevelFilter = <LevelFilter: ((Creatable shapes and valid user path) and only continuously drawn shapes)>#
Parameters:

levels (Iterable[Level]) –

Return type:

Set[Level]

reason: str = 'The algorithm detected an overshoot of more than 10% for the level {level_id}.'#

The detailed reason of the flag

task_name: AV | str = Drawing test (DRAW)#

The task name

class dispel.providers.generic.tasks.draw.steps.DrawTransformAndExtract[source]#

Bases: ProcessingStepGroup

Processing group for all individual levels (shapes).

Parameters:
  • hand – The hand on which the tremor measures are to be computed.

  • shape – The shape on which the tremor measures are to be computed.

  • attempt – The attempt on which the tremor measures are to be computed.

__init__(hand, shape, attempt)[source]#
Parameters:
Return type:

None

class dispel.providers.generic.tasks.draw.steps.DrawTremorMeasures[source]#

Bases: ProcessingStepGroup

A group of drawing processing steps for tremor measures.

Parameters:
  • hand – The hand on which the tremor measures are to be computed.

  • sensor – The sensor on which the tremor measures are to be computed.

__init__(hand, sensor)[source]#
Parameters:
class dispel.providers.generic.tasks.draw.steps.DrawUserDistanceThreshold[source]#

Bases: FlagLevelStep

Flag if a drawing distance ratio is within expected range.

flag_name: AV | str = distance threshold (dist_thresh)#

The name of the flag

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

The type of the flag

level_filter: LevelFilter = <LevelFilter: (valid user path and Creatable shapes)>#
Parameters:

levels (Iterable[Level]) –

Return type:

Set[Level]

reason: str = 'The user drawing distance ratio is outside the expected range of 0.8 - 1.20 for the level {level_id}.'#

The detailed reason of the flag

task_name: AV | str = Drawing test (DRAW)#

The task name

class dispel.providers.generic.tasks.draw.steps.DrawingFlag[source]#

Bases: ProcessingStepGroup

Processing group for all drawing flag.

__init__()[source]#
Return type:

None

class dispel.providers.generic.tasks.draw.steps.ExtractAxesMeanDistance[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract mean overshoot distance.

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

The specification of the measure definition

static extract(distances)#

Extract mean overshoot distances.

Parameters:

distances (Tuple[float, float, float]) –

Return type:

float64

static extract_mean_axes_dist(distances)[source]#

Extract mean overshoot distances.

Parameters:

distances (Tuple[float, float, float]) –

Return type:

float64

properties: str | Sequence[str] = 'axis_overshoots'#
class dispel.providers.generic.tasks.draw.steps.ExtractCornerMeanDistance[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract c accuracy.

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

The specification of the measure definition

static extract(distances)#

Extract mean maximum corner Frechet distance.

Parameters:

distances (Tuple[float, float, float]) –

Return type:

float64

static extract_mean_corner_max_dist(distances)[source]#

Extract mean maximum corner Frechet distance.

Parameters:

distances (Tuple[float, float, float]) –

Return type:

float64

properties: str | Sequence[str] = 'corners_max_dist'#
class dispel.providers.generic.tasks.draw.steps.ExtractDTW[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Abstract class to aggregate similarity using dynamic time warping.

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

aggregation (str) –

properties: str | Sequence[str] = 'up_sampled_valid_no_overshoot_matches'#
class dispel.providers.generic.tasks.draw.steps.ExtractDrawingCompletionRatio[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract the completion ratio.

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

The specification of the measure definition

static extract(x)#

Identity function.

static identity(x)[source]#

Identity function.

properties: str | Sequence[str] = 'distance_ratio'#
class dispel.providers.generic.tasks.draw.steps.ExtractDuration[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract total duration of drawing.

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

The specification of the measure definition

extract()#

Compute the duration of the total interaction of the user with the test.

Also compute the reaction time of the user between the beginning of the test and his first interaction.

Parameters:

data (DataFrame) – A pandas data frame composed of at least the user path and associated timestamps as index.

Returns:

The total duration (in milliseconds) of the user drawing action.

Return type:

float

properties: str | Sequence[str] = 'all_data'#
class dispel.providers.generic.tasks.draw.steps.ExtractDurationAccuracyNormedCombined[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract duration accuracy normalized and combined score.

__init__(**kwargs)[source]#
properties: str | Sequence[str] = ['valid_data', 'up_sampled_valid_no_overshoot_matches']#
class dispel.providers.generic.tasks.draw.steps.ExtractIntersections[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract total number of intersections between the user and the model.

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

The specification of the measure definition

extract()#

Return the number of items in a container.

properties: str | Sequence[str] = 'intersection_measures'#
class dispel.providers.generic.tasks.draw.steps.ExtractIntersectionsFrequency[source]#

Bases: ExtractMultipleStep, ValidPathAssertionMixin

Extract total number of intersections between the user and the model.

__init__()[source]#
Return type:

None

class dispel.providers.generic.tasks.draw.steps.ExtractIntersectionsPerSeconds[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract the mean number of intersections per second.

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

The specification of the measure definition

static extract(data)#

Get the number of crossings per second.

Return type:

float64

static get_cross_per_sec(data)[source]#

Get the number of crossings per second.

Return type:

float64

properties: str | Sequence[str] = 'intersection_measures'#
class dispel.providers.generic.tasks.draw.steps.ExtractPressure[source]#

Bases: ExtractMultipleStep, ValidPathAssertionMixin

Extract pressure-related measures.

__init__()[source]#
Return type:

None

class dispel.providers.generic.tasks.draw.steps.ExtractPressureAll[source]#

Bases: AggregateRawDataSetColumn, ValidPathAssertionMixin

Extract pressure related measures for all levels.

__init__()[source]#
Return type:

None

class dispel.providers.generic.tasks.draw.steps.ExtractPressureAllCV[source]#

Bases: AggregateRawDataSetColumn, ValidPathAssertionMixin

Extract pressure related measures for all levels.

__init__()[source]#
class dispel.providers.generic.tasks.draw.steps.ExtractReactionTime[source]#

Bases: ExtractStep, ValidPathAssertionMixin

Extract reaction time measures.

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

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(level)#

Compute the reaction time.

The reaction time of the user between the shape appearance and the first touch event.

Parameters:
  • data (DataFrame) – pandas data frame containing at least ‘tsTouch’ pd Series.

  • level (Level) – The level to be processed.

Returns:

the user’s reaction time for the given level (in milliseconds).

Return type:

float

class dispel.providers.generic.tasks.draw.steps.ExtractReactionTimeAll[source]#

Bases: AggregateRawDataSetColumn, ValidPathAssertionMixin

Extract reaction time related measures for all levels.

__init__()[source]#
Return type:

None

class dispel.providers.generic.tasks.draw.steps.ExtractShapeMixIn[source]#

Bases: LevelProcessingStep, MeasureDefinitionMixin

A Transformation step that applies a function on targets.

data_set_ids = 'shape'#
extract: Callable[[...], Any]#
get_extract_function()[source]#

Get the function to be applied to the data set.

get_properties(shape)[source]#

Get property from an attempt.

Parameters:

shape (DrawShape) –

Return type:

Tuple[Any, …]

process_level(level, reading, **kwargs)[source]#

Overwrite process level.

properties: str | Sequence[str]#
target_dtype = 'float64'#
class dispel.providers.generic.tasks.draw.steps.ExtractSparc[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract spectral arc length of the up sampled user draw.

The spectral arc length is a smoothness measure method. For more information about the sparc function, see sparc().

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

The specification of the measure definition

static extract(touch)#

Extract sparc.

Parameters:

touch (DrawTouch) –

Return type:

float

properties: str | Sequence[str] = 'aggregate_valid_touches'#
static sparc_call(touch)[source]#

Extract sparc.

Parameters:

touch (DrawTouch) –

Return type:

float

class dispel.providers.generic.tasks.draw.steps.ExtractSpeedAccuracy[source]#

Bases: ExtractShapeMixIn, ValidPathAssertionMixin

Extract speed accuracy.

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

aggregation (str) –

properties: str | Sequence[str] = ['valid_data', 'up_sampled_valid_no_overshoot_matches']#
class dispel.providers.generic.tasks.draw.steps.FlagCompleteDrawing[source]#

Bases: FlagLevelStep

Flag the drawing is complete.

flag_name: AV | str = complete drawing (complete_drawing)#

The name of the flag

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

The type of the flag

reason: str = 'The drawing is not complete, the user has not reached theendZone or is not considered completed in the context during level {level_id}.'#

The detailed reason of the flag

task_name: AV | str = Drawing test (DRAW)#

The task name

class dispel.providers.generic.tasks.draw.steps.FlagContinuousDrawing[source]#

Bases: FlagLevelStep

Flag the user do not lift the finger while drawing.

flag_name: AV | str = continous drawing (continuous_drawing)#

The name of the flag

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

The type of the flag

reason: str = 'The drawing is not continuous, the user has lifted the fingerduring level {level_id}.'#

The detailed reason of the flag

task_name: AV | str = Drawing test (DRAW)#

The task name

class dispel.providers.generic.tasks.draw.steps.InfinityShapes[source]#

Bases: LevelFilter

A level filter to fetch level from infinity shapes.

filter(levels)[source]#

Get infinity shapes.

Parameters:

levels (Iterable[Level]) –

Return type:

Set | Set[Level]

repr()[source]#

Get representation of the filter.

Return type:

str

dispel.providers.generic.tasks.draw.steps.RADIUS = 8#

The radius of the circle used to consider if a point from the reference path has been covered by the user trajectory. The value of 8 corresponds to the size of a fingertip.

class dispel.providers.generic.tasks.draw.steps.TransformDecelerationProfile[source]#

Bases: TransformStep

A raw data transformation step to get the user deceleration profile.

assert_valid_level(level, reading, **kwargs)[source]#

Flag the presence of a valid user path.

Parameters:
data_set_ids: str | Iterable[str] = 'shape'#

An iterable of data sets to be being processed

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: tsTouch (timestamp of interactions data, datetime64)>, <RawDataValueDefinition: min_distance (DTW distance data, float64)>, <RawDataValueDefinition: x (x user trajectory, float64)>, <RawDataValueDefinition: y (y user trajectory, float64)>]#
new_data_set_id: str = 'deceleration'#
retrieve_deceleration_from_shape(data)[source]#

Get the deceleration data.

Parameters:

data (DataFrame) –

class dispel.providers.generic.tasks.draw.steps.TransformInstantSpeed[source]#

Bases: TransformStep, ValidPathAssertionMixin

A raw data set transformation step to get user’s instantaneous speed.

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

An iterable of data sets to be being processed

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: speed (speed, float64)>, <RawDataValueDefinition: distance (distance, float64)>]#
new_data_set_id: str = 'instantaneous_speed'#
transform_function()#

Compute the instantaneous speed of the drawing.

Parameters:

data (DataFrame) – A pandas data frame composed of at least the user path and associated timestamps as index.

Returns:

The instantaneous speed of the drawing.

Return type:

numpy.float64

class dispel.providers.generic.tasks.draw.steps.TransformReactionTime[source]#

Bases: TransformStep, ValidPathAssertionMixin

A raw data set transformation step to get user’s reaction time.

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

An iterable of data sets to be being processed

definitions: List[RawDataValueDefinition] = [<RawDataValueDefinition: reaction_time (Reaction time data, float64)>]#
new_data_set_id: str = 'reaction-time'#
transform_function(level)#

Wrap reaction time in a Series for a better aggregation.

Parameters:
  • data (DataFrame) – pandas data frame containing at least ‘tsTouch’ pd Series.

  • level (Level) – The level to be processed.

Returns:

A pandas Series of the user’s reaction time for the given level (in milliseconds).

Return type:

pandas.Series

class dispel.providers.generic.tasks.draw.steps.TransformValidUserPath[source]#

Bases: FlagLevelStep

A Transform step to determine if the user path is valid.

flag_name: AV | str = valid user path (val_user_path)#

The name of the flag

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

The type of the flag

static flagging_function(level, reading, **_kwargs)#

Assert that there are valid paths.

Parameters:
static is_valid_level(level, reading, **_kwargs)[source]#

Assert that there are valid paths.

Parameters:
level_filter: LevelFilter = <LevelFilter: (Creatable shapes and only continuously drawn shapes)>#
Parameters:

levels (Iterable[Level]) –

Return type:

Set[Level]

reason: str = 'The user path after pre-processing is empty. '#

The detailed reason of the flag

task_name: AV | str = Drawing test (DRAW)#

The task name

class dispel.providers.generic.tasks.draw.steps.ValidPathAssertionMixin[source]#

Bases: LevelProcessingStepProtocol

Assertion mixin to ensure a valid path is present.

assert_valid_level(level, reading, **kwargs)[source]#

Assert that there are valid paths.

Parameters:
missing_path_error_handling = 'ignore'#

The error handling should no valid path be obtained

class dispel.providers.generic.tasks.draw.steps.ValidUserPath[source]#

Bases: LevelFilter

A level filter to fetch level with valid user path only.

filter(levels)[source]#

Keep level with a valid user path.

Parameters:

levels (Iterable[Level]) –

Return type:

Set | Set[Level]

repr()[source]#

Get representation of the filter.

Return type:

str

dispel.providers.generic.tasks.draw.steps.compute_pacman_score(shape_dataset)[source]#

Compute the pacman score for a level.

Parameters:

shape_dataset (pd.DataFrame) – A data frame containing the DrawShape object

Returns:

The pacman score.

Return type:

float

dispel.providers.generic.tasks.draw.steps.get_instant_speed(data)[source]#

Compute the instantaneous speed of the drawing.

Parameters:

data (DataFrame) – A pandas data frame composed of at least the user path and associated timestamps as index.

Returns:

The instantaneous speed of the drawing.

Return type:

numpy.float64

dispel.providers.generic.tasks.draw.steps.get_speed_accuracy(data, mean_dist)[source]#

Compute the speed accuracy of the user for a given level.

Parameters:
  • data (DataFrame) – A pandas data frame corresponding to the DrawShape data of the given level.

  • mean_dist (float) – The mean dtw minimum distance for the given level.

Returns:

The speed accuracy for the given level (unit: point-1.ms-1).

Return type:

float

Raises:

AssertionError – If speed * accuracy is equal to zero and ends up with a ZeroDivisionError for the ratio: 1 / (speed * accuracy).

dispel.providers.generic.tasks.draw.steps.get_user_duration(data)[source]#

Compute the duration of the total interaction of the user with the test.

Also compute the reaction time of the user between the beginning of the test and his first interaction.

Parameters:

data (DataFrame) – A pandas data frame composed of at least the user path and associated timestamps as index.

Returns:

The total duration (in milliseconds) of the user drawing action.

Return type:

float

dispel.providers.generic.tasks.draw.steps.reaction_time(data, level)[source]#

Compute the reaction time.

The reaction time of the user between the shape appearance and the first touch event.

Parameters:
  • data (DataFrame) – pandas data frame containing at least ‘tsTouch’ pd Series.

  • level (Level) – The level to be processed.

Returns:

the user’s reaction time for the given level (in milliseconds).

Return type:

float

dispel.providers.generic.tasks.draw.steps.wrap_reaction_time(data, level)[source]#

Wrap reaction time in a Series for a better aggregation.

Parameters:
  • data (DataFrame) – pandas data frame containing at least ‘tsTouch’ pd Series.

  • level (Level) – The level to be processed.

Returns:

A pandas Series of the user’s reaction time for the given level (in milliseconds).

Return type:

pandas.Series