Code Monkey home page Code Monkey logo

stats_project's Introduction

It's All About Stats

This is a Rails application that uses MySQL, Sequel, and AngularJS to calculate and display:

  1. Number of page views per URL, grouped by day, for the past 5 days

  2. Top 5 referrers for the top 10 URLs, grouped by day, for the past 5 days

Running the application

To run this application, you will need Rails and MySQL installed.

$ bundle install
$ rake db:reset
$ rails server

Viewing the data

Visit http://localhost:3000/top_urls to see the page views per URL, grouped by day, for the past 5 days.

Visit http://localhost:3000/top_referrers to see the top 5 referrers for the top 10 URLs, grouped by day, for the past 5 days.

Other Notes

  • I chose to add a 'date_created_at' column in order to more effectively use indexing when filtering by dates. You can't apply a function like date() to a datetime within a where clause and still use a datetime index.
  • I used the AngularJS $HTTP service to get the JSON at http://localhost:3000/get_top_urls so I could use the ng-repeat directive to display the data at http://localhost:3000/top_urls.

TODO

  • Optimize queries for large datasets
    • Work on reducing the number of SQL queries made and let the database do more of the filtering.
  • Decrease page loading time
    • While the SQL query for Top URLs takes less than a second, generating the JSON is taking much longer.
  • Add more CSS styling

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.