Skip to content

Commit

Permalink
finish flushing out the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rushfive committed Mar 26, 2019
1 parent 43ab250 commit a9700ba
Show file tree
Hide file tree
Showing 6 changed files with 303 additions and 16 deletions.
6 changes: 1 addition & 5 deletions DatabaseProviders/R5.FFDB.DbProviders.Mongo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

This document describes the schema for the current version _v1.0.0-alpha.1_

##### Quick Notes
- All enums are stored as their string representations.

There's several fields that serialize core enum values as strings. The definitions of these enums can be found in the `R5.FFDB.Core` project:

- (link to Cores readme)

- [R5.FFDB.Core Documentation](../../Engine/R5.FFDB.Core/README.md)

---

Expand Down
4 changes: 4 additions & 0 deletions DatabaseProviders/R5.FFDB.DbProviders.PostgreSql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This document describes the schema for the current version _v1.0.0-alpha.1_
- All player week stats use a `FLOAT8` datatype. I understand that this doesn't make sense for a lot of stat types, but when I was building this out initially I kept finding new stats that were of a double-precision type and running into exceptions. Keeping them all as `FLOAT8` simplifies the processing work the Engine has to do, and future proofs any additional stat types that may come out.
- Pretty much every table _doesn't_ have a single-column PK. For example, the various player stats tables make use of composite primary keys instead (eg combining player_id, season, and week which together uniquely identifies the entry)

There's several columns that serialize core enum values as strings. The definitions of these enums can be found in the `R5.FFDB.Core` project:

- [R5.FFDB.Core Documentation](../../Engine/R5.FFDB.Core/README.md)

---

### Tables
Expand Down
244 changes: 244 additions & 0 deletions Engine/R5.FFDB.Core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
## R5.FFDB.Core

_v1.0.0-alpha.1_

---

This document describes the core data models used by the Engine.

These models are the same types the database providers interface with (ie they receive them as method arguments, and return them when requested by the Engine).

They really represent a boundary between the Engine and any of the data sources used to fetch NFL data. Every data source provides a `AsyncMapper` that maps the original data received from the source, into these models the Engine can work with.

---

#### Models and Types in this Document

###### Enumerations

