Skip to content

chore: Delete V1 run page query #1594

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
531 changes: 0 additions & 531 deletions frontend/packages/data-portal/app/graphql/getRunById.server.ts

This file was deleted.

497 changes: 0 additions & 497 deletions frontend/packages/data-portal/app/graphql/getRunByIdDiffer.ts

This file was deleted.

2 changes: 0 additions & 2 deletions frontend/packages/data-portal/app/types/gql/runPageTypes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { GetRunByIdQuery } from 'app/__generated__/graphql'
import { GetRunByIdV2Query } from 'app/__generated_v2__/graphql'

export type AnnotationFile =
GetRunByIdV2Query['annotationShapes'][number]['annotationFiles']['edges'][number]['node']
export type AnnotationShape = GetRunByIdV2Query['annotationShapes'][number]
export type Tomogram = GetRunByIdQuery['tomograms'][number]
export type TomogramV2 = GetRunByIdV2Query['tomograms'][number]
18 changes: 9 additions & 9 deletions frontend/packages/data-portal/e2e/filters/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { TableValidatorOptions } from 'e2e/pageObjects/filters/types'
import {
GetDatasetByIdQuery,
GetDatasetsDataQuery,
GetRunByIdQuery,
} from 'app/__generated__/graphql'
import { GetRunByIdV2Query } from 'app/__generated_v2__/graphql'
import { AVAILABLE_FILES_VALUE_TO_I18N_MAP } from 'app/components/DatasetFilter/constants'
import { TestIds } from 'app/constants/testIds'
import { getBrowseDatasets } from 'app/graphql/getBrowseDatasets.server'
import { getDatasetById } from 'app/graphql/getDatasetById.server'
import { getRunById } from 'app/graphql/getRunById.server'
import { getRunByIdV2 } from 'app/graphql/getRunByIdV2.server'

