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

Enforces specific order in nutrition keys and adds reorder script #1203

Merged
merged 14 commits into from
Aug 26, 2024

Conversation

jknndy
Copy link
Collaborator

@jknndy jknndy commented Aug 3, 2024

Attempt at a solution to conversation related to nutrition key order in #1197

test_nutrition_order.py

  • Adds a test to check the order of nested nutrient keys against order listed on Schema NutritionInformation
  • Handles non-schema designated nutrient keys by expecting them to exist below ordered schema designated keys.

scripts/reorder_nutrition_keys.py

  • Adds a new helper script to reorder nutrition keys
  • Order designated by Schema NutritionInformation page
  • Appends extra non-schema designated nutrient keys below ordered schema designated in no particular order.

test_data

  • Reordered 171 nutrients tests

see woop.json for example of nutrients outside the schema designations.

@jknndy jknndy marked this pull request as ready for review August 3, 2024 18:41
jknndy and others added 4 commits August 4, 2024 16:37
@jknndy
Copy link
Collaborator Author

jknndy commented Aug 12, 2024

  • Refactored the nutrition_keys list into a method
  • Updated the reorder script accordingly and refactored to only iterate through each JSON once
  • Test updates
  • Added a new util test for get_nutrition_keys

@jknndy jknndy merged commit 1414703 into hhursev:main Aug 26, 2024
19 checks passed
@jknndy jknndy deleted the nutrition-keys-order branch August 26, 2024 22:30
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