File size: 1,843 Bytes
161d75f 21dae66 161d75f 21dae66 161d75f 21dae66 161d75f 21dae66 161d75f 21dae66 161d75f 21dae66 161d75f 21dae66 161d75f 21dae66 161d75f 21dae66 161d75f 88563b5 a725af0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
from pydantic import BaseModel, Field
from typing import Literal, List, Union, Optional
# Define common anomalies as a Literal type
CommonAnomalies = Literal[
"blackened/burnt skin",
"blood",
"foreign body",
"fracture",
"injury",
"parasite",
"swelling",
"warty or tumor-like growth, crusts",
]
# --- Beak-related Anomalies ---
class BeakAnomaly(BaseModel):
type: Literal["beak"]
anomaly_type: List[Literal["adhesion", "deformation", CommonAnomalies]]
# --- Body-related Anomalies ---
class BodyAnomaly(BaseModel):
type: Literal["body"]
anomaly_type: List[
Literal["emaciation", "fluffed up", "stained feathers", CommonAnomalies]
]
# --- Legs-related Anomalies ---
class LegAnomaly(BaseModel):
type: Literal["legs"]
anomaly_type: List[Literal["missing limb", "deformation", CommonAnomalies]]
# --- Feathers/Wings/Tail-related Anomalies ---
class FeathersWingsTailAnomaly(BaseModel):
type: Literal["feathers/wings/tail"]
anomaly_type: List[
Literal[
"fluffed up",
"feather abnormalities",
"stained feathers",
"abnormal wing posture",
"missing limb",
CommonAnomalies,
]
]
# --- Head-related Anomalies (including eyes) ---
class HeadAnomaly(BaseModel):
type: Literal["head incl. eyes"]
anomaly_type: List[
Literal["ear changes", "eye changes", "tilted head", CommonAnomalies]
]
# Union of all possible anomaly types for specific body parts
AnomalyType = Union[
BeakAnomaly, BodyAnomaly, LegAnomaly, FeathersWingsTailAnomaly, HeadAnomaly
]
# Main PhysicalAnomaly class that logs anomalies across different body parts
class PhysicalAnomalies(BaseModel):
physical_radio: str
physical_anomalies_type: Optional[List[AnomalyType]] = None
|