11"""Runner for the Graphomotor pipeline."""
22
3+ import datetime
34import os
45import pathlib
5- from datetime import datetime
6- from typing import Literal
6+ import typing
77
88import numpy as np
99import pandas as pd
1414
1515logger = config .get_logger ()
1616
17- FeatureCategories = Literal ["duration" , "velocity" , "hausdorff" , "AUC" ]
17+ FeatureCategories = typing . Literal ["duration" , "velocity" , "hausdorff" , "AUC" ]
1818
1919
2020def _ensure_path (path : pathlib .Path | str ) -> pathlib .Path :
@@ -122,7 +122,7 @@ def _export_features_to_csv(
122122
123123 filename = (
124124 f"{ participant_id } _{ task } _{ hand } _features_"
125- f"{ datetime .today ().strftime ('%Y%m%d' )} .csv"
125+ f"{ datetime .datetime . today ().strftime ('%Y%m%d' )} .csv"
126126 )
127127
128128 if not output_path .suffix :
@@ -220,7 +220,19 @@ def run_pipeline(
220220 "hausdorff" ,
221221 "AUC" ,
222222 ],
223- config_params : dict [str , float | int ] | None = None ,
223+ config_params : dict [
224+ typing .Literal [
225+ "center_x" ,
226+ "center_y" ,
227+ "start_radius" ,
228+ "growth_rate" ,
229+ "start_angle" ,
230+ "end_angle" ,
231+ "num_points" ,
232+ ],
233+ float | int ,
234+ ]
235+ | None = None ,
224236) -> dict [str , str ]:
225237 """Run the Graphomotor pipeline to extract features from spiral drawings.
226238
@@ -238,14 +250,14 @@ def run_pipeline(
238250 - "AUC": Area under the curve metric
239251 config_params: Optional dictionary with custom spiral configuration parameters.
240252 These parameters control reference spiral generation and spiral centering.
241- If None, default parameters are used. Supported parameters are:
242- - "center_x": X-coordinate of the spiral center. Default is 50.
243- - "center_y": Y-coordinate of the spiral center. Default is 50.
244- - "start_radius": Starting radius of the spiral. Default is 0.
245- - "growth_rate": Growth rate of the spiral. Default is 1.075.
246- - "start_angle": Starting angle of the spiral. Default is 0.
247- - "end_angle": Ending angle of the spiral. Default is 8π.
248- - "num_points": Number of points in the spiral. Default is 10000.
253+ If None, default configuration is used. Supported parameters are:
254+ - "center_x" (float) : X-coordinate of the spiral center. Default is 50.
255+ - "center_y" (float) : Y-coordinate of the spiral center. Default is 50.
256+ - "start_radius" (float) : Starting radius of the spiral. Default is 0.
257+ - "growth_rate" (float) : Growth rate of the spiral. Default is 1.075.
258+ - "start_angle" (float) : Starting angle of the spiral. Default is 0.
259+ - "end_angle" (float) : Ending angle of the spiral. Default is 8π.
260+ - "num_points" (int) : Number of points in the spiral. Default is 10000.
249261
250262 Returns:
251263 Dictionary of extracted features.
@@ -258,7 +270,9 @@ def run_pipeline(
258270 spiral_config = None
259271 if config_params :
260272 logger .info (f"Custom spiral configuration: { config_params } " )
261- spiral_config = config .SpiralConfig .add_custom_params (config_params )
273+ spiral_config = config .SpiralConfig .add_custom_params (
274+ typing .cast (dict , config_params )
275+ )
262276
263277 features = extract_features (
264278 input_path , output_path , feature_categories , spiral_config
0 commit comments