folio-data-import 0.2.8rc1__py3-none-any.whl → 0.2.8rc3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of folio-data-import might be problematic. Click here for more details.
- folio_data_import/UserImport.py +2 -2
- folio_data_import/marc_preprocessors/_preprocessors.py +55 -2
- {folio_data_import-0.2.8rc1.dist-info → folio_data_import-0.2.8rc3.dist-info}/METADATA +2 -2
- folio_data_import-0.2.8rc3.dist-info/RECORD +11 -0
- {folio_data_import-0.2.8rc1.dist-info → folio_data_import-0.2.8rc3.dist-info}/WHEEL +1 -1
- folio_data_import-0.2.8rc1.dist-info/RECORD +0 -11
- {folio_data_import-0.2.8rc1.dist-info → folio_data_import-0.2.8rc3.dist-info}/LICENSE +0 -0
- {folio_data_import-0.2.8rc1.dist-info → folio_data_import-0.2.8rc3.dist-info}/entry_points.txt +0 -0
folio_data_import/UserImport.py
CHANGED
|
@@ -539,7 +539,7 @@ class UserImporter: # noqa: R0902
|
|
|
539
539
|
and the existing PU object (existing_pu).
|
|
540
540
|
"""
|
|
541
541
|
rp_obj = user_obj.pop("requestPreference", {})
|
|
542
|
-
spu_obj = user_obj.pop("servicePointsUser")
|
|
542
|
+
spu_obj = user_obj.pop("servicePointsUser", {})
|
|
543
543
|
existing_user = await self.get_existing_user(user_obj)
|
|
544
544
|
if existing_user:
|
|
545
545
|
existing_rp = await self.get_existing_rp(user_obj, existing_user)
|
|
@@ -769,7 +769,7 @@ class UserImporter: # noqa: R0902
|
|
|
769
769
|
existing_spu (dict): The existing service-points-user object, if it exists.
|
|
770
770
|
existing_user (dict): The existing user object associated with the spu_obj.
|
|
771
771
|
"""
|
|
772
|
-
if spu_obj
|
|
772
|
+
if spu_obj:
|
|
773
773
|
await self.map_service_points(spu_obj, existing_user)
|
|
774
774
|
if existing_spu:
|
|
775
775
|
await self.update_existing_spu(spu_obj, existing_spu)
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import pymarc
|
|
2
2
|
|
|
3
|
+
def prepend_prefix_001(record: pymarc.Record, prefix: str) -> pymarc.Record:
|
|
4
|
+
"""
|
|
5
|
+
Prepend a prefix to the record's 001 field.
|
|
6
|
+
|
|
7
|
+
Args:
|
|
8
|
+
record (pymarc.Record): The MARC record to preprocess.
|
|
9
|
+
prefix (str): The prefix to prepend to the 001 field.
|
|
10
|
+
|
|
11
|
+
Returns:
|
|
12
|
+
pymarc.Record: The preprocessed MARC record.
|
|
13
|
+
"""
|
|
14
|
+
record['001'].data = f'({prefix})' + record['001'].data
|
|
15
|
+
return record
|
|
16
|
+
|
|
3
17
|
def prepend_ppn_prefix_001(record: pymarc.Record) -> pymarc.Record:
|
|
4
18
|
"""
|
|
5
19
|
Prepend the PPN prefix to the record's 001 field. Useful when
|
|
@@ -11,8 +25,20 @@ def prepend_ppn_prefix_001(record: pymarc.Record) -> pymarc.Record:
|
|
|
11
25
|
Returns:
|
|
12
26
|
pymarc.Record: The preprocessed MARC record.
|
|
13
27
|
"""
|
|
14
|
-
record
|
|
15
|
-
|
|
28
|
+
return prepend_prefix_001(record, 'PPN')
|
|
29
|
+
|
|
30
|
+
def prepend_abes_prefix_001(record: pymarc.Record) -> pymarc.Record:
|
|
31
|
+
"""
|
|
32
|
+
Prepend the ABES prefix to the record's 001 field. Useful when
|
|
33
|
+
importing records from the ABES SUDOC catalog
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
record (pymarc.Record): The MARC record to preprocess.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
pymarc.Record: The preprocessed MARC record.
|
|
40
|
+
"""
|
|
41
|
+
return prepend_prefix_001(record, 'ABES')
|
|
16
42
|
|
|
17
43
|
def strip_999_ff_fields(record: pymarc.Record) -> pymarc.Record:
|
|
18
44
|
"""
|
|
@@ -29,3 +55,30 @@ def strip_999_ff_fields(record: pymarc.Record) -> pymarc.Record:
|
|
|
29
55
|
if field.indicators == pymarc.Indicators(*['f', 'f']):
|
|
30
56
|
record.remove_field(field)
|
|
31
57
|
return record
|
|
58
|
+
|
|
59
|
+
def sudoc_supercede_prep(record: pymarc.Record) -> pymarc.Record:
|
|
60
|
+
"""
|
|
61
|
+
Preprocesses a record from the ABES SUDOC catalog to copy 035 fields
|
|
62
|
+
with a $9 subfield value of 'sudoc' to 935 fields with a $a subfield
|
|
63
|
+
prefixed with "(ABES)". This is useful when importing newly-merged records
|
|
64
|
+
from the SUDOC catalog when you want the new record to replace the old one
|
|
65
|
+
in FOLIO. This also applyes the prepend_ppn_prefix_001 function to the record.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
record (pymarc.Record): The MARC record to preprocess.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
pymarc.Record: The preprocessed MARC record.
|
|
72
|
+
"""
|
|
73
|
+
record = prepend_abes_prefix_001(record)
|
|
74
|
+
for field in record.get_fields('035'):
|
|
75
|
+
if "a" in field and "9" in field and field['9'] == 'sudoc':
|
|
76
|
+
_935 = pymarc.Field(
|
|
77
|
+
tag='935',
|
|
78
|
+
indicators=['f', 'f'],
|
|
79
|
+
subfields=[
|
|
80
|
+
pymarc.field.Subfield('a', "(ABES)" + field['a'])
|
|
81
|
+
]
|
|
82
|
+
)
|
|
83
|
+
record.add_ordered_field(_935)
|
|
84
|
+
return record
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
folio_data_import/MARCDataImport.py,sha256=gFBq6DwghC3hXPkkM-c0XlPjtoZwITVAeEhH8joPIQo,23450
|
|
2
|
+
folio_data_import/UserImport.py,sha256=Y9ZjYoUP_vNJVftx_xUcbBqvC5CwWeuzlmCcSVQfzgo,40976
|
|
3
|
+
folio_data_import/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
folio_data_import/__main__.py,sha256=kav_uUsnrIjGjVxQkk3exLKrc1mah9t2x3G6bGS-5I0,3710
|
|
5
|
+
folio_data_import/marc_preprocessors/__init__.py,sha256=Wt-TKkMhUyZWFS-WhAmbShKQLPjXmHKPb2vL6kvkqVA,72
|
|
6
|
+
folio_data_import/marc_preprocessors/_preprocessors.py,sha256=Y9t6tIFxQdzBYYniBZ3Lq05Ukk-3orAXd4YQaJuGNRA,2786
|
|
7
|
+
folio_data_import-0.2.8rc3.dist-info/LICENSE,sha256=qJX7wxMC7ky9Kq4v3zij8MjGEiC5wsB7pYeOhLj5TDk,1083
|
|
8
|
+
folio_data_import-0.2.8rc3.dist-info/METADATA,sha256=GygGgpBXdH7D9uRxx1ItKbvFuut5T119ujHv1EmlaEg,6115
|
|
9
|
+
folio_data_import-0.2.8rc3.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
|
10
|
+
folio_data_import-0.2.8rc3.dist-info/entry_points.txt,sha256=498SxWVXeEMRNw3PUf-eoReZvKewmYwPBtZhIUPr_Jg,192
|
|
11
|
+
folio_data_import-0.2.8rc3.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
folio_data_import/MARCDataImport.py,sha256=gFBq6DwghC3hXPkkM-c0XlPjtoZwITVAeEhH8joPIQo,23450
|
|
2
|
-
folio_data_import/UserImport.py,sha256=zs0kts3dCY2L0ZdMgtsbT0xrTXabvP3wxd9B75FcWF8,40984
|
|
3
|
-
folio_data_import/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
folio_data_import/__main__.py,sha256=kav_uUsnrIjGjVxQkk3exLKrc1mah9t2x3G6bGS-5I0,3710
|
|
5
|
-
folio_data_import/marc_preprocessors/__init__.py,sha256=Wt-TKkMhUyZWFS-WhAmbShKQLPjXmHKPb2vL6kvkqVA,72
|
|
6
|
-
folio_data_import/marc_preprocessors/_preprocessors.py,sha256=srx36pgY0cwl6_0z6CVOyM_Uzr_g2RObo1jJJjSEZJs,944
|
|
7
|
-
folio_data_import-0.2.8rc1.dist-info/LICENSE,sha256=qJX7wxMC7ky9Kq4v3zij8MjGEiC5wsB7pYeOhLj5TDk,1083
|
|
8
|
-
folio_data_import-0.2.8rc1.dist-info/METADATA,sha256=ofqGY2Z0W50cu5kZTkvLp6IRB2NyBsVyPSkmBA6yf3k,6115
|
|
9
|
-
folio_data_import-0.2.8rc1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
10
|
-
folio_data_import-0.2.8rc1.dist-info/entry_points.txt,sha256=498SxWVXeEMRNw3PUf-eoReZvKewmYwPBtZhIUPr_Jg,192
|
|
11
|
-
folio_data_import-0.2.8rc1.dist-info/RECORD,,
|
|
File without changes
|
{folio_data_import-0.2.8rc1.dist-info → folio_data_import-0.2.8rc3.dist-info}/entry_points.txt
RENAMED
|
File without changes
|