Пример #1
0
    def get_people(self):
        # committee
        tech = Organization('Technology', classification='committee')
        tech.add_post('Chairman', 'chairman')
        yield tech

        # subcommittee
        ecom = Organization('Subcommittee on E-Commerce',
                            parent=tech,
                            classification='committee')
        yield ecom

        p = Legislator('Paul Tagliamonte', district='6', chamber='upper',
                       party='Independent')
        p.add_committee_membership('Finance')
        p.add_membership(tech, role='chairman')
        yield p
Пример #2
0
def migrate_legislatures(state):
    spec = {}
    if state:
        spec['_id'] = state

    for metad in db.metadata.find(spec):
        abbr = metad['abbreviation']
        geoid = "ocd-division/country:us/state:%s" % (abbr)
        cow = Organization(metad['legislature_name'],
                           classification="jurisdiction",
                           geography_id=geoid,
                           abbreviation=abbr)
        cow.openstates_id = abbr

        for post in db.districts.find({"abbr": abbr}):

            cow.add_post(label="Member",
                         role="member",
                         num_seats=post['num_seats'],
                         chamber=post['chamber'],
                         district=post['name'])

        save_object(cow)