Change UOMs and db documentation
Closed this issue · 3 comments
I started to make a project like this then I found yours and stopped mine because yours is way better!
I wanted to mass add recipes to the database but haven't figured exactly how you have the database setup. Is there additional documentation on the layout of the database and the columns so I can add a lot of recipes using my computer not the touchscreen on my raspberry pi?
Living in the US we measure things in oz not ml (I know it's an us problem). But after we start drinking we are not as good at doing the math conversions and have spilled a number of times. Is there a main measure meant spot where we could add an extra function that switches from ml to oz?
Thanks,
Matt
Hey Matt,
nice to hear that you like the project. Currently, there is no model of the DB. But, this can be done with ease and should be available within the next days in the devnotes, since the structure is a) not that complicated and b) in general like any SQL recipe DB structure. Small update: The schema is now available under the devnotes.
Import of new Data
In theory, it should be no problem to add more recipes over a script, for example. While this functionality does not currently exist, I see this as a good feature for a future version to use a CLI command to import from a file. There are some open questions, like how should be the general structure of the imported data, and how flexible needs the importer to be. So It would be nice to get an insight into the data (one example recipe is enough) you want to import. In my mind there is a text like data format which is somewhat similar to [recipe_name \n ingredient data \n ....] with ingredient data being mostly in the format [volume unit name].
If you want to implement your own data now, I suggest some pseudocode:
- Get distinct ingredient names
- Build difference of existing and new distinct ingredients
- Enter missing ingredients into DB (
Ingredients
table) - Build cocktail object for each recipe
- Enter recipe into DB (
Recipes
table) - Enter recipe Data into DB (
RecipeData
table)
Switching Measurement Units
At first glace, this seemed the easier of both things, but after some consideration, the current code base and program logic prevents such an implementation in many ways. I like the idea of being able to switch units, also to get to a wider audience. But as mentioned, the project was designed and had historically grown without that consideration into mind, which leads to a big amount of can of worms, which would be opened doing such an implementation now.
To give you some examples:
- Most fields and input elements are designed to use integers only for volume
- This also includes displayed values are being rounded to the nearest digit after scaling
- The labels (ml) in all GUI elements are hardcoded and not dynamic
- Many elements (like plus buttons) use hardcoded step sizes for volume steps
- Send data to endpoints is expected to be in ml
While these are no unfixable issues, they require a moderate amount of work, as well as a good amount of refactoring in the code base to not make the current code harder to maintain. I can see a measurement switch feature in the future, but it would probably take some time and thinking until it can be properly adapted and implemented. So while it may exist in the future, I can't make a promise for that.
One 'dirty' quick idea I had in mind is just modifying the DB with the factor 0,033814 for oz. Labels would still be ml, but values in oz. But after some thinking, this will most likely break or cripple the functionality of the program, due to other elements being hardcoded.
If you have any other questions, feel free to ask
Andre
So, as another update:
I am currently working on the import CLI functionality, it should be resolved soon. Will make some other small fixes, features and the according documentation, this will then be released with the v1.10 update, which should come around in 1-2 Weeks.
As I am not that familiar with other commonly used units for cocktail recipes than ml, what are the ones you are usually using, and what's their common abbreviation? I know of oz, are there any other ones? The new script is using Regex, and I am not sure how many chars for the unit recognition is a good value to capture the unit but not an ingredient name, in case the unit is missing.
I have an idea, which may implement as a tradeoff for the oz display problem, at least that the units can visually be changed in the maker tab. But I will inform you when the implementation goes right 😆
Beyond oz there isn't really another measurement that is used in the US that would be useful for an individual drink.