Player Data Models
Relevant source files
The following files were used as context for generating this wiki page:
Player Data Models define the structures for representing user profiles, game-specific statistics, and match history within the FACEIT ecosystem. These models use Pydantic to ensure type safety and data validation when interacting with the FACEIT Data API.
The system handles core identity data, membership status, skill levels (ELO), and detailed performance metrics for games like Counter-Strike 2 (CS2).
Sources: README.md:14-20, src/faceit/models/players/general.py:1-15
Core Player Identity
The Player model represents the primary user entity. It contains identity fields, social links, and account status information.
The diagram shows the relationship between the main Player profile and its nested settings and game-specific data.
Player Model Fields
| Field | Type | Description |
|---|---|---|
id | FaceitID | Unique FACEIT identifier (aliased from player_id). |
nickname | str | User's display name. |
games | ResponseContainer[GameInfo] | Map of registered games and their respective ELO/levels. |
verified | bool | Indicates if the account is verified. |
membership_type | str | Current subscription level (e.g., premium). |
Sources: src/faceit/models/players/general.py:82-104, src/faceit/models/players/general.py:77-80
Skill Levels and ELO
The library translates raw ELO values into structured SkillLevel objects based on game-specific thresholds. The GameInfo model uses a validator to inject appropriate SkillLevel objects for supported games like CS2 and CSGO.
The flow describes how the GameInfo model resolves raw skill levels into enriched objects during validation.
Sources: src/faceit/models/players/general.py:38-66, src/faceit/constants.py:194-220
Game Statistics
Statistics are split into lifetime summaries and segment-based data (e.g., per-map stats). The PlayerStats model uses generics to support different schemas for different games.
CS2 Statistics Schema
The library provides specialized models for Counter-Strike 2 (CSPlayerStats), including detailed fields for extended metrics.
| Component | Class | Key Metrics |
|---|---|---|
| Lifetime | CSLifetimeStats | K/D Ratio, Win Rate %, ADR, Headshots %. |
| Segment | CSMapStats | Matches, Wins, Average Triple/Quadro/Penta kills. |
| Container | PlayerStats | Groups lifetime and segments together. |
Sources: src/faceit/models/players/general.py:157-234, src/faceit/models/players/general.py:317-331
Match History and Player Performance
Match data is retrieved through ItemPage collections. Each Match contains information about the competition, teams, and final results.
Match Structure
The Match model tracks the lifecycle and outcome of a game session.
This relationship diagram illustrates the hierarchy of models used to represent a single match and its participants.
Sources: src/faceit/models/players/match.py:82-101, src/faceit/models/players/match.py:53-61
Detailed Match Performance
When fetching statistics for specific matches via matches_stats, the API returns CS2MatchPlayerStats for CS2 games. This includes granular data:
- Combat: Kills, Deaths, Assists, MVPs, Headshots.
- Advanced: ADR (Average Damage per Round), K/R Ratio, Triple/Quadro/Penta kills.
- Temporal:
finished_at,updated_at,created_at.
Sources: src/faceit/models/players/match.py:126-163, src/faceit/api/data/players.py:165-200
Paginated Collections
Player-related lists (Bans, History, Hubs, Teams) are wrapped in the ItemPage model. This provides a unified interface for metadata and collection utilities.
# Example of accessing paginated data
# Sources: [src/faceit/models/item_page.py:44-88]
items = page.items # Tuple of model instances
meta = page.metadata # Offset and Limit info
filtered = page.filter(lambda x: x.kd_ratio > 1.0)
Sources: src/faceit/models/item_page.py:32-42, src/faceit/api/data/players.py:118-132
Summary
Player Data Models provide a type-safe abstraction over the FACEIT Data API. By utilizing Pydantic models like Player, PlayerStats, and Match, the library enforces data integrity and simplifies complex tasks such as ELO threshold calculation and multi-game statistical analysis.
Sources: src/faceit/models/players/general.py:1-10, src/faceit/constants.py:326-340