Ejemplo n.º 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
Ejemplo n.º 2
0
import Scraper
import json
import urllib2

mccarthyID = "M001165"
pelosiID = "P000197"

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()
actionsAll = Scraper.filterActions(actions=rawActions, billsOnly=False, passedOnly=False)
marginsAll = Scraper.getMargins(actionsAll)
legAll, votesAll = Scraper.getVoteDict(actionsAll)
mccarthyVotes = votesAll[mccarthyID]
pelosiVotes = votesAll[pelosiID]

actionsBill = Scraper.filterActions(actions = rawActions, billsOnly = True, passedOnly = False)
marginsBill = Scraper.getMargins(actionsBill)
legBill, votesBill = Scraper.getVoteDict(actionsBill)

congress = {}
for l in legAll:
    if legAll[l]['Party'] == 'D':
        congress[l] = legAll[l]
        diiAllSum = 0
        totalAllVotes = 0
        votesAllAgainst = 0
        diiBillSum = 0