GithubHelp home page GithubHelp logo

8bithero / larder-lookup Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.65 MB

Pennylane Tech Test - A recipe search app.

Dockerfile 2.89% Ruby 62.12% JavaScript 26.66% CSS 1.73% HTML 6.27% Shell 0.33%

larder-lookup's Introduction

Pennylane Tech Test - Larder Lookup

This is a recipe searching app built for the Pennylane tech test. The app has been built as a monorepo containing a Ruby on Rails 7 API with a React front-end.

A demo of the app loaded with a subset of the data (5065/10013) can be found at:

https://larder-lookup-2.fly.dev/

Approach

The main objective was to search for ingredients and return recipes that include the selected ingredients. The obvious and most straightforward approach would have been to save each recipe's ingredient as a string in an Ingredients table and search using ILIKE. Instead, I have decided to do some of the work upfront and parse the ingredients into FoodItems. The reason behind this upfront parsing is to make the results of the frontend's autocomplete cleaner, and by splitting up the measurements from the actual ingredient items, it becomes possible to introduce features like changing measurement types (i.e., from imperial to metric), or automatically adjust quantities in order to make more or less servings per recipe.

Backend

  • Callable Services used to contain and isolate logic
  • Queries have been decoupled from models
  • Rake task to parse and populate data
  • PostgreSQL Trigram's for better search capabilities

Potential Improvements

  • Presenter/View layer
  • Request specs
  • Validations for services
  • Add pagination

Frontend

  • Autocomplete
  • Control Panel to search Ingredients or preset search queries
  • Control panel designed to be extendable and allow additional features like sorting.

Potential Improvements

  • State management
  • Test coverage
  • Removal of Stimulas
  • Add sorting/pagination
  • More effective data fetching mechanism

Setup

Get code

git clone https://github.com/8bithero/larder-lookup.git
cd larder-lookup

Install gems/packages

bundle install
yarn install

Create database

rails db:setup
rails recipes:import

Populate data

For all data you can run:

rails recipes:import

If you would like to populate the database with a subset of the data, you can run the below, replacing the number with the number of records you want to populate the database with.

rails 'recipes:import[500]'

Start Server

bin/dev

Please note you will need to start the server with bin/dev rather than rails s to ensure the React frontend is also started.


Original Pennylane Test Brief

Problem statement

It's dinner time ! Create an application that helps users find the most relevant recipes that they can prepare with the ingredients that they have at home

Objective

Deliver an application prototype to answer the above problem statement.

By prototype, we mean:

  • something usable, yet as simple as possible
  • UI / design is not important
  • we do not expect features which are outside the basic scope of the problem

We expect to use this prototype as a starting point to discuss current implenentation details, as well as ideas for improvement.

Tech must-haves

  • MySQL / PostgreSQL or any other MySQL-compatible database.
  • A backend application which responds to queries
  • A web interface (can be VERY simple)
  • Ruby on Rails (if you're not familiar with Ruby on Rails, use something you're familiar with)

Bonus points

  • React
  • Application is hosted on fly.io

Data

We provide two datasets to choose from:

Download it with this command if the above link doesn't work:

wget https://pennylane-interviewing-assets-20220328.s3.eu-west-1.amazonaws.com/recipes-en.json.gz && gzip -dc recipes-en.json.gz > recipes-en.json

Deliverable

  • the 2-3 user stories which the application implements
  • the codebase : in a git repo (share it with @quentindemetz @tdeo @soyoh @lucasbonin @sforsell @clemalfroy @dmilon @pointcom @evangelos-fotis @thecodehunter)
  • the database structure
  • the application, running on fly.io or on a personal server.
  • please submit links to the GitHub repo and the hosted application via this form and if you're on Mac, make sure your browser has permission to share the screen

larder-lookup's People

Contributors

8bithero avatar

Watchers

 avatar

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.