Skip to content

Instantly share code, notes, and snippets.

@samin
Last active May 28, 2018 13:33
Show Gist options
  • Save samin/3a75a44d94a8dbd48a95 to your computer and use it in GitHub Desktop.
Save samin/3a75a44d94a8dbd48a95 to your computer and use it in GitHub Desktop.
ClassApp Dev Challenge

Dev Challenge

Create a program in Node.js where the input defined in input.csv is parsed and organised into the content shown in output.json.

Please write your program in only one file (like index.js) and write the output to a file (output.json) instead of printing it to logs or on the screen.

JSON order is not important, but its content is. The program should output the same content (not necessarily the same order) if the input column order is changed. Don't hard code the tags shown, meaning tags could be changed to "email Tio, Reponsável, Financeiro" and it should still parse accordingly.

Some libraries that may be useful, but not required:
https://lodash.com/
https://www.npmjs.com/package/google-libphonenumber

What will we consider? Succinct code, great and descriptive methods and variables, clear thinking skills, efficient code. Code documentation is not really important if your code is simple, easy to read and understand.

Complete this challenge in a maximum of 1 week and send your GitHub public project link to isabela@classapp.com.br

fullname eid class class email Responsável, Pai phone Pai phone Responsável, Mãe email Mãe email Aluno phone Aluno invisible see_all
John Doe 1 1234 Sala 1 / Sala 2 Sala 3 johndoepai1@gmail.com :) 11 22221 (11) 38839332 johndoemae1@gmail.com johndoealuno1@gmail.com hahaha 1
John Doe 1 1234 Sala 4 Sala 5, Sala 6 johndoepai2@gmail.com/johndoepai3@gmail.com 19 985504400 (11) 38839333 11 983340440 yes
Mary Doe 2 1235 Sala 1 marydoe1@gmail.com (11) 98334228 0 no
Victor Doe 3 1236 Sala 6 Sala 7 victordoepai1@hotmail.com victordoe3@gmail.com victordoe3@gmail.com 19 74430033
[{
"fullname": "John Doe 1",
"eid": "1234",
"classes": [
"Sala 1",
"Sala 2",
"Sala 3",
"Sala 4",
"Sala 5",
"Sala 6"
],
"addresses": [{
"type": "phone",
"tags": [
"Responsável",
"Mãe"
],
"address": "551138839332"
}, {
"type": "email",
"tags": [
"Mãe"
],
"address": "johndoemae1@gmail.com"
}, {
"type": "email",
"tags": [
"Aluno"
],
"address": "johndoealuno1@gmail.com"
}, {
"type": "email",
"tags": [
"Responsável",
"Pai"
],
"address": "johndoepai2@gmail.com"
}, {
"type": "email",
"tags": [
"Responsável",
"Pai"
],
"address": "johndoepai3@gmail.com"
}, {
"type": "phone",
"tags": [
"Pai"
],
"address": "5519985504400"
}, {
"type": "phone",
"tags": [
"Responsável",
"Mãe"
],
"address": "551138839333"
}],
"invisible": true,
"see_all": true
}, {
"fullname": "Mary Doe 2",
"eid": "1235",
"classes": "Sala 1",
"addresses": [{
"type": "email",
"tags": [
"Responsável",
"Pai"
],
"address": "marydoe1@gmail.com"
}],
"invisible": false,
"see_all": false
}, {
"fullname": "Victor Doe 3",
"eid": "1236",
"classes": [
"Sala 6",
"Sala 7"
],
"addresses": [{
"type": "email",
"tags": [
"Responsável",
"Pai"
],
"address": "victordoepai1@hotmail.com"
}, {
"type": "email",
"tags": [
"Mãe",
"Aluno"
],
"address": "victordoe3@gmail.com"
}, {
"type": "phone",
"tags": [
"Aluno"
],
"address": "551974430033"
}],
"invisible": false,
"see_all": false
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment