File size: 1,720 Bytes
21c7db9 e21fe7d | 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 | """API schemas."""
from __future__ import annotations
from typing import Any, Optional
from pydantic import BaseModel, ConfigDict, Field
from app.common.enums import ActionType, DecisionMode, Difficulty, DoseBucket, SubEnvironment
class StrictSchema(BaseModel):
model_config = ConfigDict(extra="forbid")
class ResetRequest(StrictSchema):
task_id: Optional[str] = None
seed: Optional[int] = None
difficulty: Optional[Difficulty] = None
sub_environment: Optional[SubEnvironment] = None
scenario_id: Optional[str] = None
patient_id: Optional[str] = None
class StepRequest(StrictSchema):
mode: DecisionMode
action_type: ActionType
target_drug: Optional[str] = None
replacement_drug: Optional[str] = None
dose_bucket: DoseBucket
taper_days: Optional[int] = None
monitoring_plan: Optional[str] = None
evidence_query: Optional[str] = None
new_drug_name: Optional[str] = None
candidate_components: list[str] = Field(default_factory=list)
candidate_id: str
confidence: float
rationale_brief: str
class StepCandidateRequest(StrictSchema):
candidate_id: str
confidence: float
rationale_brief: str
class OrchestrateRequest(StrictSchema):
coordination_mode: Optional[str] = None
class BatchInferRequest(StrictSchema):
batch_size: int = 4
class EvidenceQueryRequest(StrictSchema):
query: str
top_k: int = 5
class MedicationAlternativesRequest(StrictSchema):
"""FDA / external tool: suggest other labeled drugs in a similar pharmacologic class."""
query_drug: Optional[str] = None
regimen_drugs: list[str] = Field(default_factory=list)
max_suggestions: int = Field(default=10, ge=1, le=25)
|