rara-tools 0.7.10__tar.gz → 0.7.12__tar.gz

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 rara-tools might be problematic. Click here for more details.

Files changed (68) hide show
  1. {rara_tools-0.7.10/rara_tools.egg-info → rara_tools-0.7.12}/PKG-INFO +1 -1
  2. rara_tools-0.7.12/VERSION +1 -0
  3. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/normalizers/authorities.py +6 -1
  4. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/normalizers/base.py +32 -8
  5. rara_tools-0.7.12/rara_tools/normalizers/bibs.py +111 -0
  6. {rara_tools-0.7.10 → rara_tools-0.7.12/rara_tools.egg-info}/PKG-INFO +1 -1
  7. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_normalization.py +58 -23
  8. rara_tools-0.7.10/VERSION +0 -1
  9. rara_tools-0.7.10/rara_tools/normalizers/bibs.py +0 -63
  10. {rara_tools-0.7.10 → rara_tools-0.7.12}/LICENSE.md +0 -0
  11. {rara_tools-0.7.10 → rara_tools-0.7.12}/README.md +0 -0
  12. {rara_tools-0.7.10 → rara_tools-0.7.12}/pyproject.toml +0 -0
  13. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/__init__.py +0 -0
  14. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/digitizer.py +0 -0
  15. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/general.py +0 -0
  16. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/language_evaluator.py +0 -0
  17. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/linker.py +0 -0
  18. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/meta_extractor.py +0 -0
  19. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/normalizers.py +0 -0
  20. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/parsers.py +0 -0
  21. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/constants/subject_indexer.py +0 -0
  22. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/converters.py +0 -0
  23. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/core_formatters/core_formatter.py +0 -0
  24. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/core_formatters/formatted_keyword.py +0 -0
  25. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/core_formatters/formatted_meta.py +0 -0
  26. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/core_formatters/formatted_object.py +0 -0
  27. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/decorators.py +0 -0
  28. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/digar_schema_converter.py +0 -0
  29. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/elastic.py +0 -0
  30. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/exceptions.py +0 -0
  31. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/normalizers/__init__.py +0 -0
  32. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/normalizers/reader.py +0 -0
  33. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/normalizers/viaf.py +0 -0
  34. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_parsers/base_parser.py +0 -0
  35. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_parsers/ems_parser.py +0 -0
  36. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_parsers/location_parser.py +0 -0
  37. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_parsers/organization_parser.py +0 -0
  38. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_parsers/person_parser.py +0 -0
  39. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_parsers/title_parser.py +0 -0
  40. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_records/base_record.py +0 -0
  41. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_records/ems_record.py +0 -0
  42. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_records/organization_record.py +0 -0
  43. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_records/person_record.py +0 -0
  44. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/marc_records/title_record.py +0 -0
  45. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/tools/entity_normalizers.py +0 -0
  46. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/tools/marc_converter.py +0 -0
  47. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/parsers/tools/russian_transliterator.py +0 -0
  48. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/s3.py +0 -0
  49. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/task_reporter.py +0 -0
  50. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools/utils.py +0 -0
  51. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools.egg-info/SOURCES.txt +0 -0
  52. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools.egg-info/dependency_links.txt +0 -0
  53. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools.egg-info/requires.txt +0 -0
  54. {rara_tools-0.7.10 → rara_tools-0.7.12}/rara_tools.egg-info/top_level.txt +0 -0
  55. {rara_tools-0.7.10 → rara_tools-0.7.12}/requirements.txt +0 -0
  56. {rara_tools-0.7.10 → rara_tools-0.7.12}/setup.cfg +0 -0
  57. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_digar_schema_converter.py +0 -0
  58. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_elastic.py +0 -0
  59. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_elastic_vector_and_search_operations.py +0 -0
  60. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_entity_normalizers.py +0 -0
  61. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_formatters.py +0 -0
  62. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_marc_parsers.py +0 -0
  63. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_s3_exceptions.py +0 -0
  64. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_s3_file_operations.py +0 -0
  65. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_sierra_converters.py +0 -0
  66. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_task_reporter.py +0 -0
  67. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_utils.py +0 -0
  68. {rara_tools-0.7.10 → rara_tools-0.7.12}/tests/test_viaf_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rara-tools
3
- Version: 0.7.10
3
+ Version: 0.7.12
4
4
  Summary: Tools to support Kata's work.
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -0,0 +1 @@
1
+ 0.7.12
@@ -59,6 +59,9 @@ class AuthoritiesRecordNormalizer(RecordNormalizer):
59
59
  record, "046", "f", formatted_birth_date)
60
60
  death_date = self.get_subfield(
61
61
  record, "046", "g", formatted_death_date)
62
+
63
+ if not birth_date and not death_date:
64
+ return
62
65
 
63
66
  subfields_046 = [
64
67
  Subfield("f", birth_date),
@@ -117,7 +120,9 @@ class AuthoritiesRecordNormalizer(RecordNormalizer):
117
120
  self._add_author(record, viaf_record)
118
121
 
119
122
  def _normalize_record(self, record: Record, sierraID: str,
120
- viaf_record: VIAFRecord, is_editing_existing_record: bool) -> Record:
123
+ viaf_record: VIAFRecord,
124
+ is_editing_existing_record: bool,
125
+ original_entity: str) -> Record:
121
126
 
122
127
  self._normalize_sierra(record, sierraID)
123
128
  self._normalize_viaf(record, viaf_record)
@@ -213,13 +213,33 @@ class RecordNormalizer:
213
213
  )
214
214
 
215
215
  def _add_fields_to_record(self, record: Record, fields: List[Field]) -> Record:
216
- # filter out subfields that are empty, or 0, as VIAF returns 0 for unknown dates
216
+ cleaned_fields = []
217
+
217
218
  for field in fields:
218
- field.subfields = [sub for sub in field.subfields if sub.value and sub.value not in ["0", 0]]
219
219
 
220
- self._handle_repeatable_fields(record, *fields)
221
- self._handle_editable_fields(record, *fields)
222
- self._handle_default_fields(record, *fields)
220
+ # Always assume control fields cleaned
221
+ if field.tag < "010" and field.tag.isdigit():
222
+ cleaned_fields.append(field)
223
+ continue
224
+
225
+ # filter out subfields that are empty or 0 (VIAF returns 0 for unknown dates)
226
+ field.subfields = [
227
+ sub for sub in field.subfields
228
+ if sub.value and sub.value not in ["0", 0]
229
+ ]
230
+
231
+ # only keep the field if it still has subfields left
232
+ if field.subfields:
233
+ cleaned_fields.append(field)
234
+
235
+ if not cleaned_fields:
236
+ return record
237
+
238
+ self._handle_repeatable_fields(record, *cleaned_fields)
239
+ self._handle_editable_fields(record, *cleaned_fields)
240
+ self._handle_default_fields(record, *cleaned_fields)
241
+
242
+ return record
223
243
 
224
244
  def _add_author(self, record: Record, viaf_record: VIAFRecord) -> Optional[Field]:
225
245
 
@@ -360,7 +380,7 @@ class RecordNormalizer:
360
380
  return viaf_record
361
381
 
362
382
  def _normalize_record(self, record: Record, sierraID: str,
363
- viaf_record: VIAFRecord, is_editing_existing_record: bool) -> Record:
383
+ viaf_record: VIAFRecord, is_editing_existing_record: bool, original_entity: str) -> Record:
364
384
  return record
365
385
 
366
386
  @property
@@ -374,7 +394,11 @@ class RecordNormalizer:
374
394
  logger.error(f"Failed to normalize record: {e}")
375
395
  continue
376
396
  return result
377
-
397
+
398
+ @property
399
+ def first(self) -> Record:
400
+ return next(iter(self))
401
+
378
402
  def __iter__(self) -> Iterator:
379
403
  viaf_id_path = "viaf.queryResult.records.record.0.recordData.VIAFCluster.viafID"
380
404
  sierra_id_path = "sierraID"
@@ -391,7 +415,7 @@ class RecordNormalizer:
391
415
  record = self._normalize_common(record, is_editing_existing_record)
392
416
 
393
417
  normalized_record = self._normalize_record(
394
- record, sierra_id, viaf_record, is_editing_existing_record)
418
+ record, sierra_id, viaf_record, is_editing_existing_record, original_entity=entity)
395
419
 
396
420
  normalized_record.fields.sort(key=lambda field: field.tag)
397
421
 
