Skip to content

Commit 08ca2ed

Browse files
#BUG_FIX
Prompt Category: Bug Fixing Prompt: Fix the error in this code. The target Google sheet is not being filled User Observation: Still the Taget google sheet is empty Response ID: b917bd10-659c-4e49-a6c0-078d872b3cf3
1 parent 3e09c97 commit 08ca2ed

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

app.log

+13
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,16 @@ Exception: API Error
153153
^">
154154
2025-03-13 19:00:05,884 - ERROR - Failed to write to target sheet
155155
2025-03-13 19:00:05,885 - ERROR - Failed to process and transfer data
156+
2025-03-13 19:04:15,526 - INFO - Successfully loaded credentials
157+
2025-03-13 19:04:15,528 - INFO - file_cache is only supported with oauth2client<4.0.0
158+
2025-03-13 19:04:15,529 - INFO - Successfully created Google Sheets service
159+
2025-03-13 19:04:17,814 - INFO - Retrieved 144 rows of data
160+
2025-03-13 19:04:17,815 - INFO - Available columns in sheet: ['Timestamp', 'Email Address', 'Tool being used', 'Feature used', 'Task Objective', 'Repository Link', 'Repository: Public/Private', 'Repository: Lines of Code', '[Turn 1]: Prompt Category', '[Turn 1]: Prompt', '[Turn 1]: Model Response', '[Turn 1]: Model Response - File [Use only when response is too long]', '[Turn 1]: Observations', '[Turn 1]: Screenshots', '[Turn 2]: Prompt Category', '[Turn 2]: Prompt', '[Turn 2]: Model Response', '[Turn 2]: Model Response - File [Use only when response is too long]', '[Turn 2]: Observations', '[Turn 2]: Screenshot', '[Turn 3]: Prompt Category', '[Turn 3]: Prompt', '[Turn 3]: Model Response', '[Turn 3]: Model Response - File [Use only when response is too long]', '[Turn 3]: Observations', '[Turn 3]: Screenshot', '[Turn 4]: Prompt Category', '[Turn 4]: Prompt', '[Turn 4]: Model Response', '[Turn 4]: Model Response - File [Use only when response is too long]', '[Turn 4]: Observations', '[Turn 4]: Screenshot', '[Turn 5]: Prompt Category', '[Turn 5]: Prompt', '[Turn 5]: Model Response', '[Turn 5]: Model Response - File [Use only when response is too long]', '[Turn 5]: Observations', '[Turn 5]: Screenshot', '[Turn 6]: Prompt Category', '[Turn 6]: Prompt', '[Turn 6]: Model Response', '[Turn 6]: Model Response - File [Use only when response is too long]', '[Turn 6]: Observations', '[Turn 6]: Screenshot', '[Turn 7]: Prompt Category', '[Turn 7]: Prompt', '[Turn 7]: Model Response', '[Turn 7]: Model Response - File [Use only when response is too long]', '[Turn 7]: Observations', '[Turn 7]: Screenshot', 'Context Awareness', 'Context Awareness: Errors', 'Rationale for Context Awareness', 'Output Quality', 'Output Quality: Errors', 'Rationale for Output Quality', 'Autonomy', 'Autonomy: Errors', 'Rationale for Autonomy', 'Iteration Size and Speed', 'Iteration Size and Speed: Errors', 'Rationale for Iteration Size and Speed', 'Experience', 'Experience - Flexibility, Ease of Use and Reliability: Errors', 'Rationale for Experience', 'Loom Recording Link', 'Overall Rating', 'Rationale behind the overall rating', '[Turn 1]: Final Turn?', '[Turn 2]: Final Turn?', '[Turn 3]: Final Turn?', '[Turn 4]: Final Turn?', '[Turn 5]: Final Turn?', '[Turn 6]: Final Turn?', '[Turn 7]: Final Turn?', '[Turn 1]: Turn ID', '[Turn 2]: Turn ID', '[Turn 3]: Turn ID', '[Turn 4]: Turn ID', '[Turn 5]: Turn ID', '[Turn 6]: Turn ID', '[Turn 7]: Turn ID', 'Unique ID']
161+
2025-03-13 19:04:17,820 - INFO - Successfully filtered required columns
162+
2025-03-13 19:04:17,823 - INFO - Calculated mean ratings
163+
2025-03-13 19:04:17,824 - INFO - Calculated results and color mapping
164+
2025-03-13 19:04:17,825 - INFO - file_cache is only supported with oauth2client<4.0.0
165+
2025-03-13 19:04:19,170 - INFO - Target sheet cleared successfully
166+
2025-03-13 19:04:20,344 - INFO - Data written to target sheet successfully
167+
2025-03-13 19:04:20,345 - INFO - Data successfully written to target sheet
168+
2025-03-13 19:04:20,347 - INFO - Data processing and transfer successful

extract_data.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,18 @@ def write_to_target_sheet(df, service):
4545
try:
4646
target_spreadsheet_id = '1FEqiDqqPfb9YHAWBiqVepmmXj22zNqXNNI7NLGCDVak'
4747

48+
# Clean the DataFrame by replacing NaN with empty strings
49+
df_clean = df.fillna('')
50+
51+
# Convert numeric columns to rounded strings
52+
numeric_columns = ['Context Awareness', 'Autonomy', 'Experience',
53+
'Output Quality', 'Overall Rating', 'Mean Rating', 'Difference']
54+
for col in numeric_columns:
55+
df_clean[col] = df_clean[col].apply(lambda x: f"{x:.2f}" if x != '' else '')
56+
4857
# Prepare data for writing
49-
headers = df.columns.tolist()
50-
values = [headers] + df.values.tolist()
58+
headers = df_clean.columns.tolist()
59+
values = [headers] + df_clean.values.tolist()
5160

5261
# Write data
5362
body = {

0 commit comments

Comments
 (0)