Skip to content

Commit

Permalink
Merge pull request #1461 from sul-dlss/t1458-oclc-mod-marc
Browse files Browse the repository at this point in the history
Sets all 035 indicators to fill character
  • Loading branch information
jermnelson authored Nov 27, 2024
2 parents 84b0d5a + 2ef5f88 commit 30ed7f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libsys_airflow/plugins/data_exports/oclc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ def __mod_040__(field_040: pymarc.Field):

def __oclc_marc_modifications__(marc_record: pymarc.Record) -> pymarc.Record:
"""
Modifies the 007 and 040 fields for new OCLC records. For 007 field,
Modifies the 007, 035, and 040 fields for new OCLC records. For 007 field,
replace any spaces with |. For 040 substitute CSt with STF for all
subfields.
"""
for field in marc_record.get_fields("007"):
__mod_007__(field)
for field in marc_record.get_fields("035"):
field.indicators = pymarc.Indicators(" ", " ")
for field in marc_record.get_fields("040"):
__mod_040__(field)
return marc_record
Expand Down
6 changes: 6 additions & 0 deletions tests/data_exports/test_oclc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def sample_marc_records():
marc_record = pymarc.Record()
marc_record.add_field(
pymarc.Field(tag="007", data="cr un "),
pymarc.Field(
tag="035",
indicators=pymarc.Indicators("1", "0"),
subfields=[pymarc.Subfield("a", "234577")],
),
pymarc.Field(
tag="040",
indicators=pymarc.Indicators(" ", " "),
Expand Down Expand Up @@ -1036,6 +1041,7 @@ def test_oclc_marc_modifications():
mod_record = oclc_api.__oclc_marc_modifications__(sample_records[0])

assert mod_record["007"].value() == "cr un|||||||||"
assert mod_record["035"].indicators == pymarc.Indicators(" ", " ")
assert mod_record["040"]["a"] == "STF"
assert mod_record["040"]["b"] == "eng"

Expand Down

0 comments on commit 30ed7f1

Please sign in to comment.