jmmastey/level_up_exercises — pull request #267 by paulh16 (2014-11-12 22:59:40+00:00)
Title: Data science pgh_Iteration 1

First, I apologize for the early pull request. Second, I had an issue where my modified dino_catalog and triangle_facts files showing up in my pull request. I could not get rid of the triangle_facts file, so please ignore.

The program is organized according to the RubyGems convention, with bin, lib and spec directories. The program can be run by specifying a JSON file on the command line:

bin/data_science another_file.json

If a file isn't specified, the program will use the default file in the bin directory.

There are six main files in this program:

* data_science: This is the main driver of the program.

* conversion_test.rb: This is the main class of the program. It instantiates a new sample, imports and adds the data to the sample and prints the statistical results.

* json_parser.rb: parses a JSON file.

* sample.rb: A Sample object stores an array of DataPoint objects. In addition, the statistical test methods for a Sample are defined in this class. I used an outside library, ABAnalyzer, to perform the Chi-Square test and calculate the confidence level.

* data_point.rb: A DataPoint object is one website visit. Its attributes are date, cohort (A or B) and the result (0 or 1)

* view_helpers.rb: helper methods that print out the results of the statistical tests in sample.rb

Notable points:

#import_data: I parse a short JSON file to test the functionality of this method. I don't think a mock or Factory is a good choice here because I want to ensure the method actually imports and parses a JSON file.

sample_spec.rb: I used Factory Girl to create dummy data point objects

conversion_test.rb: I am not sure how to reduce the size of the #print_statistical_results method.