- [WeekStatType](#week-stat-type)
- [RosterStatus](#roster-status)
- [Position](#position)

###### Entities

- [Player](#player)
- [PlayerAdd](#player-add)
- [PlayerUpdate](#player-update)
- [PlayerWeekStats](#player-week-stats)
- [Roster](#roster)
- [Team](#team)
- [TeamWeekStats](#team-week-stats)
- [WeekMatchup](#week-matchup)

###### Other Important Types

- [IAppLogger](#iapplogger)
- [IDatabaseProvider](#database-provider)
- [IDatabaseContext](#database-context)

---

##### Week Stat Type

This enum contains all the weekly player stat types that are provided from NFL's Fantasy Football API.

```
public enum WeekStatType
{
Pass_Attempts = 2,
Pass_Completions = 3,
Pass_Yards = 5,
Pass_Touchdowns = 6,
Pass_Interceptions = 7,
Pass_Sacked = 8,
Rush_Attempts = 13,
Rush_Yards = 14,
Rush_Touchdowns = 15,
Receive_Catches = 20,
Receive_Yards = 21,
Receive_Touchdowns = 22,
Return_Yards = 27,
Return_Touchdowns = 28,
Fumble_Recover_Touchdowns = 29,
Fumbles_Lost = 30,
Fumbles_Total = 31,
TwoPointConversions = 32,
Kick_PAT_Makes = 33,
Kick_PAT_Misses = 34,
Kick_ZeroTwenty_Makes = 35,
Kick_TwentyThirty_Makes = 36,
Kick_ThirtyForty_Makes = 37,
Kick_FortyFifty_Makes = 38,
Kick_FiftyPlus_Makes = 39,
Kick_ZeroTwenty_Misses = 40,
Kick_TwentyThirty_Misses = 41,
Kick_ThirtyForty_Misses = 42,
Kick_FortyFifty_Misses = 43,
Kick_FiftyPlus_Misses = 44,
DST_Sacks = 45,
DST_Interceptions = 46,
DST_FumblesRecovered = 47,
DST_FumblesForced = 48,
DST_Safeties = 49,
DST_Touchdowns = 50,
DST_BlockedKicks = 51,
DST_ReturnYards = 52,
DST_ReturnTouchdowns = 53,
DST_PointsAllowed = 54,
DST_YardsAllowed = 62,
IDP_Tackles = 70,
IDP_AssistedTackles = 71,
IDP_Sacks = 72,
IDP_Interceptions = 73,
IDP_ForcedFumbles = 74,
IDP_FumblesRecovered = 75,
IDP_InterceptionTouchdowns = 76,
IDP_FumbleTouchdowns = 77,
IDP_BlockedKickTouchdowns = 78,
IDP_BlockedKicks = 79,
IDP_Safeties = 80,
IDP_PassesDefended = 81,
IDP_InterceptionReturnYards = 82,
IDP_FumbleReturnYards = 83,
IDP_TacklesForLoss = 84,
IDP_QuarterBackHits = 85,
IDP_SackYards = 86
}
```

Their API stores stats in a JavaScript object as key-value-pairs, where the numeric values of the enum represent the keys they use.

---

###### Roster Status

This enum contains the different status types a player can have while being on a team.

```
public enum RosterStatus
{
ACT, // Active
RES, // Injured Reserve
NON, // Non football-related Injured Reserve
SUS, // Suspended
PUP, // Physically Unable to Perform
UDF, // Unsigned Draft Pick
EXE // Exempt
}
```

This data is scraped from each team's individual roster page, and can be updated when you run the command:

```
ffdb update-players
```

---

###### Position

This enum represents the different position types a player can have (eg QB, RB, WR, etc.)

```
public enum Position
{
QB,
RB,
FB,
WR,
TE,
OL,
C,
G,
LG,
RG,
T,
LT,
RT,
K,
KR,
DL,
DE,
DT,
NT,
LB,
ILB,
OLB,
MLB,
DB,
CB,
FS,
SS,
S,
P,
PR,
OT,
OG,
LS,
SAF
}
```

Note that the different types may have some overlaps. For whatever reason, some teams like to use different labels for the same positions. FFDB is not going to attepmt to discriminate between those similar types, nor will it try to resolve which label is the "correct" one to use.

---

_The rest of the types on this document represent either core Entities (such as player or team) or other important types used by the Engine._

Their class or interface definitions will not be included here, check out their files if you're interested.

---

###### Player
The model returned from the `IDatabaseProvider` for the Engine to use.

---

###### PlayerAdd
The model provided by the Engine for the `IDatabaseProvider` to add to the database.

---

###### PlayerUpdate
The model provided by the Engine for the `IDatabaseProvider` to add to the database.

---

###### PlayerWeekStats
This model represents a single player's stats for a single week.

---

###### Roster
This model represents a team's current roster information. It includes a list of `RosterPlayer` objects for each player that's on the team.

---

###### Team
This model represents a single team. Because the data very rarely changes, it's been added directly into the code.

The `Teams` helper class, also found in this same Core project, contains many helper methods for interacting with the teams.

---

###### TeamWeekStats
This model represents a single team's various stats for a single game. It includes data such as points scored for the different quarters, total offensive yards, etc.

---

###### WeekMatchup
This simple model represents a single game, specifying which two teams played against each other.

---

###### IAppLogger
This is the logging abstraction that's used by the Engine. If you are using your own `IDatabaseProvider` implementation, you receive the instance of the logger to use in your factory function.

---

###### IDatabaseProvider
The interface that must be implemented for the Engine to store data.

##### IDatabaseContext
Defines the various methods that are required for the Engine to run its many different tasks.
1 change: 1 addition & 0 deletions FFDB.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
appveyor.yml = appveyor.yml
LICENSE = LICENSE
README.md = README.md
EndProjectSection
Expand Down
51 changes: 40 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
__R5.FFDB.Engine__

[![Nuget](https://img.shields.io/nuget/v/r5.ffdb.engine.svg)](https://www.nuget.org/packages/R5.FFDB.Engine/)
[![Build status](https://img.shields.io/appveyor/ci/rushfive/ffdb.svg)](https://ci.appveyor.com/project/rushfive/ffdb)

__R5.FFDB.Core__

Expand All @@ -18,7 +19,9 @@ The two databases natively supported by the CLI are:
- PostgreSql (v10.0.4)
- Mongo (v4.0.2)

If you'd like to use the engine to create a different database, or even postgres/mongo with your own customized schema, you can easily provide your own `IDbProvider` implementation to do so.
If you'd like to use the engine to create a different database, or even postgres/mongo with your own customized schema, you can easily provide your own `IDatabaseProvider` implementation to do so.

This app is written using `netcore 2.2`.

---

Expand All @@ -39,15 +42,41 @@ The Player Stats also includes data for IDP.

_The Engine and CLI are currently in an alpha release state_

Although they're essentially feature complete, I have some uncertainties on how I've drawn up the database schemas for both Postgres and Mongo. I'll leave these two issue threads up for a period to get community input:
Although they're essentially feature complete, I have some uncertainties on how I've drawn up the database schemas for both Postgres and Mongo. For those interested, check the README files below for their schemas:

- (Link to Postgres issue)
- (Link to Mongo issue)
- [PostgreSql](DatabaseProviders/R5.FFDB.DbProviders.PostgreSql/README.md)
- [Mongo](DatabaseProviders/R5.FFDB.DbProviders.Mongo/README.md)

The official v1 release may include db schema changes so be aware that you may need to re-build your db on v1 (migrations won't be supported for the alpha-to-v1 change).

---

#### Getting Started

How easy is this to use? You can run and setup a database with all the latest data in a single command:

```
ffdb setup
```

Download the latest compiled CLI programs from the list below to get started. They're all built as self-contained apps, so you don't need to have the net core runtime installed on your machine.

OS | Download | Notes | SHA256 Hash
---|---|---
Windows x64 | download-link-here | | BAEB11566837763106DE017AA8FA782492F0B67D64FC55FCD67FE9EA34EA4D7F
Windows x86 | download-link-here | | 40773284F794DECED49F165A46AB52DDCA5594376ED83FCEA2D66005C5921B37
OSX x64 | download-link-here | Minimum OS version is macOS 10.12 Sierra | 6525E717B78489C96E946B624DD9E94A464DEF5D6FB90C831D7F15DDBE6FC896
Linux x64 | download-link-here | Most desktop distributions like CentOS, Debian, Fedora, Ubuntu and derivatives | C97EB01553653DB235B83FC3C9C6347D1F539724BC7BA7132242DE9D24EAB94D

If you need the compiled program for a different environment, you can either:

- Run the build yourself using these 2 resources:
- [Simple Walkthrough of Build/Publishing](https://docs.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli)
- [Supported Environments for DotNet Publish](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)
- Create an issue and I'll see if I can get around to building it out for ya.

---

#### Documentation Table of Contents

- [Using the CLI](#using-the-cli)
Expand All @@ -70,12 +99,6 @@ The official v1 release may include db schema changes so be aware that you may n

#### Using the CLI

To get started, head to the release page and download the latest version:

- (link to release page)

Or, clone the repo and run it yourself (the app was built using netcore2.2)

##### Persisting Data Files

Just a few notes about data files before diving in:
Expand Down Expand Up @@ -383,6 +406,10 @@ To do this, you'll need a reference to the _R5.FFDB.Core_ library, which can be
dotnet add package R5.FFDB.Core --version 1.0.0-alpha.1
```

If you're also pulling in the `R5.FFDB.Engine` package, this Core library is included as a transitive dependency so no need to directly add it into your project.

---

Here, we'll walk through that interface and its contract, so you can understand not only the literal API the Engine expects to work with, but also the underlying behavior and assumptions that are relevant.

Here's the `IDatabaseProvider` interface definition:
Expand Down Expand Up @@ -488,4 +515,6 @@ Take the list of matchups and add it to your database.

Stumbled across a bug? Program throwing some exception? Please enable debug level logging and provide the log file or relevant snippets.

It's an easy request to meet, and I'll most likely ignore/close the issue without it. Thanks!
_Issues without logs (when relevant) will most likely be ignored and closed_

I can't guarantee that a fix will happen immediately, but I will at least try to get back with a reply within a reasonable time.
13 changes: 13 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 1.0.0-alpha.1
image: Visual Studio 2017
configuration: Release

before_build:
- cmd: nuget restore

build:
project: FFDB.sln
verbosity: minimal

artifacts:
- path: '**\*.nupkg'

0 comments on commit a9700ba

Please sign in to comment.