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

refactor and add nilreason logic #60

Merged
merged 1 commit into from
Nov 4, 2024
Merged

Conversation

rshewitt
Copy link

@rshewitt rshewitt commented Nov 4, 2024

related to #4924

reference to some improvements made but i'll list them here anyways as a formality.

1: most top-level modules like module_metadata, module_iso19115_2, and module_metadata_info always return a hash. low-level modules like module_date, module_citation, and module_responsibility occur nested within a document and either return nil when the root element can't be found or the hash as it could be processed.
2: i throw a structure error message either when the input document is empty or it's not well formed xml. all other warnings are validation messages.
3: this is implemented. each module will try to gather as much information as possible without returning nil on the first warning.
4: nilreason check is implemented for required elements. it's not implemented for optional.
6: this relates to nilreason.

here's some general improvements

  • changed tab width to 2 spaces instead of 3.
  • removed certain readers & tests from linting. some of them weren't originally included and they produced errors but we only care about the _2_datagov branch for now.
  • in order to make sure the nilreason logic works as intended i've broken required element xpaths down to 1 element instead of 2 ( i.e. gmd:westBoundLongitude/gco:Decimal to gmd:westBoundLongitude ). the reason is that gmd:westBoundLongitude is what's checked for the nilreason.

full translate test

  • i created this test for validating documents in production. the documents from that query can change which is why i didn't commit this.

Copy link

@btylerburton btylerburton left a comment

Choose a reason for hiding this comment

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

Nice work on this huge effort. LGTM!

.rubocop.yml Show resolved Hide resolved
@rshewitt rshewitt merged commit c4a3b46 into master Nov 4, 2024
2 checks passed
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.

2 participants