Keep numeric-looking references intact as they move from AI extraction through human review into a business system. Use boundary tests to distinguish a display change from an identifier that has actually been lost.
An AI extractor reads an order reference correctly as 000742. A reviewer opens the export in a spreadsheet, approves the row, and sends back 742. The extraction was right; the workflow still delivered the wrong identifier.
Preserving leading zeros requires a representation contract at every handoff, not just a better prompt. Treat codes as text when their characters identify something rather than measure it. Then verify that the review surface, adapter and destination preserve that contract.
This is a recommended implementation and acceptance plan for operations teams. The examples and states are illustrative, not results from a customer deployment.
Decide whether the field is a reference or a magnitude
A quantity of 742 units can participate in arithmetic. An order reference spelled 000742 identifies a record under an issuing system’s rules. Numerical equality does not establish identifier equality: 000742 and 742 may name different records or one may be invalid.
Start with the data owner’s field definition. Record its issuing system, permitted characters, length rules, whether zeros are significant, and allowed transformations. Do not infer a six-character rule merely because the first sample has six characters.
Amazon Textract’s schema guidance distinguishes digit-only identifiers, which should be strings, from numerical quantities. This is a useful schema principle, not evidence that a given extraction is correct.
Use a separate numeric-notation acceptance process for actual magnitudes. Do not apply its decimal parsing to an identifier simply because all the characters are digits.
Keep source spelling separate from a permitted lookup form
If an authoritative specification says two reference spellings are equivalent, retain the source spelling and derive a separate lookup value under that versioned rule. Record the transformation and its scope. The model must not invent equivalence, insert missing zeros or choose a likely account.
A valid reference also does not prove that the requester may act on it. An entity-resolution decision and downstream action authorization remain separate checks.
Write a contract for the whole identifier journey
Ask the AI to locate the reference, return its quoted spelling and source location, and flag ambiguity. Give deterministic validators responsibility for type and exact-value checks. Let the data steward resolve damaged or conflicting evidence. The receiving system remains responsible for record lookup, access and execution.
The following matrix is an acceptance specification to adapt, not a Workhint API or a guarantee from an AI provider.
| Boundary | Required evidence | Block progression when |
|---|---|---|
| Source to extractor | Artifact revision, field label, page/cell location and original characters | Clipping, unreadable digits or a missing source prevents exact verification |
| Extractor to structured result | String-typed reference and source-to-output comparison | A number, invented padding or changed characters replace the source spelling |
| Structured result to review file | Text storage for the reference column; visible spelling and stored value agree | A display mask hides a different stored value or conversion has removed digits |
| Reviewed file to adapter | Reviewed revision, accepted string and adapter validation result | The parser coerces the field to a number or the file changed after approval |
| Adapter to destination | Destination field contract, accepted action identity and readback | The target truncates, reformats or stores a different reference |
Keep sensitive originals in the authorized evidence store; routine logs can reference a protected location rather than repeat the full identifier. Use only the evidence needed to resolve the case.
Reject type coercion instead of disguising it
For a field whose accepted source is 000742, a structured result should contain a string such as {"order_reference":"000742"}. A numeric 742 is not an alternative representation to accept silently.
RFC 8259 does not permit leading zeros in JSON numbers. Quoting the reference makes it a string, but a valid string can still be wrong: "742" parses successfully while failing this source-preservation contract. Validate meaning against the evidence, not syntax alone.
Do not build a “helpful” conversion that first casts a number to text and then declares success. By that stage, the original zeros or long digits may already be unavailable. Return a representation-loss finding and investigate the earliest intact artifact.
Test stored values, not just what the reviewer sees
A spreadsheet can show a padded code while storing a number. Conversely, a display can use scientific notation even when the underlying value deserves a closer inspection. Neither appearance alone establishes that the reference survived.
Microsoft’s leading-zero and large-number guidance explains text-based import and Excel’s 15-significant-digit numeric precision limit. The practical implication is to establish text handling before conversion, not repair the appearance afterward. Automatic-conversion controls depend on the Excel version; test the actual review route your team uses.
Inspect the exported bytes or cell value and type, then reimport through the real adapter. A workbook that looks correct is not proof that a later CSV importer or database binding preserves the same characters. CSV quoting is not a universal type instruction to every receiving program.
Use fixtures that expose irreversible loss
These constructed fixtures specify expected outcomes. They are not measured accuracy results or universal identifier grammars.
| Source | Contract | Expected outcome |
|---|---|---|
000742 | Six-character order reference | All boundaries retain exactly six characters; 742 is held |
742 | Variable-length reference | Keep three characters; do not add zeros because a previous row had them |
12345678901234567 | Seventeen-character reference | Preserve every character as text; reject rounded or substituted trailing digits |
000000 | Six characters allowed by this fixture’s issuing rule | Do not treat it as blank or numerical zero; separately test whether the issuing register recognizes it |
| Missing field | Required reference | Request evidence; never substitute zeros or a neighboring row’s reference |
00O742 | Digits-only reference | Hold the letter O; do not silently change it to zero |
Run each fixture through extraction, spreadsheet open/save, review submission, adapter parsing and destination readback. Add a test where the display is padded but the stored cell is numeric. Record the first boundary that changes the value. A failed target write and a failed source read are different failures and need different recovery.
Recover from the last intact evidence, not a guessed width
Constructed example: a service team receives a document naming order 000742. The extractor stores that string with the page location. A review workbook turns it into numeric 742. The destination register accepts six-character order references, but that fact alone is not permission to reconstruct every damaged row.
- Hold the handoff. Mark the reviewed revision representation-invalid. Do not dispatch work or create a replacement order.
- Locate the loss. Compare the retained extraction result with the review file’s stored value. Preserve the failed artifact so the cause is not erased by a later save.
- Restore from evidence. Rebuild the review value from the intact, source-verified extraction result. If that result is not available, obtain the original document or confirmation through the approved channel. Padding alone supplies no new evidence.
- Reapprove the changed revision. The reviewer confirms the exact reference and its evidence in the repaired artifact. An approval for the damaged file does not automatically authorize the new one.
- Release one bounded action. Validate the current revision and permissions at dispatch; use the destination’s supported idempotency or conditional-write mechanism.
- Read back and close. Confirm the accepted reference in the intended target field and retain the action receipt. A success message without the stored value does not establish fidelity.
If a damaged reference already reached a live record, identify affected operations and assign an authorized correction decision. Do not overwrite a different existing reference merely to make the test pass. Unknown effects remain reconciliation work.
Make holds and retries explicit
Use states such as captured → representation checked → review accepted → dispatch authorized → applied and verified. Missing evidence, representation loss, rejected review, superseded revision and unknown write outcome need distinct dispositions.
A transient extractor failure may retry against the same artifact and configuration under a bounded policy. A repeated interpretation of damaged text is not recovery. Source changes require a new check; policy changes require reassessment; late callbacks for a superseded revision cannot release work.
After a destination timeout, reconcile the original action identity and actual stored state before repeating a write. If the system cannot establish the outcome, stop that action and give reconciliation a named owner. Do not invent a new action identity to escape uncertainty.
Where Workhint fits
The exception needs an owner, evidence and a decision before work moves on. Workhint’s Workflow Engine describes required information and approval steps, with routing to defined roles. Those building blocks are relevant to asking a data steward to verify a changed reference before the request progresses.
The workflow automation software solution describes structured forms, conditional routing and assigned review stages. That is a relevant process-design scope for the handoff between intake, review and an authorized operator.
These pages do not establish native OCR, lossless identifier storage, a spreadsheet connector or transactional destination writes. Validate those technical requirements separately. Review routing cannot restore characters that every retained source has already lost.
Measure silent changes separately from visible failures
Track exact-string preservation across each boundary, silent alteration rate, wrong-reference releases, unnecessary holds and time to evidence-backed resolution. State the number and kinds of fixtures or cases evaluated. Separate leading-zero loss, long-digit rounding and OCR character ambiguity so a single accuracy figure does not hide the actual defect.
Start with one field and one real review/export route. Enable downstream writes only when its source comparison, changed-revision review and uncertain-write reconciliation tests meet criteria chosen by the responsible owner. A prompt that passes once is not an acceptance plan.
Frequently asked questions
Can we simply add zeros back to every short reference?
No. A documented issuing rule may permit a separate derived lookup form, but guessed padding can select the wrong record. Recover the original spelling from trustworthy evidence and retain any authorized transformation separately.
Does a JSON string guarantee the right identifier?
No. It prevents that field from being represented as a JSON number, but the model or an earlier system may already have changed the characters. Compare the string with the source and test every later handoff.
Is a spreadsheet custom format enough?
Not for an end-to-end guarantee. A display mask and stored value are different things. Verify text handling, actual export content, the adapter’s interpretation and destination readback.
What if the original identifier is no longer available?
Keep the case unresolved and obtain authoritative evidence. A plausible code, matching length or nearby record is not proof of the lost characters and does not authorize a new business action.

Leave a Reply