# `PipelineStageDuration`
[🔗](https://github.com/jaizendra-netizen/pipeline_stage_duration/blob/main/lib/pipeline_stage_duration.ex#L1)

Days spent in each pipeline stage, from a stage-history CSV with the columns
`deal,stage,entered,exited` (dates as YYYY-MM-DD; leave `exited` empty for a deal still in the stage).
Open rows are measured up to the `as_of` date you pass.

# `stat`

```elixir
@type stat() :: %{
  stage: String.t(),
  deals: non_neg_integer(),
  avg: float(),
  median: float(),
  longest: non_neg_integer()
}
```

# `parse`

```elixir
@spec parse(String.t(), Date.t()) ::
  {:ok, [{String.t(), non_neg_integer()}]} | {:error, String.t()}
```

Parse the CSV text into stage rows `{stage, days}`.

# `render`

```elixir
@spec render([stat()]) :: String.t()
```

Printable table.

# `stats`

```elixir
@spec stats([{String.t(), non_neg_integer()}]) :: [stat()]
```

Average, median and longest days per stage, longest average first.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
