Why
The live MLB Stats API currently exposes a broad set of values through:
https://statsapi.mlb.com/api/v1/statTypes
The package maps returned stat payloads to concrete Pydantic split models by matching each MLB stat type against model classes with a _stat declaration.
As MLB adds or changes stat types, unsupported values may not fail loudly. A stat type with no matching model can result in an outer Stat object with empty parsed splits, which makes unsupported coverage harder to detect.
This issue should audit the current MLB statTypes surface against the models implemented in mlbstatsapi.models.stats.
Goals
- Inventory the current stat types exposed by MLB
- Map each stat type to the package model(s) that support it
- Identify stat types with no matching model
- Live-test questionable or modern stat types against the MLB API
- Verify that supported stat types deserialize into the expected Pydantic split objects
- Identify response shapes that need new models or parser behavior
- Add deterministic regression coverage for any newly supported stat types
Initial audit candidates
The following currently exposed types do not appear to have obvious mappings in the package and should be investigated first:
projected_Zips
projected_ZipsRos
projected_Zips2YR
projected_Zips3YR
metricLog
metricAverages
availableStats
sabermetricsMultiTeam
gameTypeStats
firstYearStats
lastYearStats
atGameStart
vsOpponents
tracking
This list is a starting point, not the authoritative set of unsupported types.
Suggested audit matrix
Track the investigation with something similar to:
| Stat type |
Model mapping |
Live response |
Parses correctly |
Action |
season |
existing |
yes |
yes |
none |
expectedStatistics |
existing |
yes |
verify |
test |
metricAverages |
unknown |
investigate |
unknown |
investigate |
projected_Zips |
none found |
investigate |
unknown |
investigate |
Parser behavior to review
create_split_data() / return_splits() currently locate split model classes by inspecting the stat-group module and checking whether the returned stat_type exists in a model class's _stat list.
The audit should verify what happens when MLB returns a valid stat type for which the library has no matching class. Unsupported types should not silently look like successfully parsed empty data.
Do not change this behavior as part of the audit unless the desired compatibility behavior is understood and separately tested.
Acceptance criteria
Scope
This is primarily a stats-model and parser audit. It is separate from the v1.1.0 async endpoint rollout unless the investigation uncovers a regression that affects the existing public stats methods.
Why
The live MLB Stats API currently exposes a broad set of values through:
https://statsapi.mlb.com/api/v1/statTypesThe package maps returned stat payloads to concrete Pydantic split models by matching each MLB stat type against model classes with a
_statdeclaration.As MLB adds or changes stat types, unsupported values may not fail loudly. A stat type with no matching model can result in an outer
Statobject with empty parsedsplits, which makes unsupported coverage harder to detect.This issue should audit the current MLB
statTypessurface against the models implemented inmlbstatsapi.models.stats.Goals
Initial audit candidates
The following currently exposed types do not appear to have obvious mappings in the package and should be investigated first:
This list is a starting point, not the authoritative set of unsupported types.
Suggested audit matrix
Track the investigation with something similar to:
seasonexpectedStatisticsmetricAveragesprojected_ZipsParser behavior to review
create_split_data()/return_splits()currently locate split model classes by inspecting the stat-group module and checking whether the returnedstat_typeexists in a model class's_statlist.The audit should verify what happens when MLB returns a valid stat type for which the library has no matching class. Unsupported types should not silently look like successfully parsed empty data.
Do not change this behavior as part of the audit unless the desired compatibility behavior is understood and separately tested.
Acceptance criteria
statTypesinventory is captured_statdeclarations are mapped to the MLB inventoryScope
This is primarily a stats-model and parser audit. It is separate from the v1.1.0 async endpoint rollout unless the investigation uncovers a regression that affects the existing public stats methods.