Skip to content

Commit

Permalink
feat: Add aggregate filters to datasets and deposition queries (#1470)
Browse files Browse the repository at this point in the history
* remove ehaustive check

* no tilstersi
  • Loading branch information
bchu1 authored Jan 21, 2025
1 parent b211efc commit 7fdd048
Showing 1 changed file with 54 additions and 66 deletions.
120 changes: 54 additions & 66 deletions frontend/packages/data-portal/app/graphql/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,73 +69,61 @@ export function getDatasetsFilter({
}
}
// Available Files
// TODO(bchu): Implement when available in API.
// filterState.includedContents.availableFiles.forEach((file) =>
// match(file)
// .with('raw-frames', () =>
// where.push({
// runs: {
// tiltseries: {
// frames_count: {
// _gt: 0,
// },
// },
// },
// }),
// )
// .with('tilt-series', () =>
// where.push({
// runs: {
// tiltseries_aggregate: {
// count: {
// predicate: {
// _gt: 0,
// },
// },
// },
// },
// }),
// )
// .with('tilt-series-alignment', () =>
// where.push({
// runs: {
// tiltseries: {
// https_alignment_file: {
// _is_null: false,
// },
// },
// },
// }),
// )
// .with('tomogram', () =>
// where.push({
// runs: {
// tomogram_voxel_spacings: {
// tomograms_aggregate: {
// count: {
// predicate: {
// _gt: 0,
// },
// },
// },
// },
// },
// }),
// )
// .exhaustive(),
// )
for (const availableFile of filterState.includedContents.availableFiles) {
where.runs ??= {}
switch (availableFile) {
case 'raw-frames':
where.runs.framesAggregate = {
count: {
predicate: {
_gt: 0,
},
},
}
break
case 'tilt-series':
where.runs.tiltseriesAggregate = {
count: {
predicate: {
_gt: 0,
},
},
}
break
case 'tilt-series-alignment':
where.runs.alignmentsAggregate = {
count: {
predicate: {
_gt: 0,
},
},
}
break
case 'tomogram':
where.runs.tomogramsAggregate = {
count: {
predicate: {
_gt: 0,
},
},
}
break
default:
}
}
// Number of Runs
// TODO: Implement when available in API.
// if (filterState.includedContents.numberOfRuns) {
// const runCount = +filterState.includedContents.numberOfRuns.slice(1)
// where.push({
// runs_aggregate: {
// count: {
// predicate: { _gte: runCount },
// },
// },
// })
// }
const numberOfRuns = filterState.includedContents.numberOfRuns
? parseInt(filterState.includedContents.numberOfRuns.replace('>', ''))
: undefined
if (Number.isInteger(numberOfRuns)) {
where.runsAggregate = {
count: {
predicate: {
_gte: numberOfRuns,
},
},
}
}

// NAME/ID SECTION
// Dataset IDs
Expand Down

0 comments on commit 7fdd048

Please sign in to comment.