Storehouse.Analysis (Storehouse v0.2.0)

Copy Markdown View Source

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.

Summary

Functions

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

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

Types

status()

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

t()

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

Functions

from_map(map)

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

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

to_map(analysis)

@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"}