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 @@ -551,7 +551,7 @@ def resolve_record_pid(pid):
"label": "EP approval", # shown in UI buttons/headings
"referee_group": "cds-ph-ep-publication", # CERN e-group slug
"report_number": {
"prefix": "CERN-TH-EP", # literal prefix, e.g. "CERN-EP"
"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"
},
Expand Down Expand Up @@ -606,4 +606,14 @@ def resolve_record_pid(pid):
"counter_digits": 3,
},
},
"7277793b-5fce-458a-a3c4-e05a6cc43c69": {
# ship
"label": "EP approval", # shown in UI buttons/headings
"referee_group": "cds-ph-ep-publications-referee-non-lhc", # 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"
},
},
}
5 changes: 3 additions & 2 deletions cds_migrator_kit/rdm/records/transform/models/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
# "035__z", # oai harvest tag
"037__c", # arxiv subject
"100__m", # email of contributor
# "245__9", # Provenance of title
"245__9", # Provenance of title
# "270__m", # Contact email
"300__a", # number of pages
# "520__9", # Provenance of the description
"500__9", # Provenance of the note
"520__9", # Provenance of the description
# "540__3", # Material of the license
# "540__9", # Also material of the license
# "542__3", # Also material of the license
Expand Down
49 changes: 49 additions & 0 deletions cds_migrator_kit/rdm/records/transform/models/ship.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2026 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.

"""CDS-RDM SHIP research model."""

from cds_migrator_kit.rdm.records.transform.models._config import IGNORE_SYSTEM_KEYS
from cds_migrator_kit.rdm.records.transform.models.research import (
ResearchModel,
research_model,
)


class SHIPResearchModel(ResearchModel):
"""Translation model for SHIP records."""

__query__ = (
"((980__.a:NOTE OR 980__.a:Note OR 980__.a:ConferencePaper) AND 690C_.a:SHiP) OR "
"980__.a:SHiPPUBDRAFTFINAL OR 980__.a:SHiP_Papers OR "
"(980__.a:INTNOTE AND 693__.e:SHiP) "
"-980__:DELETED -980__.a:DUMMY"
)

__ignore_keys__ = IGNORE_SYSTEM_KEYS | {
"100__v", # complete affiliation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are all the ignored confirmed with SIS? can we upgrade any to globally ignored?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the PR, thanks!

"0247_9", # provenance of the DOI
"035__h", # oai identifiers
"035__d", # oai identifiers
"035__t", # oai identifiers
"035__u", # oai identifiers
"035__m", # oai identifiers
"110__u", # Confirmed with SIS
"270__m", # document contact email
"540__3", # material of license
"542__3", # copyright material
"700__v", # complete affiliation
"773__o", # Duplicate meeting title
"8564_z", # automatic process with EP value:Stamped by WebSubmit
"903__s", # public
}


ship_research_model = SHIPResearchModel(
bases=(research_model,),
entry_point_group="cds_migrator_kit.migrator.rdm.rules.ship",
)
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ def resource_type(self, key, value):
"slide": {"id": "presentation"},
"faser_papers": {"id": "publication-article"},
"demsuppliers": {"id": "other"},
"ship_papers": {"id": "publication-article"},
"lhcf_papers": {"id": "publication-article"},
"lhcf_proc": {"id": "publication-conferenceproceeding"},
"lhcf_reports": {"id": "publication-report"},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2026 CERN.
#
# CDS-RDM is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.

"""CDS-RDM SHIP research rules."""

from dojson.errors import IgnoreKey
from dojson.utils import for_each_value

from cds_migrator_kit.errors import UnexpectedValue
from cds_migrator_kit.transform.xml_processing.quality.parsers import StringValue

from ...models.ship import ship_research_model as model
from .faser_publication import spokesperson

model.over("request_reviewers", "(^905__|^906__)", override=True)(spokesperson)


@model.over("document_type", "^594__")
def document_type(self, key, value):
"""Confirmed with SIS, we can ignore this since the record already has a resource type."""
document_type = value.get("a").strip().lower()
if document_type and document_type not in [
"int",
"conferencepaper",
"note",
]:
raise UnexpectedValue(f"Invalid document type: {document_type}")
raise IgnoreKey("document_type")


@model.over("related_identifiers", "(^78502|^78002)")
@for_each_value
def related_works(self, key, value):
"""Translates related identifiers."""
description = StringValue(value.get("i")).parse().strip().lower()
recid = value.get("w")
report_number = value.get("r")
rel_ids = self.get("related_identifiers", [])
if "superseded by" == description:
relation_type = "isobsoletedby"
elif "supersedes" == description:
relation_type = "obsoletes"
else:
raise UnexpectedValue(f"Invalid relation type: {description}")
new_id = {
"identifier": recid,
"scheme": "cds",
"relation_type": {"id": relation_type},
"resource_type": {"id": "other"},
}
if new_id not in rel_ids:
return new_id

raise IgnoreKey("related_identifiers")
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ cds_migrator_kit.migrator.models =
lhcf = cds_migrator_kit.rdm.records.transform.models.lhcf:lhcf_model
antares = cds_migrator_kit.rdm.records.transform.models.antares:antares_research_model
lcd = cds_migrator_kit.rdm.records.transform.models.lcd:lcd_research_model
ship = cds_migrator_kit.rdm.records.transform.models.ship:ship_research_model
research_comm_model = cds_migrator_kit.rdm.records.transform.models.research_committee:research_comm_model
fap = cds_migrator_kit.rdm.records.transform.models.fap:fap_model
ssn = cds_migrator_kit.rdm.records.transform.models.summer_student_report:sspn_model
Expand Down Expand Up @@ -126,6 +127,11 @@ cds_migrator_kit.migrator.rdm.rules.research =
base = cds_migrator_kit.transform.xml_processing.rules.base
base_records = cds_migrator_kit.rdm.records.transform.xml_processing.rules.base
research = cds_migrator_kit.rdm.records.transform.xml_processing.rules.research
cds_migrator_kit.migrator.rdm.rules.ship =
base = cds_migrator_kit.transform.xml_processing.rules.base
base_records = cds_migrator_kit.rdm.records.transform.xml_processing.rules.base
research = cds_migrator_kit.rdm.records.transform.xml_processing.rules.research
ship = cds_migrator_kit.rdm.records.transform.xml_processing.rules.ship
cds_migrator_kit.migrator.rdm.rules.small_exp =
base = cds_migrator_kit.transform.xml_processing.rules.base
base_records = cds_migrator_kit.rdm.records.transform.xml_processing.rules.base
Expand Down
Loading