from typing import Annotated, Literal, Union
from pydantic import AwareDatetime, Field
from ska_oso_pdm._shared import Metadata, PdmObject, ProposalID
from ska_oso_pdm._shared.atoms import TerseStrEnum
from ska_oso_pdm._shared.ids import ReviewerID
[docs]
class ReviewStatus(TerseStrEnum):
IN_PROGRESS = "In Progress"
REVIEWED = "Reviewed"
TO_DO = "To Do"
[docs]
class ReviewType(TerseStrEnum):
SCIENCE = "Science Review"
TECHNICAL = "Technical Review"
[docs]
class Conflict(PdmObject):
has_conflict: bool = False
reason: str | None = None
[docs]
class FeasibilityStatus(TerseStrEnum):
YES = "Yes"
NO = "No"
MAYBE = "Maybe"
YES_WITH_REVISION = "Yes, with Revision"
[docs]
class ScienceReview(PdmObject):
kind: Literal[ReviewType.SCIENCE] = Field(ReviewType.SCIENCE)
rank: Annotated[int | None, Field(ge=0, le=9)] = None
conflict: Conflict
excluded_from_decision: bool = False
[docs]
class TechnicalReview(PdmObject):
kind: Literal[ReviewType.TECHNICAL] = Field(ReviewType.TECHNICAL)
is_feasible: FeasibilityStatus | None = None
PanelReviewUnion = Annotated[
Union[ScienceReview, TechnicalReview], Field(discriminator="kind")
]
[docs]
class PanelReview(PdmObject):
"""
SKA review of a proposal by a panel.
"""
metadata: Metadata = Field(
default_factory=Metadata, description="The metadata of this Panel Review."
)
panel_id: str | None = None
review_id: str
is_active: bool = True
cycle: str | None = None
reviewer_id: ReviewerID
prsl_id: ProposalID
comments: str | None = None
src_net: str | None = None
assigned_on: AwareDatetime | None = None
status: ReviewStatus = ReviewStatus.TO_DO
review_type: PanelReviewUnion
is_active: bool = True