Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cds_migrator_kit/rdm/migration_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def resolve_record_pid(pid):
"counter_digits": 3,
},
},
"7277793b-5fce-458a-a3c4-e05a6cc43c69": {
"8b213ed1-31a6-408a-b474-c0c39734c2e3": {
# ship
"label": "EP approval", # shown in UI buttons/headings
"referee_group": "cds-ph-ep-publications-referee-non-lhc", # CERN e-group slug
Expand All @@ -616,4 +616,14 @@ def resolve_record_pid(pid):
"counter_digits": 3, # zero-padding width, e.g. 3 → "001"
},
},
"31bf228a-ae6e-462b-b70e-345d3e74b8ca": {
# lhcf
"label": "EP approval", # shown in UI buttons/headings
"referee_group": "cds-ph-ep-publication", # CERN e-group slug
"report_number": {
"prefix": "CERN-EP", # literal prefix, e.g. "CERN-EP"
"include_year": True, # append the current year after prefix
"counter_digits": 3, # zero-padding width, e.g. 3 → "001"
},
},
}
8 changes: 4 additions & 4 deletions cds_migrator_kit/rdm/records/load/entities/ep_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from cds_migrator_kit.rdm.records.transform.entities.version import VersionEntry

EPPHAPP_FILE_TYPE = "EPPHAPP_FILE"
EP_APPROVAL_REPORT_NUMBER_PREFIX = "CERN-EP"
EP_APPROVAL_REPORT_NUMBER_PREFIX_RE = re.compile(r"^CERN-(?:PH-)?EP-")
EP_APPROVAL_REPORT_NUMBER_RE = re.compile(r"^CERN-(?:PH-)?EP-\d{2,4}-\d+$")


