Ordered Processing
TabularProcessing and JSONProcessing are strict configuration models with
ordered, tagged steps. Every operation runs in the order declared by its steps
list. There is no hidden branch that changes the order based on the selected
operations.
Tabular processing
Section titled “Tabular processing”A tabular spec contains MappingStep variants such as filter,
rename_columns, unpivot_columns, aggregate, sort, and unique. Each step
validates its own inputs and is executed by the SourceProcessor paired with
the decoded payload. PolarsTabularBackend implements the tabular operations
included with core. Applications can register another typed reader and processor pair
for their native representation. Configured column names are matched literally, including names such as ^load$
or *.
>>> from r2x_core import TabularProcessing>>> processing = TabularProcessing(steps=[... {"op": "unpivot_columns", "columns": ["2025", "2030"]},... {"op": "rename_columns", "column_mapping": {"variable": "year"}},... {"op": "sort", "by": {"year": "asc"}},... ])>>> [step.op for step in processing.steps]# ['unpivot_columns', 'rename_columns', 'sort']The JSON kind tag is "tabular" and is filled by the model when omitted.
Serialized file mappings include the tag so FileProcessing can validate the
union without guessing the schema.
JSON processing
Section titled “JSON processing”JSONProcessing uses a separate set of steps for JSON values, including
rename_keys, drop_keys, filter, replace_values, and select_keys.
Its kind tag is "json". Replacement sources are an ordered list of
{"old": scalar, "new": JSON value} records, not a mapping. Matching is recursive and checks types: booleans do not match numbers,
numerically equal integers and floats do, and a null filter matches only when
its key exists. Replacement values that are not finite and duplicate matching
sources are rejected.
>>> from r2x_core import JSONProcessing>>> processing = JSONProcessing(steps=[... {"op": "rename_keys", "mapping": {"old": "new"}},... {"op": "replace_values", "replacements": [... {"old": 0, "new": "missing"},... {"old": True, "new": "enabled"},... ]},... {"op": "select_keys", "keys": ["new"]},... ])>>> [step.op for step in processing.steps]# ['rename_keys', 'replace_values', 'select_keys']Validation and execution
Section titled “Validation and execution”Strict models reject unknown fields, and each tagged step has a closed schema.
For example, column renaming and filtering are separate operations rather than
optional fields whose interaction depends on a global execution order.
Expected ValueError and Polars failures remain Result errors with their
causes. DataReader chains ReaderError from them. Callback TypeError and
other programming defects propagate unchanged.
See the processor reference for the supported steps and custom readers and backends for the reader and typed processor contracts.