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

View File

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

View File

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

View File

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