Skip to content

Fix: Error Handling & Validation Improvements#1719

Open
rachit23tech wants to merge 2 commits intoopenml:mainfrom
rachit23tech:feature/dataset-handling
Open

Fix: Error Handling & Validation Improvements#1719
rachit23tech wants to merge 2 commits intoopenml:mainfrom
rachit23tech:feature/dataset-handling

Conversation

@rachit23tech
Copy link

Metadata

  • Reference Issue: NA
  • New Tests Added: No
  • Documentation Updated: Yes
  • Change Log Entry: Improve error handling and validation in OpenMLDataFeature and dataset parsing

Details

This PR improves error handling and validation in the OpenMLDataFeature class and enhances dataset parsing logic for better consistency and robustness.

What does this PR implement/fix?

  • Added validation for index parameter to ensure it is non-negative
  • Added validation for name parameter to ensure it is a non-empty string
  • Added validation for number_missing_values to ensure it is non-negative
  • Enhanced validation for nominal_values
  • Improved error messages with more consistent formatting
  • Updated docstrings for better clarity

Additionally:

  • Improved _parse_features_xml in dataset.py to better handle ontologies
  • Converted ontology values to lists for consistency
  • Fixed handling of default values for nr_missing

Why is this change necessary?

Previously, insufficient validation could lead to unclear errors or unexpected behavior when working with dataset features. This update improves reliability, enforces correct input handling, and enhances the overall developer experience.

Testing

  • Ran full test suite using pytest
  • 19 tests passed successfully
  • 1 test failed (test_get_feature_with_ontology_data_id_11) due to pre-existing outdated expectations
  • Verified that ontology parsing is functioning correctly and aligns with API response

Additional Notes

The failing test appears to expect multiple ontologies, while the API currently returns only one. The implemented parsing correctly reflects the actual API behavior.

@rachit23tech
Copy link
Author

Hi maintainers, could you please approve the workflows so CI checks can run?

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.

1 participant