Report
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.
What type of aircraft has the most instances of damaged caused by bird strikes? by (nicolele)
var filter=_.filter(data, function(air){
return air['Effect: Indicated Damage'] == "Caused damage"
})
var groups=_.groupBy(filter, function(air){
return air['Aircraft: Type']
})
var maxGroups=_.mapValues(groups, function(g){
return _.size(g)
})
var maxType=_.pick(maxGroups, function(g){
return g == _.max(maxGroups)
})
return maxType
{
"Airplane": 7196
}
What are the top 5 bird species that are involved? (ZachLamb)
/*var filter=_.filter(data, function(air){
return !_.includes(air['Wildlife: Species'], "Unknown bird")
})*/
var groups=_.groupBy(data, function(air){
return air['Wildlife: Species']
})
var countGroup=_.mapValues(groups, function(g){
return _.size(g)
})
var keys=_.keys(countGroup)
var list=_.map(keys, function(key){
return {"name": key, "count": countGroup[key]}
})
return _.sortBy(list, function(e){
return e["count"]
}).reverse()
Name |
Count |
Unknown bird - medium |
23416 |
Unknown bird - small |
18567 |
Unknown bird or bat |
4411 |
Mourning dove |
4365 |
Gulls |
2795 |
American kestrel |
2651 |
Killdeer |
2601 |
European starling |
2200 |
Horned lark |
2041 |
Unknown bird |
1932 |
Barn swallow |
1924 |
Sparrows |
1705 |
Rock pigeon |
1633 |
Unknown bird - large |
1567 |
Red-tailed hawk |
1309 |
Ring-billed gull |
945 |
Eastern meadowlark |
858 |
Herring gull |
783 |
Canada goose |
771 |
Cliff swallow |
719 |
Hawks |
693 |
Barn owl |
661 |
Swallows |
614 |
Pacific golden-plover |
583 |
Doves |
576 |
Western meadowlark |
568 |
Blackbirds |
541 |
American robin |
534 |
Mallard |
478 |
Perching birds (y) |
459 |
White-tailed deer |
425 |
Turkey vulture |
387 |
Chimney swift |
359 |
Meadowlarks |
351 |
Microbats |
346 |
Ducks |
343 |
Tree swallow |
338 |
Common nighthawk |
313 |
Coyote |
299 |
Short-eared owl |
281 |
Savannah sparrow |
250 |
Laughing gull |
227 |
American crow |
220 |
Great blue heron |
209 |
Cattle egret |
200 |
Bank swallow |
198 |
Black-tailed jackrabbit |
185 |
Osprey |
180 |
Red-winged blackbird |
173 |
Peregrine falcon |
171 |
Sandpipers |
169 |
Snow bunting |
158 |
New World Vultures |
153 |
Geese |
146 |
Egrets |
144 |
Owls |
143 |
Great horned owl |
141 |
Purple martin |
138 |
Zebra dove |
136 |
Upland sandpiper |
133 |
American coot |
132 |
Brown-headed cowbird |
129 |
Western kingbird |
129 |
Brazilian free-tailed bat |
125 |
House sparrow |
121 |
Spotted dove |
120 |
Scissor-tailed flycatcher |
115 |
Striped skunk |
112 |
Bald eagle |
111 |
Virginia opossum |
109 |
Burrowing owl |
106 |
Northern pintail |
104 |
Black vulture |
103 |
Skunks |
100 |
Common grackle |
98 |
California gull |
98 |
American golden-plover |
96 |
Yellow-rumped warbler |
95 |
Red fox |
93 |
Rabbits |
91 |
Woodchuck |
87 |
Crows |
87 |
Cedar waxwing |
86 |
Black-bellied plover |
85 |
Western gull |
83 |
Swainson's hawk |
83 |
Franklin's gull |
81 |
Double-crested cormorant |
81 |
Swainson's thrush |
80 |
Northern harrier |
79 |
Sandhill crane |
77 |
Great black-backed gull |
77 |
Hermit thrush |
76 |
White-throated sparrow |
75 |
Dark-eyed junco |
74 |
Snow goose |
74 |
Lark bunting |
73 |
Least sandpiper |
73 |
Grackles |
73 |
Song sparrow |
69 |
Glaucous-winged gull |
68 |
Wood warblers |
66 |
Raccoon |
65 |
Gray catbird |
64 |
Foxes |
61 |
American pipit |
58 |
Perching birds (z) |
57 |
Thrushes |
57 |
Cooper's hawk |
57 |
Semipalmated plover |
57 |
House finch |
56 |
Snowy owl |
56 |
Finches |
56 |
Ducks, geese, swans |
56 |
Wilson's snipe |
55 |
Western sandpiper |
55 |
Rough-legged hawk |
54 |
Common myna |
50 |
Great egret |
50 |
American woodcock |
49 |
Grasshopper sparrow |
49 |
Sky lark |
48 |
Gadwall |
48 |
Northern flicker |
48 |
Nutmeg mannikin |
47 |
Merlin |
47 |
Mew gull |
46 |
Green-winged teal |
46 |
American wigeon |
46 |
Turtles |
46 |
Eastern cottontail |
46 |
Red-eyed vireo |
45 |
Red bat |
45 |
Vesper bats |
44 |
Northern mockingbird |
44 |
Northern shoveler |
42 |
Common yellowthroat |
41 |
Wild turkey |
41 |
Black-crowned night-heron |
40 |
White-winged dove |
39 |
Semipalmated sandpiper |
38 |
American goldfinch |
38 |
Brown pelican |
38 |
White-tailed jackrabbit |
37 |
Blackpoll warbler |
36 |
Brewer's blackbird |
36 |
Ruddy duck |
36 |
White-crowned sparrow |
36 |
Ovenbird |
34 |
Little brown bat |
34 |
Bats |
34 |
Vesper sparrow |
34 |
Black-headed munia |
34 |
American black duck |
34 |
Laysan albatross |
33 |
Plovers |
33 |
Ring-necked pheasant |
33 |
Chipping sparrow |
32 |
Dunlin |
31 |
Wood duck |
31 |
Varied thrush |
31 |
Falcons and Caracaras |
31 |
Great-tailed grackle |
30 |
Greater sage-grouse |
29 |
Diamondback terrapin |
29 |
Bonaparte's gull |
29 |
Lincoln's sparrow |
28 |
Yellow-billed cuckoo |
28 |
Greater white-fronted goose |
28 |
Buff-breasted sandpiper |
28 |
Mule deer |
28 |
Lesser scaup |
27 |
Black-tailed prairie dog |
27 |
Sora |
26 |
Northern rough-winged swallow |
26 |
White-throated swift |
26 |
Swamp sparrow |
24 |
Yellow-bellied sapsucker |
24 |
Fox sparrow |
24 |
Pigeons |
24 |
Blue-winged teal |
24 |
Shorebirds |
24 |
Wrens |
24 |
Common loon |
24 |
Common raven |
24 |
Free-tailed bats |
23 |
Silver-haired bat |
23 |
Red-shouldered hawk |
23 |
Pied-billed grebe |
23 |
Snowy egret |
23 |
Wilson's warbler |
22 |
Bobolink |
22 |
Sanderling |
22 |
Field sparrow |
21 |
Hoary bat |
21 |
White-tailed kite |
21 |
Least tern |
21 |
Baltimore oriole |
21 |
Big brown bat |
21 |
Terns |
21 |
Black-capped chickadee |
21 |
Lapland longspur |
21 |
Desert cottontail |
20 |
|
20 |
Indigo bunting |
20 |
Domestic cat |
20 |
Herons |
20 |
Vaux's swift |
19 |
Yellow warbler |
19 |
Tyrant flycatchers |
19 |
Domestic dog |
19 |
Ferruginous hawk |
18 |
Lark sparrow |
18 |
Eastern kingbird |
18 |
Caspian tern |
18 |
Spotted sandpiper |
18 |
Prairie falcon |
17 |
Broad-winged hawk |
17 |
Glaucous gull |
16 |
Wood thrush |
16 |
Mottled duck |
16 |
Canvasback |
16 |
Muskrat |
16 |
Hawks, eagles, vultures |
16 |
American oystercatcher |
16 |
Sharp-shinned hawk |
16 |
American tree sparrow |
15 |
Orange-crowned warbler |
15 |
Magnolia warbler |
15 |
Anhinga |
15 |
Warbling vireo |
15 |
Baird's sandpiper |
15 |
Western grebe |
15 |
Brant |
15 |
Ruby-crowned kinglet |
14 |
Yellow-crowned night-heron |
14 |
Ruby-throated hummingbird |
14 |
Western tanager |
14 |
Armadillo |
14 |
Nashville warbler |
14 |
Loggerhead shrike |
14 |
American redstart |
13 |
Barred owl |
13 |
Deer |
13 |
Plovers, lapwings |
13 |
Violet-green swallow |
13 |
Starlings |
13 |
Gray-cheeked thrush |
13 |
Gunnison's prairie dog |
12 |
Wood stork |
12 |
American white pelican |
12 |
Pigeons, doves |
12 |
Green heron |
12 |
Ring-necked duck |
12 |
Pectoral sandpiper |
12 |
White-faced ibis |
11 |
Whimbrel |
11 |
Blue jay |
11 |
Golden eagle |
11 |
Cave swallow |
10 |
House wren |
10 |
Black-throated blue warbler |
10 |
Northern waterthrush |
10 |
Budgerigar |
10 |
Bufflehead |
10 |
Common tern |
10 |
Wedge-tailed shearwater |
10 |
Unknown mammal |
10 |
North American porcupine |
10 |
Black-and-white warbler |
10 |
Pine warbler |
10 |
Ruddy turnstone |
9 |
Prairie dog |
9 |
Boat-tailed grackle |
9 |
Marsh wren |
9 |
Brown thrasher |
9 |
Palm warbler |
9 |
White-eyed vireo |
9 |
Mannikins |
9 |
Band-tailed pigeon |
8 |
Virginia rail |
8 |
Sage sparrow |
8 |
Eastern pipistrelle |
8 |
Mississippi kite |
8 |
Horned grebe |
8 |
Thrashers, mockingbirds, catbirds |
8 |
Green iguana |
8 |
Inca dove |
8 |
Tundra swan |
8 |
Veery |
7 |
Mountain bluebird |
7 |
Blue-gray gnatcatcher |
7 |
Seminole bat |
7 |
Say's phoebe |
7 |
Dickcissel |
7 |
Long-billed dowitcher |
7 |
Yellow-breasted chat |
7 |
Swifts |
7 |
American bittern |
7 |
Grebes |
7 |
Short-billed dowitcher |
7 |
Bonin petrel |
7 |
Common poorwill |
7 |
Brown noddy |
7 |
Long-billed curlew |
7 |
Black-billed magpie |
7 |
Long-eared owl |
7 |
Forster's tern |
7 |
Lesser nighthawk |
7 |
Scarlet tanager |
7 |
Woodpeckers |
7 |
Black skimmer |
7 |
Cape May warbler |
7 |
Black drongo |
6 |
Hares |
6 |
Golden-crowned kinglet |
6 |
Crested caracara |
6 |
Canada warbler |
6 |
Tropicbirds |
6 |
Northern cardinal |
6 |
Townsend's warbler |
6 |
Common ground-dove |
6 |
Quails |
6 |
Yellow-headed blackbird |
6 |
Vireos |
6 |
Pine siskin |
6 |
Redhead |
6 |
Black-necked stilt |
6 |
Eastern bluebird |
6 |
Cardinals, buntings, sparrows |
6 |
Mute swan |
6 |
Lesser yellowlegs |
6 |
Hawaiian duck |
5 |
White-rumped sandpiper |
5 |
Common goldeneye |
5 |
White ibis |
5 |
White-tailed tropicbird |
5 |
Chuck-will's-widow |
5 |
Hummingbirds |
5 |
Eurasian kestrel |
5 |
Red avadavat |
5 |
Black-footed albatross |
5 |
Greater yellowlegs |
5 |
Greater scaup |
5 |
Anna's hummingbird |
5 |
Smith's longspur |
5 |
Red-breasted merganser |
5 |
Cattle |
5 |
Townsend's shearwater |
5 |
Mynas |
5 |
European golden-plover |
5 |
Willet |
5 |
Clapper rail |
5 |
American alligator |
5 |
Yellow-throated vireo |
5 |
Little blue heron |
5 |
Northern bobwhite |
5 |
Eastern towhee |
5 |
Pronghorn |
5 |
Gulls,terns |
5 |
Megabats |
5 |
Hudsonian godwit |
4 |
Yellow-throated warbler |
4 |
Black-headed gull |
4 |
Nightjars |
4 |
Black tern |
4 |
Cinnamon teal |
4 |
White tern |
4 |
Common waxbill |
4 |
Swallow-tailed kite |
4 |
Long-tailed duck |
4 |
Hooded merganser |
4 |
Hooded warbler |
4 |
Western bluebird |
4 |
Eastern box turtle |
4 |
Common snapping turtle |
4 |
Chestnut-collared longspur |
4 |
Sprague's pipit |
4 |
Badger |
4 |
American avocet |
4 |
Northern saw-whet owl |
4 |
Cuckoos |
4 |
Common gray fox |
4 |
Northern yellow bat |
3 |
Great crested flycatcher |
3 |
Black swift |
3 |
Cackling goose |
3 |
Pacific-slope flycatcher |
3 |
Piping plover |
3 |
Gull-billed tern |
3 |
Waxbills, mannikins & parrotfinches |
3 |
Whip-poor-will |
3 |
Golden-crowned sparrow |
3 |
Bullock's oriole |
3 |
Red-throated loon |
3 |
Red-necked phalarope |
3 |
Rose-breasted grosbeak |
3 |
Common wood-pigeon |
3 |
Cormorants |
3 |
Cactus wren |
3 |
Rails |
3 |
Northern parula |
3 |
Orchard oriole |
3 |
Wilson's plover |
3 |
Mink |
3 |
Lesser black-backed gull |
3 |
Mourning warbler |
3 |
Parrots |
3 |
Pocket gophers |
3 |
Eastern phoebe |
3 |
Scaled quail |
3 |
Gray partridge |
3 |
Sooty tern |
3 |
Small Indian mongoose |
3 |
Red knot |
3 |
Red-naped sapsucker |
3 |
Black francolin |
3 |
Great frigatebird |
3 |
White-throated munia |
3 |
Frigatebirds |
3 |
Ibises |
3 |
Northwestern crow |
3 |
Gray francolin |
3 |
Solitary sandpiper |
3 |
Blackbirds, orioles |
3 |
Painted turtle |
3 |
Eagles |
3 |
Wapiti (elk) |
3 |
Eastern wood-pewee |
3 |
Red-vented bulbul |
3 |
Hairy woodpecker |
3 |
Red-tailed tropicbird |
3 |
Blue-headed vireo |
3 |
Thayer's gull |
3 |
Ptarmigans |
3 |
Black noddy |
3 |
Tanagers |
3 |
Belted kingfisher |
3 |
Red-crested cardinal |
3 |
Purple finch |
3 |
Common snipe |
2 |
Blackburnian warbler |
2 |
Long-tailed jaeger |
2 |
Gray flycatcher |
2 |
Nelson's sharp-tailed sparrow |
2 |
Chestnut-sided warbler |
2 |
Tennessee warbler |
2 |
Loons |
2 |
Evening bat |
2 |
North American beaver |
2 |
Black-throated green warbler |
2 |
Carolina chickadee |
2 |
Black-throated gray warbler |
2 |
Wilson's phalarope |
2 |
Common swift |
2 |
Northern goshawk |
2 |
Tricolored heron |
2 |
Least flycatcher |
2 |
White-tailed hawk |
2 |
Common merganser |
2 |
Rusty blackbird |
2 |
MacGillivray's warbler |
2 |
Yellow bittern |
2 |
Parasitic jaeger |
2 |
Lesser goldfinch |
2 |
Pocketed free-tailed bat |
2 |
Black-legged kittiwake |
2 |
Marbled godwit |
2 |
Yellow-legged gull |
2 |
Purple gallinule |
2 |
Mountain chickadee |
2 |
Western screech-owl |
2 |
Black-bellied whistling-duck |
2 |
Pipits |
2 |
Sharp-tailed grouse |
2 |
Carolina wren |
2 |
Downy woodpecker |
2 |
Larks |
2 |
Trumpeter swan |
2 |
Fairy tern |
2 |
Louisiana waterthrush |
2 |
Western wood-pewee |
2 |
Common moorhen |
2 |
Eared grebe |
2 |
Chukar |
2 |
Moose |
2 |
Cassin's vireo |
2 |
Red-necked grebe |
2 |
Harris's hawk |
2 |
Roseate spoonbill |
2 |
Vultures |
2 |
Magnificent frigatebird |
2 |
Acadian flycatcher |
2 |
Java sparrow |
2 |
Japanese white-eye |
2 |
Eurasian buzzard |
2 |
Little tern |
2 |
Woodrats |
2 |
Eastern screech-owl |
2 |
Grouse |
2 |
Great cormorant |
2 |
Orioles |
2 |
Barrow's goldeneye |
1 |
Pine grosbeak |
1 |
American black bear |
1 |
Cassin's finch |
1 |
White-crested elaenia |
1 |
Bewick's wren |
1 |
Painted bunting |
1 |
Sandwich tern |
1 |
Brewer's sparrow |
1 |
Eurasian collared dove |
1 |
Bushtit |
1 |
Double-striped thick-knee |
1 |
Gray jay |
1 |
Least bittern |
1 |
Arctic tern |
1 |
Calliope hummingbird |
1 |
Yellow-bellied marmot |
1 |
Pacific loon |
1 |
Gopher tortoise |
1 |
Olive-sided flycatcher |
1 |
Tri-colored blackbird |
1 |
Allen's hummingbird |
1 |
McKay's bunting |
1 |
Northern hawk owl |
1 |
Big free-tailed bat |
1 |
Florida red-bellied cooter |
1 |
Little owl |
1 |
Eurasian sparrowhawk |
1 |
Gyrfalcon |
1 |
White-breasted nuthatch |
1 |
Rook |
1 |
Hermit warbler |
1 |
Black-billed cuckoo |
1 |
Black-headed grosbeak |
1 |
Harlequin duck |
1 |
Rock sandpiper |
1 |
Eurasian curlew |
1 |
Island canary |
1 |
Winter wren |
1 |
Black-chinned hummingbird |
1 |
Hammond's flycatcher |
1 |
Black-throated sparrow |
1 |
Tropical mockingbird |
1 |
California towhee |
1 |
Greater roadrunner |
1 |
Sage thrasher |
1 |
McCown's longspur |
1 |
Redwing |
1 |
Gray heron |
1 |
Bohemian waxwing |
1 |
Red-legged partridge |
1 |
Ruffed grouse |
1 |
Lagomorphs (rabbits, hares) |
1 |
Harris's sparrow |
1 |
Curve-billed thrasher |
1 |
Burro |
1 |
Whooping crane |
1 |
Collared peccary |
1 |
Common eider |
1 |
Prothonotary warbler |
1 |
Gray-headed chickadee |
1 |
Evening grosbeak |
1 |
White-winged scoter |
1 |
Pelicans |
1 |
Rufous hummingbird |
1 |
Royal tern |
1 |
Black turnstone |
1 |
Clark's grebe |
1 |
Waxwings, silky-flycatchers |
1 |
Yellow-bellied flycatcher |
1 |
White-bellied sea-eagle |
1 |
River otter |
1 |
Kites, eagles, hawks |
1 |
Common cuckoo |
1 |
Prairie warbler |
1 |
Northern pygmy-owl |
1 |
Philippine duck |
1 |
Swift, tree-swift, hummingbird |
1 |
Red-footed booby |
1 |
Catbirds |
1 |
Caribou |
1 |
Hooded crow |
1 |
Sulphur-bellied flycatcher |
1 |
Cuckoos,roadrunners |
1 |
Roseate tern |
1 |
Scops, screech owls |
1 |
Swans |
1 |
Rock wren |
1 |
Southern lapwing |
1 |
Monk parakeet |
1 |
Florida soft shell turtle |
1 |
Snowy plover |
1 |
Wrentit |
1 |
Ash-throated flycatcher |
1 |
Yellow-billed magpie |
1 |
Canids |
1 |
Fork-tailed storm-petrel |
1 |
Pelagic cormorant |
1 |
Black kite |
1 |
Red-legged kittiwake |
1 |
Carrion crow |
1 |
Nanday parakeet |
1 |
Muscovy duck |
1 |
White-winged crossbill |
1 |
Ringtail |
1 |
Eastern small-footed myotis |
1 |
Tufted titmouse |
1 |
What is the most common flight phase where a birdstrike occurred? by (KevinKGifford)
var groups=_.groupBy(data, function(air){
return air['When: Phase of flight']
})
var countGroup=_.mapValues(groups, function(g){
return _.size(g)
})
var keys=_.keys(countGroup)
var list=_.map(keys, function(key){
return {"Phase": key, "Count": countGroup[key]}
})
return list
Phase |
Count |
Take-off run |
11914 |
|
34738 |
Climb |
10409 |
Approach |
26329 |
En Route |
1973 |
Landing Roll |
11419 |
Descent |
2032 |
Taxi |
215 |
Parked |
60 |
Landing |
315 |
How many flights have been cancelled by birdstrikes? by (pail4944)
var filter=_.filter(data, function(air){
return air['Effect: Impact to flight'] != "None" && air['Effect: Impact to flight'] != ""
})
var groups=_.groupBy(filter, function(air){
return air['Effect: Impact to flight']
})
var countGroup=_.mapValues(groups, function(g){
return _.size(g)
})
var keys=_.keys(countGroup)
var list=_.map(keys, function(key){
return {"Impact": key, "Count": countGroup[key]}
})
return list
Impact |
Count |
Other |
1359 |
Precautionary Landing |
3639 |
Engine Shut Down |
228 |
Aborted Take-off |
1300 |
What states cost the airlines the most money?(Cost and location) by willzfarmer
var groups=_.groupBy(data, function(air){
return air['Origin State']
})
var sumGroup=_.mapValues(groups, function(g){
return _.sum(g, function(e){
return e['Cost: Total $']
})
})
var keys=_.keys(sumGroup)
var list=_.map(keys, function(key){
return {"State": key, "Total cost $": sumGroup[key]}
})
return _.sortBy(list, function(e){
return e["Total cost $"]
}).reverse()
State |
Total cost $ |
N/A |
35589 |
Florida |
27674 |
Texas |
21717 |
California |
21539 |
New York |
8794 |
Tennessee |
6308 |
Michigan |
6280 |
Ohio |
5861 |
Illinois |
5781 |
Nebraska |
5647 |
Indiana |
4974 |
Kentucky |
4667 |
Colorado |
4621 |
Oregon |
4543 |
Oklahoma |
4438 |
North Carolina |
4225 |
Georgia |
4032 |
Louisiana |
3966 |
Alabama |
3826 |
Maryland |
3802 |
Missouri |
3661 |
New Jersey |
3654 |
Virginia |
3576 |
Wisconsin |
3465 |
Pennsylvania |
3097 |
Minnesota |
2978 |
Utah |
2806 |
Washington |
2757 |
Arkansas |
2596 |
South Dakota |
2473 |
Alaska |
2321 |
Massachusetts |
2102 |
Connecticut |
1781 |
Hawaii |
1731 |
Arizona |
1722 |
Rhode Island |
1497 |
North Dakota |
1362 |
New Mexico |
1347 |
New Hampshire |
1310 |
Delaware |
1309 |
Kansas |
1199 |
Idaho |
1042 |
Nevada |
1008 |
DC |
960 |
Mississippi |
938 |
Ontario |
874 |
Montana |
771 |
Prince Edward Island |
700 |
Wyoming |
674 |
South Carolina |
645 |
Vermont |
600 |
Iowa |
387 |
West Virginia |
269 |
Maine |
218 |
Puerto Rico |
103 |
Virgin Islands |
100 |
British Columbia |
83 |
Nova Scotia |
0 |
Manitoba |
0 |
Alberta |
0 |
Saskatchewan |
0 |
Newfoundland and Labrador |
0 |
Quebec |
0 |