Skip to content

Commit

Permalink
feat(app, shared-data): Add liquidProbe and tryLiquidProbe command te…
Browse files Browse the repository at this point in the history
…xt (#15722)

Closes EXEC-567
  • Loading branch information
mjhuff authored Jul 19, 2024
1 parent 8c4f50e commit b46305f
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/src/assets/localization/en/protocol_command_text.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"deactivating_tc_block": "Deactivating Thermocycler block",
"deactivating_tc_lid": "Deactivating Thermocycler lid",
"degrees_c": "{{temp}}°C",
"detect_liquid_presence": "Detecting liquid presence in well {{well_name}} of {{labware}} in {{labware_location}}",
"disengaging_magnetic_module": "Disengaging Magnetic Module",
"dispense": "Dispensing {{volume}} µL into well {{well_name}} of {{labware}} in {{labware_location}} at {{flow_rate}} µL/sec",
"dispense_in_place": "Dispensing {{volume}} µL in place at {{flow_rate}} µL/sec",
Expand Down
40 changes: 40 additions & 0 deletions app/src/molecules/Command/__fixtures__/mockRobotSideAnalysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -6391,6 +6391,46 @@
"addressableAreaName": "D3",
"offset": { "x": 0, "y": 0, "z": 0 }
}
},
{
"id": "84f7af1d-c097-4d4b-9819-ad56479bbbb8",
"createdAt": "2023-01-31T21:53:04.965216+00:00",
"commandType": "liquidProbe",
"key": "1248111104",
"status": "succeeded",
"params": {
"labwareId": "b2a40c9d-31b0-4f27-ad4a-c92ced91204d",
"wellName": "A1",
"wellLocation": {
"origin": "top",
"offset": {
"x": 0,
"y": 0,
"z": 0
}
},
"pipetteId": "f6d1c83c-9d1b-4d0d-9de3-e6d649739cfb"
}
},
{
"id": "84f7af1d-c097-4d4b-9819-ad56479bbbb8",
"createdAt": "2023-01-31T21:53:04.965216+00:00",
"commandType": "tryLiquidProbe",
"key": "1248111104",
"status": "succeeded",
"params": {
"labwareId": "b2a40c9d-31b0-4f27-ad4a-c92ced91204d",
"wellName": "A1",
"wellLocation": {
"origin": "top",
"offset": {
"x": 0,
"y": 0,
"z": 0
}
},
"pipetteId": "f6d1c83c-9d1b-4d0d-9de3-e6d649739cfb"
}
}
],
"errors": [],
Expand Down
40 changes: 40 additions & 0 deletions app/src/molecules/Command/__tests__/CommandText.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1401,4 +1401,44 @@ describe('CommandText', () => {
'Moving NEST 96 Well Plate 100 µL PCR Full Skirt (1) using gripper from Magnetic Module GEN2 in Slot 1 to Magnetic Module GEN2 in Slot 1'
)
})

it('renders correct text for liquidProbe', () => {
const command = mockCommandTextData.commands.find(
c => c.commandType === 'liquidProbe'
)
expect(command).not.toBeUndefined()
if (command != null) {
renderWithProviders(
<CommandText
commandTextData={mockCommandTextData}
robotType={FLEX_ROBOT_TYPE}
command={command}
/>,
{ i18nInstance: i18n }
)
screen.getByText(
'Detecting liquid presence in well A1 of Opentrons 96 Tip Rack 300 µL in Slot 9'
)
}
})

it('renders correct text for tryLiquidProbe', () => {
const command = mockCommandTextData.commands.find(
c => c.commandType === 'tryLiquidProbe'
)
expect(command).not.toBeUndefined()
if (command != null) {
renderWithProviders(
<CommandText
commandTextData={mockCommandTextData}
robotType={FLEX_ROBOT_TYPE}
command={command}
/>,
{ i18nInstance: i18n }
)
screen.getByText(
'Detecting liquid presence in well A1 of Opentrons 96 Tip Rack 300 µL in Slot 9'
)
}
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ export function useCommandTextString(
commandText: utils.getLoadCommandText(fullParams),
}

case 'liquidProbe':
case 'tryLiquidProbe':
return {
commandText: utils.getLiquidProbeCommandText({
...fullParams,
command,
}),
}

case 'temperatureModule/setTargetTemperature':
case 'temperatureModule/waitForTemperature':
case 'thermocycler/setTargetBlockTemperature':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import {
getFinalLabwareLocation,
getLabwareDisplayLocation,
getLabwareName,
} from '../../../utils'

import type {
LiquidProbeRunTimeCommand,
RunTimeCommand,
TryLiquidProbeRunTimeCommand,
} from '@opentrons/shared-data'
import type { HandlesCommands } from './types'
import type { TFunction } from 'i18next'

type LiquidProbeRunTimeCommands =
| LiquidProbeRunTimeCommand
| TryLiquidProbeRunTimeCommand

export function getLiquidProbeCommandText({
command,
commandTextData,
t,
robotType,
}: HandlesCommands<LiquidProbeRunTimeCommands>): string {
const { wellName, labwareId } = command.params

const allPreviousCommands = commandTextData?.commands.slice(
0,
commandTextData.commands.findIndex(c => c.id === command?.id)
)

const labwareLocation =
allPreviousCommands != null
? getFinalLabwareLocation(
labwareId as string,
allPreviousCommands as RunTimeCommand[]
)
: null

const displayLocation =
labwareLocation != null && commandTextData != null
? getLabwareDisplayLocation(
commandTextData,
labwareLocation,
t as TFunction,
robotType
)
: ''

const labware =
commandTextData != null
? getLabwareName(commandTextData, labwareId as string)
: null

return t('detect_liquid_presence', {
labware,
labware_location: displayLocation,
well_name: wellName,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ export { getCommentCommandText } from './getCommentCommandText'
export { getCustomCommandText } from './getCustomCommandText'
export { getUnknownCommandText } from './getUnknownCommandText'
export { getPipettingCommandText } from './getPipettingCommandText'
export { getLiquidProbeCommandText } from './getLiquidProbeCommandText'
12 changes: 12 additions & 0 deletions shared-data/command/types/pipetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type PipettingRunTimeCommand =
| TouchTipRunTimeCommand
| VerifyTipPresenceRunTimeCommand
| LiquidProbeRunTimeCommand
| TryLiquidProbeRunTimeCommand

export type PipettingCreateCommand =
| AspirateCreateCommand
Expand All @@ -36,6 +37,7 @@ export type PipettingCreateCommand =
| TouchTipCreateCommand
| VerifyTipPresenceCreateCommand
| LiquidProbeCreateCommand
| TryLiquidProbeCreateCommand

export interface ConfigureForVolumeCreateCommand
extends CommonCommandCreateInfo {
Expand Down Expand Up @@ -206,6 +208,16 @@ export interface LiquidProbeRunTimeCommand
result?: Record<string, unknown>
}

export interface TryLiquidProbeCreateCommand extends CommonCommandCreateInfo {
commandType: 'tryLiquidProbe'
params: WellLocationParam & PipetteAccessParams
}
export interface TryLiquidProbeRunTimeCommand
extends CommonCommandRunTimeInfo,
TryLiquidProbeCreateCommand {
result?: Record<string, unknown>
}

export type AspDispAirgapParams = FlowRateParams &
PipetteAccessParams &
VolumeParams &
Expand Down

0 comments on commit b46305f

Please sign in to comment.