# `MimirAnalytics.Mapper`
[🔗](https://github.com/cash-mckeeman/mimir/blob/mimir_analytics-v0.8.1/mimir_analytics/lib/mimir_analytics/mapper.ex#L1)

Shared ingest behaviour for session, evaluation and gateway files.
Summaries count rows by table; already-ingested and rejected contents
return their corresponding status atoms.

# `source_map`

```elixir
@type source_map() :: %{optional(String.t()) =&gt; term()}
```

A decoded-JSON boundary value: `Jason.decode!/1` output, before any
`Row.*.new/1` coercion. Mappers narrow this to typed `Row.t()` structs at
the edge; nothing past that boundary should carry a bare source map.

# `summary`

```elixir
@type summary() :: %{rows: %{required(String.t()) =&gt; non_neg_integer()}}
```

Rows written per table this ingest touched, keyed by table name.

# `ingest`

```elixir
@callback ingest(store :: MimirAnalytics.Store.t(), path_or_dir :: Path.t()) ::
  {:ok, summary()} | :already_ingested | :already_rejected | {:error, term()}
```

Ingest one source file (or, for mappers that accept directories, a
directory of them) into `store`. Idempotent by file contents: re-ingesting
contents the ledger already holds, under any name, returns
`:already_ingested` without touching the store. A mapper that records
rejections returns `:already_rejected` for contents it rejected before.

---

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