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()
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()
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)
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)
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()
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()