Skip to content

marlitas/ArtspirationBE

Repository files navigation


Logo
Artspiration API

The backend portion of a fun online application to rate and find cool artwork!

contributors_badge forks_badge stars_badge issues_badge build_badge

About The ProjectTools UsedSet UpInstallationHow To UseDatabase SchemaContributingAcknowledgements

About The Project

The backend of Artspiration consumes the Artsy API and Google Cloud Vision API to power a recommendation engine that connects users with exciting artwork based on their preferences. We expose endpoints that package up this material for frontend consumption to display to our users as a web application.

Learning Goals

  • Using an Agile process throughout development
  • Setting up continuous integration and continous deployment
  • Using project management tool Github Project
  • Demoing project ot project manager
  • Building a backend API for frontend consumption
  • Consuming endpoints and manipulating the JSON responses
  • Handling large group dynamics with short 3 day sprints
  • Working with Machine Learning outputs and implementing into app
  • Consuming Google Cloud Vision API

Tools Used

Development Testing Gems
Ruby 2.7.2 RSpec Pry
Rails 5.2.5 WebMock ShouldaMatchers
JSON VCR Faraday
Atom SimpleCov Figaro
Github FactoryBot FastJSON
TravisCI Faker
Heroku

Set Up

  1. To clone and run this application, you'll need Ruby 2.7.2 and Rails 2.5.3. Using rbenv you can install Ruby 2.7.2 (if you don't have it already) with:
rbenv install 2.7.2
  1. With rbenv you can set up your Ruby version for a directory and all subdirectories within it. Change into a directory that will eventually contain this repo and then run:
rbenv local 2.7.2

You can check that your Ruby version is correct with ruby -v

  1. Once you have verified your Ruby version is 2.7.2, check if you have Rails. From the command line:
rails -v
  1. If you get a message saying rails is not installed or you do not have version 5.2.5, run
gem install rails --version 5.2.5
  1. You may need to quit and restart your terminal session to see these changes show up

Installation

  1. Get a free API Key at Artsy API
  2. Get a free (with limits) Google Vision API KEY by following directions here
  3. Fork this repo
  4. Clone your new repo
    git clone https://github.com/#{your_github_username}/ArtspirationBE.git
  5. Install gems
    bundle install
  6. Install figaro
    bundle exec figaro install
  7. Enter your API KEYS in application.yml
    artsy_api_key = <ENTER YOUR API KEY>
    google_api_key = <ENTER YOUR API KEY>
    key = <ENTER YOUR API KEY>
  8. Setup the database
    rails db:create
    rails db:migrate

How To Use

The Artspiration Backend can be used to retrieve user preferences for artwork, as well as make calls to the Artsy API for specific artwork information including: title, artist, image(jpg). The backend can also provide daily recommendations for a piece of art based on past user preferences. Preferences are generated through label and image properties determined by the Google Cloud Vision API. The recommendation engine is built using a combination of collaborative filtering as well as sorting through the saved user preferences.

Endpoint Documentation

User Endpoint
Request: /api/v1/users/:id

Response:

{
  "data": {
  "id": "133",
  "type": "user",
  "attributes": {
    "name": "Melanie Swaniawski",
    "email": "shameka_goyette@bartell.co"
    }
  }
}

Recommeded Art Endpoint
Request: /api/v1/users/:id/recommendations

Response:

{
  "data": [
    {
      "id": 168,
      "type": "recommended_art",
      "attributes": {
        "title": "Virgin of the Rocks",
        "image": "https://d32dm0rphc51dk.cloudfront.net/Jv-e1fhDjg61OYhhsMoiQg/{image_version}.jpg",
        "user_id": 133
      }
    }
  ]
}

Rated Art Index Endpoint
Request: /api/v1/users/:id/rated_arts

Response:

{
  "data": [
      {
        "id": 175,
        "type": "rated_art",
        "attributes": {
          "title": "La Grande Odalisque",
          "image": "https://d32dm0rphc51dk.cloudfront.net/crVj8GvGliFrpExNfHWl4Q/medium.jpg",
          "liked": true,
          "user_id": 145
        }
      },
      {
        "id": 184,
        "type": "rated_art",
        "attributes": {
          "title": "L'Embarquement pour Cythère (The Embarkation for Cythera)",
          "image": "https://d32dm0rphc51dk.cloudfront.net/Ux_L_UKjxgR-gJ6XZYVgVg/medium.jpg",
          "liked": true,
          "user_id": 145
        }
      }
   ]
}

Rated Art Show Endpoint
Request: /api/v1/users/:id/rated_arts/:art_id

Response:

{
  "data": {
    "id": 106,
    "type": "rated_art",
    "attributes": {
      "title": "The Tête à Tête",
      "image": "https://d32dm0rphc51dk.cloudfront.net/5KJ7_u7BPqeltkfEnyijIw/medium.jpg",
      "liked": true,
      "user_id": 145
    }
  }
}

Database Schema

artspiration_be_schema

Contributing

👤 Jacob Piland

👤 Marla Schulz

👤 Kim Abcouwer

👤 Jason Knoll

👤 Alex Klick

👤 Dee H

Acknowledgements

About

The backend portion of Artspiration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published