Skip to content

Commit

Permalink
feat(api, app, shared-data, pd): use new flex pipette names in backen…
Browse files Browse the repository at this point in the history
…d & clients (#13082)

* replace references to '_gen3' with '_flex' for pipettes in engine, app, PD
* update pipette model specs and name specs with new names and display category ('FLEX')
* allow PAPI to load Flex pipettes using the names in RSS-261
* allow PAPI to load Flex pipettes using '_gen3' names temporarily
* update PD components and fix PD unit tests
* fix step-generation js check errors
* Update naming from gen3 to flex in app and components

---------

Co-authored-by: Jethary <[email protected]>
Co-authored-by: smb2268 <[email protected]>
  • Loading branch information
3 people authored Jul 13, 2023
1 parent a930685 commit cb2a7be
Show file tree
Hide file tree
Showing 50 changed files with 264 additions and 139 deletions.
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_api/protocol_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def load_instrument(
replaced by `instrument_name`.
"""
instrument_name = validation.ensure_lowercase_name(instrument_name)
is_96_channel = instrument_name == "p1000_96"
is_96_channel = instrument_name in ("p1000_96", "flex_96channel_1000")
if is_96_channel and isinstance(self._core, ProtocolEngineCore):
checked_instrument_name = instrument_name
checked_mount = Mount.LEFT
Expand Down
24 changes: 23 additions & 1 deletion api/src/opentrons/protocol_api/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
# The first APIVersion where Python protocols can specify deck labels like "D1" instead of "1".
_COORDINATE_DECK_LABEL_VERSION_GATE = APIVersion(2, 15)

# Mapping of user-facing pipette names to names used by the internal Opentrons system
_FLEX_PIPETTE_NAMES_MAP = {
"p50_single_gen3": "p50_single_flex",
"flex_1channel_50": "p50_single_flex",
"p50_multi_gen3": "p50_multi_flex",
"flex_8channel_50": "p50_multi_flex",
"p1000_single_gen3": "p1000_single_flex",
"flex_1channel_1000": "p1000_single_flex",
"p1000_multi_gen3": "p1000_multi_flex",
"flex_8channel_1000": "p1000_multi_flex",
"flex_96channel_1000": "p1000_96",
}


class InvalidPipetteMountError(ValueError):
"""An error raised when attempting to load pipettes on an invalid mount."""
Expand Down Expand Up @@ -86,7 +99,16 @@ def ensure_pipette_name(pipette_name: str) -> PipetteNameType:
pipette_name = ensure_lowercase_name(pipette_name)

try:
return PipetteNameType(pipette_name)
if pipette_name in _FLEX_PIPETTE_NAMES_MAP.keys():
# TODO (spp: 2023-07-11): !!! VERY IMPORTANT!!!
# We DO NOT want to support the old 'gen3' suffixed names for Flex launch.
# This provision to accept the old names is added only for maintaining
# backwards compatibility during internal testing and should be phased out.
# So remove this name mapping and conversion at an appropriate time before launch
checked_name = PipetteNameType(_FLEX_PIPETTE_NAMES_MAP[pipette_name])
else:
checked_name = PipetteNameType(pipette_name)
return checked_name
except ValueError as e:
raise ValueError(
f"Cannot resolve {pipette_name} to pipette, must be given valid pipette name."
Expand Down
6 changes: 6 additions & 0 deletions api/tests/opentrons/protocol_api/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def test_ensure_mount_input_invalid() -> None:
[
("p300_single", PipetteNameType.P300_SINGLE),
("P300_muLTI_gen2", PipetteNameType.P300_MULTI_GEN2),
(
"p50_single_gen3",
PipetteNameType.P50_SINGLE_FLEX,
), # Remove this line once we phase out '_gen3' names
("flex_8channel_1000", PipetteNameType.P1000_MULTI_FLEX),
("flex_96channel_1000", PipetteNameType.P1000_96),
],
)
def test_ensure_pipette_name(input_value: str, expected: PipetteNameType) -> None:
Expand Down
6 changes: 3 additions & 3 deletions app/src/molecules/PipetteSelect/PipetteSelect.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ PipetteSelect.args = {
nameBlocklist: [
'p20_multi_gen2',
'p300_multi_gen2',
'p20_single_gen3',
'p300_single_gen3',
'p1000_single_gen3',
'p20_single_flex',
'p300_single_flex',
'p1000_single_flex',
],
enableNoneOption: true,
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const equipmentImages = {
calibration_probe: require('../../assets/images/change-pip/calibration_probe.png'),
t10_torx_screwdriver: require('../../assets/images/t10_torx_screwdriver.png'),
hex_screwdriver: require('../../assets/images/change-pip/hex_screwdriver.png'),
gen3_pipette: require('../../assets/images/change-pip/single_mount_pipettes.png'),
flex_pipette: require('../../assets/images/change-pip/single_mount_pipettes.png'),
pipette_96: require('../../assets/images/change-pip/ninety-six-channel.png'),
mounting_plate_96_channel: require('../../assets/images/change-pip/mounting-plate-96-channel.png'),
flex_gripper: require('../../assets/images/flex_gripper.svg'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe('PipetteCard', () => {
it('renders banner to calibrate for ot3 pipette if not calibrated', () => {
when(mockUseIsOT3).calledWith(mockRobotName).mockReturnValue(true)
const { getByText } = render({
pipetteInfo: { ...mockLeftSpecs, name: 'p300_single_gen3' },
pipetteInfo: { ...mockLeftSpecs, name: 'p300_single_flex' },
mount: LEFT,
robotName: mockRobotName,
is96ChannelAttached: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('PipetteOverflowMenu', () => {
).toBeInTheDocument()
})

it('renders only the about pipette button if OT-3/GEN3 pipette is attached', () => {
it('renders only the about pipette button if FLEX pipette is attached', () => {
mockIsOT3Pipette.mockReturnValue(true)

const { getByRole, queryByRole } = render(props)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const mockGripperData = {
ok: true,
}
const mockLeftPipetteData = {
instrumentModel: 'p1000_multi_gen3',
instrumentModel: 'p1000_multi_flex',
instrumentType: 'p1000',
mount: 'left',
serialNumber: 'def456',
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('ProtocolInstrumentMountItem', () => {
mount: LEFT,
attachedInstrument: null,
attachedCalibrationData: null,
speccedName: 'p1000_multi_gen3',
speccedName: 'p1000_multi_flex',
}
mockPipetteWizardFlows.mockReturnValue(<div>pipette wizard flow</div>)
mockUseMaintenanceRunTakeover.mockReturnValue({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const RUN_ID = 'mockRunId'
const mockMissingPipette = [
{
hardwareType: 'pipette',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
mount: 'left',
connected: false,
},
Expand All @@ -51,7 +51,7 @@ const mockMissingModule = [
const missingBoth = [
{
hardwareType: 'pipette',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
mount: 'left',
connected: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ describe('useMissingHardwareText', () => {
useMissingHardwareText([
{
hardwareType: 'pipette',
pipetteName: 'p50_multi_gen3',
pipetteName: 'p50_multi_flex',
mount: 'left',
connected: false,
},
{
hardwareType: 'pipette',
pipetteName: 'p1000_multi_gen3',
pipetteName: 'p1000_multi_flex',
mount: 'right',
connected: false,
},
Expand All @@ -103,7 +103,7 @@ describe('useMissingHardwareText', () => {
useMissingHardwareText([
{
hardwareType: 'pipette',
pipetteName: 'p50_multi_gen3',
pipetteName: 'p50_multi_flex',
mount: 'left',
connected: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('BeforeBeginning', () => {
params: {
mount: LEFT,
pipetteId: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
},
{ commandType: 'home' as const, params: {} },
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('BeforeBeginning', () => {
requiredPipette: {
mount: LEFT,
id: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
}
const { getByText, getByAltText, getByRole } = render(props)
Expand All @@ -206,7 +206,7 @@ describe('BeforeBeginning', () => {
params: {
mount: LEFT,
pipetteId: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
},
{ commandType: 'home' as const, params: {} },
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('BeforeBeginning', () => {
params: {
mount: LEFT,
pipetteId: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
},
{ commandType: 'home' as const, params: {} },
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('BeforeBeginning', () => {
params: {
mount: RIGHT,
pipetteId: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
},
{ commandType: 'home' as const, params: {} },
Expand Down Expand Up @@ -398,7 +398,7 @@ describe('BeforeBeginning', () => {
params: {
mount: LEFT,
pipetteId: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
},
{ commandType: 'home' as const, params: {} },
Expand Down Expand Up @@ -455,7 +455,7 @@ describe('BeforeBeginning', () => {
params: {
mount: LEFT,
pipetteId: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
},
{ commandType: 'home' as const, params: {} },
Expand Down Expand Up @@ -515,7 +515,7 @@ describe('BeforeBeginning', () => {
params: {
mount: LEFT,
pipetteId: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
},
{ commandType: 'home' as const, params: {} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('PipetteWizardFlows', () => {
params: {
mount: LEFT,
pipetteId: 'abc',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
},
},
{ commandType: 'home' as const, params: {} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('Results', () => {
{
commandType: 'loadPipette' as const,
params: {
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
pipetteId: 'abc',
mount: 'left',
},
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('Results', () => {
{
commandType: 'loadPipette' as const,
params: {
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
pipetteId: 'abc',
mount: 'left',
},
Expand Down Expand Up @@ -323,7 +323,7 @@ describe('Results', () => {
flowType: FLOWS.ATTACH,
requiredPipette: {
id: 'mockId',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
mount: LEFT,
},
}
Expand All @@ -339,7 +339,7 @@ describe('Results', () => {
flowType: FLOWS.ATTACH,
requiredPipette: {
id: 'mockId',
pipetteName: 'p50_multi_gen3',
pipetteName: 'p50_multi_flex',
mount: LEFT,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const mockPipetteInfo = [
] as LoadedPipette[]

const mockPipettesInProtocolNotEmpty = [
{ id: '123', pipetteName: 'p1000_single_gen3', mount: 'left' },
{ id: '123', pipetteName: 'p1000_single_flex', mount: 'left' },
]
const mockPipettesInProtocolMulti = [
{ id: '123', pipetteName: 'p1000_multi_gen3', mount: 'left' },
{ id: '123', pipetteName: 'p1000_multi_flex', mount: 'left' },
]
const mockSingleMountPipetteAttached = {
left: mockAttachedPipetteInformation,
Expand All @@ -32,7 +32,7 @@ describe('getPipetteWizardStepsForProtocol', () => {
[
{
id: '123',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
mount: 'left',
},
],
Expand Down Expand Up @@ -74,7 +74,7 @@ describe('getPipetteWizardStepsForProtocol', () => {
data: { calibratedOffset: undefined as any },
} as any,
},
[{ id: '123', pipetteName: 'p1000_single_gen3', mount: 'right' }],
[{ id: '123', pipetteName: 'p1000_single_flex', mount: 'right' }],
RIGHT
)
).toStrictEqual(mockFlowSteps)
Expand Down
8 changes: 4 additions & 4 deletions app/src/organisms/PipetteWizardFlows/__tests__/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('usePipetteFlowWizardHeaderText', () => {
pipetteInfo: [
{
id: 'id',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
mount: LEFT,
},
],
Expand All @@ -282,7 +282,7 @@ describe('usePipetteFlowWizardHeaderText', () => {
pipetteInfo: [
{
id: 'id',
pipetteName: 'p1000_single_gen3',
pipetteName: 'p1000_single_flex',
mount: LEFT,
},
],
Expand Down Expand Up @@ -415,7 +415,7 @@ describe('usePipetteFlowWizardHeaderText', () => {
pipetteInfo: [
{
id: 'id',
pipetteName: 'p50_single_gen3',
pipetteName: 'p50_single_flex',
mount: LEFT,
},
],
Expand All @@ -440,7 +440,7 @@ describe('usePipetteFlowWizardHeaderText', () => {
pipetteInfo: [
{
id: 'id',
pipetteName: 'p50_single_gen3',
pipetteName: 'p50_single_flex',
mount: LEFT,
},
],
Expand Down
2 changes: 1 addition & 1 deletion app/src/organisms/PipetteWizardFlows/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const HEX_SCREWDRIVER = {
'Provided with the robot. Using another size can strip the instruments’s screws.',
}
export const PIPETTE = {
loadName: 'gen3_pipette',
loadName: 'flex_pipette',
displayName: PIPETTE_DISPLAY_NAME,
}
export const NINETY_SIX_CHANNEL_PIPETTE = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function OverflowMenu({
showPipetteWizardFlows,
setShowPipetteWizardFlows,
] = React.useState<boolean>(false)
const isGen3Pipette = isOT3Pipette(pipetteName as PipetteName)
const isFlexPipette = isOT3Pipette(pipetteName as PipetteName)
const ot3PipCal =
useAttachedPipettesFromInstrumentsQuery()[mount]?.data?.calibratedOffset
?.offset ?? null
Expand All @@ -102,7 +102,7 @@ export function OverflowMenu({
e.preventDefault()
if (
!isRunning &&
isGen3Pipette &&
isFlexPipette &&
calType === 'pipetteOffset' &&
pipetteName != null
) {
Expand Down Expand Up @@ -199,7 +199,7 @@ export function OverflowMenu({
right={0}
flexDirection={DIRECTION_COLUMN}
>
{isGen3Pipette ? (
{isFlexPipette ? (
<MenuItem onClick={handleRecalibrate}>
{t(
ot3PipCal == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('OverflowMenu', () => {
expect(saveAs).toHaveBeenCalled()
})

it('recalibration button should open up the pipette wizard flow for gen3 pipettes', () => {
it('recalibration button should open up the pipette wizard flow for flex pipettes', () => {
mockUseAttachedPipettesFromInstrumentsQuery.mockReturnValue({
left: mockAttachedPipetteInformation,
right: null,
Expand All @@ -207,7 +207,7 @@ describe('OverflowMenu', () => {
getByText('mock pipette wizard flows')
})

it('calibration button should open up the pipette wizard flow for gen3 pipettes', () => {
it('calibration button should open up the pipette wizard flow for flex pipettes', () => {
mockPipetteWizardFlow.mockReturnValue(<div>mock pipette wizard flows</div>)
mockUseAllPipetteOffsetCalibrationsQuery.mockReturnValue({
data: {
Expand Down
Loading

0 comments on commit cb2a7be

Please sign in to comment.