rara-tools 0.6.12__tar.gz → 0.6.13__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.
- {rara_tools-0.6.12/rara_tools.egg-info → rara_tools-0.6.13}/PKG-INFO +1 -1
- rara_tools-0.6.13/VERSION +1 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_records/organization_record.py +20 -10
- {rara_tools-0.6.12 → rara_tools-0.6.13/rara_tools.egg-info}/PKG-INFO +1 -1
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_marc_parsers.py +15 -3
- rara_tools-0.6.12/VERSION +0 -1
- {rara_tools-0.6.12 → rara_tools-0.6.13}/LICENSE.md +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/README.md +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/pyproject.toml +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/__init__.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/digitizer.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/general.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/language_evaluator.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/linker.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/meta_extractor.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/normalizers.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/parsers.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/constants/subject_indexer.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/converters.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/decorators.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/digar_schema_converter.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/elastic.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/exceptions.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/normalizers/__init__.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/normalizers/authorities.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/normalizers/base.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/normalizers/bibs.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/normalizers/viaf.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_parsers/base_parser.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_parsers/ems_parser.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_parsers/location_parser.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_parsers/organization_parser.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_parsers/person_parser.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_parsers/title_parser.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_records/base_record.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_records/ems_record.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_records/person_record.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_records/title_record.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/tools/entity_normalizers.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/tools/marc_converter.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/tools/russian_transliterator.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/s3.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/task_reporter.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/utils.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools.egg-info/SOURCES.txt +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools.egg-info/dependency_links.txt +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools.egg-info/requires.txt +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools.egg-info/top_level.txt +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/requirements.txt +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/setup.cfg +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_digar_schema_converter.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_elastic.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_elastic_vector_and_search_operations.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_entity_normalizers.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_normalization.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_s3_exceptions.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_s3_file_operations.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_sierra_converters.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_task_reporter.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_utils.py +0 -0
- {rara_tools-0.6.12 → rara_tools-0.6.13}/tests/test_viaf_client.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.6.13
|
{rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_records/organization_record.py
RENAMED
|
@@ -6,13 +6,8 @@ import regex as re
|
|
|
6
6
|
import json
|
|
7
7
|
|
|
8
8
|
# TODO: indikaatorid ind1 väljadel 100 ja 400?
|
|
9
|
-
"""
|
|
10
|
-
|c asutuse konverentsi toimumise koht (MK)
|
|
11
9
|
|
|
12
|
-
|d asutuse konverentsi toimumise aeg (K)
|
|
13
10
|
|
|
14
|
-
|n asutuse konverentsi järjenumber (K)
|
|
15
|
-
"""
|
|
16
11
|
class OrganizationRecord(BaseRecord):
|
|
17
12
|
""" Generates a simplified organization JSON record
|
|
18
13
|
from a pymarc MARC record.
|
|
@@ -45,6 +40,7 @@ class OrganizationRecord(BaseRecord):
|
|
|
45
40
|
self.__name_specification: str = ""
|
|
46
41
|
self.__dates: str = ""
|
|
47
42
|
self.__location: str = ""
|
|
43
|
+
self.__numeration: str = ""
|
|
48
44
|
self.__name_variations: List[str] = []
|
|
49
45
|
self.__source: str = ""
|
|
50
46
|
self.__description: str = ""
|
|
@@ -61,7 +57,10 @@ class OrganizationRecord(BaseRecord):
|
|
|
61
57
|
|
|
62
58
|
|
|
63
59
|
def _clean_value(self, value: str) -> str:
|
|
64
|
-
|
|
60
|
+
try:
|
|
61
|
+
cleaned_value = value.strip("., ")
|
|
62
|
+
except Exception as e:
|
|
63
|
+
cleaned_value = ""
|
|
65
64
|
return cleaned_value
|
|
66
65
|
|
|
67
66
|
def _merge_and_clean(self, value: dict, keys: List[str]) -> str:
|
|
@@ -103,10 +102,10 @@ class OrganizationRecord(BaseRecord):
|
|
|
103
102
|
if not self.__dates:
|
|
104
103
|
values = self.get_values(
|
|
105
104
|
marc_ids=self.__name_field_id,
|
|
106
|
-
subfield_id=
|
|
105
|
+
subfield_id="d"
|
|
107
106
|
)
|
|
108
107
|
if values:
|
|
109
|
-
self.__dates = self.
|
|
108
|
+
self.__dates = self._clean_value(values[0])
|
|
110
109
|
return self.__dates
|
|
111
110
|
|
|
112
111
|
@property
|
|
@@ -114,12 +113,23 @@ class OrganizationRecord(BaseRecord):
|
|
|
114
113
|
if not self.__location:
|
|
115
114
|
values = self.get_values(
|
|
116
115
|
marc_ids=self.__name_field_id,
|
|
117
|
-
subfield_id=
|
|
116
|
+
subfield_id="c"
|
|
118
117
|
)
|
|
119
118
|
if values:
|
|
120
|
-
self.__location = self.
|
|
119
|
+
self.__location = self._clean_value(values[0])
|
|
121
120
|
return self.__location
|
|
122
121
|
|
|
122
|
+
@property
|
|
123
|
+
def numeration(self) -> str:
|
|
124
|
+
if not self.__numeration:
|
|
125
|
+
values = self.get_values(
|
|
126
|
+
marc_ids=self.__name_field_id,
|
|
127
|
+
subfield_id="n"
|
|
128
|
+
)
|
|
129
|
+
if values:
|
|
130
|
+
self.__numeration = self._clean_value(values[0])
|
|
131
|
+
return self.__numeration
|
|
132
|
+
|
|
123
133
|
@property
|
|
124
134
|
def acronyms(self) -> List[str]:
|
|
125
135
|
if not self.__acronyms:
|
|
@@ -6,6 +6,7 @@ from rara_tools.parsers.marc_parsers.organization_parser import OrganizationsMAR
|
|
|
6
6
|
from rara_tools.parsers.marc_parsers.location_parser import LocationMARCParser
|
|
7
7
|
from rara_tools.parsers.marc_parsers.title_parser import TitlesMARCParser
|
|
8
8
|
from rara_tools.parsers.marc_records.person_record import PersonRecord
|
|
9
|
+
from rara_tools.parsers.marc_records.organization_record import OrganizationRecord
|
|
9
10
|
from tests.test_utils import read_json_file
|
|
10
11
|
|
|
11
12
|
ROOT_DIR = os.path.join("tests", "test_data", "marc_records")
|
|
@@ -15,7 +16,8 @@ EMS_TEST_FILE = os.path.join(MARC_ROOT_DIR, "ems_test_subset.mrc")
|
|
|
15
16
|
PER_TEST_FILE = os.path.join(MARC_ROOT_DIR, "per_test_subset.mrc")
|
|
16
17
|
ORG_TEST_FILE = os.path.join(MARC_ROOT_DIR, "org_test_subset.mrc")
|
|
17
18
|
TITLE_TEST_FILE = os.path.join(MARC_ROOT_DIR, "title_test_subset.mrc")
|
|
18
|
-
|
|
19
|
+
PER_JSON_TEST_FILE = os.path.join(JSON_ROOT_DIR, "per_marc_json_record.json")
|
|
20
|
+
ORG_JSON_TEST_FILE = os.path.join(JSON_ROOT_DIR, "org_marc_json_record.json")
|
|
19
21
|
|
|
20
22
|
def test_ems_parser_without_variations():
|
|
21
23
|
ems_marc_parser = EMSMARCParser(EMS_TEST_FILE, add_variations=False)
|
|
@@ -61,7 +63,17 @@ def test_title_parser_with_variations():
|
|
|
61
63
|
assert "link_variations" in record
|
|
62
64
|
assert len(record["link_variations"]) > 0
|
|
63
65
|
|
|
64
|
-
def
|
|
65
|
-
json_data = read_json_file(
|
|
66
|
+
def test_creating_per_marc_record_with_json_input():
|
|
67
|
+
json_data = read_json_file(PER_JSON_TEST_FILE)
|
|
66
68
|
record = PersonRecord(json_data)
|
|
67
69
|
assert record.name == "Koidula, Lydia"
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_creating_org_marc_record_with_json_input():
|
|
73
|
+
json_data = read_json_file(ORG_JSON_TEST_FILE)
|
|
74
|
+
record = OrganizationRecord(json_data)
|
|
75
|
+
assert record.original_name.get("a") == "Eesti"
|
|
76
|
+
assert record.original_name.get("b") == "Riigikogu"
|
|
77
|
+
assert not record.location
|
|
78
|
+
assert not record.dates
|
|
79
|
+
assert not record.numeration
|
rara_tools-0.6.12/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.6.12
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rara_tools-0.6.12 → rara_tools-0.6.13}/rara_tools/parsers/marc_parsers/organization_parser.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|