weglide / bugtracker

WeGlide platform bug tracker.
https://www.weglide.org
11 stars 0 forks source link

Add league rounds diagram #197

Open frantzheld opened 2 years ago

frantzheld commented 2 years ago

Describe the Feature Add a diagram to show the developing of league ranking. See example below.

Screenshots image

Python code

import requests
import pandas as pd

season = 2022
df = pd.DataFrame()

for i in range(14):
    url = 'https://api.weglide.org/v1/league/total/' + str(i) + '?name=DN&season=' + str(season)
    league = requests.get(url).json()

    club_names = [club['club']['name'] for club in league]
    points = [club['league_points'] for club in league]

    df2 = pd.DataFrame([points],columns=club_names)
    df = pd.concat([df,df2], ignore_index=True)

#%% Plot data
df.columns.name = 'Verein'
df.index.name = 'Runde'
clubs=['Hannoverscher Aero-Club','FSV Celle','LSV Stade','HVL Boberg','AC Hodenhagen','VfL Südheide']
df[clubs].plot(figsize=(12,8),markersize=10,grid=True,marker='.',title='Verlauf Regionalliga Nord')
moldhouse commented 2 years ago

I think we could build a custom endpoint for that. @samuel-git we don't use diagrams anywhere in the frontend, so this is probably part of a bigger update?

samuel-git commented 2 years ago

Yes, this involves some more work. I would like to get a feel how many people this would use first. Maybe we can provide it as a separate service/repo ?