Baltor Get started

Library / Code module

Multi-source table merge with provenance and conflicts

multi_source_table_merge

Compile one table from several CSV sources by mapping columns to target fields, converting units, matching on key fields, taking values by source priority, recording which source gave each value and listing disagreements.

Files, names only

  • ATTRIBUTION.md 4.9 KB
  • LICENSE 1.0 KB
  • ONET-ATTRIBUTION.md 7.9 KB
  • PROCEDURE.md 2.3 KB
  • README.md 4.8 KB
  • TOOLS.md 2.0 KB
  • component.json 11.6 KB
  • examples/known_good.json 3.2 KB
  • examples/known_wrong.json 504 bytes
  • kit_schema.py 11.4 KB
  • multi_source_table_merge.py 9.0 KB
  • test_package.py 6.8 KB

Full files in your harness.

What it takes and gives

Runs with
Python 3.10 or later
Command
python3 multi_source_table_merge.py < input.json
Function
multi_source_table_merge.run
Required input
target_fields, key_fields, sources

Cases it covers

  • Known wrong example: The ERP source maps weight_kg to a column named Weight, but its CSV calls the column Weight (g), so the field would silently stay empty. Refused as mapping column absent.
  • input invalid: refused with exit code 2
  • input not json: refused with exit code 2
  • header missing: refused with exit code 2
  • mapping column absent: refused with exit code 2
  • key not mapped: refused with exit code 2
  • unknown target field: refused with exit code 2
  • duplicate key in source: refused with exit code 2

Limits and scope

Limits
Keys must match exactly after trimming; fuzzy matching belongs to duplicate_record_finder. One row per key per source; repeated keys are refused. Unit conversion is a multiplier only, so offsets such as temperature scales are not supported. Text values are compared after case folding, so a change of capital letters is not a conflict.
Work activities
Compile data or documentation; Compile technical information or documentation; Record research or operational data.

Details

Kind
Code module
Licence
MIT
Declared effects
runs commands
Source
github.com/alisonjieli-png/loop-engine/tools/creative_originals/occupation_task_kits/items/multi_source_table_merge
Size
12 files, 65.4 KB
Identity
library.supply.creative_originals.7161bf8ab35b138362bfc693.8ad96aa9c29c347d
Version
8ad96aa9c29c347df708b2f6372560ffd2a00b2736069d0081e98a836c77f009

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Where it is shown

Related components

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.