Expand description
FanDuel DFS salary CSV parsing and SQLite storage.
This crate is primarily used by nfl-data to import FanDuel salary CSV files. It parses
CSV rows into SalariedPlayer records, then stores and retrieves them by NFL season week.
FanDuel salary CSV files do not include the NFL week, so parsing requires the caller to
provide a SeasonWeek. Parsing is separate from persistence, allowing the
returned records to be inspected before saving.
§Importing salaries
Connect, creating the database and applying this crate’s migrations as needed, parse the export, and save the resulting records.
use fanduel_data::FanduelData;
use nfl_model::{SeasonWeek, Week};
let data = FanduelData::connect(database_url).await?;
let week = SeasonWeek::from_week(Week(1)).expect("valid season week");
let salaries = data.parse_fanduel_csv(week, csv_bytes)?;
data.save_salaried_players(&salaries).await?;
let stored = data.salaried_players_for(week).await?;
println!("Stored {} salary entries", stored.len());DFS positions and team abbreviations use
shared types from nfl-model. DST entries represent team
defenses and have no Player; entries at other positions contain a player.
weekly_unmatched_counts counts unmatched player
entries only, excluding defenses.
Structs§
- Fanduel
Data - A handle for parsing and storing FanDuel salary data in SQLite.
- Game
- The NFL season week and team matchup associated with salary entries.
- Matchup
- The away and home teams in a game.
- Player
- A player identified by FanDuel’s player ID and name.
- Salaried
Player - A player’s or defense’s FanDuel salary entry for a game.
Enums§
- Fanduel
Data Error - Errors returned while parsing FanDuel salary CSV files or accessing salary data.