Skip to content

Include populated_from in TransformationError messages#184

Merged
amc-corey-cox merged 1 commit intomainfrom
error-populated-from-183
Apr 1, 2026
Merged

Include populated_from in TransformationError messages#184
amc-corey-cox merged 1 commit intomainfrom
error-populated-from-183

Conversation

@amc-corey-cox
Copy link
Copy Markdown
Contributor

Summary

Closes #183

Adds source context to TransformationError so curators can identify which source table/column caused the error without opening the YAML spec.

Before

could not convert string to float: 'A'; class_derivation=Quantity; slot_derivation=value_decimal

After

could not convert string to float: 'A'; class_derivation=Quantity (from pht004041); slot_derivation=value_decimal (from phv00191041)

Changes

  • Added class_populated_from and slot_populated_from fields to TransformationError
  • Updated __str__ to append (from ...) when populated_from is present
  • Pass both fields when constructing the error in map_object

Test plan

  • New test: all fields including populated_from in string output
  • New test: partial populated_from (only slot, not class)
  • Existing tests still pass (10/10)

🤖 Generated with Claude Code

Add class_populated_from and slot_populated_from fields so error
messages show source context: "slot_derivation=value_decimal (from
phv00191041)" instead of just "slot_derivation=value_decimal".

Closes #183

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 1, 2026 17:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves transformation diagnostics by including source mapping context (populated_from) in TransformationError string output, helping curators identify the originating source table/column directly from error messages (closes #183).

Changes:

  • Added class_populated_from and slot_populated_from fields to TransformationError.
  • Updated TransformationError.__str__ to append (from ...) to derivation segments when available.
  • Passed populated-from context when constructing TransformationError in ObjectTransformer.map_object.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/linkml_map/transformer/errors.py Extends TransformationError with populated-from context and formats it into __str__.
src/linkml_map/transformer/object_transformer.py Supplies class_deriv.populated_from and slot_derivation.populated_from when wrapping exceptions as TransformationError.
tests/test_transformer/test_continue_on_error.py Adds unit tests covering full and partial populated-from inclusion in TransformationError.__str__.

@amc-corey-cox amc-corey-cox merged commit 583983c into main Apr 1, 2026
13 checks passed
@amc-corey-cox amc-corey-cox deleted the error-populated-from-183 branch April 1, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include populated_from in TransformationError messages

2 participants