Giter VIP home page Giter VIP logo

relaxir's Introduction

Elixir CI

Setup

Install Elixir

mix local.hex --force
mix local.rebar --force
mix deps.get
npm install --prefix ./assets
npm run deploy --prefix ./assets
mix phx.digest

Dev

mix ecto.reset
mix relaxir.add_user email=test@test username=test password=test admin=true
iex -S mix phx.server

Or inside of phx.server

Mix.Tasks.Relaxir.AddUser.run(["email=test@test", "username=test", "password=test", "admin=true"])

Tests

Run unit tests, code quality tests, and static security scan

mix test --cover
mix credo
mix sobelow --skip -i Config.HTTPS

For local development, ensure all files are formatted, i.e.

mix format "{lib,test,config}/**/*.{ex,exs}"

Alternatively, a tests.sh script is included that will run all of the above and only display output of failures. This can be handy as a git hook.

Prod

Increment version in mix.esx

Add a tag for the version, found with mix relaxir.version

Push with tags

Wait for the build job

mix relaxir.deploy

Or deploy from local workspace

mix relaxir.local_deploy relaxanddine.com

USDA Data

DEPRECATED: USDA nutrition is an absolute mess and has not been working correctly. The nutrition of base foods does not generally change over time as well. USDA functionality is going to be moved to browse only and eventually removed altogether. This information is going to be individually compiled for ingredients and updated. For now, nutrition is going to be phased out of the site.

Can be found at https://fdc.nal.usda.gov/download-datasets.html

Load it in with:

mix relaxir.import Food ../../food-data/food.csv

Using sr_legacy_food

mkdir food-data
cd food-data
wget https://fdc.nal.usda.gov/fdc-datasets/FoodData_Central_sr_legacy_food_csv_%202019-04-02.zip
unzip FoodData_Central_sr_legacy_food_csv_%202019-04-02.zip
wget https://fdc.nal.usda.gov/fdc-datasets/FoodData_Central_Supporting_Data_csv_2021-10-28.zip
unzip FoodData_Central_Supporting_Data_csv_2021-10-28.zip
mix relaxir.import Food food-data/food.csv
mix relaxir.import Nutrient food-data/nutrient.csv
mix relaxir.import FoodNutrient food-data/food_nutrient.csv

relaxir's People

Contributors

dependabot[bot] avatar faheetah avatar

Watchers

 avatar  avatar

relaxir's Issues

Ingredient categorization

Doesn't need to be like RecipeCategories, just a simple classification (many to one). Dairy, meat, grains, etc

This also possibly allow substitution suggestions in recipes, like don't have a duck egg? A chicken egg might work. And being able to more broadly search recipes, like recipes with "rice" or "chicken" rather than "basmati rice" or "chicken thigh meat, extra extra, skinless, boneless, meatless"

Discussion and comments

Likely tie into the "social feed" feature, let other users comment, probably also have a Q&A section for free posts more like forum style

Would require a spam detection system as well, might be good to see if users post external links, specific patterns, and if their comments are repetitive (could run it as a separate service and use jaro_distance), also need sa report system

What permissions could people have? Edit? Delete?

Slugs and pagination

Pages should get slugs and should paginate, for pages that are still returning unbounded results. Using liveview, we can just use infinite scroll.

Explicit subsitutions

Either let recipes tag substitutions or build a dataset of typical subsitutions that broadly work, with notes on how they should be substituted.

Earmark should not output raw

XSS.Raw: XSS - Low Confidence
File: lib/relaxir_web/views/recipe_view.ex
Line: 97
Function: render_markdown:94
Variable: Elixir.Earmark

Need to sanitize the output by hand or something

I don't know how to work around not needing raw/1, but what we probably want to do is sanitize the input text, or possibly output text, so that HTML is not allowed in markdown input (needs to be escaped), and only certain tags need to be allowed (headers, paragraph) and/or ensure that risky ones like anchors can only be true URLs and not allow javascript injection

Add pagination to search results

Endless scroll would be ideal, need a way to realistically chunk ETS results so we don't end up parsing through each time, though the farther the scrolling gets less and less likely. Might do something like micro-cache results, for something like a minute, then if someone does scroll it can just pick up from that result set and continue, search is blazing fast already so I'm not worried about any overhead from checking a cached result. Only main concern is need to set an upper limit for microcache size to prevent DOS. After something like 1gb of cache used start dumping the oldest cached results.

Tools

The data for this is going to be tricky to dig up

Brining ratios
Conversion tool in JS
Time to pasteurization
Aciduation ratios (I forget what this meant, probably something like X vinegar + Y water = %)
Hydration ratios
How big of a pizza/bread/etc would this dough make

Recipes as ingredients

An ingredient can have a recipe link. When parsing a recipe, we can get recipies > ingredients > recipe > ingredients. Might not want to arbitrarily nest down too far.

Allow pinning external recipes

Should give attribution, and can calculate nutrition. This would probably be good as a "user feed" social media style feature, where you could link your recipes on this site, or link a recipe on another site.

S3 compatible backend for uploads

Should be a configurable setting. Uploading to S3 also means rewriting the URL in reference to images (might need a helper get_image_path function).

Add recipe details like cook times

Cook times
Makes (yield)
Description
Favorite recipe (missing functionality)
Rating/like button (way later functionality)
Share buttons
Print button

Rewrite the entire recipe parser

I can't stand how messy and all over the place this is. It needs to be completely rewritten and account for singular/plural better. It crosses too many modules just to update a recipe.

Link ingredients to USDA

Need to probably normalize the USDA data, it's pretty all over the place, with lots of duplicates that have varying nutrition. Probably need a script that will consolidate entries. Might need an intermediary table and/or a good way to tie Ingredients to specific USDA. Could also let USDA just make suggestions for Ingredients and let Ingredients track its own nutrition separately. Like a "new ingredient" and it lets you clone a USDA entry, and make any changes to the nutrition, or create a brand new ingredient and input your own nutrition.

Move account information to full menu for mobile views

This will require a refactor of the menu, but it should not be too bad. It will help consolidate the menu view to be more coherent. Also move the hamburger to the right hand side and probably make it black thin outline to match UI elements

Revisit ingredient parser

It's just been a while, it seems to work fine, might consider replacing it with nimble parsec if anything for terseness and readability

Exports of user data

Recipes, ingredients, etc, probably support a few formats, json, html, maybe pure markdown?

Add groups for users that support RBAC

Users should be able to join a group and share content, probably an add permissions sort of thing so that you can share read only with users, or write, or full control. Could name them like "reader" and "author" roles. Maybe functionality that either lets you share control (co-creator)

This will also require updating unit tests and better defining what a site admin is (RBAC for the site in addition to content)

Reimplement saved recipes as just favorites

We don't need an entire functionality for lists of recipes, just let people favorite recipes. Can also implement a simple like functionality too for cases of promoting recipes without adding to the saved list.

Heart for likes, something like a pin or star for favorites.

Allow forking recipes

Gives attribution to original recipe, this could also tie into external recipes, in which case only ingredients and amounts should carry over (to respect copyrights).

Frequently used (per user) ingredients list for suggestions

Cache the results on a time period so they decay out. Just keep a list (use DETS? data loss doesn't matter) {userId, [broccoli: 1, beef :10, bar: 10]} etc, when an ingredient is used it's incremented, if the ingredient isn't used for a while or gets bumped down in rank it gets dropped.

Functionality should be generic so we can do the same for nutrition for meal tracking.

Might be good to have functionality to hydrate. Restoring state should be easy, just grab the top X ingredients from a user's recipes. That would probably be a good initial implementation too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.