Skip to main content
Question

Personal Bests / Best Efforts in API

  • January 1, 2025
  • 2 replies
  • 120 views

Forum|alt.badge.img+1

Hello,

I’m trying to find an API endpoint to get my best effort times on different run distances (1K, 5K, HM etc.), but I can’t find a sensible way to do it. I understand that I could, in theory, go through each detailed activity, but that would be a hassle. There must be a more efficient way of doing this? 

2 replies

Forum|alt.badge.img
  • Hub Starter
  • 1 reply
  • January 11, 2025

same as my problem, I want to get estimated best efforts from API 


Forum|alt.badge.img+1
  • Author
  • Hub Rookie
  • 2 replies
  • January 11, 2025

@aliif I found a workaround, but it involves getting the detailed activity for each activity. It’s a bit of a pain considering the strict rate limits, so I recommend caching them. 

 

def process_best_efforts(activity_id: int, best_efforts_list: list) -> pd.DataFrame:
        best_efforts_data = []  

        best_efforts = json.dumps(best_efforts_list)

        best_efforts_data.append([activity_id, best_efforts])

        best_efforts = [
            {
                "id": effort["activity"]["id"],
                "date": effort["start_date_local"][:10],  # Extract YYYY-MM-DD
                "name": effort["name"],
                "distance": effort["distance"],
                "time": effort["moving_time"],
                "pr_rank": (
                    effort["pr_rank"] if effort["pr_rank"] is not None else 0
                ),  # Convert None to 0
            }
            for effort in best_efforts_list
        ]

best_efforts_df = pd.DataFrame(best_efforts)

return best_efforts_df

 

 

 

best_efforts_data = detailed_activity.get("best_efforts", [])
 best_efforts_df = process_best_efforts(activity_id, best_efforts_data)
        

 

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept, you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings