Aggregate yearly stats into overall totals so the trip stats page shows flight segments by airline, airports used, and stations used in the summary section at the top. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2 KiB
2 KiB
Development Guidelines
Project Overview
This is a personal agenda web application built with Flask that tracks various events and important dates:
- Events: birthdays, holidays, travel itineraries, conferences, waste collection schedules
- Space launches, meteor showers, astronomical events
- Financial information (FX rates, stock market)
- UK-specific features (holidays, waste collection, railway schedules)
- Authentication via UniAuth
- Frontend uses Bootstrap 5, Leaflet for maps, FullCalendar for calendar views
Python Environment
- Always use
python3directly, neverpython - All Python code should include type annotations
- Use
typing.Anyinstead ofAnyin type hints (import from typing module) - Run
mypy --strict(fix any type errors in the file) andblackon modified code after creating or modifying Python files - Avoid running
black . - Main entry point:
python3 web_view.py(Flask app on port 5000) - Tests: Use
pytest(tests in/tests/directory)
Project Structure
agenda/- Main Python package with modules for different event typesweb_view.py- Flask web application entry pointtemplates/- Jinja2 HTML templatesstatic/- CSS, JS, and frontend assetsconfig/- Configuration filespersonal-data/- User's personal data (not in git)
Git Workflow
- Avoid committing unrelated untracked files (e.g.,
node_modules/, build artifacts) - Only commit relevant project files
- Personal data directory (
personal-data/) is excluded from git
Notes
- Trip stats new-country badges come from
agenda.stats.calculate_yearly_statsviayear_stats.new_countries(first-visit year, excludingPREVIOUSLY_VISITED). - Trip stats are calculated in
agenda/stats.py:travel_legs()extracts airlines, airports, and stations from individual trip travel legscalculate_yearly_stats()aggregates stats per year including flight/train counts, airlines, airports, stationscalculate_overall_stats()aggregates yearly stats into overall totals for the summary section