AccountOwnerConflicts (account_owner_conflicts v1.0.0)

Copy Markdown View Source

List the accounts that name two or more owners in a CSV you supply.

Input columns: account and owner (labels). Labels are trimmed and compared case-insensitively; the first spelling seen is the one shown. The same account and owner pair on two rows counts once, and the number of such repeated rows is reported. Extra columns are ignored.

The library lists where your own file names two owners. It cannot tell which owner is right.

Summary

Functions

Analyse the rows. Returns a map with :rows, :repeated, :accounts, :owners, :single, :conflicts (list of {account, [owner]}, accounts and owners sorted case-insensitively) and :per_owner (list of {owner, accounts, shared}).

True when at least one account names two or more owners.

Parse CSV text into rows. Errors name the row (data rows are counted from 1, header excluded).

Percentage with one decimal, rounded half up, as text such as 42.9%.

Render the analysis as text.

Types

row()

@type row() :: %{row: pos_integer(), account: String.t(), owner: String.t()}

Functions

analyze(rows)

@spec analyze([row()]) :: map()

Analyse the rows. Returns a map with :rows, :repeated, :accounts, :owners, :single, :conflicts (list of {account, [owner]}, accounts and owners sorted case-insensitively) and :per_owner (list of {owner, accounts, shared}).

conflicts?(map)

@spec conflicts?(map()) :: boolean()

True when at least one account names two or more owners.

parse(text)

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

Parse CSV text into rows. Errors name the row (data rows are counted from 1, header excluded).

pct(n, total)

Percentage with one decimal, rounded half up, as text such as 42.9%.

render(a)

@spec render(map()) :: String.t()

Render the analysis as text.