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.
ATTRIBUTION.md4.9 KBLICENSE1.0 KBONET-ATTRIBUTION.md7.9 KBPROCEDURE.md2.3 KBREADME.md4.8 KBTOOLS.md2.0 KBcomponent.json11.6 KBexamples/known_good.json3.2 KBexamples/known_wrong.json504 byteskit_schema.py11.4 KBmulti_source_table_merge.py9.0 KBtest_package.py6.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
- CSV files and recordsCorner cases
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.