Skip to content

Cli importer csv #283

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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Cli importer csv #283

wants to merge 25 commits into from

Conversation

cheburan
Copy link
Contributor

@cheburan cheburan commented Jun 8, 2024

Adding the converting tool to the CLI for the food-table CSV conversion to the package format.

@cheburan
Copy link
Contributor Author

example.zip
Example of the files (CSV and JSON) to use with the cli convertor

@cheburan cheburan marked this pull request as ready for review June 10, 2024 05:44
@cheburan cheburan force-pushed the cli_importer_CSV branch from 2242d09 to 35c5f44 Compare July 8, 2024 05:52
@cheburan cheburan requested a review from mechkg October 1, 2024 01:24
@cheburan cheburan added the enhancement New feature or request label Oct 1, 2024
@@ -156,6 +157,14 @@ function adminCategoryController({
res.json(categories);
};

const all = async (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might quickly become a perf hog and cause issues for larger sets, better use paginated query/response?

Copy link
Collaborator

@chrimyn234 chrimyn234 Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct me if I'm wrong, but it looks like this isn't being used anywhere. Also, it looks like browseMain already implements what this intends to do but with pagination. Should it be removed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't checked the whole PR, just noticed it's there, but we should definitely delete it if it's a dead code. It's a bit muddle with merge commits, so probably best to rebase on main / clean-up of dead code and put into main.

@lukashroch lukashroch force-pushed the main branch 3 times, most recently from a76af83 to bba98c5 Compare October 11, 2024 22:46
…efactoring and fixes

The script now also generates a local-categories.json. Fixed a few typos. Added additional logs.
Added trim() since to account for accidental whitespaces. Replaced some for...of loops with
Promise.all.
…t wanted by locale

Replace more for...of loops with promise.all so they can run in parallel. When creating local foods,
exclude foods that are not wanted by the locale.
Previously, the associated foods/categories were incomplete. Associated categories codes were
considered as food code even though they are not. Now, it correctly searches the database to
identify whether it is a food code or category code.
Use short circuiting; Replace array includes with set has for linear time complexity; Add more error
handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants