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

cleanup: move config to python code #45

Merged
merged 1 commit into from
Jun 19, 2024
Merged

cleanup: move config to python code #45

merged 1 commit into from
Jun 19, 2024

Conversation

franciscobmacedo
Copy link
Contributor

@franciscobmacedo franciscobmacedo commented May 30, 2024

removed dynamic configuration loader from yaml file (ssda903/fixtures/config/standard-v1.yaml) and moved it into python code.
Now, age brackets, placement categories and costs are all written in python, so everything is detectable by your IDE.

Also changed all the dataframe values to just have the "label" of the placement category or age bracket - that's the human readable value, which is easy to display in the web but still accessible programmatically, with the enum values.

@amynickolls just be aware that everytime you need to filter something use it like this:

data.loc[
    data.placement_type_before == PlacementCategories.NOT_IN_CARE.value.label
]

Because:

  • PlacementCategories is an enum
  • PlacementCategories.NOT_IN_CARE is an enum member
  • PlacementCategories.NOT_IN_CARE.name is actually "NOT_IN_CARE", the enum member name
  • and PlacementCategories.NOT_IN_CARE.value is an instance of the dataclass PlacementCategory with it's label "Not in care"
  • PlacementCategories.NOT_IN_CARE.value.label is the name of this PlacementCategory instance, so in this case "Not in care"

There's examples in the docstrings of PlacementCategories and AgeBrackets.

I hope now it's more clear!!

Copy link
Contributor

@amynickolls amynickolls left a comment

Choose a reason for hiding this comment

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

No comments - thanks for the detailed comments in the code!

@amynickolls amynickolls merged commit 8b1ada6 into main Jun 19, 2024
1 check passed
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.

None yet

2 participants