Add collapse_comments option and extract includedActivities fields#345
Merged
Conversation
… ecospold2 extractor
- New `collapse_comments` kwarg (default True) on `extract()` and `extract_activity()`;
when False, `comment` is a dict keyed by source field instead of a flat string
- Always extract `included_activities_start` and `included_activities_end` as top-level
dataset fields from activityDescription/activity
- Fix pre-existing double-space in collapsed comment separator (": " not ": ")
- Update existing tests for new fields and corrected spacing; add test for dict mode
…_period) Add start_date, end_date, and valid_for_entire_period (bool) as top-level dataset fields extracted from activityDescription/timePeriod XML attributes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
collapse_commentskwarg (defaultTrue) onEcospold2DataExtractor.extract()andextract_activity(). WhenFalse, thecommentfield is adictkeyed by source (e.g."general","included activities start","geography", …) instead of a flat concatenated string. Only non-empty keys are included.included_activities_startandincluded_activities_endare now always extracted as top-level dataset fields fromactivityDescription/activity/includedActivitiesStartand…End.": "not": "— the old code used" ".join()on a label that already ended with a space).Test plan
test_extraction_without_synonymsandtest_extraction_with_synonymsupdated for new fields and corrected spacingtest_collapse_comments_falseverifies dict output, correct key values, and absent keys for missing fieldspytest tests/ecospold2/ecospold2_extractor.py)