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

Add handling of numeric values for scraping nutritional information #382

Conversation

mblennegard
Copy link
Contributor

@mblennegard mblennegard commented Jun 28, 2024

  • Adds handling of numeric values when scraping nutritional information.
  • Adds helper function to make sure the units are always imported in the same way, e.g. always g and mg, instead of what might exist on the website (grams, milligrams etc.).

Adds multiple additional test cases to schema-recipe_test.go:

  • nutrional info without space characters (renamed the old test case, "simple string")
  • nutrional info with abbreviated suffixes
  • nutrional info with non-abbreviated singular suffixes
  • nutrional info with non-abbreviated plural suffixes
  • nutrional info without suffixes as strings
  • nutrional info without suffixes as integers

… as function for ensuring units to always be imported in same way.
@mblennegard mblennegard requested a review from reaper47 as a code owner June 28, 2024 05:27
@mblennegard mblennegard changed the title Added handling of numeric values for nutritional information, as well as function for ensuring units to always be imported in same way. Add handling of numeric values for scraping nutritional information Jun 28, 2024
@mblennegard mblennegard marked this pull request as draft June 28, 2024 05:52
@mblennegard mblennegard marked this pull request as ready for review June 28, 2024 07:25
internal/utils/extensions/strings.go Outdated Show resolved Hide resolved
internal/models/schema-recipe.go Outdated Show resolved Hide resolved
internal/models/schema-recipe.go Outdated Show resolved Hide resolved
internal/models/schema-recipe.go Outdated Show resolved Hide resolved
internal/models/schema-recipe.go Outdated Show resolved Hide resolved
internal/models/schema-recipe.go Outdated Show resolved Hide resolved
internal/scraper/scraper_S_test.go Show resolved Hide resolved
@mblennegard mblennegard requested a review from reaper47 July 4, 2024 11:57
@reaper47
Copy link
Owner

reaper47 commented Jul 4, 2024

Excellent work, thank you so much! I'll fix the conflicting files later today to then merge it.

@mblennegard
Copy link
Contributor Author

Excellent work, thank you so much! I'll fix the conflicting files later today to then merge it.

Thank you, glad I could help...even though it turned out to be a bit of a rabbit hole. 😋
But besides adding scraping of number values which was the original change, it should now be decently prepared for that potential change to INTEGERS in the database table in the future, so that feels quite satisfying. 😎

Let me know if you want me to look at something else or even assign me some issues.
I have struggled with storing recipes for the past 15 years but feel that Recipya is shaping up to solve everything I need. And not to mention that you have been very active with adding features and fixes which is great to see. 🙏

@reaper47
Copy link
Owner

reaper47 commented Jul 4, 2024

Trying my best here to make a great recipe manager! Feel free to look into whatever motivates you or looks interesting to you :)

@reaper47 reaper47 merged commit 1994845 into reaper47:main Jul 4, 2024
1 check passed
@mblennegard mblennegard deleted the 375-extract-nutritional-data-from-scraped-websites branch July 5, 2024 05:28
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