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

Additional MITAardvark methods #109

Merged
merged 3 commits into from
Dec 20, 2023
Merged

Conversation

ehanson8
Copy link
Contributor

Helpful background context

Further updates to expand the MITAardvark class. The remaining fields can likely be covered in the next PR

How can a reviewer manually see the effects of these changes?

Updates to the CLI are needed before this can be tested manually.

What are the relevant tickets?

Developer

  • All new ENV is documented in README
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Includes new or updated dependencies?

NO

Why these changes are being introduced:
* Additonal methods are needed for the MITAardvark class

How this addresses that need:
* Update get_optional_fields method to include format and summary values and add corresponding unit test
* Add get_alternate_titles, get_contributors, get_notes, get_publication_information, and get_rights field methods along with calls in get_optional_fields and corresponding unit tests
* Update aardvark_record_all_fields fixture to include new fields

Side effects of this change:
* None

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/GDT-54
Copy link
Contributor

@ghukill ghukill left a comment

Choose a reason for hiding this comment

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

Overall, looking real good.

Left a couple comments about list comprehension patterns, maybe an opportunity to collapse those down a bit. And one comment about Rights.uri that may or may not throw errors (though tests aren't catching it if so...).

But looking good, easy to follow.

transmogrifier/sources/json/aardvark.py Show resolved Hide resolved
transmogrifier/sources/json/aardvark.py Outdated Show resolved Hide resolved
transmogrifier/sources/json/aardvark.py Outdated Show resolved Hide resolved
transmogrifier/sources/json/aardvark.py Show resolved Hide resolved
transmogrifier/sources/json/aardvark.py Outdated Show resolved Hide resolved
transmogrifier/sources/json/aardvark.py Outdated Show resolved Hide resolved
* Update dct_license_sm field in aardvark fixture to properly reflect expected value
* Refactor get_alternate_titles, get contributors, and get_notes methods for more efficient processing
* Update get_rights method to properly process expected value of dct_license_sm
@ehanson8
Copy link
Contributor Author

Pushed new commit @ghukill @jonavellecuerdo

Copy link
Contributor

@ghukill ghukill left a comment

Choose a reason for hiding this comment

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

Changes look good to me!

Comment on lines +160 to +165
rights.extend(
[
timdex.Rights(uri=rights_uri_value)
for rights_uri_value in source_record.get("dct_license_sm", [])
]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good!

JsonTransformer.parse_source_file(
"tests/fixtures/aardvark/aardvark_record_all_fields.jsonl"
)
return JsonTransformer.parse_source_file(
Copy link
Contributor

@jonavellecuerdo jonavellecuerdo Dec 20, 2023

Choose a reason for hiding this comment

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

Hmm, how do we feel about renaming:
JsonTransformer -> JSONTransformer--
using common capitalized abbreviations when naming functions?

Asking @ghukill , too! 🤓

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is following the capitalization pattern of classes like Ead where is was decided at some point in the past that all-caps class names like EAD weren't preferred. Not sure if that is following some linting principle but I don't have strong feelings either way about the capitalization

Copy link
Contributor

Choose a reason for hiding this comment

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

Just my two cents: I prefer, and have used, all caps like JSONTransformer or SQSClient as examples. But I noticed Transmog follows a pretty strict CamelCasing for classes. Doesn't feel like a deal breaker either way to me, but maybe leaning towards consistency in the project.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I don't think it's based on a linting rule--since it seemed pass without error in geo-harvester, but I do think CamelCasing is generally preferred. I'm okay with it being consistent just within the repo at the least, so it's fine as is!

Copy link
Contributor Author

@ehanson8 ehanson8 Dec 20, 2023

Choose a reason for hiding this comment

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

Honestly, I have to stop myself typing JSON rather than Json every time and we aren't consistent about it in other repos so I'll switch it to JSONTransformer and XMLTransformer

JsonTransformer.parse_source_file(
"tests/fixtures/aardvark/aardvark_record_all_fields.jsonl"
)
return JsonTransformer.parse_source_file(
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I don't think it's based on a linting rule--since it seemed pass without error in geo-harvester, but I do think CamelCasing is generally preferred. I'm okay with it being consistent just within the repo at the least, so it's fine as is!

@ehanson8 ehanson8 merged commit 97b8bc1 into main Dec 20, 2023
5 checks passed
@ehanson8 ehanson8 deleted the GDT-54-additional-aardvark-fields branch December 20, 2023 20:56
jonavellecuerdo pushed a commit that referenced this pull request Jan 5, 2024
* Update dct_license_sm field in aardvark fixture to properly reflect expected value
* Refactor get_alternate_titles, get contributors, and get_notes methods for more efficient processing
* Update get_rights method to properly process expected value of dct_license_sm
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.

None yet

3 participants