Skip to content

Conversation

@johnsosoka
Copy link
Owner

Summary

Adds comprehensive Stats API resource with 10 operational endpoints for IFPA statistical data and analytics.

Changes

Core Implementation:

  • ✅ 22 new Pydantic models in src/ifpa_api/models/stats.py (602 lines)
  • ✅ Stats client with 10 endpoints in src/ifpa_api/resources/stats/client.py (490 lines)
  • ✅ Full integration with existing client, models, and resources

10 Stats Endpoints:

  • Geographic: country_players(), state_players(), state_tournaments()
  • Historical: events_by_year(), players_by_year()
  • Rankings: largest_tournaments(), lucrative_tournaments()
  • Period-based: points_given_period(), events_attended_period()
  • System: overall()

Testing:

  • ✅ 1333 lines of unit tests with inline mocked responses
  • ✅ 642 lines of integration tests against live API
  • ✅ Stats-specific test fixtures for date ranges and validation
  • ✅ All 316 unit tests passing locally
  • ✅ Maintained 99% code coverage

Documentation:

  • ✅ 743-line stats resource guide in docs/resources/stats.md
  • ✅ Updated README with stats examples
  • ✅ Updated docs index and mkdocs.yml navigation
  • ✅ Comprehensive CHANGELOG entry for v0.4.0

Migration Strategy:

  • Manual migration from archive/develop-0.4.0 to avoid temporary scaffolding
  • Cherry-picked clean documentation commits
  • Selective conftest.py fixture migration (stats-specific only)

Testing

  • Unit tests: ✅ All 316 tests passing
  • Integration tests: CI will run with API key
  • Linting: ✅ Ruff passed
  • Type checking: ✅ mypy passed (strict mode, 100% coverage)

Related Issues

Closes stats resource implementation from project backlog.

Checklist

  • Tests added/updated (1975 lines of new tests)
  • Documentation updated (README, docs, mkdocs.yml, CHANGELOG)
  • All unit tests pass (316/316)
  • Code formatted with Black
  • No linting errors (Ruff)
  • Type checking passes (mypy strict)
  • Pre-commit hooks pass

John Sosoka added 6 commits November 21, 2025 19:47
Implements comprehensive stats resource providing analytical insights:
- Geographic stats (country_players, state_players, state_tournaments)
- Historical trends (events_by_year, players_by_year)
- Tournament rankings (largest_tournaments, lucrative_tournaments)
- Period analytics (points_given_period, events_attended_period)
- System metrics (overall)

Includes 22 Pydantic models for stats requests/responses.
API coverage increased from 36 to 46 endpoints (7 resources total).
Adds 1333 lines of unit tests and 642 lines of integration tests
for the Stats API resource. Tests cover all 10 endpoints with
inline mock data for unit tests and real API calls for integration.

Includes stats-specific test fixtures and helpers in conftest.py:
- Date range fixtures (90 days, 180 days, full year)
- Stats threshold fixtures for validation
- Rank type fixtures for parameterized testing
- Helper functions for field validation and ranking assertions
Updates MkDocs documentation to include Stats resource:
- Update API coverage count: 36 → 46 endpoints
- Add Stats row to resources table with description
- Add Stats to resource navigation links
- Update mkdocs.yml navigation to include stats.md
Updates README with Stats resource documentation:
- Update API coverage: 36 → 46 endpoints, 6 → 7 resources
- Add Stats section with usage examples showing:
  - Overall IFPA statistics
  - Top point earners by period
  - Largest tournaments by country
  - Player counts by country
  - Most active players by period
Adds comprehensive v0.4.0 release notes documenting:
- 10 new Stats API endpoints (geographic, historical, rankings, period-based)
- 22 new Pydantic models for stats responses
- 1333 lines of unit tests, 642 lines of integration tests
- Stats-specific test fixtures and helpers
- Known API issue with WOMEN parameter in overall() endpoint

Updates version links for 0.4.0 and 0.3.0 releases.
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 95.50173% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ifpa_api/models/stats.py 94.24% 11 Missing ⚠️
src/ifpa_api/resources/stats/client.py 97.64% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@johnsosoka johnsosoka merged commit eafe281 into develop Nov 22, 2025
9 of 11 checks passed
@johnsosoka johnsosoka deleted the feature/add-stats-resource branch November 22, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants