Coder Social home page Coder Social logo

nomatteus / dinesafe Goto Github PK

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

Dinesafe Rails App: JSON dump processing, data updating, and API for my iOS app.

Home Page: http://dinesafe.to/app/

Ruby 7.23% JavaScript 0.54% CSS 47.72% HTML 20.27% PLpgSQL 0.90% Roff 20.58% Sass 0.09% SCSS 1.55% Haml 1.10% Shell 0.02%

dinesafe's People

Contributors

nomatteus avatar

Watchers

 avatar  avatar  avatar

Forkers

jbinto

dinesafe's Issues

Optimize XML Fetching

  • Add hash check to compare old/new file when checking XML file in rake task.
  • If hash is the same then stop running.
  • Right now it always runs the import daily which is unnecessary and kills the droplet.

Make the API / searches faster by using Postgres extensions instead of "get km" function.

Instead of the custom get_distance_km function, look into using these postgres extensions: cube and earthdistance:

Check out this tutorial: http://johanndutoit.net/searching-in-a-radius-using-postgres/

Should be faster as these are official extensions, not some random function. Profile some queries and test it out to be sure!

Note that the above assumes the earth to be perfectly spherical. Should be accurate enough though. (But if not, the PostGIS is the answer...).

Also note: Since this is a significant change, and will likely require changing db structure etc., set up another digital ocean server to use as a dev server. But then promote it to be the production server when it's ready. Use the next fastest one! ($10/mo, 1GB RAM) Right now it's chugging...

Speed up JSON rendering by ditching JBuilder and using .to_json

JBuilder is taking ~300ms to render. DB queries have been speed up a lot (from ~600ms to ~120ms), and now JBuilder is the bottleneck.

Even just using ditching jbuilder partials cuts view loading time in half. But just skip that and render JSON directly.

Add ability to filter by certain attributes of inspection history.

For whatever attributes we want to filter on:

  • Add boolean (or appropriate type) column, and add hooks to keep the field updated (denormalized). With tests.
  • Add endpoints or query params to allow filtering by these types.

Some ideas:

  • perfect_record: All inspections passed. Gold star! (Should places that have all passed but some infractions still count as perfect? Maybe not... see what the #'s are like.)
  • long-term safety (?): A place that has been around for a while (say at least 2 or 3 years), has passed all inspections, and has no crucial infractions. Basically like above but a subset of places that have been open for quite a while.
  • has_been_closed: Any place that has been closed at any time in the past. This is an interesting one--allows you to see a list of all the places that have closed...
  • has_had_conditional: Any place with at least one conditional.
  • has_recent_conditional: Any place with at least one conditional in the past X time period. (where perhaps X = a year?)
  • has_crucial_infraction: Has at least one inspection that had a crucial infraction. Could do same for significant.
  • ...:

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.