class SiteCode(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_MkSiteCode" ORDERED_FIELDS =[ ("id", KnessetDataServiceSimpleField('MKSiteCode', "integer", "the primary key")), ("kns_id", KnessetDataServiceSimpleField('KnsID', "integer", "KM code for the new api tables")), ("site_id", KnessetDataServiceSimpleField('SiteId', "integer", "KM code from the old kneset website")) ]
class Position(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_Position" ORDERED_FIELDS =[ ("id", KnessetDataServiceSimpleField('PositionID', "integer", "the primary key")), ("description", KnessetDataServiceSimpleField('Description', "string", "position description")), ("gender_id", KnessetDataServiceSimpleField('GenderID', "integer", "gender id code")), ("gender_description", KnessetDataServiceSimpleField('GenderDesc', "string", "gender description")), ("last_update", KnessetDataServiceSimpleField('LastUpdatedDate', "datetime", "last updated")) ]
class BillSplit(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_BillSplit" ORDERED_FIELDS = [ ("id", KnessetDataServiceSimpleField('BillSplitID', "integer", "the primary key")), ("bill_id", KnessetDataServiceSimpleField('MainBillID', "integer", "The bill that was split")), ("split_bill_id", KnessetDataServiceSimpleField('SplitBillID', "integer", "the bill that was created from the split")), ("name", KnessetDataServiceSimpleField('Name', "string", "The newly created bill heb name")), ("last_update", KnessetDataServiceSimpleField('LastUpdatedDate', "datetime", )) ]
class DocumentBill(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_DocumentBill" ORDERED_FIELDS = [ ("id", KnessetDataServiceSimpleField('DocumentBillID', "integer", "the primary key")), ("bill_id", KnessetDataServiceSimpleField('BillID', "integer", "The main bill id that was merged")), ("group_type_id", KnessetDataServiceSimpleField('GroupTypeID', "integer", "The type of the document")), ("group_type_desc", KnessetDataServiceSimpleField('GroupTypeDesc', "string", "Type of the document")), ("application_id", KnessetDataServiceSimpleField('ApplicationID', "integer", "Code of the document format")), ("application_desc", KnessetDataServiceSimpleField( 'ApplicationDesc', "string", "The document format(word, pdf, etc...)")), ("file_path", KnessetDataServiceSimpleField('FilePath', "string", "The url of the document")), ("last_update", KnessetDataServiceSimpleField( 'LastUpdatedDate', "datetime", )) ]
class PrivateLawMk(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "laws" METHOD_NAME = "privatelaw_mk" DEFAULT_ORDER_BY_FIELD = "plaw_mk_id" id = KnessetDataServiceSimpleField('plaw_mk_id') mk_id = KnessetDataServiceSimpleField('mk_id') law_number = KnessetDataServiceSimpleField('plaw_no') mk_suggest = KnessetDataServiceSimpleField('plaw_mk_suggest') plaw_id = KnessetDataServiceSimpleField('plaw_id') @classmethod def get_by_plaw_id(cls, plaw_id): query = 'plaw_id eq %s' % plaw_id params = {'$filter': query} return cls._get_all_pages(cls._get_url_base(), params)
class BillUnion(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_BillUnion" ORDERED_FIELDS = [ ("id", KnessetDataServiceSimpleField('BillUnionID', "integer", "the primary key")), ("main_bill_id", KnessetDataServiceSimpleField('MainBillID', "integer", "The referenced bill id")), ("union_bill_id", KnessetDataServiceSimpleField('UnionBillID', "integer", "The merged bill id")), ("last_update", KnessetDataServiceSimpleField( 'LastUpdatedDate', "datetime", )) ]
class Person(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_Person" ORDERED_FIELDS =[ ("id", KnessetDataServiceSimpleField('PersonID', "integer", "the primary key")), ("last_name", KnessetDataServiceSimpleField('LastName', "string", "last name")), ("first_name", KnessetDataServiceSimpleField('FirstName', "string", "first name")), ("gender_id", KnessetDataServiceSimpleField('GenderID', "integer", "gender id code")), ("gender_description", KnessetDataServiceSimpleField('GenderDesc', "string", "gender description")), ("email", KnessetDataServiceSimpleField('Email', "string", "email address")), ("is_current", KnessetDataServiceSimpleField('IsCurrent', "string", "is a current member")), ("last_update", KnessetDataServiceSimpleField('LastUpdatedDate', "datetime", "last updated")) ]
class VoteMember(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "votes" METHOD_NAME = "vote_rslts_kmmbr_shadow" DEFAULT_ORDER_BY_FIELD = "vote_id" # linked to Vote.id vote_id = KnessetDataServiceSimpleField('vote_id') # the mk id member_id = VoteMemberIdField('kmmbr_id') # numerical id linked to vote_result_type # normally you will use vote_result_code property instead vote_result = KnessetDataServiceSimpleField('vote_result') knesset_num = KnessetDataServiceSimpleField('knesset_num') # not sure what these fields do.. reason = KnessetDataServiceSimpleField('reason') modifier = KnessetDataServiceSimpleField('modifier') remark = KnessetDataServiceSimpleField('remark') @property def vote_result_code(self): # this is based on vote service, vote_result_type method # I assume / hope it won't change.. return { 0: 'cancelled', 1: 'voted for', 2: 'voted against', 3: 'abstain', 4: 'did not vote', }[self.vote_result] @classmethod def get_by_vote_id(cls, vote_id): start_url = cls._get_url_base()+'?$filter=vote_id%%20eq%%20%s'%vote_id return cls._get_all_pages(start_url)
class BillName(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_BillName" ORDERED_FIELDS = [ ("id", KnessetDataServiceSimpleField('BillNameID', "integer", "the primary key")), ("bill_id", KnessetDataServiceSimpleField('BillID', "integer", "The bill id")), ("name", KnessetDataServiceSimpleField('Name', "string", "The bill heb name")), ("name_history_type_id", KnessetDataServiceSimpleField( 'NameHistoryTypeID', "NameHistoryTypeID", "Code for the name change time, ie before first or second call")), ("name_history_type_desc", KnessetDataServiceSimpleField( 'NameHistoryTypeDesc', "string", "Type of name change, ie name for first call, second call, etc..") ), ("last_update", KnessetDataServiceSimpleField( 'LastUpdatedDate', "datetime", )) ]
class PrivateLaw(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "laws" METHOD_NAME = "privatelaw" DEFAULT_ORDER_BY_FIELD = "id" id = KnessetDataServiceSimpleField('plaw_id') number = KnessetDataServiceSimpleField('plaw_no') name = KnessetDataServiceSimpleField('plaw_name') subject = KnessetDataServiceSimpleField('plaw_subject') suggest_date = KnessetDataServiceSimpleField('plaw_suggest_dt') creation_date = KnessetDataServiceSimpleField('plaw_creation_dt') type_id = KnessetDataServiceSimpleField('plaw_type_id') link = KnessetDataServiceSimpleField('plaw_link') knesset_id = KnessetDataServiceSimpleField('knesset_id') def guess_link_url(self): return 'http://knesset.gov.il/privatelaw/data/%s/%s' % ( self.knesset_id, self.link)
class PersonToPosition(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_PersonToPosition" ORDERED_FIELDS =[ ("id", KnessetDataServiceSimpleField('PersonToPositionID', "integer", "the primary key")), ("person_id", KnessetDataServiceSimpleField('PersonID', "integer", "the person id")), ("position_id", KnessetDataServiceSimpleField('PositionID', "integer", "the position id")), ("knnesset_num", KnessetDataServiceSimpleField('KnessetNum', "integer", "the knesset number")), ("ministry_id", KnessetDataServiceSimpleField('GovMinistryID', "integer", "the ministry id code")), ("ministry_name", KnessetDataServiceSimpleField('GovMinistryName', "string", "ministry name")), ("duty_description", KnessetDataServiceSimpleField('DutyDesc', "string", "duty description")), ("faction_id", KnessetDataServiceSimpleField('FactionID', "integer", "the party id code")), ("faction_name", KnessetDataServiceSimpleField('FactionName', "string", "party name")), ("gov_num", KnessetDataServiceSimpleField('GovernmentNum', "integer", "the government number")), ("committee_id", KnessetDataServiceSimpleField('CommitteeID', "integer", "the committee id code")), ("committee_name", KnessetDataServiceSimpleField('CommitteeName', "string", "committee name")), ("start_update", KnessetDataServiceSimpleField('StartDate', "datetime", "start date")), ("finish_update", KnessetDataServiceSimpleField('FinishDate', "datetime", "finish date")), ("is_current", KnessetDataServiceSimpleField('IsCurrent', "string", "is current")), ("last_update", KnessetDataServiceSimpleField('LastUpdatedDate', "datetime", "last updated")) ]
class Vote(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "votes" METHOD_NAME = "View_vote_rslts_hdr_Approved" DEFAULT_ORDER_BY_FIELD = "date" id = KnessetDataServiceSimpleField('vote_id') knesset_num = KnessetDataServiceSimpleField('knesset_num') session_id = KnessetDataServiceSimpleField('session_id') sess_item_nbr = KnessetDataServiceSimpleField('sess_item_nbr') sess_item_id = KnessetDataServiceSimpleField('sess_item_id') sess_item_dscr = KnessetDataServiceSimpleField('sess_item_dscr') item_id = KnessetDataServiceSimpleField('vote_item_id') item_dscr = KnessetDataServiceSimpleField('vote_item_dscr') date = KnessetDataServiceSimpleField('vote_date') time = VoteTimeField('vote_time') datetime = KnessetDataServiceDateTimeField('date', 'time') is_elctrnc_vote = KnessetDataServiceSimpleField('is_elctrnc_vote') type = KnessetDataServiceSimpleField('vote_type') is_accepted = KnessetDataServiceSimpleField('is_accepted') total_for = KnessetDataServiceSimpleField('total_for') total_against = KnessetDataServiceSimpleField('total_against') total_abstain = KnessetDataServiceSimpleField('total_abstain') stat = KnessetDataServiceSimpleField('vote_stat') session_num = KnessetDataServiceSimpleField('session_num') nbr_in_sess = KnessetDataServiceSimpleField('vote_nbr_in_sess') reason = KnessetDataServiceSimpleField('reason') modifier = KnessetDataServiceSimpleField('modifier') remark = KnessetDataServiceSimpleField('remark')
class Bill(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "api" METHOD_NAME = "KNS_Bill" ORDERED_FIELDS = [ ("id", KnessetDataServiceSimpleField('BillID', "integer", "the primary key")), ("kns_num", KnessetDataServiceSimpleField('KnessetNum', "integer", "kneset number")), ("name", KnessetDataServiceSimpleField('Name', "string", "bill heb name")), ("type_id", KnessetDataServiceSimpleField('SubTypeID', "integer", "type id of the bill")), ("type_description", KnessetDataServiceSimpleField('SubTypeDesc', "string", "type description of the bill")), ("private_num", KnessetDataServiceSimpleField( 'PrivateNumber', "integer", )), ("committee_id", KnessetDataServiceSimpleField( 'CommitteeID', "integer", )), ("status_id", KnessetDataServiceSimpleField( 'StatusID', "integer", )), ("num", KnessetDataServiceSimpleField( 'Number', "Integer", )), ("postponent_reason_id", KnessetDataServiceSimpleField( 'PostponementReasonID', "Integer", )), ("postponent_reason_desc", KnessetDataServiceSimpleField( 'PostponementReasonDesc', "string", )), ("public_date", KnessetDataServiceSimpleField( 'PublicationDate', "datetime", )), ("magazine_num", KnessetDataServiceSimpleField( 'MagazineNumber', "integer", )), ("page_num", KnessetDataServiceSimpleField('PageNumber', "integer")), ("is_continuation", KnessetDataServiceSimpleField( 'IsContinuationBill', "bool", )), ("sum_law", KnessetDataServiceSimpleField( 'SummaryLaw', "string", )), ("public_series_id", KnessetDataServiceSimpleField( 'PublicationSeriesID', "integer", )), ("public_series_desc", KnessetDataServiceSimpleField( 'PublicationSeriesID', "string", )), ("public_series_first_call", KnessetDataServiceSimpleField( 'PublicationSeriesFirstCall', "string", )), ("last_update", KnessetDataServiceSimpleField( 'LastUpdatedDate', "datetime", )) ]
class CommitteeMeeting(BaseKnessetDataServiceFunctionObject): ORDERED_FIELDS = [ ("id", KnessetDataServiceSimpleField( 'Committee_Agenda_id', 'integer', "the primary key of committee meetings")), ("committee_id", KnessetDataServiceSimpleField( 'Committee_Agenda_committee_id', 'integer', "id of the committee (linked to Committee object)")), ("datetime", KnessetDataServiceSimpleField('committee_agenda_date', 'datetime', "date/time when the meeting started")), ("title", KnessetDataServiceSimpleField('title', 'string', "title of the meeting")), ("session_content", KnessetDataServiceSimpleField( 'committee_agenda_session_content', 'string', "seems like in some committee meetings, the title field is empty, in that case title can be taken from this field" )), ("url", KnessetDataServiceSimpleField('url', 'string', "url to download the protocol")), # a CommitteeMeetingProtocol object which allows to get data from the protocol # because parsing the protocol requires heavy IO and processing - we provide it as a generator # see tests/test_meetings.py for usage example ("protocol", KnessetDataServiceLambdaField( lambda obj, entry: CommitteeMeetingProtocol.get_from_url( obj.url, proxies=obj._proxies) if obj.url else None)), ("location ", KnessetDataServiceSimpleField( 'committee_location', 'string', "this seems like a shorter name of the place where meeting took place" )), ("place ", KnessetDataServiceSimpleField( 'Committee_Agenda_place', 'string', "this looks like a longer field with the specific details of where the meeting took place" )), ("meeting_stop ", KnessetDataServiceSimpleField( 'meeting_stop', 'string', "date/time when the meeting ended - this is not always available, in some meetings it's empty" )), ### following fields seem less interesting ### ("agenda_canceled ", KnessetDataServiceSimpleField('Committee_Agenda_canceled')), ("agenda_sub ", KnessetDataServiceSimpleField('Committee_agenda_sub')), ("agenda_associated ", KnessetDataServiceSimpleField('Committee_agenda_associated')), ("agenda_associated_id ", KnessetDataServiceSimpleField('Committee_agenda_associated_id')), ("agenda_special ", KnessetDataServiceSimpleField('Committee_agenda_special')), ("agenda_invited1 ", KnessetDataServiceSimpleField('Committee_agenda_invited1')), ("agenda_invite ", KnessetDataServiceSimpleField('sd2committee_agenda_invite')), ("note ", KnessetDataServiceSimpleField('Committee_agenda_note')), ("start_datetime ", KnessetDataServiceSimpleField('StartDateTime')), ("topid_id ", KnessetDataServiceSimpleField('Topic_ID')), ("creation_date ", KnessetDataServiceSimpleField('Date_Creation')), ("streaming_url ", KnessetDataServiceSimpleField('streaming_url')), ("meeting_start ", KnessetDataServiceSimpleField('meeting_start')), ("is_paused ", KnessetDataServiceSimpleField('meeting_is_paused')), ("date_order ", KnessetDataServiceSimpleField('committee_date_order')), ("date ", KnessetDataServiceSimpleField('committee_date')), ("day ", KnessetDataServiceSimpleField('committee_day')), ("month ", KnessetDataServiceSimpleField('committee_month')), ("material_id ", KnessetDataServiceSimpleField('material_id')), ("material_committee_id ", KnessetDataServiceSimpleField('material_comittee_id')), ("material_expiration_date ", KnessetDataServiceSimpleField('material_expiration_date')), ("material_hour ", KnessetDataServiceSimpleField('committee_material_hour')), ("old_url ", KnessetDataServiceSimpleField('OldUrl')), ("background_page_link ", KnessetDataServiceSimpleField('CommitteeBackgroundPageLink')), ("agenda_invited ", KnessetDataServiceSimpleField('Committee_agenda_invited')), ] @classmethod def _get_url_base(cls): return "http://online.knesset.gov.il/WsinternetSps/KnessetDataService/CommitteeScheduleData.svc/CommitteeAgendaSearch" @classmethod def get(cls, committee_id, from_date, to_date=None, proxies=None): """ # example usage: >>> from datetime import datetime # get all meetings of committee 1 from Jan 01, 2016 >>> CommitteeMeeting.get(1, datetime(2016, 1, 1)) # get all meetings of committee 2 from Feb 01, 2015 to Feb 20, 2015 >>> CommitteeMeeting.get(2, datetime(2015, 2, 1), datetime(2015, 2, 20)) """ params = { "CommitteeId": "'%s'" % committee_id, "FromDate": "'%sT00:00:00'" % from_date.strftime('%Y-%m-%d') } if to_date: params["ToDate"] = "'%sT00:00:00'" % to_date.strftime('%Y-%m-%d') return super(CommitteeMeeting, cls).get(params, proxies=proxies)
class Committee(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "committees" METHOD_NAME = "View_committee" DEFAULT_ORDER_BY_FIELD = "id" ORDERED_FIELDS = [ ("id", KnessetDataServiceSimpleField('committee_id', "integer", "the primary key")), ("type_id", KnessetDataServiceSimpleField( 'committee_type_id', "integer", "linked to committee types dataservice")), ("parent_id", KnessetDataServiceSimpleField( 'committee_parent_id', "integer", "used for sub-committees, not sure if reliable")), ("name", KnessetDataServiceSimpleField('committee_name', "string", "hebrew name")), ("name_eng", KnessetDataServiceSimpleField('committee_name_eng', "string")), ("name_arb", KnessetDataServiceSimpleField('committee_name_arb', "string")), ("begin_date", KnessetDataServiceSimpleField('committee_begin_date', "datetime")), ("end_date", KnessetDataServiceSimpleField( 'committee_end_date', "datetime", "we assume empty end_date means committee is active in current Knesset" )), ("description", KnessetDataServiceSimpleField('committee_desc', "string", "hebrew description")), ("description_eng", KnessetDataServiceSimpleField('committee_desc_eng', "string")), ("description_arb", KnessetDataServiceSimpleField('committee_desc_arb', "string")), ("note", KnessetDataServiceSimpleField('committee_note', "string")), ("note_eng", KnessetDataServiceSimpleField('committee_note_eng', "string")), ("portal_link", KnessetDataServiceSimpleField( 'committee_portal_link', "string", "can be used to link to the dedicated page in knesset website")), ] @classmethod def get_all_active_committees(cls, has_portal_link=True, proxies=None): if has_portal_link: query = ' '.join( (IS_COMMITTEE_ACTIVE, 'and', COMMITTEE_HAS_PORTAL_LINK)) else: query = IS_COMMITTEE_ACTIVE params = {'$filter': query} return cls._get_all_pages(cls._get_url_base(), params, proxies=proxies)
class Member(BaseKnessetDataServiceCollectionObject): SERVICE_NAME = "members" METHOD_NAME = "View_mk_individual" DEFAULT_ORDER_BY_FIELD = "id" ORDERED_FIELDS = [ ("id", KnessetDataServiceSimpleField('mk_individual_id', "integer")), ("army_rank_id", KnessetDataServiceSimpleField('army_rank_id', 'string')), ("army_history_desc", KnessetDataServiceSimpleField('army_history_desc', 'string')), ("army_history_desc_eng", KnessetDataServiceSimpleField('army_history_desc_eng', 'string')), ("country_id", KnessetDataServiceSimpleField('country_id', 'integer')), ("country_desc", KnessetDataServiceSimpleField('country_desc', 'string')), ("country_desc_eng", KnessetDataServiceSimpleField('country_desc_eng', 'string')), ("minority_type_id", KnessetDataServiceSimpleField('minority_type_id', 'integer')), ("education_id", KnessetDataServiceSimpleField('education_id', 'integer')), ("education_desc", KnessetDataServiceSimpleField('education_desc', 'string')), ("education_desc_eng", KnessetDataServiceSimpleField('education_desc_eng', 'string')), ("marital_status_id", KnessetDataServiceSimpleField('marital_status_id', 'integer')), ("city_id", KnessetDataServiceSimpleField('city_id', 'integer')), ("mk_status_id", KnessetDataServiceSimpleField('mk_status_id', 'integer')), ("name", KnessetDataServiceSimpleField('mk_individual_name', 'string')), ("name_eng", KnessetDataServiceSimpleField('mk_individual_name_eng', 'string')), ("first_name", KnessetDataServiceSimpleField('mk_individual_first_name', 'string')), ("first_name_eng", KnessetDataServiceSimpleField('mk_individual_first_name_eng', 'string')), ("gender", KnessetDataServiceSimpleField('mk_individual_gender', 'string')), ("birth_date", KnessetDataServiceSimpleField('mk_individual_birth_date', 'string')), ("immigration_date", KnessetDataServiceSimpleField('mk_individual_immigration_date', 'string')), ("children_number", KnessetDataServiceSimpleField('mk_individual_children_number', 'string')), ("death_date", KnessetDataServiceSimpleField('mk_individual_death_date', 'string')), ("email", KnessetDataServiceSimpleField('mk_individual_email', 'string')), ("email_on", KnessetDataServiceSimpleField('mk_individual_email_on', 'string')), ("photo", KnessetDataServiceSimpleField('mk_individual_photo', 'string')), ("phone1", KnessetDataServiceSimpleField('mk_individual_phone1', 'string')), ("phone2", KnessetDataServiceSimpleField('mk_individual_phone2', 'string')), ("phone_fax", KnessetDataServiceSimpleField('mk_individual_phone_fax', 'string')), ("present", KnessetDataServiceSimpleField('mk_individual_present', 'string')), ("public_activity", KnessetDataServiceSimpleField('mk_individual_public_activity', 'string')), ("public_activity_eng", KnessetDataServiceSimpleField('mk_individual_public_activity_eng', 'string')), ("note", KnessetDataServiceSimpleField('mk_individual_note', 'string')), ("note_eng", KnessetDataServiceSimpleField('mk_individual_note_eng', 'string')), ] @classmethod def get_all_present_members(cls, proxies=None): params = {'$filter': 'mk_individual_present eq true'} return cls._get_all_pages(cls._get_url_base(), params, proxies=proxies)