Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Free Spirits

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
Avatar for Paul Bae Paul Bae
May 01, 2015
26

Free Spirits

Our CS 373 Software Engineering website

Avatar for Paul Bae

Paul Bae

May 01, 2015

Transcript

  1. Inspiration • Started from a joke. • Most members of

    our group do not drink alcohol • We believed the potential data set to be interesting • Clear connection from Drinks <-> Ingredients
  2. Models Drinks: • name • description • recipe Ingredients: •

    name • description • recipe Users: • name • email • pw_hash Many to many from all models to all other models
  3. Scraping We used Scrapy and Beautiful Soup 4 Scraped our

    data from drinksmixer.com Outputted the data into data/*.json. Database contains over 15,000 entries Tutorial on how to use Scrapy: http://pybae.github.io/blog/2015/04/27/a-simple- introduction-to-scrapy/
  4. Populating Populating takes the data from Scrapy and then builds

    the database. This is done in populate.py Note that this also builds the whoosh search index, which is used later for search.
  5. Frontend Bootswatch Superhero theme JQuery and Javascript to interface with

    the API Google Images was used, since our database was too large to store images reliably. Used Jinja templates inheritance
  6. User Login Flask-WTF gives support for WTForms, which supports csrf

    token, as well as providing validators. Flask-Login provides user session management, such as providing a current_user that is accessible in all the models. We also use Gravatar to get profile pictures
  7. Search Search is done by the Flask-Whooshsearch This essentially builds

    an index of possible queries to models, and searches manually if not. We ran into issues since Flask-Whooshsearch used Python 2, and thus had to use a port.
  8. Search Autocomplete Used Twitter Typeahead.js Used Flask-Cache to cache the

    results Only implemented on the index page, as we couldn’t find a way to cleanly pass variables to the parent template. Also had issues with content wrapping
  9. Deploying the Server When we initially deployed the server, we

    didn’t take the proper precautions to make it totally secure. ...Then this happened.
  10. Deploying the Server Our server (and your server!) is constantly

    being probed with login attempts. Take the security of your server seriously. Disallow password authentication and use SSH keys Do not run the server as root!
  11. API We used Flask-Restful for the API. All of it

    is defined in api.py Most are GET requests, but we have two POST requests: favoriting and unfavoriting. These are validated with the current user, therefore ensuring that the user must be signed in for the POST request to succeed.
  12. Testing Testing is done with a dummy client, which temporarily

    assigned by the dummy_client method. This bring test time to around ~2 seconds. We test model creation, deletion, queries, and search.
  13. Critique of Free Spirits We did well in implementing user

    validation and forms. Our search functionality is also well done, though our contextualized results could provide better context. We had to learn a lot to complete this project. Every step of the project required research to complete, and it was often marred by incomplete (or incorrect) documentation. In these cases, we sometimes had to even review the source code of the libraries we used to figure out why the implementation wasn’t working as intended. The design of the website was intended to be simple, but it could come across as flat. None of our group members are true website designers at heart, but we did our best to make everything look clean. Our Google Images query also lead to some dubious results.
  14. Critique of Superheroes The UI of the website is clean.

    The dataset is well-maintained, but is too small. Search isn’t contextualized and is often incorrect. Search is susceptible to errors in input, such as the character ‘;’ will give faulty results as well. Search seems to be implemented by a simple ilike matching, which wouldn’t scale for larger databases. Occasionally leads to Jinja errors when should be giving 404, such as superheroes-idb.tk/character/-1