Skip to content

Commit

Permalink
Updates based on discussion in PR #45
Browse files Browse the repository at this point in the history
* Switch collection and location crosswalk files
* Switch collection and location fields in holdings extraction code
* Remove subfield k from 986 note extraction code
* Update unit test values and fixtures
  • Loading branch information
ehanson8 committed Jan 10, 2023
1 parent 0fb22fa commit ed519ef
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 76 deletions.
58 changes: 38 additions & 20 deletions config/holdings_collection_crosswalk.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
{
"HUM": "Hayden Library",
"RBR": "Hayden Library",
"SCI": "Hayden Library",
"MIT50": "MIT Administrative Library",
"ARC": "Institute Archives",
"ACQ": "Institute Archives",
"ENG": "Barker Library",
"CAT": "Cataloging and Metadata Services",
"DEW": "Dewey Library",
"DIR": "Director's Office",
"DOC": "Document Services",
"ILB": "Interlibrary Borrowing",
"LSA": "Library Storage Annex",
"NET": "Internet Resource",
"MUS": "Lewis Music Library",
"PHY": "Physics Department Reading Room",
"RTC": "Rotch Library",
"RVC": "Rotch Visual Collections",
"SPC": "Space Cntr: Ask library staff",
"OFFIC": "Office delivery"
"STACK": "Stacks",
"ATLCS": "Atlas Case",
"AUDBK": "Audiobooks",
"JRNAL": "Journal Collection",
"BRWS": "Browsery",
"CNSUS": "Census Collection",
"CIRCD": "Service Desk",
"DETEC": "Detective Fiction Collection",
"EJ": "Electronic Journal",
"GIS": "GIS Collection",
"GOV": "Government Documents",
"GRNVL": "Graphic Novel Collection",
"HDCBX": "Harvard Depository Boxed Items",
"ICPSR": "ICPSR Codebooks",
"IMPLS": "Impulse Borrowing Display",
"LSA4": "Journal Collection",
"OVRSZ": "Oversize Materials",
"LMTED": "Limited Access Collection",
"MAPRM": "Map Room",
"MFORM": "Microforms",
"MEDIA": "Media",
"NCIP": "BLC ILB Item",
"NEWBK": "Science New Books Display",
"NOLN1": "Noncirculating Collection 1",
"NOLN2": "Noncirculating Collection 2",
"NOLN3": "Noncirculating Collection 3",
"OCC": "Off Campus Collection",
"OCCBX": "Off Campus Collection Boxed Items",
"OFFCT": "Offsite Cataloging",
"PAMPH": "Pamphlet Collection",
"PRECT": "Pre-cataloged Collection",
"REF": "Reference Collection",
"RSERV": "Reserve Stacks",
"SWING": "Basement Grammar Books",
"TRAVL": "Travel Collection",
"UNCAT": "Uncataloged Materials - see Librarian",
"UNKNW": "Problems Materials - see Librarian",
"WSTM": "Women in Science, Technology, and Medicine"
}
58 changes: 20 additions & 38 deletions config/holdings_location_crosswalk.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
{
"STACK": "Stacks",
"ATLCS": "Atlas Case",
"AUDBK": "Audiobooks",
"JRNAL": "Journal Collection",
"BRWS": "Browsery",
"CNSUS": "Census Collection",
"CIRCD": "Service Desk",
"DETEC": "Detective Fiction Collection",
"EJ": "Electronic Journal",
"GIS": "GIS Collection",
"GOV": "Government Documents",
"GRNVL": "Graphic Novel Collection",
"HDCBX": "Harvard Depository Boxed Items",
"ICPSR": "ICPSR Codebooks",
"IMPLS": "Impulse Borrowing Display",
"LSA4": "Journal Collection",
"OVRSZ": "Oversize Materials",
"LMTED": "Limited Access Collection",
"MAPRM": "Map Room",
"MFORM": "Microforms",
"MEDIA": "Media",
"NCIP": "BLC ILB Item",
"NEWBK": "Science New Books Display",
"NOLN1": "Noncirculating Collection 1",
"NOLN2": "Noncirculating Collection 2",
"NOLN3": "Noncirculating Collection 3",
"OCC": "Off Campus Collection",
"OCCBX": "Off Campus Collection Boxed Items",
"OFFCT": "Offsite Cataloging",
"PAMPH": "Pamphlet Collection",
"PRECT": "Pre-cataloged Collection",
"REF": "Reference Collection",
"RSERV": "Reserve Stacks",
"SWING": "Basement Grammar Books",
"TRAVL": "Travel Collection",
"UNCAT": "Uncataloged Materials - see Librarian",
"UNKNW": "Problems Materials - see Librarian",
"WSTM": "Women in Science, Technology, and Medicine"
"HUM": "Hayden Library",
"RBR": "Hayden Library",
"SCI": "Hayden Library",
"MIT50": "MIT Administrative Library",
"ARC": "Institute Archives",
"ACQ": "Institute Archives",
"ENG": "Barker Library",
"CAT": "Cataloging and Metadata Services",
"DEW": "Dewey Library",
"DIR": "Director's Office",
"DOC": "Document Services",
"ILB": "Interlibrary Borrowing",
"LSA": "Library Storage Annex",
"NET": "Internet Resource",
"MUS": "Lewis Music Library",
"PHY": "Physics Department Reading Room",
"RTC": "Rotch Library",
"RVC": "Rotch Visual Collections",
"SPC": "Space Cntr: Ask library staff",
"OFFIC": "Office delivery"
}
Original file line number Diff line number Diff line change
Expand Up @@ -848,23 +848,29 @@
<subfield code="g"></subfield>
<subfield code="bb"></subfield>
<subfield code="i"></subfield>
<subfield code="aa">aa</subfield>
<subfield code="t">t</subfield>
</datafield>
<datafield tag="985" ind1=" " ind2=" ">
<subfield></subfield>
<subfield code=""></subfield>
<subfield code="aa">BRWS</subfield>
<subfield code="t">VHS</subfield>
<subfield code="g">g</subfield>
<subfield code="bb">bb</subfield>
<subfield code="i">i</subfield>
<subfield code="i">HUM</subfield>
</datafield>
<datafield tag="986" ind1=" " ind2=" ">
<subfield></subfield>
<subfield code=""></subfield>
<subfield code="f"></subfield>
<subfield code="i"></subfield>
<subfield code="j"></subfield>
<subfield code="k"></subfield>
</datafield>
<datafield tag="986" ind1=" " ind2=" ">
<subfield></subfield>
<subfield code=""></subfield>
<subfield code="f">f</subfield>
<subfield code="i">i</subfield>
<subfield code="j">j</subfield>
<subfield code="k">k</subfield>
</datafield>
</record>
</collection>
21 changes: 13 additions & 8 deletions tests/test_marc.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ def test_marc_record_all_fields_transform_correctly():
holdings=[
timdex.Holding(
call_number="PL2687.L8.A28 1994",
collection="Hayden Library",
collection="Stacks",
format="Print volume",
location="Stacks",
location="Hayden Library",
),
timdex.Holding(
call_number="QD79.C4.C485 1983",
collection="Library Storage Annex",
collection="Off Campus Collection",
format="Print volume",
location="Off Campus Collection",
location="Library Storage Annex",
note="pt.A",
),
timdex.Holding(
Expand All @@ -170,7 +170,7 @@ def test_marc_record_all_fields_transform_correctly():
location=(
"http://BLCMIT.NaxosMusicLibrary.com/catalogue/item.asp?cid=ACC24383"
),
note="Available from 06/01/2001 volume: 1 issue: 1., HeinOnline",
note="Available from 06/01/2001 volume: 1 issue: 1.",
),
timdex.Holding(
collection=(
Expand All @@ -181,7 +181,6 @@ def test_marc_record_all_fields_transform_correctly():
location=(
"http://BLCMIT.NaxosMusicLibrary.com/catalogue/item.asp?cid=19029653"
),
note="Alexander Street Press Parent Record",
),
],
identifiers=[
Expand Down Expand Up @@ -525,12 +524,18 @@ def test_marc_record_attribute_and_subfield_variations_transforms_correctly():
dates=[timdex.Date(kind="Publication date", value="2016")],
edition="a b",
holdings=[
timdex.Holding(call_number="bb", note="g"),
timdex.Holding(
call_number="bb",
collection="Browsery",
format="VHS",
location="Hayden Library",
note="g",
),
timdex.Holding(
collection="j",
format="electronic resource",
location="f",
note="i, k",
note="i",
),
],
identifiers=[
Expand Down
10 changes: 5 additions & 5 deletions transmogrifier/sources/marc.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ def get_optional_fields(self, xml: Tag) -> dict:
self.create_subfield_value_string_from_datafield(datafield, ["bb"])
)
holding_collection_value = Marc.json_crosswalk_code_to_name(
self.create_subfield_value_string_from_datafield(datafield, "i"),
self.create_subfield_value_string_from_datafield(datafield, ["aa"]),
holdings_collection_crosswalk,
record_id,
"985 $i",
"985 $aa",
)
holding_format_value = Marc.json_crosswalk_code_to_name(
self.create_subfield_value_string_from_datafield(datafield, "t"),
Expand All @@ -243,10 +243,10 @@ def get_optional_fields(self, xml: Tag) -> dict:
"985 $t",
)
holding_location_value = Marc.json_crosswalk_code_to_name(
self.create_subfield_value_string_from_datafield(datafield, ["aa"]),
self.create_subfield_value_string_from_datafield(datafield, "i"),
holdings_location_crosswalk,
record_id,
"985 $aa",
"985 $i",
)
holding_note_value = self.create_subfield_value_string_from_datafield(
datafield, "g", ", "
Expand Down Expand Up @@ -275,7 +275,7 @@ def get_optional_fields(self, xml: Tag) -> dict:
datafield, "f", ", "
)
holding_note_value = self.create_subfield_value_string_from_datafield(
datafield, "ik", ", "
datafield, "i", ", "
)
if holding_collection_value or holding_location_value or holding_note_value:
fields.setdefault("holdings", []).append(
Expand Down

0 comments on commit ed519ef

Please sign in to comment.