folio-migration-tools 1.9.0a4__py3-none-any.whl → 1.9.0a5__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.
@@ -24,6 +24,7 @@ from folio_migration_tools.mapping_file_transformation.ref_data_mapping import (
24
24
  RefDataMapping,
25
25
  )
26
26
  from folio_migration_tools.migration_report import MigrationReport
27
+ from folio_migration_tools.task_configuration import AbstractTaskConfiguration
27
28
 
28
29
 
29
30
  class MapperBase:
@@ -42,7 +43,7 @@ class MapperBase:
42
43
  self.start_datetime = datetime.now(timezone.utc)
43
44
  self.folio_client: FolioClient = folio_client
44
45
  self.library_configuration: LibraryConfiguration = library_configuration
45
-
46
+ self.task_configuration: AbstractTaskConfiguration
46
47
  self.mapped_folio_fields: dict = {}
47
48
  self.migration_report: MigrationReport = MigrationReport()
48
49
  self.num_criticalerrors = 0
@@ -267,7 +268,13 @@ class MapperBase:
267
268
  sys.exit(1)
268
269
 
269
270
  def get_id_map_tuple(self, legacy_id: str, folio_record: dict, object_type: FOLIONamespaces):
270
- if object_type == FOLIONamespaces.instances:
271
+ if all(
272
+ [
273
+ object_type == FOLIONamespaces.instances,
274
+ (not getattr(self.task_configuration, "data_import_marc", False)),
275
+ getattr(self.task_configuration, "create_source_records", True),
276
+ ]
277
+ ):
271
278
  return (legacy_id, folio_record["id"], folio_record["hrid"])
272
279
  return (legacy_id, folio_record["id"])
273
280
 
@@ -32,7 +32,7 @@ class MarcFileProcessor:
32
32
  self.created_objects_file = created_objects_file
33
33
  if mapper.task_configuration.create_source_records:
34
34
  self.srs_records_file = open(self.folder_structure.srs_records_path, "w+")
35
- if mapper.task_configuration.data_import_marc:
35
+ if getattr(mapper.task_configuration, "data_import_marc", False):
36
36
  self.data_import_marc_file = open(self.folder_structure.data_import_marc_path, "wb+")
37
37
  self.unique_001s: set = set()
38
38
  self.failed_records_count: int = 0
@@ -87,7 +87,7 @@ class MarcFileProcessor:
87
87
  legacy_ids,
88
88
  self.object_type,
89
89
  )
