# `Storehouse.Analysis`
[🔗](https://github.com/hattoriai/storehouse/blob/v0.2.0/lib/storehouse/analysis.ex#L1)

What an analysis step (`Storehouse.Analyzer`) made of a file, kept in the
file's `:analysis`, by the step's name:

  * `:status` - `:ok`, `:skipped` (the step does not apply to the file)
    or `:failed`.
  * `:result` - what the step read, a map JSON holds
    (`Storehouse.Metadata`), as the step gave it: `%{}` unless `:ok`.
  * `:error` - why it failed, or `nil`.
  * `:at` - when it ran, a `DateTime`.

The step's result is never mixed with Storehouse's own keys: a step may
give `%{"error" => …}` of its own, and it is a result like any other.

# `status`

```elixir
@type status() :: :ok | :skipped | :failed
```

# `t`

```elixir
@type t() :: %Storehouse.Analysis{
  at: DateTime.t(),
  error: String.t() | nil,
  result: map(),
  status: status()
}
```

# `from_map`

```elixir
@spec from_map(term()) :: t() | nil
```

The analysis of a map `to_map/1` gave, or `nil` for one it did not.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

The analysis as a map with string keys, for JSON and a record's column.

## Examples

    iex> analysis = %Storehouse.Analysis{status: :ok, result: %{"pages" => 12}, at: ~U[2026-10-23 08:00:00Z]}
    iex> Storehouse.Analysis.to_map(analysis)
    %{"status" => "ok", "result" => %{"pages" => 12}, "error" => nil, "at" => "2026-10-23T08:00:00Z"}

---

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