Skip to content

dlamet/data-engineering

 
 

Repository files navigation

Renewable Funding: Code Challenge

Welcome to my code challenge solution. I wrote the solution on a Mac, so I'd expect best results on OS X.

I created a scaffold for items, added devise for authentication, and implemented the upload and import such that CSV and tab delimited files are supported. The code assumed proper subscripts of either 'csv' or 'tab' to designate the type. Error checking of contents would be more robust in a production application. I created a test file for tab delimited data, 'example_data.tab'. Gross revenue is tallied on a summary page after import.

Deployment Instructions

  1. Ensure that the destination server is configured with Ruby 2.1.2, Rails 4.1 and reasonably up to date SQLite.
  2. Ensure that port 3000 is free
  3. Clone the application to its destination directory.
  4. Initialize the database by running $ rake db:create, $ rake db:migrate, and $ rake db:seed
  5. Create a new user if desired (see User Management Section below.)
  6. Run the server $ rails server
  7. Open a browser to http://3000

User Management

Running seed creates a single initial user:

email: jim.test@gmail.com password: password

Also, there is a rake task that may be used to create additional users. The command takes an email and password like this:

$ rake admin:new_user['Willard Scoot',willard_scott@yahoo.com,password]

Note that in zshell, the brackets must be escaped.

Functionality

The application implements the following features:

  • full CRUD pages for users, merchants, and purchasers,
  • the ability to import the example_input.tab file, displaying total gross revenue,
  • handle authentication or authorization using devise,
  • supports open authorization through Facebook,

Developer Notes

Import Module

The object oriented approach to the creation of the imported objects is probably overkill for the size of this project. But it demonstrates a scalable design that abstracts the behavior.

Note further that I use the find_or_create_from_import for Item. The only significant cost to this is that if a new item is required, it gets saved twice, once when it is initially created with its attributes, and then once when its merchant and purchaser relationships are assigned. This could be optimized by either passing the objects into a more sophistocated find_or_create_from_import method or creating Item another way.

Testing

I've provided unit testing coverage at 100%. The simplecov gem is included an the report is updated. Simply check coverage/index.html to verify. Feature tests are provided for all pages as well.

About

Challenge for those applying to the Software Engineer, Big Data position

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 95.0%
  • CSS 3.2%
  • Other 1.8%