folio-data-import 0.2.8rc2__py3-none-any.whl → 0.2.8rc4__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.

@@ -165,7 +165,7 @@ class MARCImportJob:
165
165
  "=PREPARING_FOR_PREVIEW&uiStatusAny=READY_FOR_PREVIEW&uiStatusAny=RUNNING&limit=50"
166
166
  )
167
167
  self.current_retry_timeout = None
168
- except httpx.ConnectTimeout:
168
+ except (httpx.ConnectTimeout, httpx.ReadTimeout):
169
169
  sleep(.25)
170
170
  with httpx.Client(
171
171
  timeout=self.current_retry_timeout,
@@ -496,7 +496,7 @@ class MARCImportJob:
496
496
  f"/metadata-provider/jobSummary/{self.job_id}"
497
497
  )
498
498
  self.current_retry_timeout = None
499
- except httpx.ReadTimeout: #
499
+ except (httpx.ConnectTimeout, httpx.ReadTimeout):
500
500
  sleep(.25)
501
501
  with httpx.Client(
502
502
  timeout=self.current_retry_timeout,
@@ -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['001'].data = '(PPN)' + record['001'].data
15
- return record
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
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: folio_data_import
3
- Version: 0.2.8rc2
3
+ Version: 0.2.8rc4
4
4
  Summary: A python module to interact with the data importing capabilities of the open-source FOLIO ILS
5
5
  License: MIT
6
6
  Author: Brooks Travis
@@ -0,0 +1,11 @@
1
+ folio_data_import/MARCDataImport.py,sha256=DFAHFurz5ijTqRwYU1SS3vMVdAVE4OD7ukYnAsRBPyU,23492
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.8rc4.dist-info/LICENSE,sha256=qJX7wxMC7ky9Kq4v3zij8MjGEiC5wsB7pYeOhLj5TDk,1083
8
+ folio_data_import-0.2.8rc4.dist-info/METADATA,sha256=8-UXb7KtUNZ4dza7XzazE98L4NVnYu5x5IMRBHnNKx8,6115
9
+ folio_data_import-0.2.8rc4.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
10
+ folio_data_import-0.2.8rc4.dist-info/entry_points.txt,sha256=498SxWVXeEMRNw3PUf-eoReZvKewmYwPBtZhIUPr_Jg,192
11
+ folio_data_import-0.2.8rc4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,11 +0,0 @@
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=srx36pgY0cwl6_0z6CVOyM_Uzr_g2RObo1jJJjSEZJs,944
7
- folio_data_import-0.2.8rc2.dist-info/LICENSE,sha256=qJX7wxMC7ky9Kq4v3zij8MjGEiC5wsB7pYeOhLj5TDk,1083
8
- folio_data_import-0.2.8rc2.dist-info/METADATA,sha256=KJHfmLLY-_U7EhZwxgtsTCRwpkIBUai7vyxwIQVmWP8,6115
9
- folio_data_import-0.2.8rc2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
10
- folio_data_import-0.2.8rc2.dist-info/entry_points.txt,sha256=498SxWVXeEMRNw3PUf-eoReZvKewmYwPBtZhIUPr_Jg,192
11
- folio_data_import-0.2.8rc2.dist-info/RECORD,,