Skip to content

Commit e9ddda4

Browse files
committed
adding Reader to contributor types
Signed-off-by: Neal Ensor <ensorn@osti.gov>
2 parents 8362f82 + 20ed714 commit e9ddda4

3 files changed

Lines changed: 36 additions & 47 deletions

File tree

src/elinkapi/contribution.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from enum import Enum
2+
3+
class Contribution(Enum):
4+
Chair="Chair"
5+
ContactPerson="ContactPerson"
6+
DataCollector="DataCollector"
7+
DataCurator="DataCurator"
8+
DataManager="DataManager"
9+
Distributor="Distributor"
10+
Editor="Editor"
11+
HostingInstitution="HostingInstitution"
12+
Producer="Producer"
13+
ProjectLeader="ProjectLeader"
14+
ProjectManager="ProjectManager"
15+
ProjectMember="ProjectMember"
16+
Reader="Reader"
17+
RegistrationAgency="RegistrationAgency"
18+
RegistrationAuthority="RegistrationAuthority"
19+
RelatedPerson="RelatedPerson"
20+
Researcher="Researcher"
21+
ResearchGroup="ResearchGroup"
22+
Reviewer="Reviewer"
23+
ReviewerExternal="review-external"
24+
ReviewAssistant="review-assistant"
25+
RightsHolder="RightsHolder"
26+
Sponsor="Sponsor"
27+
StatsViewer="stats-reviewer"
28+
Supervisor="Supervisor"
29+
Translator="Translator"
30+
WorkPackageLeader="WorkPackageLeader"
31+
Other="Other"

src/elinkapi/organization.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pydantic import BaseModel, ConfigDict, field_validator, model_validator
44
from typing import List
55
from .utils import Validation
6+
from .contribution import Contribution
67

78
class Organization(BaseModel):
89
model_config = ConfigDict(validate_assignment=True)
@@ -14,27 +15,6 @@ class Type(Enum):
1415
SPONSOR="SPONSOR"
1516
PAMS_TD_INST="PAMS_TD_INST"
1617

17-
class Contribution(Enum):
18-
DataCollector="DataCollector"
19-
DataCurator="DataCurator"
20-
DataManager="DataManager"
21-
Distributor="Distributor"
22-
Editor="Editor"
23-
HostingInstitution="HostingInstitution"
24-
Producer="Producer"
25-
ProjectLeader="ProjectLeader"
26-
ProjectManager="ProjectManager"
27-
ProjectMember="ProjectMember"
28-
RegistrationAgency="RegistrationAgency"
29-
RegistrationAuthority="RegistrationAuthority"
30-
Researcher="Researcher"
31-
ResearchGroup="ResearchGroup"
32-
RightsHolder="RightsHolder"
33-
Sponsor="Sponsor"
34-
Supervisor="Supervisor"
35-
WorkPackageLeader="WorkPackageLeader"
36-
Other="Other"
37-
3818
type:str
3919
name:str = None
4020
contributor_type: str = None
@@ -57,7 +37,7 @@ def type_must_be_valid(cls, value: str) -> str:
5737
@field_validator("contributor_type")
5838
@classmethod
5939
def contributor_must_be_valid(cls, value: str) -> str:
60-
if value not in [type.value for type in cls.Contribution]:
40+
if value not in [type.value for type in Contribution]:
6141
raise ValueError("Unknown contribution type {}.".format(value))
6242
return value
6343

src/elinkapi/person.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pydantic import BaseModel, ConfigDict, field_validator
33
from typing import List
44
from .affiliation import Affiliation
5+
from .contribution import Contribution
56

67
class Person(BaseModel):
78
model_config = ConfigDict(validate_assignment=True)
@@ -15,30 +16,7 @@ class Type(Enum):
1516
RELEASE="RELEASE"
1617
BUSINESS_OFFICIAL="SBIZ_BO"
1718
PRINCIPAL_INVESTIGATOR="SBIZ_PI"
18-
class Contribution(Enum):
19-
Chair="Chair"
20-
Reader="Reader"
21-
Reviewer="Reviewer"
22-
ReviewAssistant="ReviewAssistant"
23-
ReviewerExternal="ReviewerExternal"
24-
StatsReviewer="StatsReviewer"
25-
Translator="Translator"
26-
DataCollector="DataCollector"
27-
DataCurator="DataCurator"
28-
DataManager="DataManager"
29-
Distributor="Distributor"
30-
Editor="Editor"
31-
Producer="Producer"
32-
ProjectLeader="ProjectLeader"
33-
ProjectManager="ProjectManager"
34-
ProjectMember="ProjectMember"
35-
RelatedPerson="RelatedPerson"
36-
Researcher="Researcher"
37-
RightsHolder="RightsHolder"
38-
Supervisor="Supervisor"
39-
WorkPackageLeader="WorkPackageLeader"
40-
Other="Other"
41-
19+
4220
type: str
4321
first_name: str = None
4422
middle_name: str = None
@@ -59,7 +37,7 @@ def type_must_be_valid(cls, value) -> str:
5937
@field_validator("contributor_type")
6038
@classmethod
6139
def contributor_must_be_valid(cls, value) -> str:
62-
if value not in [type.value for type in cls.Contribution]:
40+
if value not in [type.value for type in Contribution]:
6341
raise ValueError('Unknown contributor type value {}.'.format(value))
6442
return value
6543

0 commit comments

Comments
 (0)