PhoenixKitCatalogue.Import.Pro100Parser (PhoenixKitCatalogue v0.10.0)

Copy Markdown View Source

Parses the PRO100 fixed-layout text formats (# Parts / # Materials).

UTF-8 with an optional leading BOM, TAB-separated, CRLF (or LF) lines. Each data row begins with two empty fields (the leading \t\t); after dropping them the positional columns are:

Furniture: name  id  c3  price  c5  c6  c7
Materials: name  id  c3  price  c5  unit

Summary

Types

row()

@type row() :: %{
  line_no: pos_integer(),
  raw_line: String.t(),
  id: String.t(),
  name: String.t(),
  base_price: Decimal.t() | nil,
  unit: String.t() | nil,
  service: %{required(String.t()) => String.t()},
  format: :furniture | :materials
}

Functions

parse(binary, format)

@spec parse(binary(), :furniture | :materials) :: {:ok, [row()]} | {:error, term()}