Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shared-data, app): add configureNozzleLayout command type in run log #13961

Merged
merged 6 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion app/src/assets/localization/en/protocol_command_text.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
13 changes: 12 additions & 1 deletion app/src/organisms/CommandText/PipettingCommandText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
getLabwareName,
getLabwareDisplayLocation,
getFinalLabwareLocation,
getWellRange,
} from './utils'

type PipettingRunTimeCommmand =
Expand Down Expand Up @@ -122,8 +123,18 @@
})
}
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,

Check failure on line 134 in app/src/organisms/CommandText/PipettingCommandText.tsx

View workflow job for this annotation

GitHub Actions / js checks

Argument of type '"p10_single" | "p10_multi" | "p20_single_gen2" | "p20_multi_gen2" | "p50_single" | "p50_multi" | "p300_single" | "p300_single_gen2" | "p300_multi" | "p300_multi_gen2" | "p1000_single" | "p1000_single_gen2" | "p1000_single_flex" | "p50_single_flex" | "p1000_multi_flex" | "p50_multi_flex" | "p1000_96" | undefined' is not assignable to parameter of type '"p10_single" | "p10_multi" | "p20_single_gen2" | "p20_multi_gen2" | "p50_single" | "p50_multi" | "p300_single" | "p300_single_gen2" | "p300_multi" | "p300_multi_gen2" | "p1000_single" | "p1000_single_gen2" | "p1000_single_flex" | "p50_single_flex" | "p1000_multi_flex" | "p50_multi_flex" | "p1000_96"'.

Check failure on line 134 in app/src/organisms/CommandText/PipettingCommandText.tsx

View workflow job for this annotation

GitHub Actions / js checks

Argument of type '"p10_single" | "p10_multi" | "p20_single_gen2" | "p20_multi_gen2" | "p50_single" | "p50_multi" | "p300_single" | "p300_single_gen2" | "p300_multi" | "p300_multi_gen2" | "p1000_single" | "p1000_single_gen2" | "p1000_single_flex" | "p50_single_flex" | "p1000_multi_flex" | "p50_multi_flex" | "p1000_96" | undefined' is not assignable to parameter of type '"p10_single" | "p10_multi" | "p20_single_gen2" | "p20_multi_gen2" | "p50_single" | "p50_multi" | "p300_single" | "p300_single_gen2" | "p300_multi" | "p300_multi_gen2" | "p1000_single" | "p1000_single_gen2" | "p1000_single_flex" | "p50_single_flex" | "p1000_multi_flex" | "p50_multi_flex" | "p1000_96"'.
allPreviousCommands,
wellName
),
labware: getLabwareName(robotSideAnalysis, labwareId),
labware_location: displayLocation,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
}
})
Expand Down
19 changes: 19 additions & 0 deletions app/src/organisms/CommandText/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,25 @@
</StyledText>
)
}
case 'configureNozzleLayout': {
const { configuration_params, pipetteId } = command.params
const pipetteName = robotSideAnalysis.pipettes.find(
pip => pip.id === pipetteId

Check warning on line 171 in app/src/organisms/CommandText/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/CommandText/index.tsx#L169-L171

Added lines #L169 - L171 were not covered by tests
)?.pipetteName

// TODO (sb, 11/9/23): Add support for other configurations when needed
return (

Check warning on line 175 in app/src/organisms/CommandText/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/CommandText/index.tsx#L175

Added line #L175 was not covered by tests
<StyledText as="p" {...styleProps}>
{t('configure_nozzle_layout', {
amount: configuration_params.style === 'COLUMN' ? '8' : 'all',
pipette:
pipetteName != null
? getPipetteNameSpecs(pipetteName)?.displayName
: '',
})}
</StyledText>
)
}
case 'prepareToAspirate': {
const { pipetteId } = command.params
const pipetteName = robotSideAnalysis.pipettes.find(
Expand Down
44 changes: 44 additions & 0 deletions app/src/organisms/CommandText/utils/getWellRange.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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()) {

Check warning on line 22 in app/src/organisms/CommandText/utils/getWellRange.ts

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/CommandText/utils/getWellRange.ts#L22

Added line #L22 was not covered by tests
if (
c.commandType === 'configureNozzleLayout' &&
c.params?.pipetteId === pipetteId
) {
// TODO(sb, 11/9/23): add support for quadrant and row configurations when needed
if (c.params.configuration_params.style === 'SINGLE') {
usedChannels = 1

Check warning on line 29 in app/src/organisms/CommandText/utils/getWellRange.ts

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/CommandText/utils/getWellRange.ts#L29

Added line #L29 was not covered by tests
} else if (c.params.configuration_params.style === 'COLUMN') {
usedChannels = 8

Check warning on line 31 in app/src/organisms/CommandText/utils/getWellRange.ts

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/CommandText/utils/getWellRange.ts#L31

Added line #L31 was not covered by tests
}
break

Check warning on line 33 in app/src/organisms/CommandText/utils/getWellRange.ts

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/CommandText/utils/getWellRange.ts#L33

Added line #L33 was not covered by tests
}
}
}
if (usedChannels === 96) {
return 'A1 - H12'

Check warning on line 38 in app/src/organisms/CommandText/utils/getWellRange.ts

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/CommandText/utils/getWellRange.ts#L38

Added line #L38 was not covered by tests
} else if (usedChannels === 8) {
const column = wellName.substr(1)
return `A${column} - H${column}`

Check warning on line 41 in app/src/organisms/CommandText/utils/getWellRange.ts

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/CommandText/utils/getWellRange.ts#L40-L41

Added lines #L40 - L41 were not covered by tests
}
return wellName
}
1 change: 1 addition & 0 deletions app/src/organisms/CommandText/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './getModuleDisplayLocation'
export * from './getLiquidDisplayName'
export * from './getLabwareDisplayLocation'
export * from './getFinalLabwareLocation'
export * from './getWellRange'
37 changes: 37 additions & 0 deletions shared-data/command/types/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,26 @@ export interface LoadFixtureRunTimeCommand
result?: LoadLabwareResult
}

export interface ConfigureNozzleLayoutCreateCommand
extends CommonCommandCreateInfo {
commandType: 'configureNozzleLayout'
params: ConfigureNozzleLayoutParams
}

export interface ConfigureNozzleLayoutRunTimeCommand
extends CommonCommandRunTimeInfo,
ConfigureNozzleLayoutCreateCommand {
result?: {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a TODO here to remind us to add a result type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at the analysis output and the result was just an empty object - @sanni-t is that correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct. The result is an empty object.

}

export type SetupRunTimeCommand =
| LoadPipetteRunTimeCommand
| LoadLabwareRunTimeCommand
| LoadFixtureRunTimeCommand
| LoadModuleRunTimeCommand
| LoadLiquidRunTimeCommand
| MoveLabwareRunTimeCommand
| ConfigureNozzleLayoutRunTimeCommand
smb2268 marked this conversation as resolved.
Show resolved Hide resolved

export type SetupCreateCommand =
| LoadPipetteCreateCommand
Expand All @@ -86,6 +99,7 @@ export type SetupCreateCommand =
| LoadModuleCreateCommand
| LoadLiquidCreateCommand
| MoveLabwareCreateCommand
| ConfigureNozzleLayoutCreateCommand

export type LabwareLocation =
| 'offDeck'
Expand Down Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably want both primary_nozzle and configuration_params to be camelCase, like what we do for pipetteId

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would have to be a BE change, wouldn't it?

style: NozzleConfigurationStyle
}

interface ConfigureNozzleLayoutParams {
pipetteId: string
configuration_params: NozzleConfigurationParams
}
Comment on lines +197 to +200
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait i didn't realize a pipetteId is needed in the params, I was looking at the implementation section on the proposal: https://opentrons.atlassian.net/wiki/spaces/RPDO/pages/3732602905?atlOrigin=eyJpIjoiMTQxNjBkYTBkYzhjNDM0YzgzMGY2YmEwMWZlOGY4NTMiLCJwIjoiY29uZmx1ZW5jZS1jaGF0cy1pbnQifQ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure it's necessary based on this https://github.com/Opentrons/opentrons/blob/edge/api/src/opentrons/protocol_engine/commands/configure_nozzle_layout.py#L33 - @sanni-t can you confirm whether the types I have here are correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, pipette_id is required for knowing which pipette we are setting to partial nozzle configuration.

Loading