Example #1
0
#!/bin/python2
import csv
import Scraper

def findDII(margin):
    dii = (-11.0/24)*margin + (2411.0/24)
    return dii

#Get all the vote data from the Scraper script
rawActions = Scraper.getActions()
#First we find the data for all votes
actions = Scraper.filterActions(actions=rawActions, billsOnly=False, passedOnly=False)
margins = Scraper.getMargins(actions)
leg, votes = Scraper.getVoteDict(actions)
mccarthyID = "M001165"
mccarthyVotes = votes[mccarthyID]
repubs = {}
for l in leg:
    if leg[l]['Party'] == 'D':
        pass
    else:
        repubs[l] = leg[l]
        diisum = 0
        totalVotes = 0
        votesAgainst = 0
        for b in votes[l]:
            if votes[l][b] == 0:
                pass
            elif votes[l][b] != mccarthyVotes[b]:
                diisum += findDII(margins[b])
                votesAgainst += 1