Skip to content

Commit 139c0bb

Browse files
committed
add(hr): new resource types assignment
1 parent ffd07a6 commit 139c0bb

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

  • cds_migrator_kit/rdm/records/transform

cds_migrator_kit/rdm/records/transform/models/hr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class HrModel(CdsOverdo):
3535
"100__m",
3636
"300__a", # number of pages
3737
"591__b", #
38+
"6531_9", # keyword scheme
3839
"700__m",
3940
"7870_r", # detailed description of record relation (2862345)
4041
"8564_8",

cds_migrator_kit/rdm/records/transform/xml_processing/rules/hr.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ def additional_desc(self, key, value):
7474
raise IgnoreKey("additional_descriptions_hr")
7575

7676

77-
@model.over("subjects", "(^6931_)|(^650[12_][7_])|(^653[12_]_)|(^695__)|(^694__)")
77+
@model.over("subjects", "(^6931_)|(^650[12_][7_])|(^653[12_]_)|(^695__)|(^694__)", override=True)
7878
@require(["a"])
7979
@for_each_value
8080
def hr_subjects(self, key, value):
81+
keyword = value.get("a")
8182
if key == "6531_":
8283
keyword = value.get("a")
8384
if "," in keyword:
@@ -87,14 +88,17 @@ def hr_subjects(self, key, value):
8788
_subjects.append({"subject": key})
8889
self["subjects"] = _subjects
8990
raise IgnoreKey("subjects")
90-
else:
91-
resource_type_map = {
92-
"Presentation": {"id": "presentation"},
93-
}
94-
resource_type = resource_type_map.get(keyword)
95-
if resource_type:
96-
self["resource_type"] = resource_type
97-
raise IgnoreKey("subjects")
91+
92+
resource_type_map = {
93+
"Presentation": {"id": "presentation"},
94+
"Mémos": {"id": "publication-memorandum"},
95+
"Formulaires": {"id": "publication-form"},
96+
"Form": {"id": "publication-form"},
97+
"Modèles de documents": {"id": "publication-doctemplate"},
98+
}
99+
resource_type = resource_type_map.get(keyword)
100+
if resource_type:
101+
self["resource_type"] = resource_type
98102

99103
subjects(self, key, value)
100104

@@ -153,6 +157,8 @@ def resource_type(self, key, value):
153157
self["subjects"] = subjects
154158
if value == "administrativenote":
155159
raise IgnoreKey("resource_type")
160+
if value == "cern-admin-e-guide" and self["resource_type"]:
161+
raise IgnoreKey("resource_type")
156162
map = {
157163
"annualstats": {"id": "publication-report"},
158164
"cern-admin-e-guide": {"id": "publication-other"},

0 commit comments

Comments
 (0)