AshDyan.Result (AshDyan v0.1.0)

Copy Markdown View Source

The chart-ready output shape returned by AshDyan.run/1.

All analysis types share the same labels/series shape so a client-side chart adapter doesn't need per-type branching.

Shape

%AshDyan.Result{
  type: :time_bucket,
  labels: ["2026-07-01", "2026-07-02", ...],
  series: [
    %{name: "paid", data: [120.5, 98.0, ...]},
    %{name: "refunded", data: [12.0, 4.5, ...]}
  ]
}

Summary

Functions

Format raw Ash records into a t/0.

Types

series()

@type series() :: %{name: String.t(), data: [term()]}

t()

@type t() :: %AshDyan.Result{
  labels: [term()],
  series: [series()],
  type: AshDyan.capability()
}

Functions

format(request, records)

@spec format(AshDyan.Request.t(), [Ash.Resource.Record.t()]) ::
  {:ok, t()} | {:error, term()}

Format raw Ash records into a t/0.

The exact shaping depends on the request type and is delegated to the engine's formatter helpers.