bolster.data_sources.niassembly.members ======================================= .. py:module:: bolster.data_sources.niassembly.members .. autoapi-nested-parse:: NI Assembly Members (MLAs) data module. Fetches current Member of the Legislative Assembly (MLA) data from the NI Assembly AIMS API. The API returns XML; this module parses it into tidy DataFrames. Update frequency: Real-time (reflects current membership). .. rubric:: Example >>> from bolster.data_sources.niassembly import members >>> df = members.get_current_members() >>> "PersonId" in df.columns True >>> len(df) >= 85 True Attributes ---------- .. autoapisummary:: bolster.data_sources.niassembly.members.logger Functions --------- .. autoapisummary:: bolster.data_sources.niassembly.members.get_current_members bolster.data_sources.niassembly.members.get_member_by_id Module Contents --------------- .. py:data:: logger .. py:function:: get_current_members() Return all current MLAs as a DataFrame. Fetches live data from the NI Assembly AIMS API. :returns: PersonId, MemberName, MemberFirstName, MemberLastName, MemberFullDisplayName, PartyName, PartyOrganisationId, ConstituencyName, ConstituencyId, MemberTitle, MemberImgUrl, MemberPrefix, AffiliationId, MemberSortName. :rtype: DataFrame with columns :raises requests.HTTPError: If the API request fails. .. rubric:: Example >>> df = get_current_members() >>> "PartyName" in df.columns True >>> df["PersonId"].dtype == object or df["PersonId"].dtype.kind in "iu" True .. py:function:: get_member_by_id(person_id) Return a single MLA record by PersonId. Filters the full current members list to the requested person. The AIMS API does not expose a single-member endpoint, so the full list is fetched and filtered locally. :param person_id: NI Assembly AIMS PersonId for the MLA. :returns: Single-row DataFrame for the matching member, or an empty DataFrame if not found. .. rubric:: Example >>> df = get_member_by_id(5797) >>> len(df) <= 1 True