@@ -0,0 +1,111 @@
1
+ from pymarc import (Field, Subfield, Record)
2
+ from typing import List, Optional
3
+
4
+ from rara_tools.constants import EMPTY_INDICATORS
5
+ from rara_tools.normalizers.viaf import VIAFRecord
6
+ from rara_tools.normalizers import RecordNormalizer
7
+
8
+ from typing import List
9
+
10
+
11
+ class BibRecordNormalizer(RecordNormalizer):
12
+ """ Normalize bib records. """
13
+
14
+ def __init__(self, linking_results: List[dict] = [], sierra_data: List[dict] = [],
15
+ ALLOW_EDIT_FIELDS: List[str] = ["008", "925"],
16
+ REPEATABLE_FIELDS: List[str] = ["667"]):
17
+ super().__init__(linking_results, sierra_data)
18
+ self.DEFAULT_LEADER = "00399nz a2200145n 4500" # must be 24 digits
19
+ self.ALLOW_EDIT_FIELDS = ALLOW_EDIT_FIELDS
20
+ self.REPEATABLE_FIELDS = REPEATABLE_FIELDS
21
+
22
+ self.records_extra_data = []
23
+ self.sierra_data = sierra_data
24
+ self.records = self._setup_records(linking_results, sierra_data)
25
+
26
+ def _normalize_sierra(self, record: Record) -> Record:
27
+
28
+ suffix_008 = "|||aznnnaabn || ||| "
29
+
30
+ fields = [
31
+ Field(
32
+ tag="008",
33
+ data=f"{self.current_timestamp()}{suffix_008}"
34
+ ),
35
+ ]
36
+
37
+ self._add_fields_to_record(record, fields)
38
+
39
+ def _include_name_variations(self, record: Record, viaf_record: VIAFRecord) -> None:
40
+ """ Include name variations from VIAF record as 400|t fields """
41
+
42
+ if not viaf_record or not viaf_record.name_variations:
43
+ return
44
+
45
+ existing_name_variations = record.get_fields("400")
46
+ existing_variations = [sf.value for field in existing_name_variations for sf in field.get_subfields("t")]
47
+
48
+ fields = []
49
+
50
+ for variation in viaf_record.name_variations:
51
+ if variation not in existing_variations:
52
+ fields.append(
53
+ Field(
54
+ tag="400",
55
+ indicators=EMPTY_INDICATORS,
56
+ subfields=[
57
+ Subfield("t", variation)
58
+ ]
59
+ )
60
+ )
61
+
62
+ self._add_fields_to_record(record, fields)
63
+
64
+ def _add_author(self, record: Record, viaf_record: Optional[VIAFRecord], original_entity: str) -> Optional[Field]:
65
+ if record.get("100") or record.get("110") or record.get("111"):
66
+ return record
67
+
68
+ type_map = {
69
+ "Personal": "100",
70
+ "Corporate": "110",
71
+ "Collective": "111"
72
+ }
73
+
74
+ tag = type_map.get(getattr(viaf_record, "name_type", None), "100")
75
+ title = getattr(viaf_record, "name", None) or original_entity
76
+
77
+ fields = [Field(tag=tag, indicators=EMPTY_INDICATORS, subfields=[Subfield("t", title)])]
78
+
79
+ self._add_fields_to_record(record, fields)
80
+
81
+ if viaf_record:
82
+ self._include_name_variations(record, viaf_record)
83
+
84
+ def _normalize_viaf(self, record: Record, viaf_record: VIAFRecord, original_entity: str) -> None:
85
+
86
+ if not viaf_record:
87
+ # viaf record not found, include original entity as 100|t
88
+ self._add_author(record, viaf_record=None, original_entity=original_entity)
89
+ return record
90
+
91
+ viaf_id = viaf_record.viaf_id
92
+ fields = [
93
+ Field(
94
+ tag="035",
95
+ indicators=EMPTY_INDICATORS,
96
+ subfields=[
97
+ Subfield("a", viaf_id)
98
+ ]
99
+ )
100
+ ]
101
+
102
+ self._add_fields_to_record(record, fields)
103
+ self._add_author(record, viaf_record, original_entity=original_entity)
104
+
105
+ def _normalize_record(self, record: Record, sierraID: str,
106
+ viaf_record: VIAFRecord, is_editing_existing_record: bool, original_entity: str) -> Record:
107
+
108
+ self._normalize_sierra(record)
109
+ self._normalize_viaf(record, viaf_record, original_entity=original_entity)
110
+
111
+ return record
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rara-tools
3
- Version: 0.7.10
3
+ Version: 0.7.12
4
4
  Summary: Tools to support Kata's work.
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -404,6 +404,17 @@ def test_add_birth_and_death_dates():
404
404
  # empty indicators represented with \
