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

[WIP] add tool to test new categorization #95

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RignonNoel
Copy link
Collaborator

@RignonNoel RignonNoel commented Nov 5, 2022

This PR aim to implement a developer tool to help test new categorizations of ingredients.

After some personal investigation on the source code I deduced that the technical debt would be the biggest challenge to overcome in this PR and that it would be impossible to refactor the actual code without breaking a lot of things, loosing complete certitude into the results since the test coverage and quality is really poor:

  • View doesn't follow good practice of Django and contain a lot of added feature without refactor of the architecture
  • Some part of the code use direct SQL query
  • There are multiple M2M relationship without related_name
  • There are custom class of logic but the test are poor and there are no overall documentation to begin with

I tought the best would be to create a system of export/import that help us to change the system state and check generated KitchenCount. This way offer multiple pro:

  1. We will be able to generate the KitchenCount without changing the actual code
  2. We will have a system of export allowing us to analyse our state when needed
  3. The import system will allow us to easily test multiple categorization system during our decision phase

Actual state:

  • Export of the template (list of ingredients and categorization)
  • Detection of the new categories and link with actual ingredients
  • Check to detect best categorization for every existing client
  • Statistics to help evaluate the new categorization system
  • Erase old category and write new one
  • Automatic generation of the KitchenCount
  • Rollback state of DB after the generation

@RignonNoel
Copy link
Collaborator Author

Here is an example of the actual output on the commandline:

Screenshot 2022-11-05 165742

@guillaumep
Copy link
Member

Suggestion: add a link in the django admin panel to download the CSV generated by the export_template_new_categorization command (name it "Download ingredients categorization" for example).

@RignonNoel RignonNoel changed the title add tool to test new categorization [WIP] add tool to test new categorization Apr 28, 2023
@RignonNoel
Copy link
Collaborator Author

Work put on hold for the moment, Will wait for Santropol go before putting some work on it.

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