Skip to content

Commit

Permalink
feat(app, protocol-designer, step-generation): schema v8 migration (#…
Browse files Browse the repository at this point in the history
…13884)

closes RAUT-828

---------

Co-authored-by: Seth Foster <[email protected]>
  • Loading branch information
jerader and sfoster1 authored Oct 31, 2023
1 parent 8707cdc commit 916e2a7
Show file tree
Hide file tree
Showing 74 changed files with 297 additions and 273 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { POST, request } from '../request'

import type { CreateCommand } from '@opentrons/shared-data/protocol/types/schemaV7'
import type { CreateCommand } from '@opentrons/shared-data'
import type { ResponsePromise } from '../request'
import type { HostConfig } from '../types'
import type { CommandData, CreateCommandParams } from '../runs/types'
Expand Down
16 changes: 7 additions & 9 deletions api-client/src/protocols/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ import reduce from 'lodash/reduce'
import { COLORS } from '@opentrons/components/src/ui-style-constants'
import { getLabwareDefURI } from '@opentrons/shared-data'
import type {
ModuleModel,
PipetteName,
Liquid,
LoadedPipette,
LoadedLabware,
LoadedModule,
} from '@opentrons/shared-data'
import type { RunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV7'
import type {
LoadedPipette,
LoadFixtureRunTimeCommand,
LoadLabwareRunTimeCommand,
LoadLiquidRunTimeCommand,
LoadModuleRunTimeCommand,
LoadPipetteRunTimeCommand,
LoadLiquidRunTimeCommand,
LoadFixtureRunTimeCommand,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'
ModuleModel,
PipetteName,
RunTimeCommand,
} from '@opentrons/shared-data'

interface PipetteNamesByMount {
left: PipetteName | null
Expand Down
2 changes: 1 addition & 1 deletion api-client/src/runs/commands/createCommand.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { POST, request } from '../../request'

import type { CreateCommand } from '@opentrons/shared-data'
import type { ResponsePromise } from '../../request'
import type { HostConfig } from '../../types'
import type { CommandData } from '../types'
import type { CreateCommandParams } from './types'
import type { CreateCommand } from '@opentrons/shared-data/protocol/types/schemaV7'

export function createCommand(
config: HostConfig,
Expand Down
2 changes: 1 addition & 1 deletion api-client/src/runs/commands/createLiveCommand.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { POST, request } from '../../request'

import type { CreateCommand } from '@opentrons/shared-data'
import type { ResponsePromise } from '../../request'
import type { HostConfig } from '../../types'
import type { CommandData } from '../types'
import type { CreateCommandParams } from './types'
import type { CreateCommand } from '@opentrons/shared-data/protocol/types/schemaV7'

export function createLiveCommand(
config: HostConfig,
Expand Down
4 changes: 1 addition & 3 deletions api/tests/opentrons/protocol_runner/test_json_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
Module,
Pipette,
Robot,
RobotV8,
)
from opentrons_shared_data.pipette.dev_types import PipetteNameType
from opentrons.types import DeckSlotName, MountType
Expand Down Expand Up @@ -785,10 +784,9 @@ def _make_v8_json_protocol(
otSharedSchema="#/protocol/schemas/8",
schemaVersion=8,
metadata=SD_Metadata(),
robot=RobotV8(
robot=Robot(
model="OT-2 Standard",
deckId="ot2_standard",
deckSchemaId="opentronsDeckSchemaV3",
),
labwareDefinitions=labware_definitions,
labwareDefinitionSchemaId="opentronsLabwareSchemaV2",
Expand Down
2 changes: 1 addition & 1 deletion app/src/App/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { checkShellUpdate } from '../redux/shell'
import { useToaster } from '../organisms/ToasterOven'

import type { SetStatusBarCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV7/command/incidental'
import type { SetStatusBarCreateCommand } from '@opentrons/shared-data'
import type { Dispatch } from '../redux/types'

const CURRENT_RUN_POLL = 5000
Expand Down
2 changes: 1 addition & 1 deletion app/src/organisms/CommandText/TemperatureCommandText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
TCSetTargetBlockTemperatureCreateCommand,
TCSetTargetLidTemperatureCreateCommand,
HeaterShakerSetTargetTemperatureCreateCommand,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/module'
} from '@opentrons/shared-data'

type TemperatureCreateCommand =
| TemperatureModuleSetTargetTemperatureCreateCommand
Expand Down
14 changes: 5 additions & 9 deletions app/src/organisms/CommandText/__tests__/CommandText.test.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import * as React from 'react'
import { renderWithProviders } from '@opentrons/components'
import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data'
import { i18n } from '../../../i18n'
import { CommandText } from '../'
import { mockRobotSideAnalysis } from '../__fixtures__'

import type { MoveToWellRunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV7/command/gantry'
import type {
BlowoutRunTimeCommand,
DispenseRunTimeCommand,
ConfigureForVolumeRunTimeCommand,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/pipetting'
import type {
DispenseRunTimeCommand,
DropTipRunTimeCommand,
LabwareDefinition2,
LoadLabwareRunTimeCommand,
LoadLiquidRunTimeCommand,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'
import {
LabwareDefinition2,
MoveToWellRunTimeCommand,
RunTimeCommand,
DropTipRunTimeCommand,
FLEX_ROBOT_TYPE,
} from '@opentrons/shared-data'

describe('CommandText', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { HeaterShakerModule } from '../../../redux/modules/types'
import { HeaterShakerModuleCard } from '../HeaterShakerWizard/HeaterShakerModuleCard'
import { HEATERSHAKER_MODULE_TYPE } from '@opentrons/shared-data'

import type { HeaterShakerDeactivateShakerCreateCommand } from '@opentrons/shared-data/protocol/types/schemaV7/command/module'
import type { HeaterShakerDeactivateShakerCreateCommand } from '@opentrons/shared-data'

interface HeaterShakerIsRunningModalProps {
closeModal: () => void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { PipetteWizardFlows } from '../../PipetteWizardFlows'
import { FLOWS } from '../../PipetteWizardFlows/constants'
import { SetupCalibrationItem } from './SetupCalibrationItem'
import type { PipetteData } from '@opentrons/api-client'
import type { LoadPipetteRunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'
import type { LoadPipetteRunTimeCommand } from '@opentrons/shared-data'
import type { Mount } from '../../../redux/pipettes/types'

interface SetupInstrumentCalibrationItemProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ import {
getModuleDisplayName,
getModuleType,
HEATERSHAKER_MODULE_TYPE,
LabwareDefinition2,
LoadModuleRunTimeCommand,
MAGNETIC_MODULE_TYPE,
ModuleType,
TC_MODULE_LOCATION_OT2,
TC_MODULE_LOCATION_OT3,
THERMOCYCLER_MODULE_TYPE,
THERMOCYCLER_MODULE_V2,
RunTimeCommand,
LoadLabwareRunTimeCommand,
} from '@opentrons/shared-data'

import { ToggleButton } from '../../../../atoms/buttons'
Expand All @@ -45,7 +40,12 @@ import { SecureLabwareModal } from './SecureLabwareModal'
import type {
HeaterShakerCloseLatchCreateCommand,
HeaterShakerOpenLatchCreateCommand,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/module'
RunTimeCommand,
ModuleType,
LabwareDefinition2,
LoadModuleRunTimeCommand,
LoadLabwareRunTimeCommand,
} from '@opentrons/shared-data'
import type { ModuleRenderInfoForProtocol } from '../../hooks'
import type { LabwareSetupItem } from '../../../../pages/Protocols/utils'
import type { ModuleTypesThatRequireExtraAttention } from '../utils/getModuleTypesThatRequireExtraAttention'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { mockDefinition } from '../../../../../redux/custom-labware/__fixtures__
import { SetupLabwareList } from '../SetupLabwareList'
import { LabwareListItem } from '../LabwareListItem'
import type {
ProtocolAnalysisFile,
CompletedProtocolAnalysis,
RunTimeCommand,
} from '@opentrons/shared-data'

jest.mock('../LabwareListItem')

const protocolWithTC = (_uncastedProtocolWithTC as unknown) as ProtocolAnalysisFile
const protocolWithTC = (_uncastedProtocolWithTC as unknown) as CompletedProtocolAnalysis

const mockLabwareListItem = LabwareListItem as jest.MockedFunction<
typeof LabwareListItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { LabwarePositionCheck } from '../../../../LabwarePositionCheck'
import { useLPCDisabledReason } from '../../../hooks'
import { CurrentOffsetsTable } from '../CurrentOffsetsTable'
import { getLatestCurrentOffsets } from '../utils'
import type { ProtocolAnalysisFile } from '@opentrons/shared-data'
import type { CompletedProtocolAnalysis } from '@opentrons/shared-data'
import type { LabwareOffset } from '@opentrons/api-client'

jest.mock('../../../hooks')
Expand Down Expand Up @@ -43,7 +43,7 @@ const render = (props: React.ComponentProps<typeof CurrentOffsetsTable>) => {
i18nInstance: i18n,
})[0]
}
const protocolWithTC = (_uncastedProtocolWithTC as unknown) as ProtocolAnalysisFile
const protocolWithTC = (_uncastedProtocolWithTC as unknown) as CompletedProtocolAnalysis
const mockCurrentOffsets: LabwareOffset[] = [
{
createdAt: '2022-12-20T14:06:23.562082+00:00',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ import {
partialComponentPropsMatcher,
renderWithProviders,
} from '@opentrons/components'
import {
ProtocolAnalysisOutput,
protocolHasLiquids,
} from '@opentrons/shared-data'
import { ProtocolAnalysisOutput } from '@opentrons/shared-data'
import noModulesProtocol from '@opentrons/shared-data/protocol/fixtures/4/simpleV4.json'
import withModulesProtocol from '@opentrons/shared-data/protocol/fixtures/4/testModulesProtocol.json'

Expand Down Expand Up @@ -78,9 +75,6 @@ const mockSetupModuleAndDeck = SetupModuleAndDeck as jest.MockedFunction<
const mockSetupLiquids = SetupLiquids as jest.MockedFunction<
typeof SetupLiquids
>
const mockProtocolHasLiquids = protocolHasLiquids as jest.MockedFunction<
typeof protocolHasLiquids
>
const mockEmptySetupStep = EmptySetupStep as jest.MockedFunction<
typeof EmptySetupStep
>
Expand Down Expand Up @@ -239,24 +233,6 @@ describe('ProtocolRunSetup', () => {
})
})

describe('when liquids are in the protocol', () => {
it('renders correct text for liquids', () => {
when(mockUseMostRecentCompletedAnalysis)
.calledWith(RUN_ID)
.mockReturnValue({
...noModulesProtocol,
liquids: [{ displayName: 'water', description: 'liquid H2O' }],
} as any)
mockProtocolHasLiquids.mockReturnValue(true)

const { getByText } = render()
getByText('STEP 5')
getByText('Liquids')
getByText('View liquid starting locations and volumes')
getByText('Mock SetupLiquids')
})
})

describe('when modules are in the protocol', () => {
beforeEach(() => {
when(mockParseAllRequiredModuleModels).mockReturnValue([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { when, resetAllWhenMocks } from 'jest-when'
import { getLabwareDefURI } from '@opentrons/shared-data'
import {
CompletedProtocolAnalysis,
getLabwareDefURI,
} from '@opentrons/shared-data'
import _uncastedProtocolWithTC from '@opentrons/shared-data/protocol/fixtures/6/multipleTipracksWithTC.json'
import fixture_adapter from '@opentrons/shared-data/labware/definitions/2/opentrons_96_pcr_adapter/1.json'
import { getLabwareOffsetLocation } from '../getLabwareOffsetLocation'
Expand All @@ -8,14 +11,13 @@ import { getModuleInitialLoadInfo } from '../getModuleInitialLoadInfo'
import type {
LoadedLabware,
LoadedModule,
ProtocolAnalysisFile,
LabwareDefinition2,
} from '@opentrons/shared-data'

jest.mock('../getLabwareLocation')
jest.mock('../getModuleInitialLoadInfo')

const protocolWithTC = (_uncastedProtocolWithTC as unknown) as ProtocolAnalysisFile
const protocolWithTC = (_uncastedProtocolWithTC as unknown) as CompletedProtocolAnalysis
const mockAdapterDef = fixture_adapter as LabwareDefinition2
const mockAdapterId = 'mockAdapterId'
const TCModelInProtocol = 'thermocyclerModuleV1'
Expand All @@ -32,7 +34,7 @@ const mockGetModuleInitialLoadInfo = getModuleInitialLoadInfo as jest.MockedFunc

describe('getLabwareOffsetLocation', () => {
let MOCK_LABWARE_ID: string
let MOCK_COMMANDS: ProtocolAnalysisFile['commands']
let MOCK_COMMANDS: CompletedProtocolAnalysis['commands']
let MOCK_MODULES: LoadedModule[]
let MOCK_LABWARE: LoadedLabware[]
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import _protocolWithMagTempTC from '@opentrons/shared-data/protocol/fixtures/6/transferSettings.json'
import _standardDeckDef from '@opentrons/shared-data/deck/definitions/3/ot2_standard.json'
import { getLabwareRenderInfo } from '../getLabwareRenderInfo'
import type { ProtocolAnalysisFile } from '@opentrons/shared-data'
import type { LoadLabwareRunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'
import type {
CompletedProtocolAnalysis,
LoadLabwareRunTimeCommand,
} from '@opentrons/shared-data'

const protocolWithMagTempTC = (_protocolWithMagTempTC as unknown) as ProtocolAnalysisFile
const protocolWithMagTempTC = (_protocolWithMagTempTC as unknown) as CompletedProtocolAnalysis
const standardDeckDef = _standardDeckDef as any

describe('getLabwareRenderInfo', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import _protocolWithMagTempTC from '@opentrons/shared-data/protocol/fixtures/6/transferSettings.json'
import { getModuleInitialLoadInfo } from '../getModuleInitialLoadInfo'
import { ProtocolAnalysisFile } from '@opentrons/shared-data'
import type { LoadModuleRunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'
import { CompletedProtocolAnalysis } from '@opentrons/shared-data'
import type { LoadModuleRunTimeCommand } from '@opentrons/shared-data'

const protocolWithMagTempTC = (_protocolWithMagTempTC as unknown) as ProtocolAnalysisFile
const protocolWithMagTempTC = (_protocolWithMagTempTC as unknown) as CompletedProtocolAnalysis

describe('getModuleInitialLoadInfo', () => {
it('should gather protocol module info for tc if id in params', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { FIXED_TRASH_ID } from '@opentrons/shared-data/js'
import type { RunTimeCommand } from '@opentrons/shared-data'
import type {
LoadLabwareRunTimeCommand,
LabwareLocation,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'
RunTimeCommand,
} from '@opentrons/shared-data'

export const getInitialLabwareLocation = (
labwareId: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { RunTimeCommand } from '@opentrons/shared-data'
import type {
LoadLabwareRunTimeCommand,
LabwareLocation,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'
RunTimeCommand,
} from '@opentrons/shared-data'

const TRASH_ID = 'fixedTrash'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {
import { getSlotHasMatingSurfaceUnitVector } from '@opentrons/shared-data'
import type {
CompletedProtocolAnalysis,
DeckDefinition,
getSlotHasMatingSurfaceUnitVector,
LabwareDefinition2,
ProtocolAnalysisFile,
LoadLabwareRunTimeCommand,
ProtocolAnalysisOutput,
} from '@opentrons/shared-data'
import type { LoadLabwareRunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'

const getSlotPosition = (
deckDef: DeckDefinition,
Expand Down Expand Up @@ -46,10 +45,7 @@ export interface LabwareRenderInfoById {
}

export const getLabwareRenderInfo = (
protocolData:
| ProtocolAnalysisFile<{}>
| CompletedProtocolAnalysis
| ProtocolAnalysisOutput,
protocolData: CompletedProtocolAnalysis | ProtocolAnalysisOutput,
deckDef: DeckDefinition
): LabwareRenderInfoById =>
protocolData.commands
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { RunTimeCommand } from '@opentrons/shared-data'
import type {
LoadModuleRunTimeCommand,
ModuleLocation,
} from '@opentrons/shared-data/protocol/types/schemaV7/command/setup'
RunTimeCommand,
} from '@opentrons/shared-data'

interface ModuleInitialLoadInfo {
location: ModuleLocation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { PickUpTipRunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV7/command/pipetting'
import type { RunTimeCommand } from '@opentrons/shared-data/protocol/types/schemaV7'
import type {
PickUpTipRunTimeCommand,
RunTimeCommand,
} from '@opentrons/shared-data'

export const getPickUpTipCommandsWithPipette = (
commands: RunTimeCommand[],
Expand Down
Loading

0 comments on commit 916e2a7

Please sign in to comment.