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

Timx 288 marc field method refactor 5 #204

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

jonavellecuerdo
Copy link
Contributor

@jonavellecuerdo jonavellecuerdo commented Aug 1, 2024

Purpose and background context

Field method refactor for transform class Marc (Part 5).

This PR concludes the field method refactor updates for Marc. The changes introduced this PR are minor, tidying changes meant to improve code readability. Of note is the replacing the use of dictionaries when defining MARC field mappings with tuples, allowing us to assign helpful variable names to the tuple values in the for loop.

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

  1. Run make test and verify all unit tests are passing.

  2. Run CLI command

    pipenv run transform -i tests/fixtures/marc/marc_record_all_fields.xml -o output/marc-transformed-records.json -s alma
    

    Output:

    2024-08-01 13:20:43,961 INFO transmogrifier.cli.main(): Logger 'root' configured with level=INFO
    2024-08-01 13:20:43,961 INFO transmogrifier.cli.main(): No Sentry DSN found, exceptions will not be sent to Sentry
    2024-08-01 13:20:43,961 INFO transmogrifier.cli.main(): Running transform for source alma
    2024-08-01 13:20:44,476 INFO transmogrifier.cli.main(): Completed transform, total records processed: 1, transformed records: 1, skipped records: 0, deleted records: 0
    2024-08-01 13:20:44,477 INFO transmogrifier.cli.main(): Total time to complete transform: 0:00:00.515791
    

Includes new or updated dependencies?

NO

Changes expectations for external applications?

NO

What are the relevant tickets?

https://mitlibraries.atlassian.net/browse/TIMX-288

Developer

  • All new ENV is documented in README
  • All new ENV has been added to staging and production environments
  • All related Jira tickets are linked in commit message(s)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer(s)

  • The commit message is clear and follows our guidelines (not just this PR message)
  • There are appropriate tests covering any new functionality
  • The provided documentation is sufficient for understanding any new functionality introduced
  • Any manual tests have been performed and verified
  • New dependencies are appropriate or there were no changes

@jonavellecuerdo jonavellecuerdo self-assigned this Aug 1, 2024
@jonavellecuerdo jonavellecuerdo marked this pull request as ready for review August 1, 2024 17:21
Comment on lines 629 to 567
xml_element=datafield,
subfield_codes=identifier_marc_field["subfields"],
separator=". ",
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, great choice to use named args!

@jonavellecuerdo jonavellecuerdo force-pushed the TIMX-288-marc-field-method-refactor-5 branch from 6da2f04 to 353bf34 Compare August 1, 2024 17:46
Why these changes are being introduced:
* These updates are required to implement the architecture described
in the following ADR: https://github.com/MITLibraries/transmogrifier/blob/main/docs/adrs/0005-field-methods.md

How this addresses that need:
* Clean up docstrings for utility methods
* Rename xml -> source_record in abstract methods
* Use kwargs when >3 parameters
* Use tuples to define MARC field mappings

Side effects of this change:
* None

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/TIMX-288
@jonavellecuerdo jonavellecuerdo force-pushed the TIMX-288-marc-field-method-refactor-5 branch from 353bf34 to bbf688d Compare August 1, 2024 17:48
@jonavellecuerdo jonavellecuerdo merged commit cfa7f1c into main Aug 1, 2024
5 checks passed
@jonavellecuerdo jonavellecuerdo deleted the TIMX-288-marc-field-method-refactor-5 branch August 1, 2024 17:57
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