lschallenges/data-engineering — pull request #235 by redgazelle (2014-04-02 14:54:01+00:00)
Title: E Rothman Challenge Submission

This is a Ruby on Rails app using SQLite and Webrick on localhost:3000.

1. Created the following models with associations and validations:

Merchant
Product
Purchaser
Purchase
PurchaseItem

2. Created additional model called PurchaseBatch to parse the tab delimited file.

3. Created upload form using haml and the new action in the purchase batches controller.

4. The purchase batches controller handles the upload form request in the create action and pretty much delegates the parsing of the file to the purchase batch model.

5. The show template displays the success or error message, the status of the file import, and the total gross revenue of the purchases within the batch.

6. There are two sample upload files in the public directory: valid_upload_file.csv and invalid_upload_file.csv

This could have been expanded to include basic crud operations for each of the models and I debated whether to do so but opted not to since it was beyond the scope of the requirements.

At first, this challenge seemed relatively easy but once I dug in I realized how many models were needed to normalize the data, and the app got bigger. Also, one of the requirements was to make the challenge solution aesthetically pleasing so I decided to go with the rails-bootstrap composer starter app, which added many gems and a ton of new files. It does look nice though and I would definitely use the composer's starter app for my own projects.

Install notes are included in the README.

rspec spec
Finished in 1.37 seconds
39 examples, 0 failures