Register
Submit a solution
The challenge is finished.

Challenge Overview

Challenge Overview

We are creating Ruby Gem for the following APIs in this challenge :

  • Enlighten Systems API is a JSON-based API that provides access to performance data for a PV (Photovoltaic) system.

  • PVWatts API is a JSON-based API that provide access to the energy production of grid-connected photovoltaic (PV) energy systems. This service estimates the performance of hypothetical residential and small commercial PV installations.

The goal of this is to build a Ruby gem library to download user’s energy production stats. You are building a demo ruby on rails app to demonstrate the functionality.

Challenge Requirements

Technology Stack

  • Ruby on Rails 3.2

  • Ruby 2.1.5

Demo Page

Create simple ruby on rails demo application that demonstrate the ruby gem.

Enphase Demo

It should have the following :

Here is sample of page, you will create same panel for rest of the methods. (Note that fields might not needed, this is just a mockup)

Screenshot 2015-03-25 15.37.05.png

PVWatts Page

The page should be similar to the enphase page with difference that we don’t need to do any authorization in this page.

Expected Gem Usage

The gem should have a single module gm_stats, sample usage would look like this :

require ‘gm_stats’

enphase_stats = gm_stats.get_enphase_last_month_stats(userId,.. some optional parameters .. )

The returned enphase_stats represents the total energy production of the user’s system in the last 30 days.

pvwatts_stats = gm_stats.get_pvwatts_stats(module_type, losses, array_type, tilt, azimuth, address, .. some optional parameters .. )

The returned pvwatts_stats represents the last 30 days production.

Ruby Gem Requirement

  • Ruby Gem should have a module gm_stats exposes two methods :

    • Method name : get_enphase_last_month_stats

      • Returns enphase last month energy production of all user’s systems in the provided zip code.

      • Input parameters :

        • enphase_user_id

        • enphase_api_key

        • zipcode (valid US zip code)

      • Logic :

        • Validate input parameters, all input are required.

        • Check if the passed user’s id has systems within the zip code area.

        • If user has no systems then return 404 Not Found.

        • If user has systems in the provided zip code :

        • Retrieve the last year average annual  price of electricity $/kWh from EIA API

          • Calculate cost of the total energy production calculated in previous step.

        • Return the total energy production and total cost.

    • Method name : get_pvwatts_stats

      • Returns the monthly AC power output of the provided zip code.

      • Input parameters :

        • api_key

        • system_capactiy (required)

        • address (required) the zip code, must be valid US zip code.

        • module_type (default to 0)

        • losses (default to 14%)

        • array_type (default to 0)

        • tilt (default to 20 degrees)

        • azimuth (default to 180 degrees)

      • Logic :

        • Validate input parameters.

        • Use this API :

          • The parameters passed as input are to be set in the API call

          • Capture ac_monthly from the API response. It will be array of 12 months values. We only need the last month value.

        • Retrieve the last year average annual  price of electricity $/kWh from EIA API

          • Calculate cost of the energy production calculated in previous step.

        • Return the total energy production and the cost.

    • You need to configure the Ruby gem with collection of zipcode/sdid pairs, it will be used when calling EIA API, based on passed in zip code the corresponding sdid will be used in the EIA API call.

Abstracting

Please make sure to create mixin to include the common code/functionality.

Writing Tests

All of your code should be test covered (RSpec preferred).

You will include sample test data required for tests, including test users in enphase.

Documentation

Because other programmers will be working with your code, and incorporating it into their projects, all functions must be documented in detail in the code (TomDoc preferred - In order to generate HTML properly you will need to use Yard TomDoc).

Coding Standard

Follows coding standards listed here: https://github.com/copycopter/style-guide

Readme

Provide a detailed readme file using Markdown language with following information :

  • Overview

  • Setup Prerequisites

  • How to install

  • Usage Example

  • How to run Demo and Verify results.

  • Reference to APIs Documentation

  • Reference this Ruby Gem Documentation

  • Any details about any limitations of your solution.

Please note, we're judging this competition not just on the code, but also on the quality of the documentation, test coverage, and ease of use.

References

 



Final Submission Guidelines

Deliverable

  • All source code files and scripts that addresses the challenge requirement.

  • Detailed readme file as clarified above.

ELIGIBLE EVENTS:

2015 topcoder Open

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30048769