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

Use auto-completion for ingredient inputs. #1

Open
brianMxBm opened this issue Jan 9, 2022 · 0 comments
Open

Use auto-completion for ingredient inputs. #1

brianMxBm opened this issue Jan 9, 2022 · 0 comments

Comments

@brianMxBm
Copy link
Owner

Currently, the user is allowed to enter quantities along with their ingredients. The idea was to be able to detect missing ingredients more accurately by also taking into account quantities. However, this turns out to be difficult in practice.

First, quantities would have to be converted to different units to be able to compare them to the required quantities the API returns. This is may not seem too bad since there's a JS library to handle conversions. However, some units are vague, like counts (1 apple, 2 bananas). I've seen some recipes specify cups of apples (presumably chopped). If someone specified 1 of some ingredient, there's no way to know if that'd be enough to fit into 0.5 cups when chopped up. If someone specified a gram of something, then we'd need the conversion rate for each type of item, since mass and volume measure different things.

The motivation for using the parseIngredients endpoint was to be able to parse these quantities. Because quantities will no longer be of use, we can instead use autocomplete. This provides a nicer user experience while still letting us ensure inputs are valid. If autocomplete does not show a result for the input, then the user will not be able to submit that input.

The autocomplete endpoint takes 0.01 quota points per call. For simplicity, call the endpoint every time a character is entered or removed. Of course, this can quickly eat into our quota limit; 100 characters = 1 point. A decent rate limit might be 200 characters per minute.

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

No branches or pull requests

1 participant