Introduction

I took a few days off from my regular work to create an application for an employment agency located in Holland. I would like to present here, how I’ve approached this task. I invite you to read!

Background

The client was an employment agency, that organizes work for people in agricultural sector. They also provide accommodation for their employees during the time of their employment. The client wanted to be able to monitor gas and electricity consumption in those places. They already had meters installed (a kind of Smart Meters) at those places. These meters were performing readings every few minutes and collecting them as files on FTP server. It was hard for the client to view and manage these reading, so the client was looking for a solution, that would view all these data in a more friendly form, like tables and charts. They also wanted to group these data by addresses, perform some comparisons, see daily and hourly usage in selected date ranges and have costs per person automatically calculated. They contacted me and asked to propose a solution.

The solution

Currently, I specialize in building web application using Ruby on Rails and it seemed like a Ruby on Rails web application could satisfy client’s requirements. I proposed following solution, consisting of three parts:

  • An admin panel with classic CRUD for managing addresses and settings (Ruby on Rails, PostgreSQL).
  • A script, acquiring data from ftp server (Ruby, CRON).
  • Minimalistic frontend with a nice tables and charts (HTML/CSS, Bootstrap3, JavaScript/CoffeeScript with some AngularJS inserts for better UX).

I contacted the client to discuss each of above part once again. I wanted to check, if I understood their requirements. We agreed on time & material payment model and I presented hourly estimates for each of above part, to get them a sens of costs. I declared to contact them at the end of each part to show the progress and to discuss some potential changes or misunderstandings.

Work process

For my own convenience, I decided to keep the code quality high. I mean to keep the code decoupled, write tests, pay attention to data integrity (validations, foreign keys, unique indexes), handle edge cases, follow the unofficial Ruby style guide and use Rubocop to check it.

Keeping the code quality high and a craftsmanship approach helped me go through development process efficiently.

Results

I used following technology stack, to build the application:

  • Ruby 2.2
  • Rails 4.2
  • PostgreSQL 9.4
  • AngularJS 1.4
  • Bootstrap 3

Here are some screens of the finished app:

Bar charts showing gas and electricity cost for each address in selected date range
Bar charts showing gas and electricity cost for each address in selected date range
Line charts showing daily electricity consumption for selected addresses and date range
Line charts showing daily electricity consumption for selected addresses and date range
Line charts showing hourly electricity consumption for selected addresses and one day
Line charts showing hourly electricity consumption for selected addresses and one day
Meters table
Meters table
Addresses table
Addresses table
Address edit form
Address edit form
Admin login form
Admin login form
Statistics
Statistics

Here are other articles related to that application: