From c7031deffd86650a7380a92b91c004f43750fae1 Mon Sep 17 00:00:00 2001 From: smb2268 Date: Thu, 9 Nov 2023 14:39:42 -0500 Subject: [PATCH 1/6] feat(shared-data, app): add configureNozzleLayout command type and run log support --- shared-data/command/types/setup.ts | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/shared-data/command/types/setup.ts b/shared-data/command/types/setup.ts index f8fb78752e5..ec2ab0c9391 100644 --- a/shared-data/command/types/setup.ts +++ b/shared-data/command/types/setup.ts @@ -71,6 +71,18 @@ export interface LoadFixtureRunTimeCommand result?: LoadLabwareResult } +export interface ConfigureNozzleLayoutCreateCommand + extends CommonCommandCreateInfo { + commandType: 'configureNozzleLayout' + params: ConfigureNozzleLayoutParams +} + +export interface ConfigureNozzleLayoutRunTimeCommand + extends CommonCommandRunTimeInfo, + ConfigureNozzleLayoutCreateCommand { + result?: {} +} + export type SetupRunTimeCommand = | LoadPipetteRunTimeCommand | LoadLabwareRunTimeCommand @@ -78,6 +90,7 @@ export type SetupRunTimeCommand = | LoadModuleRunTimeCommand | LoadLiquidRunTimeCommand | MoveLabwareRunTimeCommand + | ConfigureNozzleLayoutRunTimeCommand export type SetupCreateCommand = | LoadPipetteCreateCommand @@ -86,6 +99,7 @@ export type SetupCreateCommand = | LoadModuleCreateCommand | LoadLiquidCreateCommand | MoveLabwareCreateCommand + | ConfigureNozzleLayoutCreateCommand export type LabwareLocation = | 'offDeck' @@ -161,3 +175,26 @@ interface LoadFixtureParams { loadName: FixtureLoadName fixtureId?: string } + +const COLUMN = 'COLUMN' +const SINGLE = 'SINGLE' +const ROW = 'ROW' +const QUADRANT = 'QUADRANT' +const EMPTY = 'EMPTY' + +export type NozzleConfigurationStyle = + | typeof COLUMN + | typeof SINGLE + | typeof ROW + | typeof QUADRANT + | typeof EMPTY + +interface NozzleConfigurationParams { + primary_nozzle: string + style: NozzleConfigurationStyle +} + +interface ConfigureNozzleLayoutParams { + pipetteId: string + configuration_params: NozzleConfigurationParams +} From 3e878252770f5e577e01974bc3cd7e1ed9b32d3d Mon Sep 17 00:00:00 2001 From: smb2268 Date: Thu, 9 Nov 2023 15:29:58 -0500 Subject: [PATCH 2/6] Update command text for pickup tip and configure pipette nozzle --- .../en/protocol_command_text.json | 3 +- .../CommandText/PipettingCommandText.tsx | 13 ++++++- .../__tests__/CommandText.test.tsx | 2 +- app/src/organisms/CommandText/index.tsx | 18 +++++++++ .../CommandText/utils/getWellRange.ts | 39 +++++++++++++++++++ app/src/organisms/CommandText/utils/index.ts | 1 + 6 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 app/src/organisms/CommandText/utils/getWellRange.ts diff --git a/app/src/assets/localization/en/protocol_command_text.json b/app/src/assets/localization/en/protocol_command_text.json index 8d84b9e341f..fddc61a345e 100644 --- a/app/src/assets/localization/en/protocol_command_text.json +++ b/app/src/assets/localization/en/protocol_command_text.json @@ -6,6 +6,7 @@ "closing_tc_lid": "Closing Thermocycler lid", "comment": "Comment", "configure_for_volume": "Configure {{pipette}} to aspirate {{volume}} µL", + "configure_nozzle_layout": "Configure {{pipette}} to use {{amount}} nozzles", "confirm_and_resume": "Confirm and resume", "deactivate_hs_shake": "Deactivating shaker", "deactivate_temperature_module": "Deactivating Temperature Module", @@ -37,7 +38,7 @@ "opening_tc_lid": "Opening Thermocycler lid", "pause_on": "Pause on {{robot_name}}", "pause": "Pause", - "pickup_tip": "Picking up tip from {{well_name}} of {{labware}} in {{labware_location}}", + "pickup_tip": "Picking up tip(s) from {{well_range}} of {{labware}} in {{labware_location}}", "prepare_to_aspirate": "Preparing {{pipette}} to aspirate", "return_tip": "Returning tip to {{well_name}} of {{labware}} in {{labware_location}}", "save_position": "Saving position", diff --git a/app/src/organisms/CommandText/PipettingCommandText.tsx b/app/src/organisms/CommandText/PipettingCommandText.tsx index 8aff25b4da3..d21acf0c3f9 100644 --- a/app/src/organisms/CommandText/PipettingCommandText.tsx +++ b/app/src/organisms/CommandText/PipettingCommandText.tsx @@ -16,6 +16,7 @@ import { getLabwareName, getLabwareDisplayLocation, getFinalLabwareLocation, + getWellRange, } from './utils' type PipettingRunTimeCommmand = @@ -122,8 +123,18 @@ export const PipettingCommandText = ({ }) } case 'pickUpTip': { + const pipetteId = command.params.pipetteId + const pipetteName = robotSideAnalysis.pipettes.find( + pip => pip.id === pipetteId + )?.pipetteName + return t('pickup_tip', { - well_name: wellName, + well_range: getWellRange( + pipetteId, + pipetteName, + allPreviousCommands, + wellName + ), labware: getLabwareName(robotSideAnalysis, labwareId), labware_location: displayLocation, }) diff --git a/app/src/organisms/CommandText/__tests__/CommandText.test.tsx b/app/src/organisms/CommandText/__tests__/CommandText.test.tsx index 28ef08f940f..0ce3a0e6ded 100644 --- a/app/src/organisms/CommandText/__tests__/CommandText.test.tsx +++ b/app/src/organisms/CommandText/__tests__/CommandText.test.tsx @@ -219,7 +219,7 @@ describe('CommandText', () => { { i18nInstance: i18n } )[0] getByText( - 'Picking up tip from A1 of Opentrons 96 Tip Rack 300 µL in Slot 9' + 'Picking up tip(s) from A1 of Opentrons 96 Tip Rack 300 µL in Slot 9' ) } }) diff --git a/app/src/organisms/CommandText/index.tsx b/app/src/organisms/CommandText/index.tsx index 67e76526ab1..a4b1c592baa 100644 --- a/app/src/organisms/CommandText/index.tsx +++ b/app/src/organisms/CommandText/index.tsx @@ -165,6 +165,24 @@ export function CommandText(props: Props): JSX.Element | null { ) } + case 'configureNozzleLayout': { + const { configuration_params, pipetteId } = command.params + const pipetteName = robotSideAnalysis.pipettes.find( + pip => pip.id === pipetteId + )?.pipetteName + + return ( + + {t('configure_nozzle_layout', { + amount: configuration_params.style === 'COLUMN' ? '8' : 'all', + pipette: + pipetteName != null + ? getPipetteNameSpecs(pipetteName)?.displayName + : '', + })} + + ) + } case 'prepareToAspirate': { const { pipetteId } = command.params const pipetteName = robotSideAnalysis.pipettes.find( diff --git a/app/src/organisms/CommandText/utils/getWellRange.ts b/app/src/organisms/CommandText/utils/getWellRange.ts new file mode 100644 index 00000000000..1e1e42d501f --- /dev/null +++ b/app/src/organisms/CommandText/utils/getWellRange.ts @@ -0,0 +1,39 @@ +import { + getPipetteNameSpecs, + PipetteName, + RunTimeCommand, +} from '@opentrons/shared-data' + +/** + * @param pipetteName name of pipette being used + * @param commands list of commands to search within + * @param wellName the target well for pickup tip + * @returns WellRange string of wells pipette will pickup tips from + */ +export function getWellRange( + pipetteId: string, + pipetteName: PipetteName, + commands: RunTimeCommand[], + wellName: string +): string { + const pipetteChannels = getPipetteNameSpecs(pipetteName)?.channels ?? 1 + let usedChannels = pipetteChannels + if (pipetteChannels === 96) { + for (const c of commands.reverse()) { + if ( + c.commandType === 'configureNozzleLayout' && + c.params?.pipetteId === pipetteId + ) { + usedChannels = c.params.configuration_params.style === 'COLUMN' ? 8 : 96 + break + } + } + } + if (usedChannels === 96) { + return 'A1 - H12' + } else if (usedChannels === 8) { + const column = wellName.substr(1) + return `A${column} - H${column}` + } + return wellName +} diff --git a/app/src/organisms/CommandText/utils/index.ts b/app/src/organisms/CommandText/utils/index.ts index 0b7a5c24124..5435a292d11 100644 --- a/app/src/organisms/CommandText/utils/index.ts +++ b/app/src/organisms/CommandText/utils/index.ts @@ -5,3 +5,4 @@ export * from './getModuleDisplayLocation' export * from './getLiquidDisplayName' export * from './getLabwareDisplayLocation' export * from './getFinalLabwareLocation' +export * from './getWellRange' From 88b077f9716033534628e30db94c5dc5bcea592a Mon Sep 17 00:00:00 2001 From: smb2268 Date: Thu, 9 Nov 2023 15:33:40 -0500 Subject: [PATCH 3/6] Add single tip support --- app/src/organisms/CommandText/utils/getWellRange.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/organisms/CommandText/utils/getWellRange.ts b/app/src/organisms/CommandText/utils/getWellRange.ts index 1e1e42d501f..97a306f3785 100644 --- a/app/src/organisms/CommandText/utils/getWellRange.ts +++ b/app/src/organisms/CommandText/utils/getWellRange.ts @@ -24,7 +24,12 @@ export function getWellRange( c.commandType === 'configureNozzleLayout' && c.params?.pipetteId === pipetteId ) { - usedChannels = c.params.configuration_params.style === 'COLUMN' ? 8 : 96 + // TODO(sb(11/9/23): add support for quadrant and row configurations as needed) + if (c.params.configuration_params.style === 'SINGLE') { + usedChannels = 1 + } else if (c.params.configuration_params.style === 'COLUMN') { + usedChannels = 8 + } break } } From a4f65e987d1c1221dc2b98de44a3301396d05717 Mon Sep 17 00:00:00 2001 From: smb2268 Date: Thu, 9 Nov 2023 15:36:02 -0500 Subject: [PATCH 4/6] Update todos --- app/src/organisms/CommandText/index.tsx | 1 + app/src/organisms/CommandText/utils/getWellRange.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/organisms/CommandText/index.tsx b/app/src/organisms/CommandText/index.tsx index a4b1c592baa..8ce1605f5fa 100644 --- a/app/src/organisms/CommandText/index.tsx +++ b/app/src/organisms/CommandText/index.tsx @@ -171,6 +171,7 @@ export function CommandText(props: Props): JSX.Element | null { pip => pip.id === pipetteId )?.pipetteName + // TODO (sb, 11/9/23): Add support for other configurations when needed return ( {t('configure_nozzle_layout', { diff --git a/app/src/organisms/CommandText/utils/getWellRange.ts b/app/src/organisms/CommandText/utils/getWellRange.ts index 97a306f3785..9e75bafa936 100644 --- a/app/src/organisms/CommandText/utils/getWellRange.ts +++ b/app/src/organisms/CommandText/utils/getWellRange.ts @@ -24,7 +24,7 @@ export function getWellRange( c.commandType === 'configureNozzleLayout' && c.params?.pipetteId === pipetteId ) { - // TODO(sb(11/9/23): add support for quadrant and row configurations as needed) + // TODO(sb, 11/9/23): add support for quadrant and row configurations when needed if (c.params.configuration_params.style === 'SINGLE') { usedChannels = 1 } else if (c.params.configuration_params.style === 'COLUMN') { From f2253eb61a72da208f83589b99d48ea189cc962d Mon Sep 17 00:00:00 2001 From: smb2268 Date: Thu, 9 Nov 2023 15:55:56 -0500 Subject: [PATCH 5/6] Fix TS error --- app/src/organisms/CommandText/PipettingCommandText.tsx | 9 ++++++--- app/src/organisms/CommandText/utils/getWellRange.ts | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/organisms/CommandText/PipettingCommandText.tsx b/app/src/organisms/CommandText/PipettingCommandText.tsx index d21acf0c3f9..7285195c994 100644 --- a/app/src/organisms/CommandText/PipettingCommandText.tsx +++ b/app/src/organisms/CommandText/PipettingCommandText.tsx @@ -18,6 +18,7 @@ import { getFinalLabwareLocation, getWellRange, } from './utils' +import type { PipetteName } from '@opentrons/shared-data' type PipettingRunTimeCommmand = | AspirateRunTimeCommand @@ -124,16 +125,18 @@ export const PipettingCommandText = ({ } case 'pickUpTip': { const pipetteId = command.params.pipetteId - const pipetteName = robotSideAnalysis.pipettes.find( + const pipetteName: + | PipetteName + | undefined = robotSideAnalysis.pipettes.find( pip => pip.id === pipetteId )?.pipetteName return t('pickup_tip', { well_range: getWellRange( pipetteId, - pipetteName, allPreviousCommands, - wellName + wellName, + pipetteName ), labware: getLabwareName(robotSideAnalysis, labwareId), labware_location: displayLocation, diff --git a/app/src/organisms/CommandText/utils/getWellRange.ts b/app/src/organisms/CommandText/utils/getWellRange.ts index 9e75bafa936..8baa6c0b709 100644 --- a/app/src/organisms/CommandText/utils/getWellRange.ts +++ b/app/src/organisms/CommandText/utils/getWellRange.ts @@ -12,11 +12,13 @@ import { */ export function getWellRange( pipetteId: string, - pipetteName: PipetteName, commands: RunTimeCommand[], - wellName: string + wellName: string, + pipetteName?: PipetteName ): string { - const pipetteChannels = getPipetteNameSpecs(pipetteName)?.channels ?? 1 + const pipetteChannels = pipetteName + ? getPipetteNameSpecs(pipetteName)?.channels ?? 1 + : 1 let usedChannels = pipetteChannels if (pipetteChannels === 96) { for (const c of commands.reverse()) { From 5c77e4fdaab76414bc4cfb93db613798241dc58f Mon Sep 17 00:00:00 2001 From: smb2268 Date: Thu, 9 Nov 2023 16:03:24 -0500 Subject: [PATCH 6/6] Alphabetize exports --- shared-data/command/types/setup.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-data/command/types/setup.ts b/shared-data/command/types/setup.ts index ec2ab0c9391..e5b3184241d 100644 --- a/shared-data/command/types/setup.ts +++ b/shared-data/command/types/setup.ts @@ -84,22 +84,22 @@ export interface ConfigureNozzleLayoutRunTimeCommand } export type SetupRunTimeCommand = + | ConfigureNozzleLayoutRunTimeCommand | LoadPipetteRunTimeCommand | LoadLabwareRunTimeCommand | LoadFixtureRunTimeCommand | LoadModuleRunTimeCommand | LoadLiquidRunTimeCommand | MoveLabwareRunTimeCommand - | ConfigureNozzleLayoutRunTimeCommand export type SetupCreateCommand = + | ConfigureNozzleLayoutCreateCommand | LoadPipetteCreateCommand | LoadLabwareCreateCommand | LoadFixtureCreateCommand | LoadModuleCreateCommand | LoadLiquidCreateCommand | MoveLabwareCreateCommand - | ConfigureNozzleLayoutCreateCommand export type LabwareLocation = | 'offDeck'