ffverse / ffscrapr

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

mfl_players() out of date #434

Closed TheMathNinja closed 3 weeks ago

TheMathNinja commented 3 weeks ago

Describe the bug The mapping within mfl_players(), specifically from mfl ID's to ESPN ID's is quite incomplete, especially compared to nflreadr::load_ff_playerids().

Reprex

# Load required libraries
library(dplyr)
library(nflreadr)
library(ffscrapr)

# Load the data
nflreadr_df <- nflreadr::load_ff_playerids()
mfl_df <- ffscrapr::mfl_players()

# Rename player_id to mfl_id in the mfl_df for consistency
mfl_df <- mfl_df %>%
  rename(mfl_id = player_id)

# Find mfl_id's present in mfl_df but not in nflreadr_df
missing_mfl_in_nflreadr <- mfl_df %>%
  anti_join(nflreadr_df, by = "mfl_id") %>%
  select(mfl_id, espn_id) %>%
  arrange(mfl_id)

# Find espn_id's present in nflreadr_df but not in mfl_df
missing_espn_in_mfl <- nflreadr_df %>%
  anti_join(mfl_df, by = "espn_id") %>%
  select(mfl_id, espn_id) %>%
  arrange(espn_id)

# Find espn_id's present in mfl_df but not in nflreadr_df
missing_espn_in_nflreadr <- mfl_df %>%
  anti_join(nflreadr_df, by = "espn_id") %>%
  select(mfl_id, espn_id) %>%
  arrange(espn_id)

# Output results for inspection
list(
  missing_mfl_in_nflreadr = missing_mfl_in_nflreadr,
  missing_espn_in_mfl = missing_espn_in_mfl,
  missing_espn_in_nflreadr = missing_espn_in_nflreadr
)
 # Please include the code used for the connection object from `ff_connect()`

Expected behavior The above reprex gives 292 missing MFL ID's in nflreadr::load_ff_playerids(), 5971 missing ESPN IDs in mfl_players(), and 7 missing ESPN ID's in nflreadr::load_ff_playerids().

I would expect that these two functions are synced up with each other (e.g. mfl_players() uses nflreadr::load_ff_playerids() for its output).

Could we get these synced up so that there's a "most complete" database that the other draws from (I assume ffscrapr prefers to draw from nflreadr than vice versa).

Session information Please copy the output of ffscrapr::ffverse_sitrep() into the box below.

── System Info ────────────────────────────────────────────────────────────────
• R version 4.4.1 (2024-06-14 ucrt) • Running under: Windows 11 x64 (build 22631)
── Package Status ─────────────────────────────────────────────────────────────
   package installed  cran      dev behind
1 ffscrapr  1.4.8.18 1.4.8 1.4.8.18       
── Package Options ────────────────────────────────────────────────────────────
• No options set for above packages
── Package Dependencies ───────────────────────────────────────────────────────
• askpass    (1.2.0)   • jsonlite   (1.8.8)     • stringr    (1.5.1)  
• assertthat (0.2.1)   • lifecycle  (1.0.4)     • sys        (3.4.2)  
• backports  (1.5.0)   • magrittr   (2.0.3)     • tibble     (3.2.1)  
• cachem     (1.1.0)   • memoise    (2.0.1)     • tidyr      (1.3.1)  
• checkmate  (2.3.1)   • mime       (0.12)      • tidyselect (1.2.1)  
• cli        (3.6.3)   • nflreadr   (1.4.1.00)  • utf8       (1.2.4)  
• cpp11      (0.4.7)   • openssl    (2.2.0)     • vctrs      (0.6.5)  
• curl       (5.2.1)   • pillar     (1.9.0)     • withr      (3.0.1)  
• data.table (1.15.4)  • pkgconfig  (2.0.3)     • graphics   (4.4.1)  
• dplyr      (1.1.4)   • purrr      (1.0.2)     • grDevices  (4.4.1)  
• fansi      (1.0.6)   • R6         (2.5.1)     • methods    (4.4.1)  
• fastmap    (1.2.0)   • rappdirs   (0.3.3)     • stats      (4.4.1)  
• generics   (0.1.3)   • ratelimitr (0.4.1)     • tools      (4.4.1)  
• glue       (1.7.0)   • rlang      (1.1.4)     • utils      (4.4.1)  
• httr       (1.4.7)   • stringi    (1.8.4)       
── Not Installed ──────────────────────────────────────────────────────────────
• ffsimulator  • ffpros  • ffopportunity  
───────────────────────────────────────────────────────────────────────────────

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

tanho63 commented 3 weeks ago

mfl_players() provides the MFL API output only, the equivalent to load_ff_playerids() is dp_player_ids()

TheMathNinja commented 3 weeks ago

Can you explain this more? mfl_players() returns ESPN_id and many other id’s but they are quite incomplete. Are you saying these espn_id are part of MFL API? That seems very odd to me. I assumed it was just an outdated join…

tanho63 commented 3 weeks ago

Correct, MFL api returns a semi sparse set of other IDs. No joins are occurring in mfl_players

TheMathNinja commented 3 weeks ago

WHAAAAAAAT?!?! That’s crazy lol