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

refactor(app, api-client): add utilities for parsing deck config via addressable areas #13947

Merged
merged 6 commits into from
Nov 9, 2023

Conversation

b-cooper
Copy link
Contributor

@b-cooper b-cooper commented Nov 8, 2023

Overview

Instead of explicit load fixture commands, extrapolate the simplest possible setup for the deck
given the included addressable areas referenced in a set of protocol commands

Closes RAUT-853

Changelog

  • add addressableAreaName to LabwareLocation type
  • add parseAllAddressableAreas util for iterating through commands and scraping out addressableArea references
  • add getSimplestDeckConfigForProtocolCommands util that returns the simplest compatible set of cutout fixtures that would satisfy the specced addressable areas

Risk assessment

low

…addressable areas

Instead of explicit load fixture commands, extrapolate the simplest possible setup for the deck
given the included addressable areas referenced in a set of protocol commands

Closes RAUT-853
@b-cooper b-cooper requested review from a team as code owners November 8, 2023 19:21
@b-cooper b-cooper requested a review from a team November 8, 2023 19:21
@b-cooper b-cooper requested a review from a team as a code owner November 8, 2023 19:21
Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #13947 (659cfb4) into edge (c4b3b56) will decrease coverage by 0.34%.
Report is 32 commits behind head on edge.
The diff coverage is 58.46%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             edge   #13947      +/-   ##
==========================================
- Coverage   70.82%   70.49%   -0.34%     
==========================================
  Files        2504     2509       +5     
  Lines       70465    72211    +1746     
  Branches     8616     9226     +610     
==========================================
+ Hits        49908    50906     +998     
- Misses      18457    19057     +600     
- Partials     2100     2248     +148     
Flag Coverage Δ
app 67.87% <64.15%> (-0.93%) ⬇️
components 61.89% <0.00%> (-1.45%) ⬇️
labware-library 49.17% <ø> (ø)
protocol-designer 45.72% <0.00%> (+0.16%) ⬆️
react-api-client 66.39% <ø> (+0.56%) ⬆️
shared-data 73.03% <80.00%> (+0.04%) ⬆️
step-generation 84.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...rc/organisms/ProtocolSetupModulesAndDeck/index.tsx 67.94% <ø> (ø)
protocol-designer/src/load-file/migration/8_0_0.ts 81.25% <ø> (+1.25%) ⬆️
app/src/organisms/CommandText/LoadCommandText.tsx 54.76% <0.00%> (-1.34%) ⬇️
.../Devices/ProtocolRun/utils/getLabwareRenderInfo.ts 76.66% <0.00%> (-3.34%) ⬇️
...InterventionModal/utils/getRunLabwareRenderInfo.ts 83.33% <0.00%> (-5.56%) ⬇️
shared-data/js/helpers/index.ts 74.21% <80.00%> (-0.39%) ⬇️
.../Devices/ProtocolRun/utils/getLocationInfoNames.ts 54.05% <0.00%> (-3.09%) ⬇️
...rc/organisms/LabwarePositionCheck/utils/labware.ts 14.43% <0.00%> (-0.16%) ⬇️
...ocol-designer/src/labware-ingred/reducers/index.ts 22.36% <0.00%> (-0.61%) ⬇️
...yHistoricOffsets/hooks/getLabwareLocationCombos.ts 21.66% <0.00%> (-1.15%) ⬇️
... and 3 more

... and 68 files with indirect coverage changes

@@ -91,11 +91,13 @@ export type LabwareLocation =
| { slotName: string }
| { moduleId: string }
| { labwareId: string }
| { addressableAreaName: string }
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you need to add this here? Aren't all the components (supposed to be) using LabwareLocation from schema v8?

OT2RobotMixin,
OT3RobotMixin,
ProtocolBase,
ProtocolFile,
} from '@opentrons/shared-data/protocol/types/schemaV8'
import type { LoadLabwareCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV7'
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this being imported from schemaV7 now?

@@ -75,7 +75,10 @@ export const getLabwareRenderInfo = (
)
}
// TODO(bh, 2023-10-19): convert this to deck definition v4 addressableAreas
Copy link
Collaborator

Choose a reason for hiding this comment

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

can this TODO be deleted now?

Comment on lines +295 to +296
// TODO(BC, 11/6/23): once moveToAddressableArea command exists add it back here
// else if (command.commandType === 'moveToAddressableArea') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

moveToAddressableArea command exists in types on edge

Copy link
Contributor

@brenthagen brenthagen left a comment

Choose a reason for hiding this comment

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

functions look good to me - this will affect BaseDeck renders of fixture SVGs but i think we should merge this later today and resolve inconsistencies in #13931

Comment on lines +287 to +303
export interface CutoutFixture {
id: CutoutFixtureId
mayMountTo: CutoutId[]
displayName: string
providesAddressableAreas: Record<CutoutId, AddressableAreaName[]>
}

export interface AddressableArea {
id: AddressableAreaName
areaType: 'slot' | 'movableTrash' | 'fixedTrash' | 'wasteChute'
matingSurfaceUnitVector: UnitVectorTuple
offsetFromCutoutFixture: UnitVectorTuple
boundingBox: Dimensions
displayName: string
compatibleModuleTypes: ModuleType[]
}

Copy link
Contributor

Choose a reason for hiding this comment

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

just a note, some of this is duplicated in https://github.com/Opentrons/opentrons/pull/13931/files#diff-d6a873bb9d1ca073c74cc090513ae5c1f010fb305b1440f8607b7e4e34fcb002, some types more complete there, some more complete here. probably this will merge first so can be accounted for in that PR

Comment on lines +56 to +64
| 'singleLeftSlot'
| 'singleCenterSlot'
| 'singleRightSlot'
| 'stagingAreaRightSlot'
| 'trashBinAdapter'
| 'wasteChuteRightAdapterCovered'
| 'wasteChuteRightAdapterNoCover'
| 'stagingAreaSlotWithWasteChuteRightAdapterCovered'
| 'stagingAreaSlotWithWasteChuteRightAdapterNoCover'
Copy link
Contributor

Choose a reason for hiding this comment

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

another note, BaseDeck will need these as string literal constants and sets of "singleSlotFixtures" at some point. and probably other components as well. might be better to adjust in #13931 with the understanding that the deck map won't render correctly until that PR is merged.

addressableArea: AddressableAreaName,
cutoutFixtures: CutoutFixture[]
): CutoutId | null {
return cutoutFixtures.reduce<CutoutId | null>((acc, cutoutFixture) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

this might read simpler as a forEach

@b-cooper b-cooper merged commit 7258da8 into edge Nov 9, 2023
62 of 66 checks passed
@b-cooper b-cooper deleted the app_addressable-area-utils branch November 9, 2023 16:56
ncdiehl11 pushed a commit that referenced this pull request Nov 14, 2023
…addressable areas (#13947)

Instead of explicit load fixture commands, extrapolate the simplest possible setup for the deck
given the included addressable areas referenced in a set of protocol commands

Closes RAUT-853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants