lschallenges/data-engineering — pull request #248 by jackiekircher (2014-04-07 21:37:14+00:00)
Title: jackie kircher - Senior Software Engineer Challenge solution

Here is my solution for the Senior Software Engineer Challenge. All of the documentation for setup is located in `importer/README.markdown`

One unwritten direction in the setup is to make sure you checkout branch `importer` once you have pulled or cloned my changes when you plan to run the solution locally. This step isn't dependent on the structure of the solution, so I didn't feel it was pertinent to include in the readme. Outside of that, here is a brief overview of my design decisions:

## Design

For simplicity sake I use most of Rails' conventions, with one exception for the test suite. Since I don't have any experience with MiniTest I replaced it with Rspec.

As far as the data normalization goes, I chose to split the incoming data into 4 models:

#### Purchasers

Identified by their name. I assumed that any two purchasers with the same name were the same purchaser. This seems like a grave oversight in our acquisition's data, since people can have the same name.

#### Merchants

Identified by their name and address. I asserted uniqueness on both because it is possible for two different merchants to have the same address (if they share an office building) or to have the same name
(by coincidence or if they are independently owned franchises).

#### Items

Identified by their description, price, and merchant. Once again, I asserted uniqueness on all three of these attributes because there are arguments where different items might share one or two of them.
For instance, a merchant may offer the same deal at a lower price to first time customers or members but the description might remain the same.

#### Transactions

Transactions connect Purchasers to Items along with the quantity of items purchased. Every line in the parsed CSV amounts to one transaction, so a purchaser could make duplicate purchases and they
would both be counted.

Most of the above models are just there for data representation. All of the logic used to parse the CSV and then create the appropriate models is in the CSVImporter class. Error handling is at a minimum under the
assumption that the CSV will always follow the same, complete format. More robust handling could be added in but there's no need to solve a problems that doesn't exist yet.

The above rundown is also located in `importer/README.markdown` for completeness. If you have any other questions please comment or ping me by email. Thank you for taking time to review my submission!