Topcoder Skill Builder Competition | Golang | Solar System data: Recovery

Key Information

Register
Submit
Competition Timeline

Timezone:Etc/UTC

Registration

Starts

Jul 22, 2021

03:15

Ends

Apr 02, 2022

17:16

Submission

Starts

Jul 22, 2021

03:36

Ends

Apr 02, 2022

17:40

Review

Starts

Apr 02, 2022

17:41

Ends

Apr 04, 2022

17:41

Appeals

Starts

Apr 04, 2022

17:41

Ends

Apr 05, 2022

17:41

Winners Announced

Apr 06, 2022

05:41

Challenge Overview

Challenge Overview

Challenge Banner

Recovery

This is the EASY 250 Points Competition

Tycho station data engineers compiled solar system data from old offline data cores that were unaffected by the virus attack; and have put them together in well formatted CSV files for you. Your task in this challenge is to create an initial application in Go that will read data fed to it through a REST Api and write them to a Postgres database. You are given a starter application and in this task, you have to modify and extend that starter application to do the recovery.

Solving this problem you learn:

  • To create an initial application structure and understand packages and modules.
  • To use interface embedding to create re-usable segments of code.
  • To use environment variables to load app configurations
  • To read data from files
  • To connect to and write data into a database

Learning Resource: https://pg.uptrace.dev/models/

What do you need to do?

Technology Stack

  • Go
  • PostgreSQL
  • go-pg

Data model

Body model (Table name: body)

  • id: Long (Primary key)
  • type: String
  • name: String
  • description: String
  • moons: Integer

Physical Characteristics model (Table name: physical_data)

  • id: Long (Primary key)
  • body_id: (Foreign key, references body(id))
  • density: Float
  • gravity: Float
  • mass_value: Float
  • mass_exponent: Integer
  • volume_value: Float
  • volume_exponent: Integer

Orbital Parameters model (Table name: orbital_parameters)

  • id: Long (Primary key)
  • body_id: (Foreign key, references body(id))
  • sideral_orbit: Float
  • sideral_rotation: Float

The sample submission contains a POST /api/v1/recover route which accepts three CSV files as multipart/form-data

  • body - containing Body data
  • physicalData - containing Physical Characteristics data
  • orbitalData - containing Orbital Parameters data

Task

  • Create structs to represent each of the data models. (See the file models/Body.go in the sample submission for an example). Take special care to add the foreign key constraints in PhysicalCharacteristics and OrbitalParameters models.
  • controllers/Recovery.go in the sample submission shows an example implementation of inserting Body data from the uploaded CSV into database. Using that as an example, insert PhysicalCharacteristics and OrbitalParameters data into the database.

Grading The automated grader will invoke the POST /api/v1/recover endpoint with randomly generated CSV files and check the database to see if the data has been inserted correctly. The overall score will be (number of tests/total number of tests) * 100. An individual test for example be randomly checking if a certain id from the CSV was properly inserted into the appropriate table.

Submission Deliverables

You must follow this submission folder structure and the Dockerfile in the sample submission so our automated test process can process your scoring:

  • Create a folder with “code” as the folder name then zip.
  • Inside the “code” folder, there needs to be a file named Dockerfile. This is the docker file used to build the user’s submission. Refer to the provided Docker file in Sample Submission for each level.
  • Zip that “code” folder and submit to the challenge.
  • After you submit - you will be able to check your score and logs on the challenge leaderboard and submission-review app respectively.
  • In case you receive a score of -1, please look at the logs and go through the sample submission and submission guidelines once to see if you are doing things correctly.

Topcoder Go Skill Builder Problems

ELIGIBLE EVENTS:

2022 Topcoder(R) Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30195929