# Function computeMepVotingActivityFromDoceo

- computeMepVotingActivityFromDoceo(
  mepId: string,
  options?: ComputeMepVotingActivityOptions,
  ): Promise<DoceoMepAggregateResult | null>

  Compute per-MEP voting activity stats from the EP DOCEO XML source.

  Fetches the latest plenary-week RCV records via `doceoClient.getLatestVotes` and aggregates the MEP's individual vote positions. Returns `null` when the DOCEO call fails (timeout, network, parse error) so the caller can fall back to placeholder data and emit a `dataQualityWarning`.

  #### Parameters

  - mepId: string

    EP MEP identifier (e.g. `'197558'`).

  - options: ComputeMepVotingActivityOptions = {}

    Optional date range, political group, timeout and limit overrides.

  #### Returns Promise<DoceoMepAggregateResult | null>

  Aggregate result or `null` if DOCEO data is unavailable.

  #### Security

  Errors are audit-logged via `auditLogger.logError( 'doceo_mep_aggregator.fetch', ...)`. Only `mepId` is logged (no PII).

  #### Example

      const result = await computeMepVotingActivityFromDoceo('197558', {
        dateFrom: '2026-01-01',
        dateTo: '2026-12-31',
        politicalGroup: 'EPP',
      });
      if (result !== null) {
        console.log(result.stats.totalVotes, result.stats.loyaltyScore);
      }

  - Defined in utils/doceoMepAggregator.ts:294