Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise cohort structure inside community #340

Merged
merged 6 commits into from
Oct 23, 2024

Conversation

davidorme
Copy link
Collaborator

Description

This PR:

  • replaces the community.cohort_data: dict[str, NDArray] dictionary of arrays with a new dataclass Cohorts.
  • updates the test suite to add some simple testing of the Cohorts constructor
  • updates the rest of the test suite and the code to the new structure.

The main reasons are:

  • more consistent attribute access within model rather than a mix of dataclass dot notation and dictionary keys.
  • ability to extend the functionality of the Cohorts dataclass with shared functionality (see Shared base classes for demography classes #338).

Fixes #336

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@davidorme davidorme linked an issue Oct 22, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.89%. Comparing base (1f315ba) to head (c43bedf).
Report is 298 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #340      +/-   ##
===========================================
- Coverage    95.29%   94.89%   -0.40%     
===========================================
  Files           28       34       +6     
  Lines         1720     2549     +829     
===========================================
+ Hits          1639     2419     +780     
- Misses          81      130      +49     

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

Copy link
Collaborator

@MarionBWeinzierl MarionBWeinzierl left a comment

Choose a reason for hiding this comment

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

The changes look ok to me (with the explanations provided), and this seems a cleaner way to implement it.

@davidorme davidorme merged commit f715d44 into develop Oct 23, 2024
12 checks passed
@davidorme davidorme deleted the 336-revise-cohort-structure-inside-community branch October 23, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Revise cohort structure inside Community
3 participants