Skip to content

Commit

Permalink
Merge pull request #20 from stanfordnmbl/dev
Browse files Browse the repository at this point in the history
Add info to metrics
  • Loading branch information
antoinefalisse authored Feb 23, 2024
2 parents f536adf + cbce85f commit a54bc48
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gait_analysis/function/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ def handler(event, context):
gait_scalars[key]['multiplier'] = 1

gait_scalars['step_width']['multiplier'] = 100 # cm

# %% Info about metrics.
gait_scalars['gait_speed']['info'] = "Gait speed is computed by dividing the displacement of the center of mass by the time it takes to move that distance. A speed larger than 1.12 m/s is considered good."
gait_scalars['step_width']['info'] = "Step width is computed as the average distance between the ankle joint centers in the mediolateral direction during 40-60% of the stance phase. A step width between 4.3 and 7.4 times the subject's height is considered good."
gait_scalars['stride_length']['info'] = "Stride length is computed as the distance between the calcaneus positions at the beginning and end of the gait cycle. A stride length larger than 0.45 times the subject's height is considered good."
gait_scalars['cadence']['info'] = "Cadence is computed as the number of gait cycles (left and right) per minute. A cadence larger than 100 is considered good."
gait_scalars['double_support_time']['info'] = "Double support time is computed as the duration when both feet are in contact with the ground. A double support time smaller than 35% of the gait cycle is considered good."
gait_scalars['step_length_symmetry']['info'] = "Step length symmetry is computed as the ratio between the right and left step lengths. A step length symmetry between 90 and 110 is considered good."

# %% Thresholds.
metadataPath = os.path.join(sessionDir, 'sessionMetadata.yaml')
Expand Down Expand Up @@ -155,6 +163,7 @@ def handler(event, context):
gait_scalars[scalar_name]['decimal'])
metrics_out[scalar_name]['label'] = scalar_labels[scalar_name]
metrics_out[scalar_name]['value'] = vertical_values
metrics_out[scalar_name]['info'] = gait_scalars[scalar_name]['info']
if scalar_name in scalar_reverse_colors:
# Margin zone (orange) is 10% above threshold.
metrics_out[scalar_name]['colors'] = ["green", "yellow", "red"]
Expand Down
9 changes: 9 additions & 0 deletions treadmill_gait_analysis/function/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ def handler(event, context):
gait_scalars[key]['multiplier'] = 1

gait_scalars['step_width']['multiplier'] = 100 # cm

# %% Info about metrics.
gait_scalars['gait_speed']['info'] = "Gait speed is computed by dividing the displacement of the center of mass by the time it takes to move that distance. A speed larger than 1.12 m/s is considered good."
gait_scalars['step_width']['info'] = "Step width is computed as the average distance between the ankle joint centers in the mediolateral direction during 40-60% of the stance phase. A step width between 4.3 and 7.4 times the subject's height is considered good."
gait_scalars['stride_length']['info'] = "Stride length is computed as the distance between the calcaneus positions at the beginning and end of the gait cycle. A stride length larger than 0.45 times the subject's height is considered good."
gait_scalars['cadence']['info'] = "Cadence is computed as the number of gait cycles (left and right) per minute. A cadence larger than 100 is considered good."
gait_scalars['double_support_time']['info'] = "Double support time is computed as the duration when both feet are in contact with the ground. A double support time smaller than 35% of the gait cycle is considered good."
gait_scalars['step_length_symmetry']['info'] = "Step length symmetry is computed as the ratio between the right and left step lengths. A step length symmetry between 90 and 110 is considered good."

# %% Thresholds.
metadataPath = os.path.join(sessionDir, 'sessionMetadata.yaml')
Expand Down Expand Up @@ -154,6 +162,7 @@ def handler(event, context):
gait_scalars[scalar_name]['decimal'])
metrics_out[scalar_name]['label'] = scalar_labels[scalar_name]
metrics_out[scalar_name]['value'] = vertical_values
metrics_out[scalar_name]['info'] = gait_scalars[scalar_name]['info']
if scalar_name in scalar_reverse_colors:
# Margin zone (orange) is 10% above threshold.
metrics_out[scalar_name]['colors'] = ["green", "yellow", "red"]
Expand Down

0 comments on commit a54bc48

Please sign in to comment.