Skip to content

Commit b479d6d

Browse files
committed
thesis: drop hidden files and plots
1 parent 670fce5 commit b479d6d

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

cds_migrator_kit/rdm/migration_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _(x): # needed to avoid start time failure with lazy strings
5353
# https://flask.palletsprojects.com/en/2.1.x/config/#SEND_FILE_MAX_AGE_DEFAULT
5454
SEND_FILE_MAX_AGE_DEFAULT = 300
5555
RDM_RECORDS_MAX_FILES_COUNT = (
56-
2000 # temporarily, until we decide what we do with figures
56+
100 # temporarily, until we decide what we do with figures
5757
)
5858

5959
# SECURITY WARNING: keep the secret key used in production secret!

cds_migrator_kit/rdm/records/transform/transform.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import arrow
1616
from cds_rdm.legacy.models import CDSMigrationAffiliationMapping
1717
from idutils import normalize_ror
18-
from idutils.validators import is_doi
18+
from idutils.validators import is_doi, is_ror
1919
from invenio_access.permissions import system_identity
2020
from invenio_accounts.models import User
2121
from invenio_db import db
@@ -202,6 +202,8 @@ def _owner(self, json_entry):
202202

203203
def _match_affiliation(self, affiliation_name):
204204
"""Match an affiliation against `CDSMigrationAffiliationMapping` db table."""
205+
if is_ror(affiliation_name):
206+
return {"id": normalize_ror(affiliation_name)}
205207
# Step 1: search in the affiliation mapping (ROR organizations)
206208
match = self.affiliations_mapping.query.filter_by(
207209
legacy_affiliation_input=affiliation_name
@@ -781,15 +783,27 @@ def compute_files(file_dump, versions_dict):
781783
)
782784
return
783785

786+
if file["type"] == "Plot":
787+
# skip figures
788+
RDMJsonLogger().add_success_state(
789+
str(file["recid"]),
790+
{
791+
"message": f"Plot file dropped.",
792+
"value": file["full_name"],
793+
},
794+
)
795+
return
784796
if file["hidden"]:
785-
raise RestrictedFileDetected(
786-
field=file["full_name"],
787-
value=file["status"],
788-
priority="critical",
789-
message="File marked as hidden",
797+
# skip hidden files
798+
RDMJsonLogger().add_success_state(
799+
str(file["recid"]),
800+
{
801+
"message": f"Hidden file dropped.",
802+
"value": file["full_name"],
803+
},
790804
)
791-
if file["status"] and file["status"] != "SSO":
792-
# check if any other restrictions
805+
if file["status"] and file["status"] not in ["SSO", "lhcb-general [CERN]"]:
806+
# check if any other restrictions, recid 2267334
793807
raise RestrictedFileDetected(
794808
field=file["full_name"], value=file["status"], priority="critical"
795809
)

0 commit comments

Comments
 (0)