405
405
  assert field_046 == "=046 \\\\$f19700817"
406
406
 
407
+ # Case 3 - viaf record has no birth or death date
408
+ viaf_record = normalizer._get_viaf_record(
409
+ record,
410
+ entity="Eesti Interlingvistika Selts"
411
+ )
412
+ record = Record()
413
+ normalizer._add_birth_and_death_dates(record, viaf_record)
414
+ # should not add 046 field
415
+ fields_046 = record.get_fields("046")
416
+ assert len(fields_046) == 0
417
+
407
418
  def test_add_nationality():
408
419
  """ Test adding nationality from VIAF record to 043 field """
409
420
 
@@ -456,7 +467,7 @@ def test_add_nationality():
456
467
  # Case 4 - 043 field already exists - should not get edited (not in ALLOW_EDIT_FIELDS)
457
468
  linking_results = [{
458
469
  "original_entity": "Eduard Vilde",
459
- "entity_type": "PER",
470
+ "entity_type": EntityType.PER,
460
471
  "linked_info": [
461
472
  {
462
473
  "json": {
@@ -482,12 +493,7 @@ def test_add_nationality():
482
493
  normalizer = AuthoritiesRecordNormalizer(
483
494
  linking_results=linking_results,
484
495
  )
485
- records = JSONReader(
486
- json.dumps(normalizer.data, ensure_ascii=False)
487
- )
488
-
489
- record = next(iter(records))
490
-
496
+ record = normalizer.first
491
497
  # mock run add nationality with foreign VIAF record
492
498
  viaf_record = normalizer._get_viaf_record(
493
499
  record,
@@ -519,9 +525,7 @@ def test_create_new_normrecord():
519
525
  data = normalizer.data
520
526
  assert len(data) == 1
521
527
 
522
- record = next(iter(JSONReader(
523
- json.dumps(normalizer.data, ensure_ascii=False)
524
- )))
528
+ record = normalizer.first
525
529
  leader = str(record.leader)
526
530
  assert leader == "01682nz a2200349n 4500"
527
531
  assert len(leader) == 24
@@ -534,9 +538,7 @@ def test_create_new_normrecord():
534
538
  normalizer = AuthoritiesRecordNormalizer(linking_results=linking_results)
535
539
  data = normalizer.data
536
540
  assert len(data) == 1
537
- record = next(iter(JSONReader(
538
- json.dumps(normalizer.data, ensure_ascii=False)
539
- )))
541
+ record = normalizer.first
540
542
 
541
543
  _validate_new_record_notes(record)
542
544
  # validate leader
@@ -552,9 +554,7 @@ def test_create_new_normrecord():
552
554
  normalizer = BibRecordNormalizer(linking_results=linking_results)
553
555
  data = normalizer.data
554
556
  assert len(data) == 1
555
- record = next(iter(JSONReader(
556
- json.dumps(normalizer.data, ensure_ascii=False)
557
- )))
557
+ record = normalizer.first
558
558
 
559
559
  _validate_new_record_notes(record)
560
560
  # validate leader
@@ -571,9 +571,7 @@ def test_create_new_normrecord():
571
571
  normalizer = BibRecordNormalizer(linking_results=linking_results)
572
572
  data = normalizer.data
573
573
  assert len(data) == 1
574
- record = next(iter(JSONReader(
575
- json.dumps(normalizer.data, ensure_ascii=False)
576
- )))
574
+ record = normalizer.first
577
575
 
578
576
  def test_680_field_on_existing_record_moved_to_667():
579
577
  """ 680 Should not be added for new, if exists on existing record, should be moved to 667 """
@@ -604,9 +602,7 @@ def test_680_field_on_existing_record_moved_to_667():
604
602
  normalizer = AuthoritiesRecordNormalizer(
605
603
  linking_results=linking_results
606
604
  )
607
- record = next(iter(JSONReader(
608
- json.dumps(normalizer.data, ensure_ascii=False)
609
- )))
605
+ record = normalizer.first
610
606
 
611
607
  fields_680 = record.get_fields("680")
612
608
  assert len(fields_680) == 0
@@ -630,4 +626,43 @@ def test_date_formatting():
630
626
  # invalid date formats - should return empty string
631
627
  invalid_dates = ["abcd", "199A0101"]
632
628
  for date in invalid_dates:
633
- assert normalizer._format_date(date) == ""
629
+ assert normalizer._format_date(date) == ""
630
+
631
+ def test_new_bibrecord_title_included():
632
+ """ normrecord for bibs has to always have the 1XX|t field filled """
633
+
634
+ # Case 1 No linker response, & Viaf record found
635
+ linking_results = [{
636
+ "original_entity": "Lord of the Rings",
637
+ "entity_type": EntityType.TITLE,
638
+ "linked_info": []
639
+ }]
640
+
641
+ normalizer = BibRecordNormalizer(
642
+ linking_results=linking_results,
643
+ )
644
+ data = normalizer.data
645
+ assert len(data) == 1 # should enrich existing record
646
+ record = normalizer.first
647
+
648
+ _validate_new_record_notes(record)
649
+ fields_100 = record.get_fields("100")
650
+ assert len(fields_100) == 1
651
+ assert fields_100[0].get_subfields("t")[0] == "Lord of the rings"
652
+
653
+ # Case 2 - Viaf record not found - should use original entity
654
+ linking_results = [{
655
+ "original_entity": "Roolijoodiku katastroofiline jõulusõit",
656
+ "entity_type": EntityType.TITLE,
657
+ "linked_info": []
658
+ }]
659
+ normalizer = BibRecordNormalizer(
660
+ linking_results=linking_results,
661
+ )
662
+ record = normalizer.first
663
+ data = normalizer.data
664
+ assert len(data) == 1 # should enrich existing record
665
+
666
+ fields_100 = record.get_fields("100")
667
+ assert len(fields_100) == 1
668
+ assert fields_100[0].get_subfields("t")[0] == "Roolijoodiku katastroofiline jõulusõit"
rara_tools-0.7.10/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.7.10
@@ -1,63 +0,0 @@
1
- from pymarc import (Field, Subfield, Record)
2
-
3
- from rara_tools.constants import EMPTY_INDICATORS
4
- from rara_tools.normalizers.viaf import VIAFRecord
5
- from rara_tools.normalizers import RecordNormalizer
6
-
7
- from typing import List
8
-
9
-
10
- class BibRecordNormalizer(RecordNormalizer):
11
- """ Normalize bib records. """
12
-
13
- def __init__(self, linking_results: List[dict] = [], sierra_data: List[dict] = [],
14
- ALLOW_EDIT_FIELDS: List[str] = ["008", "925"],
15
- REPEATABLE_FIELDS: List[str] = ["667"]):
16
- super().__init__(linking_results, sierra_data)
17
- self.DEFAULT_LEADER = "00399nz a2200145n 4500" # must be 24 digits
18
- self.ALLOW_EDIT_FIELDS = ALLOW_EDIT_FIELDS
19
- self.REPEATABLE_FIELDS = REPEATABLE_FIELDS
20
-
21
- self.records_extra_data = []
22
- self.sierra_data = sierra_data
23
- self.records = self._setup_records(linking_results, sierra_data)
24
-
25
- def _normalize_sierra(self, record: Record) -> Record:
26
-
27
- suffix_008 = "|||aznnnaabn || ||| "
28
-
29
- fields = [
30
- Field(
31
- tag="008",
32
- data=f"{self.current_timestamp()}{suffix_008}"
33
- ),
34
- ]
35
-
36
- self._add_fields_to_record(record, fields)
37
-
38
- def _normalize_viaf(self, record: Record, viaf_record: VIAFRecord) -> None:
39
-
40
- if not viaf_record:
41
- return record
42
-
43
- viaf_id = viaf_record.viaf_id
44
- fields = [
45
- Field(
46
- tag="035",
47
- indicators=EMPTY_INDICATORS,
48
- subfields=[
49
- Subfield("a", viaf_id)
50
- ]
51
- )
52
- ]
53
-
54
- self._add_fields_to_record(record, fields)
55
- self._add_author(record, viaf_record)
56
-
57
- def _normalize_record(self, record: Record, sierraID: str,
58
- viaf_record: VIAFRecord, is_editing_existing_record: bool) -> Record:
59
-
60
- self._normalize_sierra(record)
61
- self._normalize_viaf(record, viaf_record)
62
-
63
- return record
File without changes
File without changes
File without changes
File without changes