Extracting Order Status? Always Keep an "unknown" Value

When the order status is not in the system’s predefined list, the easiest approach is often to select the value that “most closely resembles” it. The time saved

Why guessing an order status is risky

Mapping an unfamiliar order status to the closest value in your list is tempting because it saves time. That shortcut can cause bigger problems later. For example, a source text that said "waiting for more information" could be processed as "approved" by the system, and every downstream step would then act on a decision that was never made.

This article shows you how to keep uncertain statuses honest, route them to the right place, and avoid silent defaults. The examples are synthetic and were checked in an isolated environment. They do not guarantee results for every real file or product, so keep your original copies and verify the process against your own boundaries and acceptance criteria before you use it on important documents.

How do you handle an order status that is not in the list? The short answer

Record the status as unknown, keep the original text fragment, and send anything ambiguous to a person instead of guessing.

Your situationWhat to doWhy
The status text is not in your predefined listSet it to unknown and keep the source fragmentAn unclear status does not become a false definite answer
The business does not accept unknown valuesEscalate the item to a human operatorThe field is not filled with a silent default
The text matches more than one stateSend it to human disambiguation and keep all candidatesConflicts cannot be settled automatically
You change the status word tableKeep old records and define the migration scopeReplacing unknown can overwrite the historical meaning
You translate a multilingual documentKeep the source document's uncertainty in the translationAn affirmative translation can override the original

Keep unknown to preserve the facts

unknown is not a catch-all for every exception. It is still more honest than an unfounded definitive answer. In this approach, the business state is limited to four values:

  • pending
  • approved
  • rejected
  • unknown

Each record also keeps the original text fragment, so a reviewer can see what the source actually said.

Keep in mind that the enumeration constraint only controls the output vocabulary. It does not check whether the word the model selected matches the original text.

Escalate instead of choosing a default

If the business does not accept unknown values, send the task to a human operator rather than silently selecting a default status in the field. Default values should be used only when the business agreement explicitly specifies them. The extraction script should never generate them automatically.

Map explicit phrases and check the enumeration

The following sketch shows the mapping and enumeration check:

from jsonschema import Draft202012Validator

schema = {"type": "object", "required": ["state", "source_text"],
          "properties": {"state": {"enum": ["pending", "approved", "rejected", "unknown"]},
                         "source_text": {"type": "string"}},
          "additionalProperties": False}
validator = Draft202012Validator(schema)
mapping = {"待审核": "pending", "已批准": "approved", "已拒绝": "rejected"}

def map_state(text):
    return {"state": mapping.get(text, "unknown"), "source_text": text}

assert map_state("已批准")["state"] == "approved"
assert map_state("等待更多资料")["state"] == "unknown"
assert not list(validator.iter_errors(map_state("等待更多资料")))
assert list(validator.iter_errors({"state": "probably-approved", "source_text": "?"}))

The mapping handles explicit phrases only. Synonyms, negative sentences and contextual variations are not processed. For example, "unapproved" must not be mapped to approved. If you add fuzzy matching later, include counterexamples like this one in your tests, and keep the original textual evidence.

How do unknown values enter the work queue?

Each extraction result follows one of four paths:

ResultProcessing strategyWhat to retain
Explicitly matchesEnters the next-level business validationSource fragment and rule version
Not in the mappingMarked unknownOriginal text, not automatically rewritten
Multiple-state conflictSent to human disambiguationAll candidates and their positions
Format does not conform to the enumRejectedError path and output version

Handle changes to the status table without silent compatibility

When your status table changes, downstream systems may need a new branch for the new state. Simply replacing the old unknown meaning with a new state silently rewrites history. Instead:

  • Keep the old records.
  • Define the migration scope clearly.
  • Check which tasks need re-extraction.

Keep uncertainty when you translate

In multilingual documents, start by confirming the status in the source document. Then check how the target language expresses it. Do not let a confident-sounding translation override the uncertainty in the original text.

OmniDoc (product entry point) can serve as the entry point for document translation. However, your own system must still define and maintain the release rules for business status.

Reference: JSON Schema enum

📊 At a glance

ApproachWhen it is acceptableRisk
Choose the closest valueNot recommended; the article shows it can turn "waiting for more information" into "approved"Wrong definite status flows into later steps
Set unknown and keep the source fragmentWhen the business accepts unknown valuesOnly as honest as the evidence kept with it
Escalate to a human operatorWhen the business does not accept unknown valuesNeeds people to review the queue
Use a default statusOnly when the business agreement explicitly specifies itMust not be generated automatically by the script

🎯 Which approach fits you?

If your business accepts unknown values

Set unmatched statuses to unknown, keep the original fragment, and store the rule version with each result.

If your business does not accept unknown values

Escalate those items to a human operator instead of filling the field with a default.

If you are changing your status word table

Keep the old records, define the migration scope, and identify which tasks need re-extraction before you switch.

If your documents are multilingual

Confirm the status in the source document first, then make sure the translation keeps the same level of certainty.

❓ FAQ

1. Why not just pick the closest status?

The closest match can be wrong. The article's example shows "waiting for more information" being processed as "approved," which creates errors in later steps.

2. Does the enum constraint check that the extracted word matches the original text?

No. The enumeration constraint only controls the output vocabulary. It does not verify whether the selected word conforms to the source text.

3. Can I use fuzzy matching to handle synonyms?

The article's mapping covers explicit phrases only. If you add fuzzy matching, include counterexamples such as "unapproved" and keep the original textual evidence.

4. Should I replace the old unknown value when I update the status table?

No. Keep the old records and define the migration scope. Replacing unknown can silently overwrite its historical meaning.

📝 Summary

Unclear order statuses should stay unclear until someone with the right authority resolves them. Keep unknown with its source text, escalate when the business requires it, and never let a default fill the field silently. Verify the process against your own files and acceptance criteria before you rely on it.

Try it now: upload a document and get it translated with the layout intact

Updated 2026-11-04