Expand Down Expand Up @@ -223,7 +223,7 @@ def identifiers(self, identifiers):
kept.append(id_entry)
continue
identifier = id_entry.get("identifier", "")
if identifier.startswith(EP_APPROVAL_REPORT_NUMBER_PREFIX):
if EP_APPROVAL_REPORT_NUMBER_PREFIX_RE.match(identifier):
removed.append(identifier)
else:
kept.append(id_entry)
Expand Down Expand Up @@ -331,10 +331,10 @@ def identifiers(self, identifiers):
elif scheme != "cdsrn":
kept.append(id_entry)
continue
if not identifier.startswith(EP_APPROVAL_REPORT_NUMBER_PREFIX):
if not EP_APPROVAL_REPORT_NUMBER_PREFIX_RE.match(identifier):
kept.append(id_entry)
continue
# Remove CERN-EP-YYYY-NNN but keep CERN-EP-DRAFT report number
# Remove CERN-(PH-)?EP-YYYY-NNN but keep *-DRAFT report numbers.
if EP_APPROVAL_REPORT_NUMBER_RE.match(identifier):
if identifier != self.approval_request.report_number:
raise UnexpectedValue(
Expand Down
13 changes: 1 addition & 12 deletions cds_migrator_kit/rdm/streams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -622,18 +622,7 @@ records:
files_dump_dir: cds_migrator_kit/rdm/data/lhcf/files/
missing_users: cds_migrator_kit/rdm/data/users
communities_ids:
- "88a105fe-4713-493b-b555-6ab398599d21"
lhcf-ep:
data_dir: cds_migrator_kit/rdm/data/lhcf-ep
plots: true
create_inclusion_request: true
extract:
dirpath: cds_migrator_kit/rdm/data/lhcf-ep/dump/
transform:
files_dump_dir: cds_migrator_kit/rdm/data/lhcf-ep/files/
missing_users: cds_migrator_kit/rdm/data/users
communities_ids:
- "88a105fe-4713-493b-b555-6ab398599d21"
- "31bf228a-ae6e-462b-b70e-345d3e74b8ca"
na61:
data_dir: cds_migrator_kit/rdm/data/north_area/na61
plots: true
Expand Down
27 changes: 27 additions & 0 deletions cds_migrator_kit/rdm/streams_done.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,30 @@ records:
missing_users: cds_migrator_kit/rdm/data/users
communities_ids:
- "e5de962b-5e2c-408f-be69-2823fda1f732"
ship:
data_dir: cds_migrator_kit/rdm/data/ship
plots: true
create_inclusion_request: true
extract:
dirpath: cds_migrator_kit/rdm/data/ship/dump
transform:
files_dump_dir: cds_migrator_kit/rdm/data/ship/files/
missing_users: cds_migrator_kit/rdm/data/users
communities_ids:
- "8b213ed1-31a6-408a-b474-c0c39734c2e3"
load:
legacy_pids_to_redirect: cds_migrator_kit/rdm/data/ship/legacy_pids_to_redirect.json
ship-restricted:
data_dir: cds_migrator_kit/rdm/data/ship-restricted
plots: true
create_inclusion_request: true
restricted: "True"
extract:
dirpath: cds_migrator_kit/rdm/data/ship-restricted/dump/
transform:
files_dump_dir: cds_migrator_kit/rdm/data/ship-restricted/files/
missing_users: cds_migrator_kit/rdm/data/users
communities_ids:
- "8b213ed1-31a6-408a-b474-c0c39734c2e3"
load:
legacy_pids_to_redirect: cds_migrator_kit/rdm/data/ship-restricted/legacy_pids_to_redirect.json
21 changes: 19 additions & 2 deletions tests/cds-rdm/test_ep_approval_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,14 @@ class TestPublicEntryIdentifiers:
"""Test identifier handling in the public split."""

def test_public_removes_cern_ep_report_numbers(self, app):
entry = _make_entry(_versions_with_epphapp())
legacy_draft_rn = "CERN-PH-EP-DRAFT-LHCF-2015-001"
identifiers = [
{"identifier": RECID, "scheme": "cds"},
{"scheme": "cdsrn", "identifier": APPROVED_REPORT_NUMBER},
{"scheme": "cdsrn", "identifier": DRAFT_REPORT_NUMBER},
{"scheme": "cdsrn", "identifier": legacy_draft_rn},
]
entry = _make_entry(_versions_with_epphapp(), identifiers=identifiers)
result = PublicEntry(
entry, _make_approval_request(), _make_migration_logger()
).build()
Expand All @@ -451,6 +458,8 @@ def test_public_removes_cern_ep_report_numbers(self, app):
cdsrn_values = {i["identifier"] for i in identifiers if i["scheme"] == "cdsrn"}

assert APPROVED_REPORT_NUMBER not in cdsrn_values
assert DRAFT_REPORT_NUMBER not in cdsrn_values
assert legacy_draft_rn not in cdsrn_values
assert any(
i["scheme"] == "apprn" and i["identifier"] == APPROVED_REPORT_NUMBER
for i in identifiers
Expand Down Expand Up @@ -510,7 +519,14 @@ def test_restricted_removes_apprn(self, app):
)

def test_restricted_keeps_draft_report_number(self, app):
entry = _make_entry(_versions_with_epphapp())
legacy_draft_rn = "CERN-PH-EP-DRAFT-LHCF-2015-001"
identifiers = [
{"identifier": RECID, "scheme": "cds"},
{"scheme": "cdsrn", "identifier": APPROVED_REPORT_NUMBER},
{"scheme": "cdsrn", "identifier": DRAFT_REPORT_NUMBER},
{"scheme": "cdsrn", "identifier": legacy_draft_rn},
]
entry = _make_entry(_versions_with_epphapp(), identifiers=identifiers)
result = RestrictedEntry(
entry, _make_approval_request(), _make_migration_logger()
).build()
Expand All @@ -522,6 +538,7 @@ def test_restricted_keeps_draft_report_number(self, app):
}

assert DRAFT_REPORT_NUMBER in cdsrn_values
assert legacy_draft_rn in cdsrn_values

def test_restricted_raises_on_mismatched_report_number(self, app):
identifiers = [
Expand Down
Loading