Skip to content

Logic to handle optional_extra in Vision Excel converter input - #344

Merged
Jerry-Jinfeng-Guo merged 22 commits into
mainfrom
feature/optional-extra
Dec 22, 2025
Merged

Logic to handle optional_extra in Vision Excel converter input#344
Jerry-Jinfeng-Guo merged 22 commits into
mainfrom
feature/optional-extra

Conversation

@Jerry-Jinfeng-Guo

@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo commented Nov 26, 2025

Copy link
Copy Markdown
Member

Closes #338

In this PR:

  • Logic to handle optional_extra
  • Documentation
  • Test

Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo self-assigned this Nov 26, 2025
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo added the feature New feature or request label Nov 26, 2025
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo changed the title logic to handle optional_extra Logic to handle optional_extra in Vision Excel converter input Nov 26, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 implements logic to handle optional extra columns in the tabular converter, addressing issue #338. The feature allows specifying columns that should be included in extra_info if present but won't cause conversion failure if missing.

Key Changes:

  • Added allow_missing parameter throughout the column definition parsing chain to support optional columns
  • Implemented optional_extra wrapper in column definitions to mark columns as optional
  • Enhanced error handling to gracefully skip missing optional columns while preserving required column behavior

Reviewed changes

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

File Description
src/power_grid_model_io/converters/tabular_converter.py Core implementation of optional_extra logic with allow_missing parameter propagation and empty DataFrame handling for missing columns
tests/unit/converters/test_tabular_converter.py Comprehensive test coverage for optional_extra feature including edge cases and integration tests
docs/converters/vision_converter.md Documentation explaining optional_extra syntax, behavior, and use cases for Vision Excel exports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread src/power_grid_model_io/converters/tabular_converter.py Outdated
Jerry-Jinfeng-Guo and others added 3 commits November 26, 2025 12:08
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/power_grid_model_io/converters/tabular_converter.py Outdated
Comment thread src/power_grid_model_io/converters/tabular_converter.py Outdated
Jerry-Jinfeng-Guo and others added 4 commits November 27, 2025 14:35
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Comment thread docs/converters/vision_converter.md
Comment thread src/power_grid_model_io/converters/tabular_converter.py Outdated
Comment thread src/power_grid_model_io/converters/tabular_converter.py Outdated
Comment thread src/power_grid_model_io/converters/tabular_converter.py
Comment thread src/power_grid_model_io/converters/tabular_converter.py
Comment thread src/power_grid_model_io/converters/tabular_converter.py
Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread src/power_grid_model_io/converters/tabular_converter.py
Comment thread src/power_grid_model_io/converters/tabular_converter.py
Jerry-Jinfeng-Guo and others added 3 commits December 1, 2025 21:09
Comments from Martijn

Co-authored-by: Martijn Govers <martijn.govers@alliander.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Comments from Martijn

Co-authored-by: Martijn Govers <martijn.govers@alliander.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Comment thread src/power_grid_model_io/converters/tabular_converter.py
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Comment thread src/power_grid_model_io/converters/tabular_converter.py

@mgovers mgovers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

probably good to have multiple people review this as it's quite a complex PR

Comment thread src/power_grid_model_io/converters/tabular_converter.py Outdated
Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread src/power_grid_model_io/converters/tabular_converter.py
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
@mgovers mgovers reopened this Dec 15, 2025
@mgovers

mgovers commented Dec 15, 2025

Copy link
Copy Markdown
Member

Apologies! Did not mean to close it. Apparently, referencing that it resolves a specific comment in this PR made GitHub think that it actually resolves the entire PR. Not great.

Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>

@figueroa1395 figueroa1395 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor final remarks. From my perspective we can merge after addressing them.

Side note: I resolved/addressed remaining open comments such that it wouldn't be blocking.

Comment thread src/power_grid_model_io/converters/tabular_converter.py Outdated
Comment thread src/power_grid_model_io/converters/tabular_converter.py
Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread tests/unit/converters/test_tabular_converter.py
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>

@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comments addressed in the form of updated code, test or replies. see 734345b

Comment thread src/power_grid_model_io/converters/tabular_converter.py
Comment thread src/power_grid_model_io/converters/tabular_converter.py Outdated
Comment thread tests/unit/converters/test_tabular_converter.py
Comment thread tests/unit/converters/test_tabular_converter.py
@sonarqubecloud

Copy link
Copy Markdown

@figueroa1395 figueroa1395 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, nothing more to add. The remaining sonar warning is irrelevant.

@Jerry-Jinfeng-Guo
Jerry-Jinfeng-Guo added this pull request to the merge queue Dec 22, 2025
Merged via the queue into main with commit 02e4a61 Dec 22, 2025
37 checks passed
@Jerry-Jinfeng-Guo
Jerry-Jinfeng-Guo deleted the feature/optional-extra branch December 22, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Graceful Handling of Missing Extra Columns in Vision Excel Files

5 participants