ffverse / ffscrapr

R API Client for Fantasy Football League Platforms
https://ffscrapr.ffverse.com
Other
81 stars 22 forks source link

Include platform player_id in ff_scoringhistory()? #275

Closed TheMathNinja closed 3 years ago

TheMathNinja commented 3 years ago

I'm currently trying to work with ff_scoringhistory() but since it doesn't support a couple of my league's scoring categories, I'm trying to join the points variable from ff_playerscores() into that df. But I'm realizing I have 3 different sets of player_id's here to work with (ff_scoringhistory() has GSIS and sportradar, while ff_playerscores() uses the fantasy platform). Is it possible to include another column in ff_scoringhistory() for the player_id from the fantasy platform of choice for easy joining of actual (rather than estimated) scores? Thanks.

tanho63 commented 3 years ago

It’s primarily a completeness problem for me, I think, with dp_playerids() not stretching to the same breadth of historical player IDs.

May revisit some point down the line, I need to revisit my data pipeline again soon

TheMathNinja commented 3 years ago

I'd gladly take an incomplete column in the interim :)

TheMathNinja commented 3 years ago

Let me know if I should open a new issue for this, but I'm noticing this:

ff_scoringhistory(mfl_connect(season = 2020, league_id = 22686), season = 2018:2020)

returns valid player_id's for some years but not others for the same player. Somehow this function knows that Alex Collins is mfl_id = 12628 in 2020, but has NA mfl_id in 2018. Obviously there are quite a few instances where the player_id is unknown in this function (I assume that's a bigger project) but the especially curious cases were ones where it "learns" the player_id later. Is it smart/possible to back-apply these cases?

tanho63 commented 3 years ago

is Alex Collins sportradar ID or gsis ID empty in 2018?

TheMathNinja commented 3 years ago

Always sportradar.

TheMathNinja commented 3 years ago

I'm running ffscrapr 1.4.2 but still having issues with this.

Running this code:

FAFL20 <- mfl_connect(season = 2020, league_id = 22686)
ff_scoringhistory(FAFL20, season = 2018:2020)

I'm getting NA mfl_id and sportradar_id for A.J. Brown in 2019 (but both are present for 2020). Same for Demaryius Thomas in 2018 and 2019.

Is this just a completeness thing to be figured out later?