Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions protocol-designer/src/form-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export interface HydratedMoveLiquidFormData extends AnnotationFields {
nozzles: NozzleConfigurationStyle | null
path: PathOption
pipette: PipetteEntity
tipRack: string
tipRack: LabwareEntity
volume: number
pushOut_volume: number | null
pushOut_checkbox: boolean
Expand Down Expand Up @@ -375,7 +375,7 @@ export interface HydratedMixFormData extends AnnotationFields {
nozzles: NozzleConfigurationStyle | null
pipette: PipetteEntity // can be null if user deletes pipette
stepType: 'mix'
tipRack: string
tipRack: LabwareEntity
volume: number
wells: string[]
aspirate_delay_seconds?: number | null
Expand Down
13 changes: 13 additions & 0 deletions protocol-designer/src/steplist/fieldLevel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
import type {
InvariantContext,
LabwareEntities,
LabwareEntity,
PipetteEntity,
StagingAreaEntities,
TrashBinEntities,
Expand Down Expand Up @@ -61,6 +62,15 @@ const getLabwareOrAdditionalEquipmentEntity = (
} else return null
}

const getTipRackEntityByURI = (
state: InvariantContext,
tiprackDefURI: string
): LabwareEntity | undefined => {
return Object.values(state.labwareEntities).find(
lw => lw.labwareDefURI === tiprackDefURI
)
}

const getIsStackingLocation = (
newLocation: string,
labwareEntities: LabwareEntities
Expand Down Expand Up @@ -287,6 +297,9 @@ const stepFieldHelperMap: Record<StepFieldName, StepFieldHelpers> = {
pipette: {
hydrate: getPipetteEntity,
},
tipRack: {
hydrate: getTipRackEntityByURI,
},
times: {
maskValue: composeMaskers(maskToInteger, onlyPositiveNumbers, defaultTo(0)),
castValue: Number,
Expand Down
6 changes: 4 additions & 2 deletions protocol-designer/src/steplist/formLevel/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,8 @@ export const volumeTooHigh = (
}
const volume = Number(fields.volume)

const pipetteCapacity = getPipetteCapacity(pipette, tipRack)
// TODO: refactor getPipetteCapacity() to use tiprack def directly instead of tiprackDefURI
const pipetteCapacity = getPipetteCapacity(pipette, tipRack?.labwareDefURI)
if (
!Number.isNaN(volume) &&
!Number.isNaN(pipetteCapacity) &&
Expand Down Expand Up @@ -1418,13 +1419,14 @@ export const conditioningVolumeOutOfRange = (
) {
return null
}
// TODO: refactor getMaxConditioningVolume() to use tiprack def directly instead of tiprackDefUri
const maxConditioningVolume = getMaxConditioningVolume({
transferVolume: Number(volume),
disposalVolume:
disposalVolume_checkbox === true ? Number(disposalVolume_volume) : 0,
pipetteSpecs: pipette.spec,
labwareEntities: labwareEntities ?? {},
tiprackDefUri: tipRack,
tiprackDefUri: tipRack?.labwareDefURI,
})
return conditioning_checkbox && conditioning_volume > maxConditioningVolume
? CONDITIONING_VOLUME_OUT_OF_RANGE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ export const mixFormToArgs = (
pushOut_checkbox,
pushOut_volume,
} = hydratedFormData
// TODO: refactor getMatchingTipLiquidSpecs() to use tiprack def directly instead of tiprackDefURI
const matchingTipLiquidSpecs = getMatchingTipLiquidSpecs(
pipette,
hydratedFormData.volume,
hydratedFormData.tipRack
hydratedFormData.tipRack.labwareDefURI
)
const unorderedWells = hydratedFormData.wells || []
const orderedWells = getOrderedWells(
Expand Down Expand Up @@ -110,7 +111,7 @@ export const mixFormToArgs = (
offsetFromBottomMm,
blowoutOffsetFromTopMm,
aspirateDelaySeconds,
tipRack: hydratedFormData.tipRack,
tipRack: hydratedFormData.tipRack.labwareDefURI,
dispenseDelaySeconds,
// TODO(jr, 7/26/24): wire up wellNames
dropTipLocation: dropTip_location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,8 @@ const getCheckedPath = (
contextualState: InvariantContext,
path: PathOption
): PathOption => {
const { pipette, tipRack, volume } = hydratedFormData
const { pipette, tipRack: tiprackEntity, volume } = hydratedFormData
const { spec: pipetteSpecs } = pipette
const tiprackEntity = Object.values(contextualState.labwareEntities).find(
lw => lw.labwareDefURI === tipRack
)
// should not hit
if (tiprackEntity == null) {
console.error('Tiprack for transfer has no associated labware entity.')
Expand Down Expand Up @@ -297,10 +294,11 @@ export const moveLiquidFormToArgs = (
'dispense_airGap_checkbox',
'dispense_airGap_volume'
)
// TODO: refactor getMatchingTipLiquidSpecs() to use tiprack def directly instead of tiprackDefURI
const matchingTipLiquidSpecs = getMatchingTipLiquidSpecs(
hydratedFormData.pipette,
hydratedFormData.volume,
tipRack
tipRack.labwareDefURI
)
const conditioningVolume =
hydratedFormData.conditioning_checkbox === true &&
Expand All @@ -314,7 +312,7 @@ export const moveLiquidFormToArgs = (
volume,
sourceLabware: sourceLabware.id,
destLabware: destLabware.id,
tipRack: tipRack,
tipRack: tipRack.labwareDefURI,
aspirateFlowRateUlSec:
hydratedFormData.aspirate_flowRate ||
matchingTipLiquidSpecs.defaultAspirateFlowRate.default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ beforeEach(() => {
blowout_checkbox: false,
blowout_location: null,
mix_mmFromBottom: 0.5,
tipRack: 'mockTiprack',
tipRack: { labwareDefURI: 'mockTiprack' } as any,
pipette: {
id: 'pipetteId',
spec: fixtureP10SingleV2Specs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('move liquid step form -> command creator args', () => {
type: sourceLabwareType,
def: sourceLabwareDef,
},
tipRack: 'tiprack1Id',
tipRack: { labwareDefURI: 'tiprack1Id' } as any,
aspirate_wells: [ASPIRATE_WELL],
aspirate_wellOrder_first: 'l2r',
aspirate_wellOrder_second: 't2b',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('form casting', () => {
dispense_airGap_checkbox: false,
dropTip_location: 'some location',
nozzles: null,
tipRack: 'some tiprack',
tipRack: {} as LabwareEntity,
liquidClassesSupported: true,
aspirate_retract_position_reference: POSITION_REFERENCE_BOTTOM,
aspirate_submerge_mmFromBottom: 1,
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('form casting', () => {
dropTip_location: 'some location',
mix_touchTip_checkbox: false,
nozzles: null,
tipRack: 'some tiprack',
tipRack: {} as LabwareEntity,
liquidClassesSupported: true,
pushOut_checkbox: false,
pushOut_volume: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ describe('liquid class compatibility', () => {
pipette: {
spec: { channels: 1, liquids: { default: { maxVolume: 1000 } } },
},
tipRack: 'opentrons/opentrons_flex_96_tiprack_1000ul/1',
tipRack: {
labwareDefURI: 'opentrons/opentrons_flex_96_tiprack_1000ul/1',
},
liquidClass: 'glycerol_50',
path: 'singleDispense',
}
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/steplist/formLevel/warnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export const incompatibleLiquidClass: (
}

const tipRackObject = pipetteObject.byTipType.find(
({ tiprack }) => tiprack === tipRack
({ tiprack }) => tiprack === tipRack.labwareDefURI
)

if (tipRackObject == null) {
Expand Down
Loading