As a team, answer a subset of the questions submitted during the hackathon.
But instead of using Tableau, you will need to write Javascript/Lodash code
to derive your answers. Similar to before, each team member is responsible for
one question. But everyone should work together to come up with a good solution.
Your answer should consist of Lodash code and a brief writeup.
Utilize _.map
, _.filter
, _.group
...etc. Do not se any for loop.
This time, the data is not already prepared for you in a nice JSON format. You
will need to do it on your own, replacing the placeholder birdstrike.json
with
real data.
return _.chain(data)
.groupBy(function(obj) {return obj["Conditions: Sky"]; })
.mapValues(function(arr) {return arr.length; })
.value();
{ "Overcast": 8594, "": 50151, "No Cloud": 23686, "Some Cloud": 16157, "No Clouds": 668, "Some Clouds": 148 }
return _.chain(data)
.groupBy(function(obj) {return obj["When: Phase of flight"]; })
.mapValues(function(arr) {return arr.length; })
.value();
{ "Take-off run": 11914, "": 34738, "Climb": 10409, "Approach": 26329, "En Route": 1973, "Landing Roll": 11419, "Descent": 2032, "Taxi": 215, "Parked": 60, "Landing": 315 }
return _.chain(data)
.groupBy(function(obj) {return obj["Feet above ground"]; })
.mapValues(function(arr) {return arr.length; })
.value();
{ "0": 22898, "1": 45, "2": 84, "3": 66, "4": 31, "5": 516, "6": 21, "7": 20, "8": 24, "9": 5, "10": 1496, "11": 1, "12": 8, "13": 5, "14": 2, "15": 241, "16": 1, "19": 2, "20": 943, "21": 4, "22": 1, "23": 3, "24": 2, "25": 273, "26": 1, "27": 3, "28": 1, "30": 432, "32": 1, "33": 1, "34": 2, "35": 49, "37": 7, "38": 4, "40": 148, "43": 1, "45": 7, "47": 1, "48": 1, "50": 2302, "53": 1, "55": 9, "60": 54, "62": 1, "63": 2, "65": 7, "70": 32, "72": 1, "74": 2, "75": 205, "80": 40, "83": 1, "85": 4, "87": 1, "90": 38, "95": 4, "99": 1, "100": 2564, "105": 1, "110": 6, "111": 1, "115": 1, "120": 20, "125": 23, "126": 1, "130": 10, "133": 1, "140": 3, "142": 2, "145": 2, "146": 1, "150": 493, "153": 1, "160": 3, "169": 1, "170": 4, "175": 10, "180": 9, "190": 4, "200": 1950, "210": 5, "220": 1, "223": 1, "225": 2, "230": 2, "250": 174, "255": 1, "260": 1, "270": 5, "272": 1, "275": 2, "280": 3, "300": 1441, "320": 4, "325": 1, "327": 1, "330": 3, "340": 4, "350": 106, "360": 1, "370": 1, "374": 1, "380": 3, "400": 901, "410": 2, "420": 2, "425": 2, "430": 1, "440": 2, "450": 59, "460": 3, "470": 3, "475": 2, "480": 3, "490": 1, "500": 1991, "501": 1, "506": 1, "510": 1, "520": 5, "525": 1, "538": 1, "545": 1, "550": 39, "560": 5, "565": 1, "570": 1, "580": 2, "583": 1, "600": 483, "620": 1, "630": 1, "634": 1, "640": 3, "650": 29, "680": 1, "700": 467, "720": 1, "734": 1, "740": 1, "750": 60, "755": 1, "760": 1, "775": 1, "790": 2, "800": 805, "820": 1, "825": 1, "850": 15, "860": 1, "880": 2, "900": 232, "905": 1, "930": 1, "940": 1, "950": 3, "982": 1, "995": 1, "1000": 1819, "1020": 1, "1022": 1, "1030": 1, "1040": 1, "1050": 7, "1060": 1, "1070": 1, "1075": 1, "1100": 140, "1110": 2, "1126": 1, "1130": 1, "1140": 2, "1150": 6, "1160": 1, "1170": 1, "1182": 1, "1185": 1, "1200": 501, "1220": 2, "1250": 29, "1260": 1, "1265": 1, "1270": 2, "1300": 172, "1350": 6, "1400": 146, "1450": 1, "1500": 1232, "1540": 1, "1550": 3, "1560": 1, "1580": 1, "1600": 155, "1617": 1, "1650": 4, "1675": 1, "1680": 1, "1700": 262, "1740": 1, "1750": 11, "1760": 1, "1800": 276, "1825": 1, "1850": 9, "1870": 1, "1880": 1, "1900": 96, "1950": 2, "1970": 1, "1980": 2, "2000": 1232, "2081": 1, "2100": 71, "2130": 1, "2150": 2, "2200": 174, "2250": 6, "2300": 116, "2350": 4, "2375": 1, "2400": 97, "2440": 1, "2448": 1, "2450": 1, "2500": 620, "2530": 1, "2550": 2, "2600": 97, "2650": 2, "2700": 228, "2720": 1, "2750": 1, "2800": 86, "2850": 5, "2900": 27, "2950": 1, "2970": 1, "3000": 1192, "3100": 32, "3120": 1, "3150": 3, "3200": 77, "3300": 63, "3350": 1, "3400": 41, "3500": 291, "3550": 1, "3600": 47, "3660": 1, "3680": 1, "3700": 104, "3740": 1, "3750": 1, "3800": 33, "3850": 4, "3900": 14, "4000": 720, "4050": 1, "4100": 16, "4200": 47, "4225": 1, "4240": 1, "4260": 1, "4300": 28, "4350": 3, "4400": 22, "4500": 162, "4600": 25, "4650": 1, "4700": 73, "4750": 2, "4800": 24, "4850": 1, "4900": 7, "5000": 562, "5100": 13, "5200": 24, "5250": 1, "5300": 12, "5330": 1, "5400": 20, "5450": 1, "5500": 112, "5600": 12, "5700": 40, "5770": 2, "5800": 13, "5900": 9, "6000": 382, "6100": 6, "6200": 14, "6300": 13, "6400": 6, "6500": 72, "6517": 1, "6600": 11, "6650": 1, "6700": 18, "6800": 13, "6900": 2, "7000": 248, "7080": 1, "7100": 2, "7200": 12, "7250": 1, "7300": 12, "7350": 1, "7400": 9, "7500": 68, "7600": 10, "7700": 13, "7800": 5, "7900": 2, "8000": 193, "8100": 4, "8200": 6, "8300": 9, "8400": 5, "8500": 45, "8600": 4, "8700": 6, "8800": 6, "8900": 5, "9000": 90, "9150": 1, "9200": 3, "9300": 1, "9400": 4, "9500": 26, "9600": 3, "9650": 1, "9700": 7, "9800": 5, "9980": 1, "10000": 149, "10001": 1, "10100": 2, "10200": 6, "10300": 1, "10400": 5, "10500": 15, "10700": 2, "10800": 2, "10900": 1, "11000": 88, "11200": 1, "11300": 1, "11400": 2, "11500": 6, "11700": 4, "12000": 53, "12300": 2, "12400": 1, "12500": 7, "12600": 1, "12700": 1, "12800": 1, "13000": 26, "13400": 1, "13500": 2, "13700": 1, "13800": 1, "14000": 15, "14300": 1, "14400": 1, "14500": 2, "14600": 1, "15000": 15, "15500": 1, "16000": 13, "16500": 3, "17000": 4, "17500": 2, "18000": 2, "18500": 1, "20000": 4, "21000": 3, "21300": 1, "22000": 1, "23000": 1, "24000": 3, "25000": 1, "30000": 1, "31300": 1, "": 43955 }
return _.chain(data)
.groupBy(function(obj) {return obj["Airport: Name"] })
.values()
.map(function(arr) {return [arr[0]["Airport: Name"], arr.length]; })
.reduce(function(n, p) {
if ((n[1] > p[1]) && (n[0] != "UNKNOWN")) { return n; } else {return p; }
}).value()
[ "DENVER INTL AIRPORT", 3397 ]
return _.chain(data)
.groupBy(function(obj) {return obj["Aircraft: Airline/Operator"] })
.values()
.map(function(arr) {return [arr[0]["Aircraft: Airline/Operator"], arr.length]; })
.reduce(function(n, p) {
if ((n[1] > p[1]) && (n[0] != "UNKNOWN")) { return n; } else {return p; }
}).value()
[ "MILITARY", 9193 ]
return _.chain(data)
.groupBy(function(obj) {return obj["Aircraft: Make/Model"] })
.values()
.map(function(arr) {return [arr[0]["Aircraft: Make/Model"], arr.length]; })
.reduce(function(n, p) {
if ((n[1] > p[1]) && (n[0] != "UNKNOWN")) { return n; } else {return p; }
}).value()
[ "A-320", 4654 ]