-
Notifications
You must be signed in to change notification settings - Fork 2
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
Food database changes #333
base: main
Are you sure you want to change the base?
Conversation
Thank you for writing this up @lukashroch! This looks great so far. I wrote this down to make sure we're on the same page about the intent behind these changes, please let me know if there is anything that you see differently or disagree with. My understanding of the relationship between category and food codes/internal ids is that the codes should still serve as a persistent identifier that can be used to reference foods and categories in a portable manner, across instances and as part of a self-contained food database package. The internal ids on the other hand are a simple numerical id that is efficient but is only valid within a single Intake24 instance, so in essence the internal id is just a surrogate id for the locale_id/food_code pair, but they are generally interchangeable. The current code system (before these changes) has the following downsides:
Since after these changes we can now always scope the food/category codes to a locale, I think we should relax the code uniqueness constraint to only require uniqueness within a locale (eventually the composable "food list", whatever we decide to call it), and we should also make the character limit more generous (at least 36 characters to accomodate UUIDs). This way we can include the original food and category ids from external sources (such as the French Alabane food database) without having to jump hoops making them globally unique and compatible with the Intake24 code system, and also make copies of food lists when required for versioning purposes (NDNS years) or extensions (UK + Gusto, UK + gluten-free foods, UK + ethnic minority foods etc.) without having to change any codes. If we do this, associated food prompts and any other features that refers to foods or categories (like the sandwich builder) will need to be updated to use internal ids to keep the references simple (otherwise they'd have to be a locale/code pair). The prompt condition editor will also need to be updated to use a friendly UI for searching/picking categories, at the moment it only accepts a code string that has to be typed manually. The packager API relies heavily on the food/category code concept because it needs to identify foods/categories by their persistent codes to be able to update records without breaking any internal references. It will also need a workaround to import existing packages with separate local/global data as we might need to import some data from old packages at some point (like Danish and Portuguese databases). So it looks like for some operations there will need to be two API paths, the default one using the internal id and the one using the category/food codes ( Ranking/food index code should probably still use codes, because initialising, updating or exporting the ranking data will need to use the persistent codes anyway. Attributes -> tags conversion looks good, I sent a request to the DA team re the reasonable amount values. If they decide to keep it, we could move them to Agree that |
Great I think this all aligns what I have done so far in the PR!
Agreed,
I wasn't sure about this, whether to introduce internal
Makes sense, I think we could do a bit of API clean-up as it's inconsistent and do something like this to have both
Agreed
Agreed I'm not sure what to do with food groups, but I think they are used a bit for reference, just not with localized food names (food_group_locals only has If you get a chance, could you please run / review the foods migration file so far? It should already include quite a lot what we discussed here and there is also code to back-fill locales with prototypes. Could I ask you to review this more closely to be sure I haven't messed up the prototype resolution :-) |
afd84f4
to
1285ba3
Compare
b659998
to
8beb761
Compare
8beb761
to
0da7f5b
Compare
Food database redesign changes - proposal based on workshop.
Local/Global records and inheritance
foods_local_lists
data dropped since all is local now? not needed? We should probably introducehidden
flag as for categories (I think I saw a ticket too for that)Local category structure
Food attributes
tags
exclude_tags
same-as-before
tagready-meal
taguse-anywhere
taguse-as-food
taguse-as-ingredient
tagBrands
Foods group
System data
API
Future work ?
composite food list
per survey -> be able to pick multiple locales to form food list