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

Refactor subroles #1196

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Refactor subroles #1196

wants to merge 7 commits into from

Conversation

bonjourmauko
Copy link
Member

@bonjourmauko bonjourmauko commented Oct 4, 2023

Depends on #1197

New features

  • Introduce SubRole.
    • Allows for building subroles in an explicit manner.

Discussion

Currently, roles and subroles coexist and are used interchangeably, as
instances of the Role data model. This is very confusing, as the only thing
they have in common is the key attribute, shared with every other data model
in the entities module. By declaring SubRole as an independent data model
from Role, we can make the distinction between the two clearer, improving
readability, maintenance, debugging, and eventual extensibility of both.

@coveralls
Copy link

coveralls commented Oct 4, 2023

Coverage Status

coverage: 73.695% (+0.2%) from 73.501% when pulling c78940a on compose-entity-2 into a3c2f83 on master.

@bonjourmauko bonjourmauko requested a review from a team October 4, 2023 13:18
@bonjourmauko
Copy link
Member Author

@benjello is this the intented definition and use of subroles or am I missing something?

@bonjourmauko bonjourmauko removed the request for review from a team October 4, 2023 13:40
@bonjourmauko bonjourmauko marked this pull request as draft October 4, 2023 13:40
>>> from openfisca_core import entities

>>> entity = entities.GroupEntity("person", "", "", "", {})
>>> role = entities.Role({"key": "sorority"}, entity)
Copy link
Member

Choose a reason for hiding this comment

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

This sorority example is not very clear to me.

Examples:
>>> from openfisca_core import entities

>>> entity = entities.GroupEntity("person", "", "", "", {})
Copy link
Member

Choose a reason for hiding this comment

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

The group entity is not clear here.

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