This repo contains a Python script that can calculate the average milage biked over the last few weeks (currently defined as 8 weeks arbitrarily)
This assumes you use Strava to track bike rides, and that you provide an "activities.csv" file which can be exported from Strava if you request a copy of your data