Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support directional region validation #440

Merged
merged 8 commits into from
Dec 19, 2024

Conversation

danielhuppmann
Copy link
Member

This PR implements validation for "directional regions" - when defining a region to report e.g. trade flows, this can be implemented as "China>Europe" using a > character. Both the source and the destination have to be defined in the codelist.

Copy link
Collaborator

@dc-almeida dc-almeida left a comment

Choose a reason for hiding this comment

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

That clarifies why I had seen regions with the '>' before!

Copy link
Contributor

@phackstock phackstock left a comment

Choose a reason for hiding this comment

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

One change requested, then good to merge.
If it's ok, I'd push my proposed change and you can take a look.

nomenclature/codelist.py Outdated Show resolved Hide resolved
@danielhuppmann
Copy link
Member Author

Thanks @phackstock for the improvement, very nice!

I made one minor suggestion to reduce the duplicated validation-statement, feel free to decide whether that should be merged. Over to you to approve.

@phackstock phackstock self-requested a review December 19, 2024 10:48
Copy link
Contributor

@phackstock phackstock left a comment

Choose a reason for hiding this comment

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

Good to be merged from my side.
I'd keep the two checks for origin and destination explicit for better readability.

Copy link
Member Author

@danielhuppmann danielhuppmann left a comment

Choose a reason for hiding this comment

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

Fair enough @phackstock, but then we can at least make the error messages more specific - what do you think?

nomenclature/codelist.py Outdated Show resolved Hide resolved
nomenclature/codelist.py Outdated Show resolved Hide resolved
@phackstock
Copy link
Contributor

Fair enough @phackstock, but then we can at least make the error messages more specific - what do you think?

Good point, suggestions are merged.

@danielhuppmann danielhuppmann merged commit c3ad7da into main Dec 19, 2024
12 checks passed
@danielhuppmann danielhuppmann deleted the feature/directional-region-validation branch December 19, 2024 13:50
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.

3 participants