Skip to content

Comments

pyrenew_builder delegates validation of observational data to observation classes#698

Merged
cdc-mitzimorris merged 23 commits intomainfrom
mem_678_delegate_validation
Feb 11, 2026
Merged

pyrenew_builder delegates validation of observational data to observation classes#698
cdc-mitzimorris merged 23 commits intomainfrom
mem_678_delegate_validation

Conversation

@cdc-mitzimorris
Copy link
Collaborator

Issue #678: Delegate observation data validation to observation processes

Changes made:

  1. pyrenew/observation/base.py - Added abstract validate_data(n_total, n_subpops, **obs_data) method plus three reusable validation helpers: _validate_times(),
    _validate_subpop_indices(), _validate_obs_times_length()
  2. pyrenew/observation/count_observations.py - Implemented validate_data() on Counts (validates dense obs length) and CountsBySubpop (validates times, subpop_indices, obs/times
    length match)
  3. pyrenew/observation/measurements.py - Implemented validate_data() on Measurements (validates times, subpop_indices, sensor_indices, obs/times length match)
  4. pyrenew/model/multisignal_model.py - Replaced 46 lines of hardcoded validation with 4-line delegation loop
  5. test/test_pyrenew_builder.py - Added validation_builder fixture with both Counts and CountsBySubpop observations; updated tests to target the correct observation type; added
    dense obs length test; made match patterns less brittle
  6. test/test_observation_counts.py - Added validate_data stub to test's IncompleteCountProcess

@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.73%. Comparing base (e7df19c) to head (db7c53d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #698      +/-   ##
==========================================
+ Coverage   97.43%   97.73%   +0.29%     
==========================================
  Files          51       51              
  Lines        1523     1542      +19     
==========================================
+ Hits         1484     1507      +23     
+ Misses         39       35       -4     
Flag Coverage Δ
unittests 97.73% <100.00%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link

github-actions bot commented Feb 10, 2026

Thank you for your contribution @cdc-mitzimorris 🚀! Your github-pages is ready for download 👉 here 👈!
(The artifact expires on 2026-02-18T16:33:44Z. You can re-generate it by re-running the workflow here.)

Copy link
Collaborator

@dylanhmorris dylanhmorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! A few minor suggestions.

@cdc-mitzimorris
Copy link
Collaborator Author

@dylanhmorris - fixed inconsistent/incomplete data validation - moved logic into base class. thanks for being picky.

@dylanhmorris
Copy link
Collaborator

Thanks @cdc-mitzimorris! I think you can fix pre-commit issues and merge

@cdc-mitzimorris cdc-mitzimorris merged commit d260ea5 into main Feb 11, 2026
8 checks passed
@cdc-mitzimorris cdc-mitzimorris deleted the mem_678_delegate_validation branch February 11, 2026 16:36
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.

2 participants