Feature request
Support importing structured data from Excel/CSV files using a mapping that associates cell coordinates (or column positions) to model property paths.
Concept
A two-phase generic approach:
-
mapping_to_json(worksheet, mapping): Read cell values from an Excel/CSV file using a mapping dict like {"formula": "D2", "measurements.0.area": "T2"} and assemble a nested JSON dict from the dotted property paths. This phase is fully model-agnostic.
-
json_to_model(data, ModelClass, context): Construct a typed model instance from the JSON dict, with automatic type coercion driven by the model's field annotations (e.g. int->str where the model expects str). Supports context injection via wildcard paths like measurements.*.sample_info.
Mapping generation
The mapping can be:
- Auto-generated by analyzing the Excel structure (header row parsing, row grouping via outline_level metadata)
- Exported to / imported from a JSON file for manual inspection and override
- Manually defined for custom layouts
Use case
Parsing Compound Discoverer Excel exports (275 columns, nested features with candidates and per-sample measurements spread across distant column ranges). The cell mapping makes the import traceable and debuggable.
Reference implementation
Working prototype in oold-example-env:
Feature request
Support importing structured data from Excel/CSV files using a mapping that associates cell coordinates (or column positions) to model property paths.
Concept
A two-phase generic approach:
mapping_to_json(worksheet, mapping): Read cell values from an Excel/CSV file using a mapping dict like
{"formula": "D2", "measurements.0.area": "T2"}and assemble a nested JSON dict from the dotted property paths. This phase is fully model-agnostic.json_to_model(data, ModelClass, context): Construct a typed model instance from the JSON dict, with automatic type coercion driven by the model's field annotations (e.g. int->str where the model expects str). Supports context injection via wildcard paths like
measurements.*.sample_info.Mapping generation
The mapping can be:
Use case
Parsing Compound Discoverer Excel exports (275 columns, nested features with candidates and per-sample measurements spread across distant column ranges). The cell mapping makes the import traceable and debuggable.
Reference implementation
Working prototype in oold-example-env:
https://github.com/OO-LD/oold-example-env/tree/main/nts