Bulk delete old data

Sorry if this obvious, but is there a way to bulk remove rides? I’ve recently got a power meter after realising the numbers from my trainer were basically random, so it would be good to delete all of these. Is it a case of removing them from strava?

Unfortunately you would need to remove them from Strava. However you can go to each activity, click the “cog” icon under the ride timeline chart and tick the “ignore power” box. Then they won’t mess up your power stats but you will still have the record.

If you give me a date I can bulk set the “ignore power” flag on all activities on or before that date for you.

3 Likes

Thanks David, that’s incredibly kind of you. If you cleared all power data from before 17th October this year that would be really helpful!

1 Like

Done!

Thanks David (and Patreon added)

2 Likes

That’s :tada:

Hi all
IS there a way to bulk delete metric data such as resting HR, HRV etc?

Download wellness csv, edit, upload edited csv.

1 Like

Thanks for the reply! Yes, that’s what I did.
Seemed the most logical thing to do. But one thing that doesn’t work for me there is upload of ‘Comments’. Won’t allow an upload with a ‘comments’ column in the csv file. Anyone know a way around this?

Onze a comment has been entered, you can´t clear the field anymore. Try returning a comment with a single space ISO empty.
My guess is that this will work.

I was trying to upload comments rather than clear the field. Wouldn’t let me.

Are you sending line breaks?
The field is json formatted. If you want a line break, insert a backslash followed by the letter n.
Start with something basic and see what is accepted.

1 Like

I don’t really know what line breaks are
What I was did was as follows

Added a comment to yesterday’s calendar.
Downloaded csv
Edited the csv and put either an ‘S’ or a ‘PS’ in each cell in the comments column (to denote Sympathetic or Parasympathetic HRV readiness score because the readiness score field itself only allows a numeric value).
Edited what other fields I needed to and reupload.
Upload won’t allow the comments column but all other columns are accepted.

It’s not a huge deal. I don’t really need that historical data but it’s a nice to have.

Thanks
D

I fixed that bug. You can now upload comments in the CSV.

1 Like

Wow. That was quick. Thanks a million. Much appreciated.

I’m trying the .csv download/upload in order to remove old HR and HRV entries that I would like to discard. However, when I upload the modified file nothing seems to be happening?

Here’s the code I’m using. helpers.read_allinfo and helpers.save_allinfo are small helper scripts that I’ve written to easily read a .csv file into a python dictionary.

# read in data
allinfo = helpers.read_allinfo('athlete_4427957_wellness.csv', delim=',', unique=True)

# fields to reset
reset = ['restingHR', 'hrv', 'hrvSDNN', 'readiness', 'sleepSecs', 'sleepScore', 'sleepQuality', 'avgSleepingHR']
# reset fields
for x in allinfo.keys():
    if datetime.strptime(allinfo[x]['\ufeffdate'], '%Y-%m-%d') < datetime(2022, 9, 27, 0, 0):
        for r in reset:
            allinfo[x][r] = ''

# save adjusted csv
helpers.save_allinfo(allinfo, 'athlete_4427957_wellnessADJUSTED.csv', delim=',', myfieldnames=allinfo[0].keys())

Only thing I can think off is maybe the ‘date’ key is not read correctly, as it’s encoded as ‘\ufeffdate’ in the resulting dictionary.

Texteditor (BBEdit) says both the original and the adjusted file have the same encoding.

Empty columns in the uploaded CSV are ignored. For numeric values you need to use -1 to reset. I just tested this with resting HR and it worked.

date,restingHR
2023-01-11,
2023-01-10,46
2023-01-09,55
2023-01-08,-1
2023-01-07,58
1 Like

Thanks @david, that worked nicely.

I guess I should have read the upload text a bit better instead of thinking it was just the typical you can drag and drop explanation. :sweat_smile:

1 Like