Skip to content

Commit

Permalink
add pff to update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Oct 8, 2024
1 parent 2e286e3 commit 9b0dfc5
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/update_players.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ jobs:
echo "seasons=$seasons" >> "$GITHUB_OUTPUT"
update_roster_and_draft:
update_season_data:
needs: update_setup
name: Update ${{ matrix.season }} ${{ matrix.type }} data
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
season: ${{ fromJson(needs.update_setup.outputs.seasons) }}
type: ["roster", "raw_draft"]
type: ["roster", "raw_draft", "raw_pff"]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PAT: ${{ secrets.NFLVERSE_GH_TOKEN }}
Expand All @@ -74,16 +74,16 @@ jobs:
with:
extra-packages: local::.
- name: Release ${{ matrix.season }} ${{ matrix.type }}
run: Rscript -e 'source("build/00_update_roster_and_draft.R")'
run: Rscript -e 'source("build/00_update_season_data.R")'

update_components:
needs: [update_setup, update_roster_and_draft]
needs: [update_setup, update_season_data]
name: Update ${{ matrix.type }} data
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
type: ["basis", "pfr", "otc", "draft"]
type: ["basis", "pfr", "otc", "pff", "draft"]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PAT: ${{ secrets.NFLVERSE_GH_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

export(.basis_release_raw_roster)
export(.draft_release_season)
export(.pff_release_raw_players)
export(players_basis_release)
export(players_build_dataset)
export(players_download)
export(players_draft_release)
export(players_fetch_manual_ids)
export(players_manual_overwrite)
export(players_otc_release)
export(players_pff_release)
export(players_pfr_release)
export(players_validate)
export(players_validate_extract_replicated)
8 changes: 6 additions & 2 deletions R/players_build_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ players_build_dataset <- function(release = FALSE){
pfr <- players_download("pfr") |>
remove_replicated("pfr_id")

# at the moment, we take pff ids from the otc dataset
# pff <- players_download("pff")
pff <- players_download("pff") |>
remove_replicated("pff_id")

otc <- players_download("otc") |>
dplyr::mutate(dplyr::across(c(otc_id, pff_id), as.integer)) |>
Expand All @@ -51,6 +51,10 @@ players_build_dataset <- function(release = FALSE){
otc |> dplyr::select(gsis_id, pff_id, otc_id),
by = "gsis_id"
) |>
dplyr::left_join(
pff |> dplyr::select(pff_id, pff_position, pff_status),
by = "pff_id"
) |>
dplyr::left_join(
draft, by = "pfr_id"
) |>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
season <- Sys.getenv("NFLVERSE_UPDATE_SEASON", unset = NA_character_) |> as.integer()

type <- Sys.getenv("NFLVERSE_UPDATE_TYPE", unset = NA_character_)
type <- rlang::arg_match0(type, c("roster", "raw_draft"))
type <- rlang::arg_match0(type, c("roster", "raw_draft", "raw_pff"))

if (type == "roster"){
out <- nflverse.players::.basis_release_raw_roster(seasons = season)
Expand All @@ -12,4 +12,6 @@ if (type == "roster"){
if (Sys.Date() %in% nflverse.players:::.draft_date_range()){
out <- nflverse.players::.draft_release_season(years = season)
}
} else if (type == "raw_pff" && .pff_is_valid_season(season)){
out <- nflverse.players::.pff_release_raw_players(seasons = season)
}
4 changes: 3 additions & 1 deletion build/01_update_components.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type <- Sys.getenv("NFLVERSE_UPDATE_TYPE", unset = NA_character_)
type <- rlang::arg_match0(type, c("basis", "pfr", "otc", "draft"))
type <- rlang::arg_match0(type, c("basis", "pfr", "otc", "draft", "pff"))

if (type == "basis"){
out <- nflverse.players::players_basis_release()
Expand All @@ -11,4 +11,6 @@ if (type == "basis"){
out <- nflverse.players::players_otc_release()
} else if (type == "draft"){
out <- nflverse.players::players_draft_release()
} else if (type == "pff"){
out <- nflverse.players::players_pff_release()
}
16 changes: 16 additions & 0 deletions man/dot-pff_release_raw_players.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions man/players_pff_release.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9b0dfc5

Please sign in to comment.