Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

paulfioravanti/sentia-coding-test

Repository files navigation

Sentia Coding Test

An example Ruby on Rails application that can import information and display it.

The application comes from a coding test, and I decided to take it on just because I felt like I had not created a Rails application from scratch for a while.

The application is currently deployed here using Heroku.

Blog Post

I wrote more about this codebase, and my rationale for all the major development decisions, in the following blog post:

Language Versions

Setup

git clone https://github.com/paulfioravanti/sentia-coding-test.git
cd senta-coding-test
bundle install
bin/rails db:init
yarn

Run

bin/rails server

Open http://localhost:3000 in a browser and you should be greeted with an empty table.

Sample Data

Import via User Interface

The original CSV file containing the data that the application must be able to import can be found at:

test/fixtures/files/SentiaCodingTestData.csv

This is the file that can be selected upon pressing the "Import Data" button to import the required data.

Import via Fixtures

During development, I also recreated the seed data in Rails fixtures files, which can be found under the test/fixtures directory. These can be loaded into the database on the command line:

bin/rails db:fixtures:load

Import via Rails Console

I often tested the logic in the file importer modules themselves via the Rails console, so the data can also be imported in the following way:

bin/rails console
irb(main):001:0> file = File.open("#{Rails.root}/test/fixtures/files/SentiaCodingTestData.csv")
irb(main):002:0> DataImporter.import(file)

Deploy

Push to Heroku with the following command:

git push heroku main

Tests

No tests. Too lazy for this one.

Original Requirements

You will be required to create a Ruby on Rails application with the following features below. The sample CSV data required for the test can be found here. This application can be built in 1 hour.

Below is a list of user stories and requirements for each section of this application.

PART 1

  1. As a user, I should be able to upload this sample CSV and import the data into a database.

    IMPORTER REQUIREMENTS

    a. The data needs to load into 3 tables. People, Locations and Affiliations
    b. A Person can belong to many Locations
    c. A Person can belong to many Affiliations
    d. A Person without an Affiliation should be skipped
    e. A Person should have both a first_name and last_name. All fields need to be validated except for last_name, weapon and vehicle which are optional.
    f. Names and Locations should all be titlecased

PART 2

  1. As a user, I should be able to view these results from the importer in a table.
  2. As a user, I should be able to paginate through the results so that I can see a maximum of 10 results at a time.
  3. As a user, I want to type in a search box so that I can filter the results I want to see.
  4. As a user, I want to be able to click on a table column heading to reorder the visible results.

Once the test has been completed. Please upload to Git Repo/Google Drive/DropBox or zip and email over back to <person> at <person's email>.