jflo commited on
Commit
74d9ef0
Β·
verified Β·
1 Parent(s): 9f9e3a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -6
app.py CHANGED
@@ -82,6 +82,50 @@ SORENESS_SEVERITY_OPTIONS = ["none", "mild", "moderate", "severe"]
82
 
83
  COMPLETION_OPTIONS = ["full", "partial"]
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  # ─────────────────────────────────────────────────────────────
87
  # SUBMISSION HANDLER
@@ -120,15 +164,15 @@ def submit_entry(
120
  if soreness_region != "none" and soreness_severity == "none":
121
  return "⚠️ Please select a severity level for your soreness region."
122
 
123
- # ── Build row ────────────────────────────────────────────
124
  row = [
125
  datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S"),
126
  user_text.strip(),
127
- mood,
128
- exertion,
129
- soreness_region,
130
- soreness_severity,
131
- completion_status,
132
  ]
133
 
134
  # ── Write to Google Sheets ───────────────────────────────
 
82
 
83
  COMPLETION_OPTIONS = ["full", "partial"]
84
 
85
+ # ─────────────────────────────────────────────────────────────
86
+ # NUMERICAL ENCODING MAPS
87
+ # Must stay in sync with your training notebook label maps
88
+ # ─────────────────────────────────────────────────────────────
89
+
90
+ MOOD_MAP = {
91
+ "accomplished": 0,
92
+ "anxious": 1,
93
+ "distracted": 2,
94
+ "energized": 3,
95
+ "fatigued": 4,
96
+ "frustrated": 5,
97
+ "neutral": 6,
98
+ "positive": 7,
99
+ }
100
+
101
+ EXERTION_MAP = {
102
+ "low": 0,
103
+ "moderate": 1,
104
+ "high": 2,
105
+ }
106
+
107
+ SORENESS_REGION_MAP = {
108
+ "none": 0,
109
+ "back": 1,
110
+ "biceps": 2,
111
+ "chest": 3,
112
+ "legs": 4,
113
+ "shoulder": 5,
114
+ "triceps": 6,
115
+ }
116
+
117
+ SORENESS_SEVERITY_MAP = {
118
+ "none": 0,
119
+ "mild": 1,
120
+ "moderate": 2,
121
+ "severe": 3,
122
+ }
123
+
124
+ COMPLETION_MAP = {
125
+ "full": 1,
126
+ "partial": 0,
127
+ }
128
+
129
 
130
  # ─────────────────────────────────────────────────────────────
131
  # SUBMISSION HANDLER
 
164
  if soreness_region != "none" and soreness_severity == "none":
165
  return "⚠️ Please select a severity level for your soreness region."
166
 
167
+ # ── Encode labels to integers ─────────────────────────────
168
  row = [
169
  datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S"),
170
  user_text.strip(),
171
+ MOOD_MAP[mood],
172
+ EXERTION_MAP[exertion],
173
+ SORENESS_REGION_MAP[soreness_region],
174
+ SORENESS_SEVERITY_MAP[soreness_severity],
175
+ COMPLETION_MAP[completion_status],
176
  ]
177
 
178
  # ── Write to Google Sheets ───────────────────────────────