# `ListSplitAssign`
[🔗](https://github.com/jaizendra-netizen/list_split_assign/blob/main/lib/list_split_assign.ex#L1)

Split a CSV list of ids into groups with a seeded hash.

Input is a CSV with the columns `id` and `segment`. The id is trimmed and compared
case-insensitively; the segment is a label (trimmed, case-insensitive, the first
spelling is the one shown).

The group of an id is `:erlang.phash2({seed, String.downcase(id)}, groups)`, mapped to
the letters A, B, C and so on. The same id and seed always give the same group, whatever
the row order. A hash split is only approximately balanced: small lists can be far from
even. `:erlang.phash2/2` is the Erlang term hash.

# `row`

```elixir
@type row() :: %{
  id: String.t(),
  key: String.t(),
  segment: String.t(),
  row: pos_integer()
}
```

# `analyze`

Assign every row to a group. Returns a map with `:ids`, `:groups` (the letters),
`:seed`, `:assigned` (rows with their `:group`, in input order), `:by_group` and
`:by_segment`.

# `default_groups`

# `default_seed`

# `group_of`

```elixir
@spec group_of(String.t(), String.t(), 2..26) :: String.t()
```

The group letter of an id for a seed and a number of groups (2 to 26).

# `parse`

```elixir
@spec parse(String.t()) :: {:ok, [row()]} | {:error, String.t()}
```

Parse the CSV text into a list of rows.

# `render`

Render the report as text.

# `to_csv`

The assignment as CSV text: id,segment,group, in input order.

---

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