Support multiple aggregation types in gql

This commit is contained in:
Ivan Malison 2024-03-31 03:49:29 +00:00
parent 01a580cee5
commit ed751f5cdd
4 changed files with 95 additions and 159 deletions

View File

@ -33,14 +33,25 @@ export type Scalars = {
};
export type AggregateInputGql = {
bucketSets: Array<BucketSetInputGql>;
aggregations: Array<AggregationInput>;
filterInput?: InputMaybe<FilterInput>;
};
export type AggregateResultGql = {
__typename?: "AggregateResultGQL";
featureBuckets: Array<BucketGql>;
targetMetrics: TargetMetricGql;
aggregationIdentifiers: Array<AggregationIdentifierGql>;
targetMetrics: TargetMetricsGql;
};
export type AggregationIdentifierGql = {
__typename?: "AggregationIdentifierGQL";
featureName: Scalars["String"]["output"];
groupName: Scalars["String"]["output"];
};
export type AggregationInput = {
bucketSet?: InputMaybe<BucketSetInputGql>;
enum?: InputMaybe<EnumAggregation>;
};
export type AndFilter = {
@ -96,18 +107,6 @@ export type CreateUploadStreamReturn = {
videoId: Scalars["Int"]["output"];
};
export type CueBallSpeedInput = {
value: RangeFilter;
};
export type CueObjectAngleInput = {
value: RangeFilter;
};
export type CueObjectDistanceInput = {
value: RangeFilter;
};
export type CueObjectFeaturesGql = {
__typename?: "CueObjectFeaturesGQL";
cueBallSpeed?: Maybe<Scalars["Float"]["output"]>;
@ -127,17 +126,21 @@ export enum DeviceTypeEnum {
Ios = "IOS",
}
export type EnumAggregation = {
feature: Scalars["String"]["input"];
};
export type FilterInput = {
andFilters?: InputMaybe<AndFilter>;
cueBallSpeed?: InputMaybe<CueBallSpeedInput>;
cueObjectAngle?: InputMaybe<CueObjectAngleInput>;
cueObjectDistance?: InputMaybe<CueObjectDistanceInput>;
intendedPocketType?: InputMaybe<IntendedPocketTypeInput>;
make?: InputMaybe<MakeInputGql>;
cueBallSpeed?: InputMaybe<RangeFilter>;
cueObjectAngle?: InputMaybe<RangeFilter>;
cueObjectDistance?: InputMaybe<RangeFilter>;
intendedPocketType?: InputMaybe<Array<PocketEnum>>;
make?: InputMaybe<Array<Scalars["Boolean"]["input"]>>;
orFilters?: InputMaybe<OrFilter>;
shotDirection?: InputMaybe<ShotDirectionInput>;
shotDirection?: InputMaybe<Array<ShotDirectionEnum>>;
tags?: InputMaybe<Array<VideoTagInput>>;
targetPocketDistance?: InputMaybe<TargetPocketDistanceInput>;
targetPocketDistance?: InputMaybe<RangeFilter>;
userId?: InputMaybe<Array<Scalars["Int"]["input"]>>;
videoId?: InputMaybe<Array<Scalars["Int"]["input"]>>;
};
@ -169,14 +172,6 @@ export type IntPoint2D = {
y: Scalars["Int"]["output"];
};
export type IntendedPocketTypeInput = {
value: ValueFilterString;
};
export type MakeInputGql = {
value: ValueFilterBool;
};
export type MakePercentageIntervalGql = {
__typename?: "MakePercentageIntervalGQL";
elapsedTime: Scalars["Float"]["output"];
@ -283,7 +278,7 @@ export type QueryGetPlayTimeArgs = {
};
export type QueryGetShotsArgs = {
filterInput?: InputMaybe<FilterInput>;
filterInput: FilterInput;
};
export type QueryGetUserArgs = {
@ -315,27 +310,12 @@ export enum ShotDirectionEnum {
Straight = "STRAIGHT",
}
export type ShotDirectionInput = {
value: ValueFilterString;
};
export type ShotFeaturesGql = {
__typename?: "ShotFeaturesGQL";
bank?: Maybe<BankFeaturesGql>;
cueBallSpeed?: Maybe<Scalars["Float"]["output"]>;
cueObjectAngle?: Maybe<Scalars["Float"]["output"]>;
cueObjectDistance?: Maybe<Scalars["Float"]["output"]>;
intendedPocket?: Maybe<PocketEnum>;
shotDirection?: Maybe<ShotDirectionEnum>;
targetPocketDistance?: Maybe<Scalars["Float"]["output"]>;
};
export type ShotGql = {
__typename?: "ShotGQL";
bankFeatures?: Maybe<BankFeaturesGql>;
createdAt?: Maybe<Scalars["DateTime"]["output"]>;
cueObjectFeatures?: Maybe<CueObjectFeaturesGql>;
endFrame?: Maybe<Scalars["Int"]["output"]>;
features?: Maybe<ShotFeaturesGql>;
id?: Maybe<Scalars["Int"]["output"]>;
pocketingIntentionFeatures?: Maybe<PocketingIntentionFeaturesGql>;
startFrame?: Maybe<Scalars["Int"]["output"]>;
@ -348,16 +328,12 @@ export type StreamErrorGql = {
message: Scalars["String"]["output"];
};
export type TargetMetricGql = {
__typename?: "TargetMetricGQL";
count?: Maybe<Scalars["Int"]["output"]>;
export type TargetMetricsGql = {
__typename?: "TargetMetricsGQL";
count: Scalars["Int"]["output"];
makePercentage?: Maybe<Scalars["Float"]["output"]>;
};
export type TargetPocketDistanceInput = {
value: RangeFilter;
};
export type UploadStreamGql = {
__typename?: "UploadStreamGQL";
createdAt: Scalars["DateTime"]["output"];
@ -397,14 +373,6 @@ export type UserPlayTimeGql = {
totalSeconds: Scalars["Float"]["output"];
};
export type ValueFilterBool = {
equals?: InputMaybe<Scalars["Boolean"]["input"]>;
};
export type ValueFilterString = {
equals?: InputMaybe<Scalars["String"]["input"]>;
};
export type VideoFeedGql = {
__typename?: "VideoFeedGQL";
pageInfo: PageInfoGql;
@ -476,14 +444,14 @@ export type GetAggregatedShotMetricsQuery = {
__typename?: "Query";
getAggregatedShotMetrics: Array<{
__typename?: "AggregateResultGQL";
featureBuckets: Array<{
__typename?: "BucketGQL";
rangeKey: string;
lowerBound: number;
aggregationIdentifiers: Array<{
__typename?: "AggregationIdentifierGQL";
featureName: string;
groupName: string;
}>;
targetMetrics: {
__typename?: "TargetMetricGQL";
count?: number | null;
__typename?: "TargetMetricsGQL";
count: number;
makePercentage?: number | null;
};
}>;
@ -570,7 +538,7 @@ export type GetVideoMakePercentageIntervalsQuery = {
};
export type GetShotsQueryVariables = Exact<{
filterInput?: InputMaybe<FilterInput>;
filterInput: FilterInput;
includeCueObjectDistance?: Scalars["Boolean"]["input"];
includeCueObjectAngle?: Scalars["Boolean"]["input"];
includeCueBallSpeed?: Scalars["Boolean"]["input"];
@ -784,9 +752,9 @@ export type EditUploadStreamMutation = {
export const GetAggregatedShotMetricsDocument = gql`
query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) {
getAggregatedShotMetrics(aggregateInput: $aggregateInput) {
featureBuckets {
rangeKey
lowerBound
aggregationIdentifiers {
featureName
groupName
}
targetMetrics {
count
@ -1125,7 +1093,7 @@ export type GetVideoMakePercentageIntervalsQueryResult = Apollo.QueryResult<
>;
export const GetShotsDocument = gql`
query GetShots(
$filterInput: FilterInput
$filterInput: FilterInput!
$includeCueObjectDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false
@ -1180,7 +1148,7 @@ export const GetShotsDocument = gql`
* });
*/
export function useGetShotsQuery(
baseOptions?: Apollo.QueryHookOptions<GetShotsQuery, GetShotsQueryVariables>,
baseOptions: Apollo.QueryHookOptions<GetShotsQuery, GetShotsQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<GetShotsQuery, GetShotsQueryVariables>(

View File

@ -1,8 +1,8 @@
query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) {
getAggregatedShotMetrics(aggregateInput: $aggregateInput) {
featureBuckets {
rangeKey
lowerBound
aggregationIdentifiers {
featureName
groupName
}
targetMetrics {
count

View File

@ -1,5 +1,5 @@
query GetShots(
$filterInput: FilterInput
$filterInput: FilterInput!
$includeCueObjectDistance: Boolean! = false
$includeCueObjectAngle: Boolean! = false
$includeCueBallSpeed: Boolean! = false

View File

@ -7,7 +7,7 @@ type Query {
getDeployedConfig: DeployedConfigGQL!
getPlayTime(userId: Int!): UserPlayTimeGQL!
getVideo(videoId: Int!): VideoGQL!
getShots(filterInput: FilterInput = null): [ShotGQL!]!
getShots(filterInput: FilterInput!): [ShotGQL!]!
getBucketSet(keyName: String!): BucketSetGQL
getVideoFeedForUser(limit: Int! = 5, after: String = null): VideoFeedGQL!
getVideoMakePercentageIntervals(
@ -17,25 +17,30 @@ type Query {
}
type AggregateResultGQL {
featureBuckets: [BucketGQL!]!
targetMetrics: TargetMetricGQL!
aggregationIdentifiers: [AggregationIdentifierGQL!]!
targetMetrics: TargetMetricsGQL!
}
type BucketGQL {
rangeKey: String!
lowerBound: Float!
type AggregationIdentifierGQL {
featureName: String!
groupName: String!
}
type TargetMetricGQL {
count: Int
type TargetMetricsGQL {
count: Int!
makePercentage: Float
}
input AggregateInputGQL {
bucketSets: [BucketSetInputGQL!]!
aggregations: [AggregationInput!]!
filterInput: FilterInput
}
input AggregationInput {
bucketSet: BucketSetInputGQL = null
enum: EnumAggregation = null
}
input BucketSetInputGQL {
feature: String!
buckets: [BucketInputGQL!]!
@ -46,18 +51,22 @@ input BucketInputGQL {
lowerBound: Float!
}
input EnumAggregation {
feature: String!
}
input FilterInput {
andFilters: AndFilter = null
orFilters: OrFilter = null
cueObjectDistance: CueObjectDistanceInput = null
targetPocketDistance: TargetPocketDistanceInput = null
cueObjectAngle: CueObjectAngleInput = null
cueBallSpeed: CueBallSpeedInput = null
intendedPocketType: IntendedPocketTypeInput = null
shotDirection: ShotDirectionInput = null
cueObjectDistance: RangeFilter = null
targetPocketDistance: RangeFilter = null
cueObjectAngle: RangeFilter = null
cueBallSpeed: RangeFilter = null
intendedPocketType: [PocketEnum!] = null
shotDirection: [ShotDirectionEnum!] = null
videoId: [Int!] = null
userId: [Int!] = null
make: MakeInputGQL = null
make: [Boolean!] = null
tags: [VideoTagInput!] = null
}
@ -69,45 +78,20 @@ input OrFilter {
filters: [FilterInput!]!
}
input CueObjectDistanceInput {
value: RangeFilter!
}
input RangeFilter {
lessThan: Float = null
greaterThanEqualTo: Float = null
}
input TargetPocketDistanceInput {
value: RangeFilter!
enum PocketEnum {
CORNER
SIDE
}
input CueObjectAngleInput {
value: RangeFilter!
}
input CueBallSpeedInput {
value: RangeFilter!
}
input IntendedPocketTypeInput {
value: ValueFilterString!
}
input ValueFilterString {
equals: String = null
}
input ShotDirectionInput {
value: ValueFilterString!
}
input MakeInputGQL {
value: ValueFilterBool!
}
input ValueFilterBool {
equals: Boolean = null
enum ShotDirectionEnum {
LEFT
RIGHT
STRAIGHT
}
input VideoTagInput {
@ -169,41 +153,9 @@ type ShotGQL {
endFrame: Int
createdAt: DateTime
updatedAt: DateTime
features: ShotFeaturesGQL
cueObjectFeatures: CueObjectFeaturesGQL
pocketingIntentionFeatures: PocketingIntentionFeaturesGQL
}
type ShotFeaturesGQL {
cueObjectAngle: Float
cueObjectDistance: Float
targetPocketDistance: Float
intendedPocket: PocketEnum
cueBallSpeed: Float
shotDirection: ShotDirectionEnum
bank: BankFeaturesGQL
}
enum PocketEnum {
CORNER
SIDE
}
enum ShotDirectionEnum {
LEFT
RIGHT
STRAIGHT
}
type BankFeaturesGQL {
wallsHit: [WallTypeEnum!]!
bankAngle: Float!
distance: Float!
}
enum WallTypeEnum {
LONG
SHORT
bankFeatures: BankFeaturesGQL
}
type CueObjectFeaturesGQL {
@ -219,6 +171,17 @@ type PocketingIntentionFeaturesGQL {
intendedPocketType: PocketEnum
}
type BankFeaturesGQL {
wallsHit: [WallTypeEnum!]!
bankAngle: Float!
distance: Float!
}
enum WallTypeEnum {
LONG
SHORT
}
type UploadStreamGQL {
id: ID!
linksRequested: Int!
@ -278,6 +241,11 @@ type BucketSetGQL {
buckets: [BucketGQL!]!
}
type BucketGQL {
rangeKey: String!
lowerBound: Float!
}
type VideoFeedGQL {
videos: [VideoGQL!]!
pageInfo: PageInfoGQL!