European Parliament MCP Server API - v1.3.9
    Preparing search index...

    Module utils/votingBaseline

    Per-MEP voting baseline computation for anomaly detection.

    Provides primitives for the detect_voting_anomalies MCP tool:

    • resolveGroupMajority — DOCEO group-breakdown → plurality position (FOR/AGAINST/ABSTAIN) with deterministic alphabetical tie-breaking.
    • classifyMepVote — for a given MEP and a single LatestVoteRecord, returns whether the MEP was aligned with their home group's majority, defected, abstained, or was absent, plus the list of other groups whose majority matched the MEP's position (used to detect cross-party alignment shifts).
    • bucketByWeek — groups classified votes into ISO-week buckets and computes per-week defection / abstention rates.
    • computeBaseline / zScore — running mean & standard deviation of weekly rates and per-week z-score.
    • findOutlierWeeks — collects weeks whose rate has a z-score ≥ a configurable threshold (default 1.5 per issue spec).
    • findWoWShifts — collects consecutive-week pairs whose defection rate jumped by ≥ a configurable threshold (default 20 percentage points).
    • findCrossPartyAlignmentWindows — sub-windows where the MEP voted with non-home group majorities on ≥ a configurable share (default 60%) of decisive RCVs.

    All helpers are pure and deterministic so they can be exercised with synthetic fixtures and the golden-snapshot suite referenced in the detect_voting_anomalies issue.

    ISMS Policy: SC-002 (Input Validation), AC-003 (Least Privilege), AU-002 (Audit Logging). GDPR Article 5(1)(d) — accuracy.

    1.4.0

    Interfaces

    BaselineSummary
    ClassifiedVote
    CrossPartyWindow
    OutlierWeek
    WeekBucket
    WoWShift

    Type Aliases

    Alignment
    VotePosition

    Variables

    DEFAULT_CROSS_PARTY_SHARE
    DEFAULT_WOW_THRESHOLD_PP
    DEFAULT_Z_SCORE_THRESHOLD
    MIN_SUBWINDOW_DECISIVE_VOTES

    Functions

    bucketByWeek
    classifyMepVote
    computeBaseline
    coverageConfidence
    findCrossPartyAlignmentWindows
    findOutlierWeeks
    findWoWShifts
    isoWeekStart
    resolveGroupBreakdownRow
    resolveGroupMajority
    zScore