# Function buildLifecycleStatistics

- buildLifecycleStatistics(
  procedures: readonly Procedure[],
  eventsByProcedureId: ReadonlyMap<string, EPEvent[]>,
  ): LifecycleStatisticsModel

  Build the lifecycle statistics model from a procedure corpus and their event timelines.

  Deterministic: identical input procedures and events produce identical statistics (the model is independent of `Map` insertion order — only the `byTypeAndStage` map's `Map`/`Object.entries` iteration order may differ, but the per-key values are stable).

  #### Parameters

  - procedures: readonly Procedure[]

    The corpus of procedures

  - eventsByProcedureId: ReadonlyMap<string, EPEvent[]>

    Event timelines fetched via fetchEventsBounded

  #### Returns LifecycleStatisticsModel

  Frozen lifecycle statistics model

  - Defined in utils/lifecycleStatistics.ts:299