Skip to content

etl: Add canonical data #507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions exercises/etl/canonical-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"transform": {
"#": [
"Note: The expected input data for these tests should have",
"integer keys (not stringified numbers as shown in the JSON below",
"Unless the language prohibits that, please implement these tests",
"such that keys are integers. e.g. in JavaScript, it might look ",
"like `transform( { 1: ['A'] } );`"
],
"description": "transforms the a set of scrabble data previously indexed by the tile score to a set of data indexed by the tile letter",
"cases": [
{
"description": "a single letter",
"input": {
"1": ["A"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that this is a "1": (rather than 1:) because JSON would only allow string keys in their objects.

Is it the case that languages will usually use integers as their keys? If so, perhaps a note saying so? Can put it on the same level as description and cases. No standard key for that note, for some reason people ahve used "#": in the past, but maybe "notes": is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought about this when I started this PR but then quickly got distracted with other changes. I'll add a note. I think it's an important thing to call out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at several data files. Not a single one uses notes. Though that is probably a better key (long term) I'm not sure this commit should be the one to start that. So I went with #.

If there is some documentation that could be updated... and if you guys want (me) to build a script to update all # entries with notes to lay down the "new" convention. I'd be happy to help. but for now, i'm sticking with #

},
"expected": {
"a" : 1
}
},
{
"description": "single score with multiple letters",
"input": {
"1": ["A", "E", "I", "O", "U" ]
Copy link
Contributor

@Insti Insti Jan 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"multiple letters with the same score"

},
"expected": {
"a" : 1,
"e" : 1,
"i" : 1,
"o" : 1,
"u" : 1
}
},
{
"description": "multiple scores with multiple letters",
"input": {
"1": ["A", "E"],
"2": ["D", "G"]
},
"expected": {
"a" : 1,
"e" : 1,
"d" : 2,
"g" : 2
}
},
{
"description": "multiple scores with differing numbers of letters",
"input": {
"1": [ "A", "E", "I", "O", "U", "L", "N", "R", "S", "T" ],
"2": [ "D", "G" ],
"3": [ "B", "C", "M", "P" ],
"4": [ "F", "H", "V", "W", "Y" ],
"5": [ "K" ],
"8": [ "J", "X" ],
"10": [ "Q", "Z" ]
},
"expected": {
"a": 1, "b": 3, "c": 3, "d": 2, "e": 1,
"f": 4, "g": 2, "h": 4, "i": 1, "j": 8,
"k": 5, "l": 1, "m": 3, "n": 1, "o": 1,
"p": 3, "q": 10, "r": 1, "s": 1, "t": 1,
"u": 1, "v": 4, "w": 4, "x": 8, "y": 4,
"z": 10
}
}
]
}
}