diff --git a/robot-server/robot_server/runs/router/base_router.py b/robot-server/robot_server/runs/router/base_router.py index eeaf8b9a7a8..3b0e7040e02 100644 --- a/robot-server/robot_server/runs/router/base_router.py +++ b/robot-server/robot_server/runs/router/base_router.py @@ -52,6 +52,7 @@ ActiveNozzleLayout, RunCurrentState, CommandLinkNoMeta, + NozzleLayoutConfig, ) from ..run_auto_deleter import RunAutoDeleter from ..run_models import Run, BadRun, RunCreate, RunUpdate @@ -576,7 +577,7 @@ async def get_current_state( pipetteId: ActiveNozzleLayout.construct( startingNozzle=nozzle_map.starting_nozzle, activeNozzles=list(nozzle_map.map_store.keys()), - config=nozzle_map.configuration.value, + config=NozzleLayoutConfig(nozzle_map.configuration.value.lower()), ) for pipetteId, nozzle_map in active_nozzle_maps.items() } diff --git a/robot-server/robot_server/runs/run_models.py b/robot-server/robot_server/runs/run_models.py index f2573306fa7..962c3ab51e7 100644 --- a/robot-server/robot_server/runs/run_models.py +++ b/robot-server/robot_server/runs/run_models.py @@ -1,5 +1,7 @@ """Request and response models for run resources.""" from datetime import datetime + +from enum import Enum from pydantic import BaseModel, Field from typing import List, Optional, Literal, Dict @@ -280,6 +282,16 @@ class LabwareDefinitionSummary(BaseModel): ) +class NozzleLayoutConfig(str, Enum): + """Possible valid nozzle configurations.""" + + COLUMN = "column" + ROW = "row" + SINGLE = "single" + FULL = "full" + SUBRECT = "subrect" + + class ActiveNozzleLayout(BaseModel): """Details about the active nozzle layout for a pipette used in the current run.""" @@ -290,7 +302,9 @@ class ActiveNozzleLayout(BaseModel): ..., description="A map of all the pipette nozzles active in the current configuration.", ) - config: str = Field(..., description="The nozzle configuration type.") + config: NozzleLayoutConfig = Field( + ..., description="The active nozzle configuration." + ) class RunCurrentState(BaseModel): diff --git a/robot-server/tests/runs/router/test_base_router.py b/robot-server/tests/runs/router/test_base_router.py index 8d244cd9d0e..37e5cd6dd3d 100644 --- a/robot-server/tests/runs/router/test_base_router.py +++ b/robot-server/tests/runs/router/test_base_router.py @@ -46,6 +46,7 @@ RunCurrentState, ActiveNozzleLayout, CommandLinkNoMeta, + NozzleLayoutConfig, ) from robot_server.runs.run_orchestrator_store import RunConflictError from robot_server.runs.run_data_manager import ( @@ -868,7 +869,9 @@ async def test_get_current_state_success( assert result.content.data == RunCurrentState.construct( activeNozzleLayouts={ "mock-pipette-id": ActiveNozzleLayout( - startingNozzle="A1", activeNozzles=["A1"], config="FULL" + startingNozzle="A1", + activeNozzles=["A1"], + config=NozzleLayoutConfig.FULL, ) } )