Skip to content

Commit c3d6678

Browse files
authored
refactor(protocol-designer, step-generation): multi tiprack uses defURI instead of id (#15096)
closes AUTH-12
1 parent c867d3f commit c3d6678

25 files changed

+121
-104
lines changed

protocol-designer/fixtures/protocol/8/doItAllV3MigratedToV8.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"3961e4c0-75c7-11ea-b42f-4b64e50f43e5": {
7474
"pipette": "0b3f2210-75c7-11ea-b42f-4b64e50f43e5",
7575
"volume": "40",
76-
"tipRack": "0b44c760-75c7-11ea-b42f-4b64e50f43e5:opentrons/opentrons_96_tiprack_300ul/1",
76+
"tipRack": "opentrons/opentrons_96_tiprack_300ul/1",
7777
"changeTip": "always",
7878
"path": "multiDispense",
7979
"aspirate_wells_grouped": false,
@@ -175,7 +175,7 @@
175175
"mix_touchTip_mmFromBottom": 11.8,
176176
"dropTip_location": "8053a205-f2dc-4b1d-8d05-bf8233949e2e:trashBin",
177177
"nozzles": null,
178-
"tipRack": "0b44c760-75c7-11ea-b42f-4b64e50f43e5:opentrons/opentrons_96_tiprack_300ul/1",
178+
"tipRack": "opentrons/opentrons_96_tiprack_300ul/1",
179179
"mix_x_position": 0,
180180
"mix_y_position": 0,
181181
"blowout_z_offset": 0,

protocol-designer/fixtures/protocol/8/doItAllV4MigratedToV8.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"3961e4c0-75c7-11ea-b42f-4b64e50f43e5": {
108108
"pipette": "0b3f2210-75c7-11ea-b42f-4b64e50f43e5",
109109
"volume": "30",
110-
"tipRack": "0b44c760-75c7-11ea-b42f-4b64e50f43e5:opentrons/opentrons_96_tiprack_300ul/1",
110+
"tipRack": "opentrons/opentrons_96_tiprack_300ul/1",
111111
"changeTip": "always",
112112
"path": "single",
113113
"aspirate_wells_grouped": false,

protocol-designer/fixtures/protocol/8/doItAllV7MigratedToV8.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
"f9a294f1-f42b-4cae-893a-592405349d56": {
152152
"pipette": "2e7c6344-58ab-465c-b542-489883cb63fe",
153153
"volume": "100",
154-
"tipRack": "23ed35de-5bfd-4bb0-8f54-da99a2804ed9:opentrons/opentrons_flex_96_filtertiprack_50ul/1",
154+
"tipRack": "opentrons/opentrons_flex_96_filtertiprack_50ul/1",
155155
"changeTip": "always",
156156
"path": "single",
157157
"aspirate_wells_grouped": false,
@@ -227,7 +227,7 @@
227227
"mix_touchTip_mmFromBottom": null,
228228
"dropTip_location": "134504e1-b212-41cf-966d-2560deb5b693:trashBin",
229229
"nozzles": null,
230-
"tipRack": "23ed35de-5bfd-4bb0-8f54-da99a2804ed9:opentrons/opentrons_flex_96_filtertiprack_50ul/1",
230+
"tipRack": "opentrons/opentrons_flex_96_filtertiprack_50ul/1",
231231
"mix_x_position": 0,
232232
"mix_y_position": 0,
233233
"blowout_z_offset": 0,

protocol-designer/fixtures/protocol/8/doItAllV8.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"d2f74144-a7bf-4ba2-aaab-30d70b2b62c7": {
112112
"pipette": "9fcd50d9-92b2-45ac-acf1-e2cf773feffc",
113113
"volume": "100",
114-
"tipRack": "f2d371ea-5146-4c89-8200-9c056a7f321a:opentrons/opentrons_flex_96_tiprack_1000ul/1",
114+
"tipRack": "opentrons/opentrons_flex_96_tiprack_1000ul/1",
115115
"changeTip": "always",
116116
"path": "single",
117117
"aspirate_wells_grouped": false,

protocol-designer/fixtures/protocol/8/example_1_1_0MigratedToV8.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"e7d36200-92a5-11e9-ac62-1b173f839d9e": {
7676
"pipette": "c6f45030-92a5-11e9-ac62-1b173f839d9e",
7777
"volume": "6",
78-
"tipRack": "c6f4ec70-92a5-11e9-ac62-1b173f839d9e:tiprack-10ul",
78+
"tipRack": "opentrons/opentrons_96_tiprack_10ul/1",
7979
"changeTip": "always",
8080
"path": "single",
8181
"aspirate_wells_grouped": false,
@@ -161,7 +161,7 @@
161161
"mix_touchTip_mmFromBottom": 30.5,
162162
"dropTip_location": "9b1c0d01-9d4f-4016-afe6-9e08b46acf5e:trashBin",
163163
"nozzles": null,
164-
"tipRack": "c6f4ec70-92a5-11e9-ac62-1b173f839d9e:tiprack-10ul",
164+
"tipRack": "opentrons/opentrons_96_tiprack_10ul/1",
165165
"mix_x_position": 0,
166166
"mix_y_position": 0,
167167
"blowout_z_offset": 0,

protocol-designer/fixtures/protocol/8/mix_8_0_0.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"mix_touchTip_mmFromBottom": null,
7575
"dropTip_location": "5ba7047d-d3e2-4845-9eaa-1974af796ead:trashBin",
7676
"nozzles": null,
77-
"tipRack": "f1c677c0-fc3a-11ea-8809-e959e7d61d96:opentrons/opentrons_96_tiprack_10ul/1",
77+
"tipRack": "opentrons/opentrons_96_tiprack_10ul/1",
7878
"mix_x_position": 0,
7979
"mix_y_position": 0,
8080
"blowout_z_offset": 0,

protocol-designer/fixtures/protocol/8/newAdvancedSettingsAndMultiTemp.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"stepDetails": "",
5656
"pipette": "21087f15-4c03-4587-8a2b-1ba0b5a501a0",
5757
"volume": "10",
58-
"tipRack": "0d39213c-49c2-4170-bf19-4c09e1b72aca:opentrons/opentrons_flex_96_tiprack_50ul/1",
58+
"tipRack": "opentrons/opentrons_flex_96_tiprack_50ul/1",
5959
"changeTip": "always",
6060
"path": "single",
6161
"aspirate_wells_grouped": false,

protocol-designer/fixtures/protocol/8/ninetySixChannelFullAndColumn.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"83a095fa-b649-4105-99d4-177f1a3f363a": {
5151
"pipette": "de7da440-95ec-43e8-8723-851321fbd6f9",
5252
"volume": "10",
53-
"tipRack": "75aa666f-98d8-4af9-908e-963ced428580:opentrons/opentrons_flex_96_tiprack_50ul/1",
53+
"tipRack": "opentrons/opentrons_flex_96_tiprack_50ul/1",
5454
"changeTip": "always",
5555
"path": "single",
5656
"aspirate_wells_grouped": false,
@@ -107,7 +107,7 @@
107107
"f5ea3139-1585-4848-9d5f-832eb88c99ca": {
108108
"pipette": "de7da440-95ec-43e8-8723-851321fbd6f9",
109109
"volume": "10",
110-
"tipRack": "75aa666f-98d8-4af9-908e-963ced428580:opentrons/opentrons_flex_96_tiprack_50ul/1",
110+
"tipRack": "opentrons/opentrons_flex_96_tiprack_50ul/1",
111111
"changeTip": "always",
112112
"path": "single",
113113
"aspirate_wells_grouped": false,

protocol-designer/src/components/StepEditForm/fields/TiprackField.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ export function TiprackField(props: TiprackFieldProps): JSX.Element {
3030
const [targetProps, tooltipProps] = useHoverTooltip()
3131
const pipetteEntities = useSelector(getPipetteEntities)
3232
const options = useSelector(uiLabwareSelectors.getTiprackOptions)
33-
const defaultTipracks =
33+
const defaultTiprackUris =
3434
pipetteId != null ? pipetteEntities[pipetteId as string].tiprackDefURI : []
35-
const pipetteOptions = options.filter(option =>
36-
defaultTipracks.includes(option.defURI)
35+
const tiprackOptions = options.filter(option =>
36+
defaultTiprackUris.includes(option.value)
3737
)
38-
const hasMissingTiprack = defaultTipracks.length > pipetteOptions.length
3938

39+
const hasMissingTiprack = defaultTiprackUris.length > tiprackOptions.length
4040
return (
4141
<Box {...targetProps}>
4242
<FormGroup
4343
label={t('step_edit_form.tipRack')}
4444
className={styles.large_field}
4545
>
4646
<DropdownField
47-
options={pipetteOptions}
47+
options={tiprackOptions}
4848
name={name}
4949
value={String(value) != null ? String(value) : null}
5050
onBlur={onFieldBlur}

protocol-designer/src/components/StepEditForm/fields/__tests__/TiprackField.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,12 @@ describe('TiprackField', () => {
4040
})
4141
vi.mocked(getTiprackOptions).mockReturnValue([
4242
{
43-
value: 'mockValue',
43+
value: 'mockDefURI1',
4444
name: 'tiprack1',
45-
defURI: 'mockDefURI1',
4645
},
4746
{
48-
value: 'mockValue',
47+
value: 'mockDefURI2',
4948
name: 'tiprack2',
50-
defURI: 'mockDefURI2',
5149
},
5250
])
5351
})

protocol-designer/src/load-file/migration/8_1_0.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export const migrateFile = (
4646
{}
4747
)
4848

49+
const pipetteTiprackAssignments =
50+
designerApplication.data?.pipetteTiprackAssignments
51+
4952
const loadLabwareCommands = commands.filter(
5053
(command): command is LoadLabwareCreateCommand =>
5154
command.commandType === 'loadLabware'
@@ -74,9 +77,6 @@ export const migrateFile = (
7477
const tiprackLoadCommands = loadLabwareCommands.filter(
7578
command => command.params.loadName === tiprackLoadName
7679
)
77-
const tiprackIds = tiprackLoadCommands.map(
78-
command => command.params.labwareId
79-
)
8080
const xyKeys =
8181
item.stepType === 'mix'
8282
? { mix_x_position: 0, mix_y_position: 0 }
@@ -105,6 +105,7 @@ export const migrateFile = (
105105
const pipetteName = loadPipetteCommands.find(
106106
pipette => pipette.params.pipetteId === item.pipette
107107
)?.params.pipetteName
108+
108109
const defaultBlowOutFlowRate = getDefaultBlowoutFlowRate(
109110
pipetteName as PipetteName,
110111
item.volume,
@@ -116,11 +117,13 @@ export const migrateFile = (
116117
blowoutFlowRate = null
117118
}
118119

120+
const tipRackDefURI = pipetteTiprackAssignments[item.pipette]
121+
119122
acc[item.id] = {
120123
...item,
121124
blowout_flowRate: blowoutFlowRate,
122125
blowout_z_offset: 0,
123-
tipRack: tiprackIds[0],
126+
tipRack: tipRackDefURI,
124127
...xyKeys,
125128
}
126129
return acc

protocol-designer/src/step-forms/test/createPresavedStepForm.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('createPresavedStepForm', () => {
141141
pipette: 'leftPipetteId',
142142
nozzles: null,
143143
stepType: 'moveLiquid',
144-
tipRack: null,
144+
tipRack: 'defaultTipRack',
145145
// default fields
146146
dropTip_location: 'mockTrash',
147147
aspirate_airGap_checkbox: false,
@@ -228,7 +228,7 @@ describe('createPresavedStepForm', () => {
228228
volume: undefined,
229229
aspirate_flowRate: null,
230230
dispense_flowRate: null,
231-
tipRack: null,
231+
tipRack: 'defaultTipRack',
232232
blowout_flowRate: null,
233233
})
234234
})

protocol-designer/src/step-forms/utils/createPresavedStepForm.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ const _patchDefaultTiprack = (args: {
132132
savedStepForms,
133133
orderedStepIds,
134134
} = args
135-
const labware = initialDeckSetup.labware
136-
const tipRackIds = Object.values(labware)
137-
.filter(lw => lw.def.parameters.isTiprack)
138-
.map(lw => lw.id)
139-
140135
const defaultPipetteId = getNextDefaultPipetteId(
141136
savedStepForms,
142137
orderedStepIds,
@@ -145,15 +140,12 @@ const _patchDefaultTiprack = (args: {
145140

146141
const pipetteFirstTiprackDefUri =
147142
pipetteEntities[defaultPipetteId].tiprackDefURI[0]
148-
const defaultTiprackId = tipRackIds.find(id =>
149-
id.includes(pipetteFirstTiprackDefUri)
150-
)
151143
const formHasTipRackField = formData && 'tipRack' in formData
152144

153-
if (formHasTipRackField && defaultTiprackId != null) {
145+
if (formHasTipRackField) {
154146
const updatedFields = handleFormChange(
155147
{
156-
tipRack: defaultTiprackId,
148+
tipRack: pipetteFirstTiprackDefUri,
157149
},
158150
formData,
159151
pipetteEntities,

protocol-designer/src/steplist/test/generateSubsteps.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import {
44
makeContext,
55
FIXED_TRASH_ID,
66
} from '@opentrons/step-generation'
7+
import { fixtureTiprack300ul, getLabwareDefURI } from '@opentrons/shared-data'
78
import { THERMOCYCLER_STATE } from '../../constants'
89
import { generateSubstepItem } from '../generateSubstepItem'
910

11+
import type { LabwareDefinition2 } from '@opentrons/shared-data'
1012
import type {
1113
RobotState,
1214
InvariantContext,
@@ -181,7 +183,7 @@ describe('generateSubstepItem', () => {
181183
dispenseFlowRateUlSec: 5,
182184
dispenseOffsetFromBottomMm: 10,
183185
dropTipLocation: FIXED_TRASH_ID,
184-
tipRack: 'tiprack1Id',
186+
tipRack: getLabwareDefURI(fixtureTiprack300ul as LabwareDefinition2),
185187
}
186188
})
187189
;[
@@ -404,7 +406,7 @@ describe('generateSubstepItem', () => {
404406
aspirateFlowRateUlSec: 5,
405407
dispenseFlowRateUlSec: 5,
406408
dropTipLocation: FIXED_TRASH_ID,
407-
tipRack: 'tiprack1Id',
409+
tipRack: getLabwareDefURI(fixtureTiprack300ul as LabwareDefinition2),
408410
},
409411
// @ts-expect-error(sa, 2021-6-15): errors should be boolean typed
410412
errors: {},

protocol-designer/src/timelineMiddleware/__tests__/generateRobotStateTimeline.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import {
1010
} from '@opentrons/step-generation'
1111
import { generateRobotStateTimeline } from '../generateRobotStateTimeline'
1212
import type { StepArgsAndErrorsById } from '../../steplist'
13+
import {
14+
LabwareDefinition2,
15+
fixtureTiprack300ul,
16+
getLabwareDefURI,
17+
} from '@opentrons/shared-data'
1318

1419
vi.mock('../../labware-defs/utils')
1520

@@ -49,7 +54,7 @@ describe('generateRobotStateTimeline', () => {
4954
mixBeforeAspirate: null,
5055
description: null,
5156
nozzles: null,
52-
tipRack: 'tiprack1Id',
57+
tipRack: getLabwareDefURI(fixtureTiprack300ul as LabwareDefinition2),
5358
aspirateXOffset: 0,
5459
aspirateYOffset: 0,
5560
dispenseXOffset: 0,
@@ -89,7 +94,7 @@ describe('generateRobotStateTimeline', () => {
8994
mixBeforeAspirate: null,
9095
description: null,
9196
nozzles: null,
92-
tipRack: 'tiprack1Id',
97+
tipRack: getLabwareDefURI(fixtureTiprack300ul as LabwareDefinition2),
9398
aspirateXOffset: 0,
9499
aspirateYOffset: 0,
95100
dispenseXOffset: 0,
@@ -121,7 +126,7 @@ describe('generateRobotStateTimeline', () => {
121126
aspirateDelaySeconds: null,
122127
dispenseDelaySeconds: null,
123128
nozzles: null,
124-
tipRack: 'tiprack1Id',
129+
tipRack: getLabwareDefURI(fixtureTiprack300ul as LabwareDefinition2),
125130
aspirateXOffset: 0,
126131
aspirateYOffset: 0,
127132
dispenseXOffset: 0,

protocol-designer/src/ui/labware/selectors.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,27 +241,22 @@ export const getDisposalOptions = createSelector(
241241
}
242242
)
243243

244-
export interface TiprackOption {
245-
name: string
246-
value: string
247-
defURI: string
248-
}
249-
export const getTiprackOptions: Selector<TiprackOption[]> = createSelector(
244+
export const getTiprackOptions: Selector<DropdownOption[]> = createSelector(
250245
stepFormSelectors.getLabwareEntities,
251246
getLabwareNicknamesById,
252247
(labwareEntities, nicknamesById) => {
253248
const options = reduce(
254249
labwareEntities,
255250
(
256-
acc: TiprackOption[],
251+
acc: DropdownOption[],
257252
labwareEntity: LabwareEntity,
258253
labwareId: string
259-
): TiprackOption[] => {
254+
): DropdownOption[] => {
260255
const labwareDefURI = labwareEntity.labwareDefURI
261-
const optionValues = acc.map(option => option.value)
256+
const optionDefURI = acc.map(option => option.value)
262257

263258
if (
264-
optionValues.includes(labwareDefURI) ||
259+
optionDefURI.includes(labwareDefURI) ||
265260
!getIsTiprack(labwareEntity.def)
266261
) {
267262
return acc
@@ -270,8 +265,7 @@ export const getTiprackOptions: Selector<TiprackOption[]> = createSelector(
270265
...acc,
271266
{
272267
name: nicknamesById[labwareId],
273-
value: labwareId,
274-
defURI: labwareDefURI,
268+
value: labwareDefURI,
275269
},
276270
]
277271
}

step-generation/src/__tests__/consolidate.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { beforeEach, describe, it, expect } from 'vitest'
2+
import { getLabwareDefURI, fixtureTiprack300ul } from '@opentrons/shared-data'
23
import { consolidate } from '../commandCreators/compound/consolidate'
34
import { FIXED_TRASH_ID } from '../constants'
45
import {
@@ -25,7 +26,11 @@ import {
2526
blowoutInPlaceHelper,
2627
} from '../fixtures'
2728
import { DEST_WELL_BLOWOUT_DESTINATION } from '../utils'
28-
import type { AspDispAirgapParams, CreateCommand } from '@opentrons/shared-data'
29+
import type {
30+
AspDispAirgapParams,
31+
CreateCommand,
32+
LabwareDefinition2,
33+
} from '@opentrons/shared-data'
2934
import type { ConsolidateArgs, InvariantContext, RobotState } from '../types'
3035

3136
const airGapHelper = makeAirGapHelper({
@@ -99,7 +104,7 @@ beforeEach(() => {
99104
mixInDestination: null,
100105
blowoutLocation: null,
101106
dropTipLocation: FIXED_TRASH_ID,
102-
tipRack: 'tiprack1Id',
107+
tipRack: getLabwareDefURI(fixtureTiprack300ul as LabwareDefinition2),
103108
aspirateXOffset: 0,
104109
dispenseXOffset: 0,
105110
aspirateYOffset: 0,
@@ -3210,7 +3215,7 @@ describe('consolidate multi-channel', () => {
32103215
const data: ConsolidateArgs = {
32113216
...args,
32123217
volume: 140,
3213-
tipRack: 'tiprack1Id',
3218+
tipRack: getLabwareDefURI(fixtureTiprack300ul as LabwareDefinition2),
32143219
changeTip: 'once',
32153220
aspirateXOffset: 0,
32163221
dispenseXOffset: 0,

0 commit comments

Comments
 (0)