soccerdata icon indicating copy to clipboard operation
soccerdata copied to clipboard

Modify season codes to account for seasons within single calendar year

Open marcjbaron opened this issue 1 year ago • 3 comments

This PR addresses a problem of gathering data from certain unsupported leagues, referenced in #246, #218, and a comment in #354; specifically, custom leagues whose seasons take place within a single calendar year. Previously, the way the season codes were interpreted for single-year seasons would mean some seasons were skipped over or the same season was downloaded twice.

There is a change to the behaviour of currently supported leagues: Using a season code like "2015" would now be interpreted as "1415", as opposed to the previous interpretation of "1516". The original interpretation seems to make more logical sense, but at the expense of the non-supported leagues.

If this behaviour for supported leagues is not desired, I can comment on previous issues for visibility instead, but hopefully this is a minimally invasive change.

marcjbaron avatar Mar 29 '24 03:03 marcjbaron

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 63.79310% with 21 lines in your changes missing coverage. Please review.

Project coverage is 65.47%. Comparing base (69fb0de) to head (fa2b79c). Report is 163 commits behind head on master.

Files Patch % Lines
soccerdata/_common.py 60.78% 18 Missing and 2 partials :warning:
soccerdata/whoscored.py 0.00% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #523      +/-   ##
==========================================
+ Coverage   59.33%   65.47%   +6.13%     
==========================================
  Files          11       13       +2     
  Lines        1633     2007     +374     
  Branches      336      414      +78     
==========================================
+ Hits          969     1314     +345     
- Misses        610      624      +14     
- Partials       54       69      +15     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Mar 29 '24 03:03 codecov-commenter

I do not think this solution is appropriate. Ideally, what you would want as a season code for the current season is "2324" for the EPL and "2024" for the MLS. To be able to implement this, I would add to the config file which calendar a league / tournament uses.

probberechts avatar Apr 04 '24 12:04 probberechts

I have made a change to the season_code function to account for single calendar-year leagues; this change uses the start/end month in the league config files to modify the season codes as needed. However, this required adding a league parameter to the season code function, and changing subsequent calls to that function.

I have not written any tests for this change, since none of the default leagues use this type of calendar. However, I can do this shortly if the changes are appropriate.

marcjbaron avatar May 05 '24 18:05 marcjbaron

@probberechts @marcjbaron Very interested into this PR ; any chance we could have that merge before the beginning of the Euro ? Many thanks,

hugo-mrc avatar Jun 01 '24 21:06 hugo-mrc

Superseded by #611

probberechts avatar Jun 16 '24 13:06 probberechts