lumnik. / scenarios All scenarios · Français

One row per item to pick with model colour and size

Goal Turn a marketplace export into one row per item, to pick the stock.

The marketplace export gives one row per order. The items are packed into one cell, and each reference packs model, colour and size.

manifests/90-dlq-beside-split-row.yaml
apiVersion: connectors.lumnik.io/v1kind: Connectormetadata:  name: scenario-order-items-b  connector_type: csv-file  scopes: [logistics-b]spec:  transport:    kind: local    path: /tmp/lumnik-scenario/marketplace-order-items/b/orders.csv  parser:    delimiter: ";"  after_process: none  mapping:    on-error:      fields: { items: dlq }                              # refused: a split order has no single row to dead-letter    row:      - split-row: { by: items, sep: "|" }      - validate-row: { required: [items] }               # refused: it would drop items, not orders    cell:      - split: { column: items, by: "-", into: [model, colour, size] }
orders.csv
order_no;customer;items
CMD-1001;Durand;TSH-BLEU-M|TSH-ROUGE-L|CASQ-NOIR-U
CMD-1002;Morel;SWEAT-GRIS-XL
CMD-1003;Nguyen;TSH-BLEU-M|TSH-BLEU-M
;;
CMD-1004;Faure;tsh-vert-s|SWEAT-GRIS-M
CMD-1005;Roux;CASQ-NOIR

CMD-1006;Garnier;TSH-ROUGE-L|SWEAT-BLEU-MARINE-L
$ lm entity get pick_line_b
ORDER_NO  ITEM_NO  CUSTOMER  ITEMS                MODEL  COLOUR  SIZE    _CONFLICTS
CMD-1001  1        Durand    TSH-BLEU-M           TSH    BLEU    M       {}
CMD-1001  2        Durand    TSH-ROUGE-L          TSH    ROUGE   L       {}
CMD-1001  3        Durand    CASQ-NOIR-U          CASQ   NOIR    U       {}
CMD-1002  1        Morel     SWEAT-GRIS-XL        SWEAT  GRIS    XL      {}
CMD-1003  1        Nguyen    TSH-BLEU-M           TSH    BLEU    M       {}
CMD-1003  2        Nguyen    TSH-BLEU-M           TSH    BLEU    M       {}
CMD-1004  1        Faure     TSH-VERT-S           TSH    VERT    S       {}
CMD-1004  2        Faure     SWEAT-GRIS-M         SWEAT  GRIS    M       {}
CMD-1005  1        Roux      CASQ-NOIR            CASQ   NOIR            {}
CMD-1006  1        Garnier   TSH-ROUGE-L          TSH    ROUGE   L       {}
CMD-1006  2        Garnier   SWEAT-BLEU-MARINE-L  SWEAT  BLEU    MARINE  {}
orders-renamed.csv
order_no;customer;articles
CMD-1001;Durand;TSH-BLEU-M|TSH-ROUGE-L|CASQ-NOIR-U
CMD-1002;Morel;SWEAT-GRIS-XL
CMD-1003;Nguyen;TSH-BLEU-M|TSH-BLEU-M
;;
CMD-1004;Faure;tsh-vert-s|SWEAT-GRIS-M
CMD-1005;Roux;CASQ-NOIR

CMD-1006;Garnier;TSH-ROUGE-L|SWEAT-BLEU-MARINE-L

Limits

  • A colour holding a dash, like BLEU-MARINE, shifts the size: split counts the cell but does not correct it.
  • OUT counts the orders written; the number of items is read in the table.
  • Two identical lines in the file itself land as one row.
  • Synthetic orders.

Logistics · marketplace

Orders come from the marketplace.

Logistics wants one row per item.

Seven orders, eleven items

The problem

Everything is packed into one cell.

  • Several items per order.
  • Model, colour, size in one reference.

What is not changed

The export stays as it is.

  • The marketplace's file.
  • No script beside it.

The trap

Two identical T-shirts.

  • Same order, same reference.
  • Without a rank, the table keeps one.

What had to be written

split-row: { by: items, position: item_no }

One line.

  • One item, one row, its rank.
  • A malformed reference is counted.
  • A 39-line scenario, two manifests.

The next day

The column is renamed: refused.

  • The run names the missing column.
  • Yesterday's rows stay.

The limit

A hyphenated colour shifts the size.

  • BLEU-MARINE gives the size MARINE.
  • The cell is counted, not fixed.

Try it

The scenario replays locally.

Every step is published with its output.

This scenario runs on lumnik Open, free and open source.

Try lumnik Open →