Exemplo n.º 1
0
def addCommitteeToParse(com_id):
	data=getMNLegCommitteeById(com_id)
	if data:
		members=[]
		for m in data.get('members'):
			leg=getLegislatorByID(m.get('leg_id'))
			leg['role']=m.get('role')
			members.append(leg)
		com=Committee.get_by_id(com_id)
		if com.count()==0:
			params={'name': data.get('committee'),
					'chamber': data.get('chamber'),
					'subcommittee': data.get('subcommittee'),
					'parent_id': data.get('parent_id'),
					'com_id': data.get('id'),
					'com_url': data.get('sources'),
	    			'members': members
	    			}
			com=Committee(**params)
			com.save()
		else:
			for c in com:
				# members=[]
				# for m in data.get('members'):
				# 	members.append(getLegislatorByID(m.leg_id))
				c.name=data.get('committee')
				c.chamber=data.get('chamber')
				c.subcommittee=data.get('subcommittee')
				c.parent_id=data.get('parent_id')
				c.com_id=data.get('id')
				c.com_url=data.get('sources')
				c.members=members
				c.save()
Exemplo n.º 2
0
def addCommitteeToParse(com_id):
    data = getMNLegCommitteeById(com_id)
    if data:
        members = []
        for m in data.get('members'):
            leg = getLegislatorByID(m.get('leg_id'))
            leg['role'] = m.get('role')
            members.append(leg)
        com = Committee.get_by_id(com_id)
        if com.count() == 0:
            params = {
                'name': data.get('committee'),
                'chamber': data.get('chamber'),
                'subcommittee': data.get('subcommittee'),
                'parent_id': data.get('parent_id'),
                'com_id': data.get('id'),
                'com_url': data.get('sources'),
                'members': members
            }
            com = Committee(**params)
            com.save()
        else:
            for c in com:
                # members=[]
                # for m in data.get('members'):
                # 	members.append(getLegislatorByID(m.leg_id))
                c.name = data.get('committee')
                c.chamber = data.get('chamber')
                c.subcommittee = data.get('subcommittee')
                c.parent_id = data.get('parent_id')
                c.com_id = data.get('id')
                c.com_url = data.get('sources')
                c.members = members
                c.save()
Exemplo n.º 3
0
def getCommitteeDictByID(com_id):
	com=Committee.get_by_id(com_id)
	for c in com:
		if c.chamber=='lower':
			meetings=getHouseCommitteeMeetings(c.com_url[0]['url'])
		elif c.chamber=='upper':
			meetings=getSenateCommitteeMeetingsByID(getCommitteeIDFromURL(c.com_url[0]['url']))
		return makeCommitteeDict(c.name,c.members,meetings,c.chamber)
Exemplo n.º 4
0
def getCommitteeDictByID(com_id):
    com = Committee.get_by_id(com_id)
    for c in com:
        if c.chamber == 'lower':
            meetings = getHouseCommitteeMeetings(c.com_url[0]['url'])
        elif c.chamber == 'upper':
            meetings = getSenateCommitteeMeetingsByID(
                getCommitteeIDFromURL(c.com_url[0]['url']))
        return makeCommitteeDict(c.name, c.members, meetings, c.chamber)
Exemplo n.º 5
0
def addLegislatorsToParseCommittee(com_id):
	com=Committee.get_by_id(com_id)
	if com.count()==1:
		for c in com:
			members=[]
			for m in c.members:
				leg=Legislator.get_by_id(m.get('leg_id'))
				members.append(leg)
			c.members=members
			c.save()
Exemplo n.º 6
0
def addLegislatorsToParseCommittee(com_id):
    com = Committee.get_by_id(com_id)
    if com.count() == 1:
        for c in com:
            members = []
            for m in c.members:
                leg = Legislator.get_by_id(m.get('leg_id'))
                members.append(leg)
            c.members = members
            c.save()