CS21 Lab 9: Example

Candidate summary

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 0

Your choice? 1

Data files:
1. Grouped by candidates (2020candidates.txt)
2. Grouped by month (2020months.txt)
3. Grouped by state (2020states.txt)
4. Grouped by donor (2020donors.txt)
5. All records (2020all.txt)

Your choice? 1
0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 105

Your choice? 2
How many?: 10
STEYER, TOM:                 48199335
		P00012716|Summary|Summary|US|01|01|2019|$    48199335

BUTTIGIEG, PETE:             33943835
		P00010298|Summary|Summary|US|01|01|2019|$    33943835

SANDERS, BERNARD:            30523241
		P60007168|Summary|Summary|US|01|01|2019|$    30523241

HARRIS, KAMALA D.:           22208134
		P00009423|Summary|Summary|US|01|01|2019|$    22208134

BIDEN, JOSEPH R JR:          20317082
		P80000722|Summary|Summary|US|01|01|2019|$    20317082

WARREN, ELIZABETH:           15329719
		P00009621|Summary|Summary|US|01|01|2019|$    15329719

KLOBUCHAR, AMY J.:           13165462
		P80006117|Summary|Summary|US|01|01|2019|$    13165462

TRUMP, DONALD J.:            12945866
		P80001571|Summary|Summary|US|01|01|2019|$    12945866

BOOKER, CORY A.:             12372417
		P00009795|Summary|Summary|US|01|01|2019|$    12372417

O'ROURKE, ROBERT BETO:       12020868
		P00010793|Summary|Summary|US|01|01|2019|$    12020868

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 105

State data

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 105

Your choice? 1

Data files:
1. Grouped by candidates (2020candidates.txt)
2. Grouped by month (2020months.txt)
3. Grouped by state (2020states.txt)
4. Grouped by donor (2020donors.txt)
5. All records (2020all.txt)

Your choice? 3

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 9951

Your choice? 4
State?: FL

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 249

Your choice? 2
How many?: 10
BIDEN, JOSEPH R JR:           1778897
		P80000722|Summary|Summary|FL|05|01|2019|$     1778897

BUTTIGIEG, PETE:               621475
		P00010298|Summary|Summary|FL|06|01|2019|$      621475

BIDEN, JOSEPH R JR:            526839
		P80000722|Summary|Summary|FL|04|01|2019|$      526839

BUTTIGIEG, PETE:               483262
		P00010298|Summary|Summary|FL|04|01|2019|$      483262

TRUMP, DONALD J.:              471760
		P80001571|Summary|Summary|FL|09|01|2019|$      471760

BUTTIGIEG, PETE:               437469
		P00010298|Summary|Summary|FL|05|01|2019|$      437469

HARRIS, KAMALA D.:             276922
		P00009423|Summary|Summary|FL|03|01|2019|$      276922

TRUMP, DONALD J.:              243965
		P80001571|Summary|Summary|FL|06|01|2019|$      243965

SANDERS, BERNARD:              222673
		P60007168|Summary|Summary|FL|06|01|2019|$      222673

BIDEN, JOSEPH R JR:            209717
		P80000722|Summary|Summary|FL|06|01|2019|$      209717

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 249

This query shows the top monthly hauls in Florida. Since we currently filtered on FL, if we want to browse another state, we need to reload the data.

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 249

Your choice? 1

Data files:
1. Grouped by candidates (2020candidates.txt)
2. Grouped by month (2020months.txt)
3. Grouped by state (2020states.txt)
4. Grouped by donor (2020donors.txt)
5. All records (2020all.txt)

Your choice? 3

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 9951

Your choice? 3
Campaign ID?: P60007168

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 577

Your choice? 2
How many?: 5

SANDERS, BERNARD:             1511711
		P60007168|Summary|Summary|CA|06|01|2019|$     1511711

SANDERS, BERNARD:             1154562
		P60007168|Summary|Summary|CA|03|01|2019|$     1154562

SANDERS, BERNARD:             1080237
		P60007168|Summary|Summary|CA|09|01|2019|$     1080237

SANDERS, BERNARD:              946317
		P60007168|Summary|Summary|CA|02|01|2019|$      946317

SANDERS, BERNARD:              806253
		P60007168|Summary|Summary|CA|04|01|2019|$      806253

Bernie Sanders’s (campaign ID P60007168) top state totals where all in California, but different months. Not surprising. California has a lot of people.

Filtering and searching donors

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 105

Your choice? 1

Data files:
1. Grouped by candidates (2020candidates.txt)
2. Grouped by month (2020months.txt)
3. Grouped by state (2020states.txt)
4. Grouped by donor (2020donors.txt)
5. All records (2020all.txt)

Your choice? 4

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 308816

That’s a lot of records. Don’t try to sort all of those with a quadratic sort. Let’s filter first.

Number of current records: 308816

Your choice? 5
City?: Pittsburgh

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 763

Ah, much more reasonable

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 763

Your choice? 2
How many?: 6

BUTTIGIEG, PETE:                16600
		P00010298|JOHNSON, JAMES|PITTSBURGH|PA|12|31|2019|$       16600

BUTTIGIEG, PETE:                11200
		P00010298|COHEN, PAM|PITTSBURGH|PA|12|31|2019|$       11200

RYAN, TIMOTHY J.:               11200
		P00011338|CAPUTO, JOHN|PITTSBURGH|PA|12|31|2019|$       11200

BIDEN, JOSEPH R JR:              8400
		P80000722|PERELMAN, EMMA|PITTSBURGH|PA|12|31|2019|$        8400

BIDEN, JOSEPH R JR:              6200
		P80000722|GOLDBERG, ARTHUR|PITTSBURGH|PA|12|31|2019|$        6200

WARREN, ELIZABETH:               5707
		P00009621|CONNOLLY, LAUREN|PITTSBURGH|PA|12|31|2019|$        5707

Seems Yinzers lean blue. But we can filter some more.

Your choice? 3
Campaign ID?: P80001571

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Number of current records: 104

0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Your choice? 2
How many?: 3

TRUMP, DONALD J.:                2800
		P80001571|WOODINGS, ROBERT|PITTSBURGH|PA|12|31|2019|$        2800

TRUMP, DONALD J.:                2799
		P80001571|EDWARDS, MELINDA|PITTSBURGH|PA|12|31|2019|$        2799

TRUMP, DONALD J.:                2700
		P80001571|WOODINGS, ROBERT|PITTSBURGH|PA|12|31|2018|$        2700


0. Quit
1. Load file
2. Print top donations
3. Filter by campaign ID
4. Filter by state
5. Filter by city

Your choice? 8
Invalid option. Try again
Your choice? corgi
Invalid option. Try again
Your choice? 0
Goodbye!