Register
Submit a solution
The challenge is finished.

Challenge Overview

Baton Rouge IV is the one of several challenges to build out public facing mobile REST services for Sugar Cane growers app. In this challenge we'd like to enhance existing REST API and build new data services.

For API detailed definitions and JSON format you can reference this apiary documentation

Cane Quality API

Need to add a new set of data aggregated sample data for full season. Need to collect average vaules for a given grower for the year to date records found in labtransactions table and return as CropYearToDate section including all fields from this table. Averges need to be collected for each field for given grower, all across all growers and provide a diference column between those two averages (As shown on provided screen image)

Update returned data fields based on Apiary sample API

Fielads listed for Cane Quality reports have calculated values, see attached document for field formulas table.

  • Version endpoint <heroku app base url>/aps/1.0/sampledata
  • Existing Endpoint
  • method: GET
  • HTTP Header parameters: APSKEY - authorization API key value
  • Query parameters: growerid, date

NOTE: Some of the fields mapping/formulas not availble those fields need to be included into response for API cosistency but can be left empty or set 0.

Example of Average fields mapping

"corelabtrs" - NOT AVAILABLE
"estmillcrs" - NOT AVAILABLE
"juicebrix" - DB column brixcorrected
"juicepol" - DB column pol
"juicepurity" - NOT AVAILABLE
"fibraque" - NOT AVAILABLE

Cane Survey API

User will enter several values in the app for survey questions and submit the survey. This API will simply insert all these values into canesurvey table and respond with success or failed attempt in case of error.

  • Version endpoint <heroku app base url>/aps/1.0/survey
  • NEW Endpoint
  • method: POST
  • HTTP Header parameters: APSKEY - authorization API key value
  • Insert values: (based in apiary example)

Need also provide a survey listing for a given grower id return all sent surveys for season/year to date

  • Version endpoint <heroku app base url>/aps/1.0/survey
  • New Endpoint
  • method: GET
  • HTTP Header parameters: APSKEY - authorization API key value
  • Parameter: growerid

Quota List API

Return list of recent quotas for a diven grower. Add new field to header result set - Almaestimate is record header data field on Account table set for each grower.

Query 3 recent days of quotas for a given grower and order records with earliest date 1st (today)

  • Version endpoint <heroku app base url>/aps/1.0/quota
  • Existing endpoint
  • method: GET
  • HTTP Header parameters: APSKEY - authorization API key value
  • Query values: growerid, date

Quota Response API

API needs to update quota record sent via notifcation setting data fields: response = Accepted/Changed, reason - grower enter reason for change, this is required if quota needs change. quota_adjusted - number entered by user to change quota loads

Quota Response service

  • Version endpoint <heroku app base url>/aps/1.0/quota
  • existing endpoint
  • method: POST
  • HTTP Header parameters: APSKEY - authorization API key value
  • Update values: quotaid response, quota_adjusted, reason_notes, action

User Settings API

API to set user settings, whne user opt out from notifications is an example of setting. For this app we have this single setting to update on Grower Account table.

  • Version endpoint <heroku app base url>/aps/1.0/settings
  • New Endpoint
  • method: POST
  • HTTP Header parameters: APSKEY - authorization API key value
  • Update values: sampleoptin, growerid

Grower is identified by alphanumeric ID, this will also be the app user.

*SQL file provided to create your own copy of Postgres DB tables. Server API app needs to work with shared Heroku DB instance however due to limited connection (120) resources it is possible that it be consumed/busy. We recomend to use your own copy of DB for development and migrate sample data from existing Postgres tables. We also provided sample data files archive to load sample data for development.

Here are additional backup databases with sample data populated:

DEV1: postgres://hohlgkfywwltfd:8kuUUQipTENV5PP3ui1F_6oeim@ec2-54-204-15-48.compute-1.amazonaws.com:5432/d1h7ljjs54tvlb

QA:  postgres://cmlkbtsotpwfmy:GU5M8DK9ZjR433SKT3O90sdWtl@ec2-107-21-221-59.compute-1.amazonaws.com:5432/da6fq9fir41v9f



Final Submission Guidelines

Guidelines:

Setup:

ELIGIBLE EVENTS:

2016 TopCoder(R) Open

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30051789