Work sample / data rules

Match the known. Flag the rest.

A small, runnable example of data-validation work: match requested product codes to an approved catalogue, calculate exact whole-unit prices, and stop uncertain rows for review.

Input rows

Fictional requested items
CodeQtyUnit
CB-163each
WIRE-210roll
UNKNOWN2each
DUP1each

Read the approved catalogue and these requests in the example input below.

Download the runnable sample

Verified output

$37.50

matched-row subtotal

  • MATCHED3 x CB-16, each
  • REVIEWWIRE-2: roll requested, metre listed
  • REVIEWUNKNOWN: no catalogue entry
  • REVIEWDUP: two catalogue entries

The overall result remains review_required. No substitutions or guessed prices.

Run the example.

Unzip the download and open a terminal in its folder. With Node.js 20 or later:

node test.mjs
node match.mjs input.json result.json

Open result.json. Expect matchedSubtotalCents: "3750", one matched row and three review rows. The downloaded output.json is the reference result.

Why it stops

The $37.50 is only the subtotal for the one exact match. The other rows remain visible because a partial answer is safer than a confident-looking quotation.

This sample accepts JSON, USD catalogue prices in integer cents and positive whole-unit quantities. It does not extract PDFs, create Excel files, infer matches, calculate tax or freight, integrate with an ERP or send customer quotes.

Self-created demonstration

Fictional product data. Tested component. Not client work or a complete quotation system.

Have a small workflow to repair? Share an example input, expected output and the failure you want fixed.

Discuss a workflow