-
Notifications
You must be signed in to change notification settings - Fork 180
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(protocol-designer, step-generation, app): introduce pythonName to each entity #17463
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The quick transfer changes make sense - just left one comment. Thanks for adding that version bump!
app/src/organisms/ODD/QuickTransferFlow/utils/generateQuickTransferArgs.ts
Outdated
Show resolved
Hide resolved
@@ -204,7 +204,7 @@ export function createQuickTransferFile( | |||
}, | |||
designerApplication: { | |||
name: 'opentrons/quick-transfer', | |||
version: '1.0.0', | |||
version: '1.1.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does Quick Transfer versioning work? Like, what cares about this version number?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddcc4 Right now, nothing cares about this version number since once these files are created the designerApplicationData
isn't read. However, we may want to read it and add migration functionality in the future. I'm working on a doc to keep track of this - you can see my draft here: https://github.com/Opentrons/opentrons/blob/e9a77696e65022c480ae704edecb22c794c45111/app/src/organisms/ODD/QuickTransferFlow/README.md
@@ -96,18 +98,28 @@ function getInvariantContextAndRobotState( | |||
}, | |||
} | |||
} | |||
const sourceDisplayCategory = | |||
quickTransferState.source.metadata.displayCategory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's a sourceDisplayCategory
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is the source labware in quick transfer (aka where you are aspirating from). quick transfer is limited to only a source and destination labware
interface DeleteContainerArgs { | ||
labwareId: string | ||
} | ||
export const deleteContainer: ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, what is the container that this is referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleteContainer
is our redux action for deleting a labware. idk why we called it container (definitely from before my time working on PD) but i made a new one in the thunk since the old deleteContainer
was a singular action. This way in the future when devs need to delete a container, they can just refer to an intuitive fn name like deleteContainer
instead of something more in depth like deleteContainerAndRenamePythonName
}, | ||
}) | ||
|
||
if (typeCount > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this limited to typeCount > 1
? What happens if it's 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh if its equal to 1, you won't need to call the action that renames the rest of the pythonNames. like if you have 1 wellPlate and you delete it, no sense calling the action to rename the rest of the pythonNames in labware because they don't exist
model: moduleLoadInfo.model, | ||
pythonName: getModulePythonName(moduleType, typeCount + 1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh! ... I figured out what this is doing :) I was confused at first because I thought "Isn't typeCount
a constant? Won't this give all the modules the same pythonName
when you LOAD_FILE
?"
But you're recomputing typeCount
for each module in the loop, so this works.
export type Ingredient = Omit<LiquidEntity, 'pythonName'> | ||
export interface Ingredients { | ||
[liquidId: string]: Ingredient | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to keep all the types straight in my head: when do we use LiquidEntities
and when do we use Ingredients
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ingredients
refers to the json structure type for the ingredients key, it is just like liquidEntities
but does not include pythonName
. It's similar to how we have a labwareLoadInfo
, moduleLoadInfo
, etc for the labware
and modules
keys in designerApplication
…o each entity (#17463) closes AUTH-1383 For python/pd interop, we want to add a `pythonName` to `liquidEntity`, `labwareEntity`, `moduleEntity`, and `pipetteEntity`. This PR does that by adding them in redux, that way, the `pythonName` is not polluting the JSON structure. For Quick Transfer, the `pythonName` is generated in `generateQuickTransferArgs`. The python name patterning is as follows: - modules: moduleType minus `Type` in snake case plus the number so `heater_shaker_module_1` and then `heater_shaker_module_2` for 2 heater-shaker modules - pipettes: `pipette_left` or `pipette_right` - labware: the labware displayCategory in snake case plus the number. So 2 well plates and 1 reservoir would be `well_plate_1`, `well_plate_2`, `reservoir_1` - liquids: just liquid with the number so `liquid_1`, `liquid_2`, etc.
…o each entity (#17463) closes AUTH-1383 For python/pd interop, we want to add a `pythonName` to `liquidEntity`, `labwareEntity`, `moduleEntity`, and `pipetteEntity`. This PR does that by adding them in redux, that way, the `pythonName` is not polluting the JSON structure. For Quick Transfer, the `pythonName` is generated in `generateQuickTransferArgs`. The python name patterning is as follows: - modules: moduleType minus `Type` in snake case plus the number so `heater_shaker_module_1` and then `heater_shaker_module_2` for 2 heater-shaker modules - pipettes: `pipette_left` or `pipette_right` - labware: the labware displayCategory in snake case plus the number. So 2 well plates and 1 reservoir would be `well_plate_1`, `well_plate_2`, `reservoir_1` - liquids: just liquid with the number so `liquid_1`, `liquid_2`, etc.
closes AUTH-1383
Overview
For python/pd interop, we want to add a
pythonName
toliquidEntity
,labwareEntity
,moduleEntity
, andpipetteEntity
. This PR does that by adding them in redux, that way, thepythonName
is not polluting the JSON structure. For Quick Transfer, thepythonName
is generated ingenerateQuickTransferArgs
.The python name patterning is as follows:
Type
in snake case plus the number soheater_shaker_module_1
and thenheater_shaker_module_2
for 2 heater-shaker modulespipette_left
orpipette_right
well_plate_1
,well_plate_2
,reservoir_1
liquid_1
,liquid_2
, etc.Test Plan and Hands on Testing
Since the python names are not included in the JSON structure and not actually held in the redux tree, you'll have to console.log invariant context. I guess an easy one to check is:
add
console.log('invariantContext', invariantContext)
todelay.ts
in step-generationupload this attached protocol with labware, pipettes, liquids, and modules and go to the step timeline. check console and look at invariant context. test deleting different things and making sure the numbers update correctly
pythonNames.json
there should be 5 well plates, 3 tipracks, 2 adapters, 1 reservoir, 3 liquids, 2 heater-shakers, 2 magnetic blocks, 1 thermocycler, 2 pipettes
Changelog
Review requests
Review my redux changes in particular. The files to look at for that are:
protocol-designer/src/labware-ingred/actions/thunks.ts
for editing subsequent labware numbering -> so if you have 2 well plates and delete 1, it ensures the number of that 1 remaining iswell_plate_1
protocol-designer/src/modules/thunks.ts
for editing subsequent module numbering -> so if you have 2 h-s and delete 1, it ensures the number of that 1 remaining isheater_shaker_1
protocol-designer/src/step-forms/reducers/index.ts
has the redux reducer logic for adding the python name tomodules
andlabware
protocol-designer/src/step-forms/selectors/index.ts
has the pipette selector logic for adding the python nameRisk assessment
med-ish but its contained in redux and only adding stuff on instead of changing how the entities are generated