# Function buildLegislativeTracking

- buildLegislativeTracking(
  procedure: Procedure,
  events?: EPEvent[],
  externalEnrichmentFailures?: string[],
  ): LegislativeProcedure

  Build a legislative tracking result from a real EP API Procedure.

  Most fields are derived directly from the API response. Amendment counts and voting records are placeholders (zeros / empty array) because the single-procedure endpoint does not supply them; these are surfaced in LegislativeProcedure.dataQualityWarnings.

  Per-step enrichment failures are tracked and returned in LegislativeProcedure.enrichmentFailures so that consumers can identify exactly which data dimensions are incomplete and weight per-field confidence accordingly.

  #### Parameters

  - procedure: Procedure

    Real procedure data from EP API

  - events: EPEvent[] = []

    Optional events from `/procedures/{process-id}/events` endpoint for timeline enrichment

  - externalEnrichmentFailures: string[] = []

    Named sub-steps that already failed before this call (e.g. `["events-lookup"]` when the events API call threw an error)

  #### Returns LegislativeProcedure

  Structured legislative tracking data

  - Defined in tools/trackLegislation/procedureTracker.ts:171