Skip to content

Restructure into a tested package and add the browser dashboard - #1

Merged
digomes87 merged 3 commits into
developfrom
feature/package-and-dashboard
Oct 11, 2026
Merged

digomes87 merged 3 commits into
developfrom
feature/package-and-dashboard

Conversation

@digomes87

Copy link
Copy Markdown
Owner

Summary

  • Replace the flat scripts in src/ with the bee_migration package (climate, analysis, prediction, evidence, charts, reports, sources, web) and the bee-migration command.
  • Add a dashboard in docs/ that runs the package in the browser through Pyodide, plus a chapter with live data from GBIF and Open-Meteo.
  • Add the CI and Pages workflows and document Git Flow in CONTRIBUTING.md.

Behaviour changes worth reviewing

  • Models are scored on the most recent years, held out chronologically. The same-year change of the target was removed from the features; it leaked the answer and explained the previous R² of 0.997. Best model is now Linear Regression at R² 0.81.
  • Lagged correlations now compare temperature with bee abundance in later years; before, every lag compared the same year.
  • A missing --data file is an error instead of a silent fallback to simulated data.
  • Trained model files are no longer tracked; bee-migration predict recreates them.
  • Minimum Python is 3.11.

Test plan

  • pytest — 83 tests, 98% coverage
  • ruff check and ruff format --check
  • node --test "tests/web/*.test.mjs" — 20 tests
  • Package runs under Pyodide 314.0.7 (study in about 2 s, 15 s with tuning)
  • Dashboard checked in Chrome at 320, 375, 768 and 1440 px, light and dark: no console errors, no horizontal overflow
  • Field chapter loads real GBIF and Open-Meteo data
  • Firefox and Safari
  • Pages deployment after the release to main

Replace the flat scripts with a tested package split into climate,
analysis, prediction, evidence, charts and reports, exposed through the
bee-migration command.

- Hold out the most recent years chronologically when scoring models and
  drop the same-year target change from the features, which leaked the
  answer into training
- Compare temperature with bee abundance in later years for lagged
  correlations; the previous code compared the same year for every lag
- Validate observations at the boundary and report a missing data file
  instead of silently falling back to simulated data
- Consolidate packaging, pytest and ruff configuration in pyproject.toml
- Regenerate reports, data and charts with the new pipeline and stop
  tracking trained model files
Run the package inside the page with Pyodide: a visitor picks the seed,
the held-out years and the measurement to forecast, and the study is
computed on their machine and drawn as accessible SVG charts with a table
view for each.

A separate chapter loads observed temperatures from Open-Meteo and bee
occurrence counts from GBIF, parsed by the new bee_migration.sources
module, and states plainly that record locations follow observers as
much as bees.
CI lints and tests the package and the site utilities on pull requests
and pushes to develop and main. Pages builds the package into the site
and deploys it on pushes to main.
@digomes87
digomes87 merged commit d56f448 into develop Oct 11, 2026
4 checks passed
@digomes87
digomes87 deleted the feature/package-and-dashboard branch October 11, 2026 07:08
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.

1 participant