Spaces:
Running on Zero
Running on Zero
Upload community_contributions/codypharm/schemas.py with huggingface_hub
Browse files
community_contributions/codypharm/schemas.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel, Field
|
| 2 |
+
from typing import List, Optional
|
| 3 |
+
|
| 4 |
+
# --- Input Models ---
|
| 5 |
+
|
| 6 |
+
class Drug(BaseModel):
|
| 7 |
+
name: str = Field(..., description="Name of the drug (e.g. Amoxicillin)")
|
| 8 |
+
dosage: str = Field(..., description="Dosage strength (e.g. 500mg)")
|
| 9 |
+
frequency: str = Field(..., description="Frequency (e.g. 3x daily)")
|
| 10 |
+
|
| 11 |
+
class PatientProfile(BaseModel):
|
| 12 |
+
age: int
|
| 13 |
+
weight_kg: float
|
| 14 |
+
allergies: List[str] = Field(default_factory=list)
|
| 15 |
+
conditions: List[str] = Field(default_factory=list)
|
| 16 |
+
|
| 17 |
+
class PrescriptionInput(BaseModel):
|
| 18 |
+
patient: PatientProfile
|
| 19 |
+
drugs: List[Drug]
|
| 20 |
+
|
| 21 |
+
# --- Output Models (The Council's Verdict) ---
|
| 22 |
+
|
| 23 |
+
class Finding(BaseModel):
|
| 24 |
+
severity: str = Field(..., description="SAFE, WARNING, or CRITICAL")
|
| 25 |
+
message: str = Field(..., description="Explanation of the finding")
|
| 26 |
+
|
| 27 |
+
class AgentReport(BaseModel):
|
| 28 |
+
agent_name: str
|
| 29 |
+
status: str = Field(..., description="GREEN (Safe), YELLOW (Warning), RED (Danger)")
|
| 30 |
+
findings: List[Finding]
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class FinalVerdict(BaseModel):
|
| 34 |
+
status: str = Field(..., description="GREEN (Dispense), YELLOW (Caution), RED (Do Not Dispense)")
|
| 35 |
+
summary: str = Field(..., description="Executive summary for the pharmacist.")
|
| 36 |
+
required_actions: List[str] = Field(..., description="Specific steps to resolve issues (e.g. 'Call Prescriber')")
|