-
Notifications
You must be signed in to change notification settings - Fork 1
Add missing wild_foods_valid_instances in the consolidated_instances … #145
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
Add missing wild_foods_valid_instances in the consolidated_instances … #145
Conversation
…of consolidated_fixture asset see HEA-677
pipelines/assets/fixtures.py
Outdated
| for model_name, instances in livelihood_activity_valid_instances.items() | ||
| if model_name != "WealthGroup" | ||
| }, | ||
| **wild_foods_valid_instances, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@girum-air why is this required? Doesn't the code below on line 345 add the wild_foods_valid_instances?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rhunwicks the keys Fishing and WildFoodGathering weren't in the consolidated_instances at the line and that raises key error - Key error 'Fishing' in consolidated_fixture asset when trying to append it using += We might either need the keys added with empty list to initialize, I think that is better and updated it
| # Add the keys: `Fishing` and `WildFoodGathering` | ||
| consolidated_instances["Fishing"] = [] | ||
| consolidated_instances["WildFoodGathering"] = [] | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be better as:
# Add the wild foods and other cash income instances, if they are present
for model_name, instances in {**other_cash_income_valid_instances, **wild_foods_valid_instances}.items():
if instances and model_name != "WealthGroup":
if model_name not in consolidated_instances:
consolidated_instances[model_name] = []
consolidated_instances[model_name] += instancesThat way, if we ever have to add additional models in the future it will still work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, agreed. Pushed the updates
rhunwicks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@girum-air I think we should avoid hard-coding the model names.
No description provided.