async function waitForTableCountChange({
countLabel,
Expand Down Expand Up @@ -88,10 +88,10 @@ export function getRunTableFilterValidator(expectedData: GetDatasetByIdQuery) {
}

export function getAnnotationTableFilterValidator(
expectedData: GetRunByIdQuery,
expectedData: GetRunByIdV2Query,
) {
const annotationIds = new Set(
expectedData.annotation_files.map((file) => file.annotation.id),
expectedData.annotationShapes.map((shape) => shape.annotation!.id),
)

return async (page: Page) => {
Expand Down Expand Up @@ -120,19 +120,19 @@ export async function validateTable({
countLabel?: string
page: Page
singleDatasetData?: GetDatasetByIdQuery
singleRunData?: GetRunByIdQuery
singleRunData?: GetRunByIdV2Query
validateRows(page: Page): Promise<void>
}) {
const expectedFilterCount =
browseDatasetsData?.filtered_datasets_aggregate.aggregate?.count ??
singleDatasetData?.datasets.at(0)?.filtered_runs_count.aggregate?.count ??
singleRunData?.annotation_files_aggregate_for_filtered.aggregate?.count ??
singleRunData?.numFilteredAnnotationRows.aggregate?.[0].count ??
0

const expectedTotalCount =
browseDatasetsData?.datasets_aggregate.aggregate?.count ??
singleDatasetData?.datasets.at(0)?.runs_aggregate.aggregate?.count ??
singleRunData?.annotation_files_aggregate_for_total.aggregate?.count ??
singleRunData?.numTotalAnnotationRows.aggregate?.[0].count ??
0

await waitForTableCountChange({
Expand Down Expand Up @@ -219,9 +219,9 @@ export async function validateAnnotationsTable({
pageNumber = 1,
id = +E2E_CONFIG.runId,
}: TableValidatorOptions & { id?: number }) {
const { data } = await getRunById({
const { data } = await getRunByIdV2({
client,
params,
params: params ?? new URLSearchParams(),
id,
annotationsPage: pageNumber,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import { ApolloClient, NormalizedCacheObject } from '@apollo/client'
import { test } from '@playwright/test'
import { E2E_CONFIG } from 'e2e/constants'

import { GetRunByIdQuery } from 'app/__generated__/graphql'
import { GetRunByIdV2Query } from 'app/__generated_v2__/graphql'
import {
getAnnotationCodeSnippet,
getTomogramCodeSnippet,
} from 'app/components/Download/APIDownloadTab'
import { getAwsCommand } from 'app/components/Download/AWSDownloadTab'
import { getCurlCommand } from 'app/components/Download/CurlDownloadTab'
import { getDefaultFileFormat } from 'app/components/Download/FileFormatDropdown'
import { QueryParams } from 'app/constants/query'
import { getDatasetById } from 'app/graphql/getDatasetById.server'
import { getRunById } from 'app/graphql/getRunById.server'
import { getRunByIdV2 } from 'app/graphql/getRunByIdV2.server'
import { DownloadTab } from 'app/types/download'

export function skipClipboardTestsForWebkit(browserName: string) {
Expand Down Expand Up @@ -82,36 +83,35 @@ export function fetchTestSingleDataset(
export function fetchTestSingleRun(
client: ApolloClient<NormalizedCacheObject>,
) {
return getRunById({ client, id: +E2E_CONFIG.runId, annotationsPage: 1 })
return getRunByIdV2({
client,
id: +E2E_CONFIG.runId,
annotationsPage: 1,
params: new URLSearchParams(),
})
}

export function getTomogramDownloadCommand({
data,
fileFormat,
tab,
}: {
data: GetRunByIdQuery
data: GetRunByIdV2Query
fileFormat?: string
tab: DownloadTab
}): string {
const tomogram = data.runs[0].tomogram_voxel_spacings[0].tomograms[0]
const activeTomogram = data.tomograms.find((tomo) => {
return (
tomo.voxel_spacing === tomogram.voxel_spacing &&
tomo.processing === tomogram.processing
)
})
const activeTomogram = data.tomograms[0]

switch (tab) {
case DownloadTab.API:
return getTomogramCodeSnippet(activeTomogram?.id, fileFormat)
case DownloadTab.AWS:
return getAwsCommand({
s3Path: activeTomogram?.s3_mrc_scale0,
s3Path: activeTomogram.s3MrcFile!,
s3Command: 'cp',
})
case DownloadTab.Curl:
return getCurlCommand(activeTomogram?.https_mrc_scale0)
return getCurlCommand(activeTomogram.httpsMrcFile!)
case DownloadTab.Download:
return ''
default:
Expand All @@ -123,31 +123,33 @@ export function getAnnotationDownloadCommand({
data,
tab,
}: {
data: GetRunByIdQuery
data: GetRunByIdV2Query
tab: DownloadTab
}): string {
const annotationFile = data.annotation_files[0]
const fileFormat = annotationFile.format
const annotationShape = data.annotationShapes[0]
const fileFormat = getDefaultFileFormat(
annotationShape.annotationFiles.edges.map((file) => file.node.format),
)!

switch (tab) {
case DownloadTab.PortalCLI: // TODO(bchu): Update.
case DownloadTab.API:
return getAnnotationCodeSnippet(
annotationFile.annotation.id.toString(),
annotationShape.annotation!.id.toString(),
fileFormat,
)
case DownloadTab.AWS:
return getAwsCommand({
s3Path: annotationFile.annotation.files.find(
(file) => file.format === fileFormat,
)!.s3_path,
s3Path: annotationShape.annotationFiles.edges.find(
(file) => file.node.format === fileFormat,
)!.node.format,
s3Command: 'cp',
})
case DownloadTab.Curl:
return getCurlCommand(
annotationFile.annotation.files.find(
(file) => file.format === fileFormat,
)!.https_path,
annotationShape.annotationFiles.edges.find(
(file) => file.node.format === fileFormat,
)!.node.httpsPath,
)
case DownloadTab.Download:
return ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { translations } from 'e2e/constants'
import {
GetDatasetByIdQuery,
GetDatasetsDataQuery,
GetRunByIdQuery,
} from 'app/__generated__/graphql'
import { GetRunByIdV2Query } from 'app/__generated_v2__/graphql'
import { getBrowseDatasets } from 'app/graphql/getBrowseDatasets.server'
import { getDatasetById } from 'app/graphql/getDatasetById.server'
import { getDatasetsFilterData } from 'app/graphql/getDatasetsFilterData.server'
import { getRunById } from 'app/graphql/getRunById.server'
import { getRunByIdV2 } from 'app/graphql/getRunByIdV2.server'

import { FiltersPage } from './filtersPage'
import { MultiInputFilterType, QueryParamObjectType } from './types'
Expand Down Expand Up @@ -71,7 +71,7 @@ export class FiltersActor {
serialize,
})

const { data } = await getRunById({
const { data } = await getRunByIdV2({
client,
params,
id,
Expand Down Expand Up @@ -207,14 +207,14 @@ export class FiltersActor {
public async expectAnnotationsTableToBeCorrect({
singleRunData,
}: {
singleRunData: GetRunByIdQuery
singleRunData: GetRunByIdV2Query
}) {
// Extract counts from response
const expectedGroundTruthCount =
singleRunData.annotation_files_aggregate_for_ground_truth.aggregate
?.count ?? 0
singleRunData.numFilteredGroundTruthAnnotationRows.aggregate?.[0].count ??
0
const expectedOtherCount =
singleRunData.annotation_files_aggregate_for_other.aggregate?.count ?? 0
singleRunData.numFilteredOtherAnnotationRows.aggregate?.[0].count ?? 0
const expectedFilterCount = getExpectedFilterCount({ singleRunData })
const expectedTotalCount = getExpectedTotalCount({ singleRunData })

Expand Down
20 changes: 10 additions & 10 deletions frontend/packages/data-portal/e2e/pageObjects/filters/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
GetDatasetByIdQuery,
GetDatasetsDataQuery,
GetDatasetsFilterDataQuery,
GetRunByIdQuery,
} from 'app/__generated__/graphql'
import { GetRunByIdV2Query } from 'app/__generated_v2__/graphql'
import { AVAILABLE_FILES_VALUE_TO_I18N_MAP } from 'app/components/DatasetFilter/constants'

import { QueryParamObjectType, RowCounterType } from './types'
Expand Down Expand Up @@ -44,12 +44,12 @@ export function getExpectedFilterCount({
}: {
browseDatasetsData?: GetDatasetsDataQuery
singleDatasetData?: GetDatasetByIdQuery
singleRunData?: GetRunByIdQuery
singleRunData?: GetRunByIdV2Query
}) {
return (
browseDatasetsData?.filtered_datasets_aggregate.aggregate?.count ??
singleDatasetData?.datasets.at(0)?.filtered_runs_count.aggregate?.count ??
singleRunData?.annotation_files_aggregate_for_filtered.aggregate?.count ??
singleRunData?.numFilteredAnnotationRows.aggregate?.[0].count ??
0
)
}
Expand All @@ -61,12 +61,12 @@ export function getExpectedTotalCount({
}: {
browseDatasetsData?: GetDatasetsDataQuery
singleDatasetData?: GetDatasetByIdQuery
singleRunData?: GetRunByIdQuery
singleRunData?: GetRunByIdV2Query
}) {
return (
browseDatasetsData?.datasets_aggregate.aggregate?.count ??
singleDatasetData?.datasets.at(0)?.runs_aggregate.aggregate?.count ??
singleRunData?.annotation_files_aggregate_for_total.aggregate?.count ??
singleRunData?.numTotalAnnotationRows.aggregate?.[0].count ??
0
)
}
Expand All @@ -75,14 +75,14 @@ export function getExpectedTotalCount({
export function getAnnotationRowCountFromData({
singleRunData,
}: {
singleRunData: GetRunByIdQuery
singleRunData: GetRunByIdV2Query
}): RowCounterType {
const rowCounter: RowCounterType = {}
for (const file of singleRunData.annotation_files) {
if (rowCounter[file.annotation.id] === undefined) {
rowCounter[file.annotation.id] = 1
for (const shape of singleRunData.annotationShapes) {
if (rowCounter[shape.annotation!.id] === undefined) {
rowCounter[shape.annotation!.id] = 1
} else {
rowCounter[file.annotation.id] += 1
rowCounter[shape.annotation!.id] += 1
}
}
return rowCounter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DeepPartial } from 'utility-types'

import { GetDatasetByIdQuery, GetRunByIdQuery } from 'app/__generated__/graphql'
import { GetDatasetByIdQuery } from 'app/__generated__/graphql'
import { GetRunByIdV2Query } from 'app/__generated_v2__/graphql'
import { I18nKeys } from 'app/types/i18n'

export type DrawerMetadataValue = number | string | null | undefined | string[]
Expand All @@ -16,8 +17,8 @@ export interface DrawerTestData {

export type Dataset =
| GetDatasetByIdQuery['datasets'][number]
| GetRunByIdQuery['runs'][number]['dataset']
| GetRunByIdV2Query['runs'][number]['dataset']

export type TiltSeries =
GetDatasetByIdQuery['datasets'][number]['run_metadata'][number]['tiltseries'][number] &
GetRunByIdQuery['runs'][number]['tiltseries'][number]
GetRunByIdV2Query['runs'][number]['tiltseries']['edges'][number]
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@ import { getObjectShapeTypeLabel } from 'e2e/utils'
import { startCase } from 'lodash-es'
import { DeepPartial } from 'utility-types'

import {
Annotations,
Datasets,
GetRunByIdQuery,
Tiltseries,
} from 'app/__generated__/graphql'
import { Annotations, Datasets, Tiltseries } from 'app/__generated__/graphql'
import {
Dataset,
Fiducial_Alignment_Status_Enum,
GetRunByIdV2Query,
Tomogram,
} from 'app/__generated_v2__/graphql'
import { Dataset as DatasetV2 } from 'app/types/gql/genericTypes'
import { getDatasetById } from 'app/graphql/getDatasetById.server'
import { getRunById } from 'app/graphql/getRunById.server'
import { getRunByIdV2 } from 'app/graphql/getRunByIdV2.server'
import { ObjectShapeType } from 'app/types/shapeTypes'

Expand Down Expand Up @@ -62,6 +58,8 @@ function getDatasetTestMetadata({
}
}

function getDatasetTestMetadataV2(dataset: DatasetV2)

function getTiltSeriesTestMetadata({
tiltSeries,
type,
Expand Down Expand Up @@ -100,18 +98,18 @@ function getTiltSeriesTestMetadata({
}

function getTomogramAccordionTestMetadata(
response: GetRunByIdQuery,
response: GetRunByIdV2Query,
): DrawerTestMetadata {
return {
totalTomograms: response.tomograms_aggregate.aggregate!.count.toString(),
resolutionsAvailable: response.tomograms_for_resolutions.map((tomo) =>
tomo.voxel_spacing.toString(),
totalTomograms: response.tomogramsAggregate.aggregate![0].count!.toString(),
resolutionsAvailable: response.uniqueResolutions.aggregate!.map(
(aggregate) => aggregate.groupBy!.voxelSpacing!.toString(),
),
tomogramProcessing: response.tomograms_for_distinct_processing_methods.map(
(tomo) => startCase(tomo.processing),
tomogramProcessing: response.uniqueProcessingMethods.aggregate!.map(
(aggregate) => startCase(aggregate.groupBy!.processing!),
),
annotatedObjects: response.annotations_for_object_names
.map((annotation) => annotation.object_name)
annotatedObjects: response.uniqueObjectNames
.aggregate!.map((aggregate) => aggregate.groupBy!.objectName!)
.slice(0, 4),
}
}
Expand Down Expand Up @@ -232,14 +230,15 @@ export async function getSingleDatasetTestMetadata(
export async function getSingleRunTestMetadata(
client: ApolloClient<NormalizedCacheObject>,
): Promise<DrawerTestData> {
const { data } = await getRunById({
const { data } = await getRunByIdV2({
client,
id: +E2E_CONFIG.runId,
annotationsPage: 1,
params: new URLSearchParams(),
})

const [run] = data.runs
const [tiltSeries] = run.tiltseries
const [tiltSeries] = run.tiltseries.edges

return {
title: run.name,
Expand All @@ -262,10 +261,11 @@ export async function getSingleRunTestMetadata(
export async function getAnnotationTestData(
client: ApolloClient<NormalizedCacheObject>,
) {
const { data } = await getRunById({
const { data } = await getRunByIdV2({
client,
id: +E2E_CONFIG.runId,
annotationsPage: 1,
params: new URLSearchParams(),
})

const { annotation } = data.annotation_files[0]
Expand Down
Loading