EU Parliament Monitor โ€” API Documentation - v0.8.48
    Preparing search index...

    Function getVotingRecordsWithFallback

    • Execute the three-state voting-data fallback decision tree.

      Given an already-retrieved MCP result and fallback options (dateFrom / dateTo / fetchImpl / โ€ฆ), returns a VotingRecordsFallbackResult that records both the data and the provenance label consumed by the voting-patterns.md ยง"Voting Data Freshness" section.

      Decision tree:

      (a) mcpResult has votes  โ†’ source: "mcp",                freshness: ๐ŸŸข
      (b) MCP empty, portal ok โ†’ source: "ep-open-data-portal", freshness: ๐ŸŸก
      (c) both empty โ†’ source: "unavailable", freshness: ๐Ÿ”ด

      Parameters

      Returns Promise<VotingRecordsFallbackResult>

      Fallback result with source tag and human-readable freshness label.

      When dateFrom or dateTo is missing/blank, or when the EP Open Data Portal base URL is malformed (configuration error โ€” distinct from the ๐Ÿ”ด unavailable data-empty path).

      const mcp = await epClient.getVotingRecords({ dateFrom, dateTo, limit: 50 });
      const { result, source, freshnessLabel } = await getVotingRecordsWithFallback(mcp, {
      dateFrom, dateTo,
      });
      // Write freshnessLabel into voting-patterns.md ยง"Voting Data Freshness"