lumnik. / scenarios All scenarios · Français

The supplier file goes to EDI in ASCII with a stable id

Goal Send EDI the suppliers in the form it requires, with an id that does not change.

Purchasing's EDI platform requires names in ASCII, upper case, at most 35 characters, and one id per supplier. The ERP's export has accents, long company names, inactive suppliers, and ids that read N/A, 0 or nothing.

suppliers.csv
FOURN_CODE;FOURN_NOM;ACTIF;EXT_ID;PAYS
F0001;Société Générale d'Équipements Industriels du Rhône;O;N/A;
F0002;Électricité Ménard & Fils;O;3f2b8c1e-5a7d-4c2e-9b1f-0a6d8e4c2b71;FR
F0003;Ancien Fournisseur;N;0;FR
F0004;Transports Lefèvre;O;;FR
F0005;Société Générale d'Équipements Industriels du Rhône-Alpes;O;7c9e6679-7425-40de-944b-e07fc1f90ae7;
F0006;Garage Müller;O;0;DE
F0007;Imprimerie Côté, S.A.;O;;BE
F0008;Fournisseur Fermé;N;;FR
manifests/11-suppliers-policy.yaml
apiVersion: connectors.lumnik.io/v1kind: Connectormetadata:  name: scenario-suppliers-b  connector_type: csv-file  scopes: [purchasing-b]spec:  transport:    kind: local    path: /tmp/lumnik-scenario/supplier-master-edi/b/suppliers.csv  parser:    delimiter: ";"  after_process: none  mapping:    dataset:      - filter-where: { column: ACTIF, equals: "O" }        # inactive suppliers out, counted    row:      - map-columns:          rename: { FOURN_CODE: code, FOURN_NOM: name, ACTIF: active, EXT_ID: ext_id, PAYS: country }      - defaults: { country: FR }                            # an empty country is France    cell:      - remove-diacritics: { columns: [name] }               # Électricité -> Electricite      - upper: { columns: [name] }      - regex-replace: { column: name, pattern: "&", replacement: " ET " }      - regex-replace: { column: name, pattern: "[^A-Z0-9 ]", replacement: " " }   # what the EDI refuses      - regex-replace: { column: name, pattern: " +", replacement: " " }      - clean: { columns: [name], strip: true }      - truncate: { column: name, length: 35 }               # the EDI's hard limit      - to-uuid: { column: ext_id, on-invalid: "null", generate-from: code }   # junk emptied, counted; an empty id derived from the code
suppliers-day2.csv
FOURN_CODE;FOURN_NOM;ACTIF;EXT_ID;PAYS
F0001;Société Générale d'Équipements Industriels du Rhône;O;N/A;
F0002;Électricité Ménard & Fils;O;3f2b8c1e-5a7d-4c2e-9b1f-0a6d8e4c2b71;FR
F0003;Ancien Fournisseur;N;0;FR
F0004;Transports Lefèvre;O;;FR
F0005;Société Générale d'Équipements Industriels du Rhône-Alpes;O;7c9e6679-7425-40de-944b-e07fc1f90ae7;
F0006;Garage Müller;O;0;DE
F0007;Imprimerie Côté, S.A.;O;;BE
F0008;Fournisseur Fermé;N;;FR
F0009;Cartonnages Dubois;O;;FR

Limits

  • truncate cuts without warning: F0001 and F0005 carry the same 35-character name; only their codes tell them apart.
  • A derived id joins to no other system.
  • Synthetic suppliers.

Purchasing · EDI

Suppliers go to EDI.

Every night, from the ERP.

Eight suppliers, six active

The problem

EDI requires its own form.

  • ASCII, upper case, 35 characters.
  • One id per supplier.

What is not changed

The ERP stays as it is.

  • Its export, accents included.
  • No fix at the source.

The trap

Ids that are not ids.

  • N/A, 0, or nothing at all.
  • A random id changes every night.

What had to be written

to-uuid: { generate-from: code }

One line.

  • The same code gives the same id.
  • Wrong values are emptied and counted.
  • A 43-line scenario, two manifests.

The next day

The same ids.

  • One more supplier gets its own.
  • No row removed.

The limit

Cutting at 35 can merge two names.

  • Only their codes tell them apart.

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 →