folio-migration-tools 1.9.0rc3__py3-none-any.whl → 1.9.0rc5__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.
- folio_migration_tools/mapping_file_transformation/order_mapper.py +8 -4
- folio_migration_tools/marc_rules_transformation/rules_mapper_holdings.py +3 -2
- folio_migration_tools/migration_tasks/batch_poster.py +90 -8
- folio_migration_tools/migration_tasks/courses_migrator.py +54 -8
- folio_migration_tools/migration_tasks/holdings_csv_transformer.py +102 -14
- folio_migration_tools/migration_tasks/items_transformer.py +133 -20
- folio_migration_tools/migration_tasks/loans_migrator.py +61 -9
- folio_migration_tools/migration_tasks/migration_task_base.py +104 -11
- folio_migration_tools/migration_tasks/orders_transformer.py +107 -14
- folio_migration_tools/migration_tasks/organization_transformer.py +79 -14
- folio_migration_tools/migration_tasks/requests_migrator.py +56 -7
- folio_migration_tools/migration_tasks/reserves_migrator.py +26 -4
- folio_migration_tools/migration_tasks/user_transformer.py +88 -18
- folio_migration_tools/transaction_migration/legacy_loan.py +13 -1
- folio_migration_tools/transaction_migration/legacy_reserve.py +3 -5
- {folio_migration_tools-1.9.0rc3.dist-info → folio_migration_tools-1.9.0rc5.dist-info}/METADATA +1 -1
- {folio_migration_tools-1.9.0rc3.dist-info → folio_migration_tools-1.9.0rc5.dist-info}/RECORD +20 -20
- {folio_migration_tools-1.9.0rc3.dist-info → folio_migration_tools-1.9.0rc5.dist-info}/WHEEL +1 -1
- {folio_migration_tools-1.9.0rc3.dist-info → folio_migration_tools-1.9.0rc5.dist-info}/LICENSE +0 -0
- {folio_migration_tools-1.9.0rc3.dist-info → folio_migration_tools-1.9.0rc5.dist-info}/entry_points.txt +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
3
|
import sys
|
|
4
|
-
from typing import Optional
|
|
4
|
+
from typing import Optional, Annotated
|
|
5
|
+
from pydantic import Field
|
|
5
6
|
|
|
6
7
|
import i18n
|
|
7
8
|
from folio_uuid.folio_namespaces import FOLIONamespaces
|
|
@@ -25,15 +26,84 @@ from folio_migration_tools.task_configuration import AbstractTaskConfiguration
|
|
|
25
26
|
|
|
26
27
|
class UserTransformer(MigrationTaskBase):
|
|
27
28
|
class TaskConfiguration(AbstractTaskConfiguration):
|
|
28
|
-
name:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
name: Annotated[
|
|
30
|
+
str,
|
|
31
|
+
Field(
|
|
32
|
+
title="Migration task name",
|
|
33
|
+
description=(
|
|
34
|
+
"Name of this migration task. The name is being used to call "
|
|
35
|
+
"the specific task, and to distinguish tasks of similar types"
|
|
36
|
+
),
|
|
37
|
+
),
|
|
38
|
+
]
|
|
39
|
+
migration_task_type: Annotated[
|
|
40
|
+
str,
|
|
41
|
+
Field(
|
|
42
|
+
title="Migration task type",
|
|
43
|
+
description="The type of migration task you want to perform",
|
|
44
|
+
),
|
|
45
|
+
]
|
|
46
|
+
group_map_path: Annotated[
|
|
47
|
+
str,
|
|
48
|
+
Field(
|
|
49
|
+
title="Group map path",
|
|
50
|
+
description="Define the path for group mapping",
|
|
51
|
+
)
|
|
52
|
+
]
|
|
53
|
+
departments_map_path: Annotated[
|
|
54
|
+
Optional[str],
|
|
55
|
+
Field(
|
|
56
|
+
title="Departments map path",
|
|
57
|
+
description=(
|
|
58
|
+
"Define the path for departments mapping. "
|
|
59
|
+
"Optional, by dfault is empty string"
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
] = ""
|
|
63
|
+
use_group_map: Annotated[
|
|
64
|
+
Optional[bool],
|
|
65
|
+
Field(
|
|
66
|
+
title="Use group map",
|
|
67
|
+
description=(
|
|
68
|
+
"Specify whether to use group mapping. "
|
|
69
|
+
"Optional, by default is True"
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
] = True
|
|
73
|
+
user_mapping_file_name: Annotated[
|
|
74
|
+
str,
|
|
75
|
+
Field(
|
|
76
|
+
title="User mapping file name",
|
|
77
|
+
description="Specify the user mapping file name",
|
|
78
|
+
)
|
|
79
|
+
]
|
|
80
|
+
user_file: Annotated[
|
|
81
|
+
FileDefinition,
|
|
82
|
+
Field(
|
|
83
|
+
title="User file",
|
|
84
|
+
description="Select the user data file",
|
|
85
|
+
)
|
|
86
|
+
]
|
|
87
|
+
remove_id_and_request_preferences: Annotated[
|
|
88
|
+
Optional[bool],
|
|
89
|
+
Field(
|
|
90
|
+
title="Remove ID and request preferences",
|
|
91
|
+
description=(
|
|
92
|
+
"Specify whether to remove user ID and request preferences. "
|
|
93
|
+
"Optional, by default is False"
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
] = False
|
|
97
|
+
remove_request_preferences: Annotated[
|
|
98
|
+
Optional[bool],
|
|
99
|
+
Field(
|
|
100
|
+
title="Remove request preferences",
|
|
101
|
+
description=(
|
|
102
|
+
"Specify whether to remove user request preferences. "
|
|
103
|
+
"Optional, by default is False"
|
|
104
|
+
),
|
|
105
|
+
)
|
|
106
|
+
] = False
|
|
37
107
|
|
|
38
108
|
@staticmethod
|
|
39
109
|
def get_object_type() -> FOLIONamespaces:
|
|
@@ -128,7 +198,7 @@ class UserTransformer(MigrationTaskBase):
|
|
|
128
198
|
print_email_warning()
|
|
129
199
|
folio_user, index_or_id = self.mapper.do_map(
|
|
130
200
|
legacy_user,
|
|
131
|
-
num_users,
|
|
201
|
+
str(num_users),
|
|
132
202
|
FOLIONamespaces.users,
|
|
133
203
|
)
|
|
134
204
|
folio_user = self.mapper.perform_additional_mapping(
|
|
@@ -168,9 +238,9 @@ class UserTransformer(MigrationTaskBase):
|
|
|
168
238
|
logging.error(ee, exc_info=True)
|
|
169
239
|
|
|
170
240
|
self.total_records = num_users
|
|
171
|
-
except FileNotFoundError as
|
|
241
|
+
except FileNotFoundError as fn:
|
|
172
242
|
logging.exception("File not found")
|
|
173
|
-
print(f"\n{
|
|
243
|
+
print(f"\n{fn}")
|
|
174
244
|
sys.exit(1)
|
|
175
245
|
|
|
176
246
|
def wrap_up(self):
|
|
@@ -214,10 +284,10 @@ class UserTransformer(MigrationTaskBase):
|
|
|
214
284
|
def print_email_warning():
|
|
215
285
|
s = (
|
|
216
286
|
" ______ __ __ _____ _ _____ ___ \n" # noqa: E501, W605
|
|
217
|
-
" | ____| |
|
|
218
|
-
" | |__ |
|
|
219
|
-
" | __| |
|
|
220
|
-
" |______| |_| |_| /_/
|
|
287
|
+
" | ____| | \\/ | /\\ |_ _| | | / ____| |__ \\ \n" # noqa: E501, W605
|
|
288
|
+
" | |__ | \\ / | / \\ | | | | | (___ ) |\n" # noqa: E501, W605
|
|
289
|
+
" | __| | |\\/| | / /\\ \\ | | | | \\___ \\ / / \n" # noqa: E501, W605
|
|
290
|
+
" |______| |_| |_| /_/ \\_\\ |_____| |______| |_____/ (_) \n" # noqa: E501, W605
|
|
221
291
|
" \n" # noqa: E501, W605
|
|
222
292
|
" \n"
|
|
223
293
|
)
|
|
@@ -252,4 +322,4 @@ def find_primary_addresses(addresses):
|
|
|
252
322
|
primary_true.append(address)
|
|
253
323
|
else:
|
|
254
324
|
address["primaryAddress"] = False
|
|
255
|
-
return primary_true
|
|
325
|
+
return primary_true
|
|
@@ -91,7 +91,7 @@ class LegacyLoan(object):
|
|
|
91
91
|
self.out_date: datetime = temp_date_out
|
|
92
92
|
self.correct_for_1_day_loans()
|
|
93
93
|
self.make_utc()
|
|
94
|
-
self.renewal_count =
|
|
94
|
+
self.renewal_count = self.set_renewal_count(legacy_loan_dict)
|
|
95
95
|
self.next_item_status = legacy_loan_dict.get("next_item_status", "").strip()
|
|
96
96
|
if self.next_item_status not in legal_statuses:
|
|
97
97
|
self.errors.append(("Not an allowed status", self.next_item_status))
|
|
@@ -101,6 +101,18 @@ class LegacyLoan(object):
|
|
|
101
101
|
else fallback_service_point_id
|
|
102
102
|
)
|
|
103
103
|
|
|
104
|
+
def set_renewal_count(self, loan: dict) -> int:
|
|
105
|
+
if "renewal_count" in loan:
|
|
106
|
+
renewal_count = loan["renewal_count"]
|
|
107
|
+
try:
|
|
108
|
+
return int(renewal_count)
|
|
109
|
+
except ValueError:
|
|
110
|
+
self.report(
|
|
111
|
+
f"Unresolvable {renewal_count=} was replaced with 0.")
|
|
112
|
+
else:
|
|
113
|
+
self.report(f"Missing renewal count was replaced with 0.")
|
|
114
|
+
return 0
|
|
115
|
+
|
|
104
116
|
def correct_for_1_day_loans(self):
|
|
105
117
|
try:
|
|
106
118
|
if self.due_date.date() <= self.out_date.date():
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import uuid
|
|
2
|
-
from typing import Dict
|
|
3
|
-
from typing import List
|
|
4
|
-
from typing import Tuple
|
|
2
|
+
from typing import Dict, List, Tuple
|
|
5
3
|
|
|
6
4
|
from folio_uuid.folio_namespaces import FOLIONamespaces
|
|
7
5
|
from folio_uuid.folio_uuid import FolioUUID
|
|
@@ -17,9 +15,9 @@ class LegacyReserve(object):
|
|
|
17
15
|
for h in correct_headers:
|
|
18
16
|
if h not in legacy_request_dict:
|
|
19
17
|
raise TransformationProcessError(
|
|
20
|
-
|
|
18
|
+
row,
|
|
21
19
|
"Missing header in file. The following are required:",
|
|
22
|
-
",".join(correct_headers),
|
|
20
|
+
", ".join(correct_headers),
|
|
23
21
|
)
|
|
24
22
|
self.errors: List[Tuple[str, str]] = [
|
|
25
23
|
("Missing properties in legacy data", prop)
|
{folio_migration_tools-1.9.0rc3.dist-info → folio_migration_tools-1.9.0rc5.dist-info}/RECORD
RENAMED
|
@@ -19,7 +19,7 @@ folio_migration_tools/mapping_file_transformation/item_mapper.py,sha256=CWKpve0U
|
|
|
19
19
|
folio_migration_tools/mapping_file_transformation/manual_fee_fines_mapper.py,sha256=nCkqbxaDHKxMuqQHh_afxQp48YrVD-SeCZ0L1iGvnkk,13402
|
|
20
20
|
folio_migration_tools/mapping_file_transformation/mapping_file_mapper_base.py,sha256=RacwSOP6r6i28EOywaepq5K5FimD8Ld5MlBo89FYO7c,37963
|
|
21
21
|
folio_migration_tools/mapping_file_transformation/notes_mapper.py,sha256=auLQZqa4rSJo_MIV4Lc5-LG8RcBpp2bnKH243qNYq_0,3470
|
|
22
|
-
folio_migration_tools/mapping_file_transformation/order_mapper.py,sha256=
|
|
22
|
+
folio_migration_tools/mapping_file_transformation/order_mapper.py,sha256=k-kIuf2ceXrPWe3oVnfhuQlE7eglcx6PDLVJtddkeiM,17680
|
|
23
23
|
folio_migration_tools/mapping_file_transformation/organization_mapper.py,sha256=0zjw0-C-qTYH9GC6FDBElucWCZWdoOiTHOY7q9_4NQg,14571
|
|
24
24
|
folio_migration_tools/mapping_file_transformation/ref_data_mapping.py,sha256=qFsn_LwKZeKFdOudfEQnNA3DEHOdNQVKzTPdZAlDPX0,8864
|
|
25
25
|
folio_migration_tools/mapping_file_transformation/user_mapper.py,sha256=oWuIPRQL0anF_qTVFibHtc1oOaqyKCBH4O1hX5rQAZQ,7806
|
|
@@ -33,35 +33,35 @@ folio_migration_tools/marc_rules_transformation/marc_reader_wrapper.py,sha256=9A
|
|
|
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
35
|
folio_migration_tools/marc_rules_transformation/rules_mapper_bibs.py,sha256=ckVeysbpW9s19pmHvogdRFOCouzz17Y6oKJD0_QfQAk,28924
|
|
36
|
-
folio_migration_tools/marc_rules_transformation/rules_mapper_holdings.py,sha256=
|
|
36
|
+
folio_migration_tools/marc_rules_transformation/rules_mapper_holdings.py,sha256=gPJaWcvt-CKIJxrEzheRzohnc3mFEnsznuZIXLPhyZM,18954
|
|
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
|
|
39
39
|
folio_migration_tools/migration_tasks/authority_transformer.py,sha256=AoXg9s-GLO3yEEDCrQV7hc4YVXxwxsdxDdpj1zhHydE,4251
|
|
40
|
-
folio_migration_tools/migration_tasks/batch_poster.py,sha256=
|
|
40
|
+
folio_migration_tools/migration_tasks/batch_poster.py,sha256=8Oksp7uGjr6eAq-aqSpelQDTum14V9VzYGa_ZfLJQCM,35451
|
|
41
41
|
folio_migration_tools/migration_tasks/bibs_transformer.py,sha256=XzlPo-0uuugJA4SM80xOlOj5nDK6OMDXFnAYg80hOBc,7791
|
|
42
|
-
folio_migration_tools/migration_tasks/courses_migrator.py,sha256=
|
|
43
|
-
folio_migration_tools/migration_tasks/holdings_csv_transformer.py,sha256=
|
|
42
|
+
folio_migration_tools/migration_tasks/courses_migrator.py,sha256=CzXnsu-KGP7B4zcINJzLYUqz47D16NuFfzu_DPqRlTQ,7061
|
|
43
|
+
folio_migration_tools/migration_tasks/holdings_csv_transformer.py,sha256=WT-RlDRm2ILr2-2shfG3TZ3nlSfqxEXT3TklZSqtJCM,22311
|
|
44
44
|
folio_migration_tools/migration_tasks/holdings_marc_transformer.py,sha256=8dtrhxyA9hbISISzpvMJGYaMaDbtZ1MOZeoJJF5lk24,11164
|
|
45
|
-
folio_migration_tools/migration_tasks/items_transformer.py,sha256=
|
|
46
|
-
folio_migration_tools/migration_tasks/loans_migrator.py,sha256=
|
|
45
|
+
folio_migration_tools/migration_tasks/items_transformer.py,sha256=7J222fmUIWeJ-d3Oz7YQeb0zGSQ1ff4aJ19-rfYyMKI,18777
|
|
46
|
+
folio_migration_tools/migration_tasks/loans_migrator.py,sha256=4n7zbwljX_jgj9ltnxZAegjN3e8QJMjr6JJa5XfVueY,34771
|
|
47
47
|
folio_migration_tools/migration_tasks/manual_fee_fines_transformer.py,sha256=CnmlTge7nChUJ10EiUkriQtJlVxWqglgfhjgneh2_yM,7247
|
|
48
|
-
folio_migration_tools/migration_tasks/migration_task_base.py,sha256=
|
|
49
|
-
folio_migration_tools/migration_tasks/orders_transformer.py,sha256=
|
|
50
|
-
folio_migration_tools/migration_tasks/organization_transformer.py,sha256=
|
|
51
|
-
folio_migration_tools/migration_tasks/requests_migrator.py,sha256=
|
|
52
|
-
folio_migration_tools/migration_tasks/reserves_migrator.py,sha256=
|
|
53
|
-
folio_migration_tools/migration_tasks/user_transformer.py,sha256=
|
|
48
|
+
folio_migration_tools/migration_tasks/migration_task_base.py,sha256=8enHPNrgOHZs5sDGsz0yMPXap0HBprz8-1HVr9udvf0,16704
|
|
49
|
+
folio_migration_tools/migration_tasks/orders_transformer.py,sha256=Q9YU8DUtVBqXfmvwa2LFxsO09h3IRRXXh3xWF5hUNg8,14249
|
|
50
|
+
folio_migration_tools/migration_tasks/organization_transformer.py,sha256=vcCjhN1sS55c_a0LXi1Yw1eq3zpDn5E4BGbm2zDQ_Z4,16885
|
|
51
|
+
folio_migration_tools/migration_tasks/requests_migrator.py,sha256=QP9OBezC3FfcKpI78oMmydxcPaUIYAgHyKevyLwC-WQ,14841
|
|
52
|
+
folio_migration_tools/migration_tasks/reserves_migrator.py,sha256=SA3b7FQWHMHb7bEO8ZqOlblQ9m65zWUMH71uRk-zOKw,9950
|
|
53
|
+
folio_migration_tools/migration_tasks/user_transformer.py,sha256=g-0etM5MpW3gjOrJ4pHotJHfubH8nxsZqUI8ZDi_TC0,12912
|
|
54
54
|
folio_migration_tools/task_configuration.py,sha256=C5-OQtZLH7b4lVeyj5v8OXsqKNN4tzfp9F3b4vhthN4,632
|
|
55
55
|
folio_migration_tools/test_infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
56
|
folio_migration_tools/test_infrastructure/mocked_classes.py,sha256=rNes6UlRqIWGwPurfiQK97IvgB5OPwnZTbv1T28jHzk,9150
|
|
57
57
|
folio_migration_tools/transaction_migration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
|
-
folio_migration_tools/transaction_migration/legacy_loan.py,sha256=
|
|
58
|
+
folio_migration_tools/transaction_migration/legacy_loan.py,sha256=M48ZU45yEL1h93Jbld5qKwF1DEKt6sGYPc-t_JgLYX0,5896
|
|
59
59
|
folio_migration_tools/transaction_migration/legacy_request.py,sha256=1ulyFzPQw_InOjyPzkWpGnNptgXdQ18nmri0J8Nlpkc,6124
|
|
60
|
-
folio_migration_tools/transaction_migration/legacy_reserve.py,sha256=
|
|
60
|
+
folio_migration_tools/transaction_migration/legacy_reserve.py,sha256=d0qbh2fWpwlVSYRL6wZyZG20__NAYNxh7sPSsB-LAes,1804
|
|
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.
|
|
64
|
-
folio_migration_tools-1.9.
|
|
65
|
-
folio_migration_tools-1.9.
|
|
66
|
-
folio_migration_tools-1.9.
|
|
67
|
-
folio_migration_tools-1.9.
|
|
63
|
+
folio_migration_tools-1.9.0rc5.dist-info/LICENSE,sha256=PhIEkitVi3ejgq56tt6sWoJIG_zmv82cjjd_aYPPGdI,1072
|
|
64
|
+
folio_migration_tools-1.9.0rc5.dist-info/METADATA,sha256=6MxKZNM3wUsGNheI_nzS9YpJjR2XqDTigIedpeAcvzA,7415
|
|
65
|
+
folio_migration_tools-1.9.0rc5.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
66
|
+
folio_migration_tools-1.9.0rc5.dist-info/entry_points.txt,sha256=Hbe-HjqMcU8FwVshVIkeWyZd9XwgT1CCMNf06EpHQu8,77
|
|
67
|
+
folio_migration_tools-1.9.0rc5.dist-info/RECORD,,
|
{folio_migration_tools-1.9.0rc3.dist-info → folio_migration_tools-1.9.0rc5.dist-info}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|