90
- if self.mapper.task_configuration.data_import_marc:
90
+ if getattr(self.mapper.task_configuration, "data_import_marc", False):
91
91
  self.save_marc_record(
92
92
  marc_record,
93
93
  folio_rec,
@@ -271,7 +271,7 @@ class MarcFileProcessor:
271
271
  if not self.srs_records_file.seek(0):
272
272
  os.remove(self.srs_records_file.name)
273
273
  self.srs_records_file.close()
274
- if self.mapper.task_configuration.data_import_marc:
274
+ if getattr(self.mapper.task_configuration, "data_import_marc", False):
275
275
  self.data_import_marc_file.seek(0)
276
276
  if not self.data_import_marc_file.read(1):
277
277
  os.remove(self.data_import_marc_file.name)
@@ -59,7 +59,7 @@ class BibsRulesMapper(RulesMapperBase):
59
59
  self.instance_relationship_types: dict = {}
60
60
  self.other_mode_of_issuance_id = get_unspecified_mode_of_issuance(self.folio_client)
61
61
  self.create_source_records = all(
62
- [self.task_configuration.create_source_records, (not self.task_configuration.data_import_marc)]
62
+ [self.task_configuration.create_source_records, (not getattr(self.task_configuration, "data_import_marc", False))]
63
63
  )
64
64
  self.data_import_marc = self.task_configuration.data_import_marc
65
65
  self.start = time.time()
@@ -118,7 +118,7 @@ class BibsRulesMapper(RulesMapperBase):
118
118
  bad_tags = set(self.task_configuration.tags_to_delete) # "907"
119
119
  folio_instance = self.perform_initial_preparation(marc_record, legacy_ids)
120
120
  if self.data_import_marc:
121
- self.simple_bib_map(marc_record, folio_instance, ignored_subsequent_fields, legacy_ids)
121
+ self.simple_bib_map(folio_instance, marc_record, ignored_subsequent_fields, legacy_ids)
122
122
  else:
123
123
  for marc_field in marc_record:
124
124
  self.report_marc_stats(marc_field, bad_tags, legacy_ids, ignored_subsequent_fields)
@@ -152,7 +152,13 @@ class BibsRulesMapper(RulesMapperBase):
152
152
  legacy_ids (List[str]): _description_
153
153
  file_def (FileDefinition): _description_
154
154
  """
155
- self.process_marc_field(folio_instnace, marc_record['245'], ignored_subsequent_fields, legacy_ids)
155
+ try:
156
+ self.process_marc_field(folio_instnace, marc_record['245'], ignored_subsequent_fields, legacy_ids)
157
+ except KeyError:
158
+ raise TransformationRecordFailedError(
159
+ legacy_ids,
160
+ "No 245 field in MARC record"
161
+ )
156
162
 
157
163
  def perform_additional_parsing(
158
164
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: folio_migration_tools
3
- Version: 1.9.0a4
3
+ Version: 1.9.0a5
4
4
  Summary: A tool allowing you to migrate data from legacy ILS:s (Library systems) into FOLIO LSP
5
5
  Home-page: https://github.com/FOLIO-FSE/folio_migration_tools
6
6
  License: MIT
@@ -11,7 +11,7 @@ folio_migration_tools/helper.py,sha256=KkOkNAGO_fuYqxdLrsbLzCJLQHUrFZG1NzD4RmpQ-
11
11
  folio_migration_tools/holdings_helper.py,sha256=yJpz6aJrKRBiJ1MtT5bs2vXAc88uJuGh2_KDuCySOKc,7559
12
12
  folio_migration_tools/i18n_config.py,sha256=3AH_2b9zTsxE4XTe4isM_zYtPJSlK0ix6eBmV7kAYUM,228
13
13
  folio_migration_tools/library_configuration.py,sha256=60hgGtyvHhRUKXHvqz41-2V5EtUaySMV20JIKk279N0,3636
14
- folio_migration_tools/mapper_base.py,sha256=46eO9wAxGoXZJC3SI7BNh-X7779SKSM8a8KXqdR9S8Y,19942
14
+ folio_migration_tools/mapper_base.py,sha256=dmwsgeolBWjmzaztms5r1_7OG2PlTcp0D74TQCE6cgk,20303
15
15
  folio_migration_tools/mapping_file_transformation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  folio_migration_tools/mapping_file_transformation/courses_mapper.py,sha256=mJQxxeTn1bCYb2zwFYyXJ6EGZpJ0DsmwOY3nED7D_gQ,8091
17
17
  folio_migration_tools/mapping_file_transformation/holdings_mapper.py,sha256=GI9xnN74EsUMAshXKNJ6p9bGPdLtK0PCXqbB3nIxrC8,7207
@@ -28,11 +28,11 @@ folio_migration_tools/marc_rules_transformation/conditions.py,sha256=MnbMThiOZ6I
28
28
  folio_migration_tools/marc_rules_transformation/holdings_statementsparser.py,sha256=lTb5QWEAgwyFHy5vdSK6oDl1Q5v2GnzuV04xWV3p4rc,12401
29
29
  folio_migration_tools/marc_rules_transformation/hrid_handler.py,sha256=lEvtJFWe5FoU372nHqTdnVF76qCKZjWgUJqIpiKUHY0,10026
30
30
  folio_migration_tools/marc_rules_transformation/loc_language_codes.xml,sha256=ztn2_yKws6qySL4oSsZh7sOjxq5bCC1PhAnXJdtgmJ0,382912
31
- folio_migration_tools/marc_rules_transformation/marc_file_processor.py,sha256=vP6u8BDrf3v5q-scIPEINXYUL223cmreAQ8BUr9WCcM,12292
31
+ folio_migration_tools/marc_rules_transformation/marc_file_processor.py,sha256=WkOQRDi7f4PZ5qmVH3Q-1_zdGEKYSvOGC6jixDwDp98,12349
32
32
  folio_migration_tools/marc_rules_transformation/marc_reader_wrapper.py,sha256=9ATjYMRAjy0QcXtmNZaHVhHLJ5hE1WUgOcF6KMJjbgo,5309
33
33
  folio_migration_tools/marc_rules_transformation/rules_mapper_authorities.py,sha256=GFw8j9UtCxnUdLShmPzJa1MpCK8a0NkQIN5C3jyouRs,9604
34
34
  folio_migration_tools/marc_rules_transformation/rules_mapper_base.py,sha256=WWSJgYvF9LeY8vh-BtQi7Fm3J-cowUJKWa0Wk2Ge7fc,39358
35
- folio_migration_tools/marc_rules_transformation/rules_mapper_bibs.py,sha256=ys27z3PGF0I4RQfTXYB-YMgs-2nyNS3L70mkXEFnwLY,28555
35
+ folio_migration_tools/marc_rules_transformation/rules_mapper_bibs.py,sha256=5BHCEAoTmsJLzG9161Y49-DwA_-Jr44XUGX725-dNKE,28755
36
36
  folio_migration_tools/marc_rules_transformation/rules_mapper_holdings.py,sha256=EBxf9Qh5Y0eDOmqYssWfaizxafiXSYDFzWmCuPtdG-8,18226
37
37
  folio_migration_tools/migration_report.py,sha256=BkRspM1hwTBnWeqsHamf7yVEofzLj560Q-9G--O00hw,4258
38
38
  folio_migration_tools/migration_tasks/__init__.py,sha256=ZkbY_yGyB84Ke8OMlYUzyyBj4cxxNrhMTwQlu_GbdDs,211
@@ -60,7 +60,7 @@ folio_migration_tools/transaction_migration/legacy_request.py,sha256=1ulyFzPQw_I
60
60
  folio_migration_tools/transaction_migration/legacy_reserve.py,sha256=rZVtiMBYnt6aI0WxAwPN8fML_MKEUSUYsadCKPTeB4E,1839
61
61
  folio_migration_tools/transaction_migration/transaction_result.py,sha256=cTdCN0BnlI9_ZJB2Z3Fdkl9gpymIi-9mGZsRFlQcmDk,656
62
62
  folio_migration_tools/translations/en.json,sha256=HOVpkb_T-SN_x0NpDp8gyvV1hMLCui3SsG7ByyIv0OU,38669
63
- folio_migration_tools-1.9.0a4.dist-info/LICENSE,sha256=PhIEkitVi3ejgq56tt6sWoJIG_zmv82cjjd_aYPPGdI,1072
64
- folio_migration_tools-1.9.0a4.dist-info/METADATA,sha256=d0X2DDsYyC0_We_jm13ohilfXLQ_ujWVXejh5WThOis,7318
65
- folio_migration_tools-1.9.0a4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
66
- folio_migration_tools-1.9.0a4.dist-info/RECORD,,
63
+ folio_migration_tools-1.9.0a5.dist-info/LICENSE,sha256=PhIEkitVi3ejgq56tt6sWoJIG_zmv82cjjd_aYPPGdI,1072
64
+ folio_migration_tools-1.9.0a5.dist-info/METADATA,sha256=ohkzY98Ct_djuhK-ks9sFehWfuQCsEE42kOOQQeyDR4,7318
65
+ folio_migration_tools-1.9.0a5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
66
+ folio_migration_tools-1.9.0a5.dist-info/RECORD,,