AshDyan.Engine.Formatter (AshDyan v0.1.0)

Copy Markdown View Source

Aggregates raw Ash records (returned by the read action) in memory into the stable labels/series output shape.

Output conventions (so a client-side chart adapter needs no per-type branching):

  • :frequency (no group_by): labels = distinct column values; one series named after the column with the counts.
  • :frequency (group_by): labels = distinct column values; one series per group_by combination, each series's data aligned to labels.
  • :aggregate (no group_by): labels = [column]; one series named after the function.
  • :aggregate (group_by): labels = distinct group_by combinations; one series named after the function.
  • :time_bucket: labels = bucket labels; series per group_by combination (or a single series named after the function when there is no group_by).
  • :percentile: labels = percentile labels; series per group_by combination (or a single series named after the column when there is no group_by).

Summary

Functions

Format raw records into an AshDyan.Result.

Functions

format(request, records)

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

Format raw records into an AshDyan.Result.