Skip to content

Update diet template#6

Merged
somacdivad merged 2 commits into
mainfrom
update/diet-template
Feb 10, 2026
Merged

Update diet template#6
somacdivad merged 2 commits into
mainfrom
update/diet-template

Conversation

@somacdivad
Copy link
Copy Markdown
Collaborator

AI summary

This pull request significantly improves the diet optimization template in the v0.13/diet directory, making it more user-friendly, well-documented, and easier to customize or extend. The changes clarify the purpose and usage of the template, provide detailed documentation, and refactor the code for clarity and maintainability.

Documentation and Usability Improvements:

  • Completely rewrote and expanded README.md to include clear explanations of the problem, who it is for, how to use and customize the template, model structure, troubleshooting, and next steps. This includes a detailed walkthrough of the code and sample data, as well as step-by-step instructions for setup and running the template. [1] [2]

Code Refactoring and Clarity:

  • Refactored diet.py for readability and maintainability: added a module docstring, clarified comments, and restructured code to match the new documentation. The code now explicitly separates configuration, model definition, and optimization steps.
  • Improved variable and property naming for clarity and consistency with the documentation (e.g., renamed contains to nutrients for the food-nutrient relationship, and clarified how properties are loaded and defined).
  • Updated the logic for loading and mapping CSV data to the semantic model, ensuring that nutrient columns are handled correctly and that the code is robust to changes in the data files.

User Experience Enhancements:

  • Modified the output to display only foods with non-trivial amounts in the optimal solution, making results more relevant and easier to interpret.

Dependency and Installation Instructions:

  • Updated installation instructions in both the main and diet template README files to use python -m pip install . instead of -e ., simplifying the setup process.

These changes make the diet optimization template much more approachable for new users and easier to adapt for custom requirements.

@somacdivad somacdivad merged commit cbf34fa into main Feb 10, 2026
@somacdivad somacdivad deleted the update/diet-template branch February 10, 2026 22:48
@cafzal cafzal mentioned this pull request May 15, 2026
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.

1 participant