From 0f6b2b5245a010a43f0f2026c9a5c606e3777ab1 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sat, 3 Feb 2024 03:16:55 -0700 Subject: [PATCH] Add schema --- schema.gql | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 267 insertions(+) create mode 100644 schema.gql diff --git a/schema.gql b/schema.gql new file mode 100644 index 0000000..88b0813 --- /dev/null +++ b/schema.gql @@ -0,0 +1,267 @@ +type Query { + getAggregateShots(bucketSets: [BucketSetInputGQL!]!): [AggregateResultGQL!]! + getUser(userId: Int!): UserGQL + getVideo(videoId: Int!): VideoGQL! + getShots(filterInput: FilterInput = null): [ShotGQL!]! + getBucketSet(keyName: String!): BucketSetGQL +} + +type AggregateResultGQL { + featureBuckets: [BucketGQL!]! + targetMetrics: [TargetMetricGQL!]! +} + +type BucketGQL { + rangeKey: String! + lowerBound: Float! +} + +type TargetMetricGQL { + count: Int + makePercentage: Float + floatFeature: TargetFloatFeatureGQL +} + +type TargetFloatFeatureGQL { + featureName: String! + average: Float + median: Float +} + +input BucketSetInputGQL { + feature: String! + buckets: [BucketInputGQL!]! +} + +input BucketInputGQL { + rangeKey: String! + lowerBound: Float! +} + +type UserGQL { + id: Int! + username: String! + createdAt: DateTime + updatedAt: DateTime + statistics: UserStatisticsGQL! +} + +"""Date with time (isoformat)""" +scalar DateTime + +type UserStatisticsGQL { + totalShots: Int! + totalShotsMade: Int! + makePercentage: Decimal! + averageTimeBetweenShots: Decimal! + timeSpentPlaying: Decimal! + medianRun: Decimal +} + +"""Decimal (fixed-point)""" +scalar Decimal + +type VideoGQL { + id: Int! + totalShotsMade: Int! + totalShots: Int! + makePercentage: Decimal! + medianRun: Decimal! + averageTimeBetweenShots: Decimal + createdAt: DateTime! + updatedAt: DateTime! + shots: [ShotGQL!]! + startTime: DateTime! + endTime: DateTime! + elapsedTime: Decimal! + framesPerSecond: Int! + totalFrames: Int! + stream: UploadStreamGQL +} + +type ShotGQL { + id: Int + videoId: Int + startFrame: Int + 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 +} + +type CueObjectFeaturesGQL { + cueObjectDistance: Float + cueObjectAngle: Float + cueBallSpeed: Float + shotDirection: ShotDirectionEnum +} + +type PocketingIntentionFeaturesGQL { + targetPocketDistance: Float + make: Boolean + intendedPocketType: PocketEnum +} + +type UploadStreamGQL { + id: ID! + linksRequested: Int! + uploadsCompleted: Int! + isCompleted: Boolean! + uploadMetadata: UploadStreamMetadata! + createdAt: DateTime! + updatedAt: DateTime! +} + +type UploadStreamMetadata { + deviceType: DeviceTypeEnum + osVersion: String + appVersion: String + browserName: String + browserVersion: String + locale: String + timezone: String + networkType: String + ipAddress: String +} + +enum DeviceTypeEnum { + IOS + ANDROID + BROWSER +} + +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 +} + +input AndFilter { + filters: [FilterInput!]! +} + +input OrFilter { + filters: [FilterInput!]! +} + +input CueObjectDistanceInput { + value: RangeFilter! +} + +input RangeFilter { + lessThan: Float = null + greaterThanEqualTo: Float = null +} + +input TargetPocketDistanceInput { + value: RangeFilter! +} + +input CueObjectAngleInput { + value: RangeFilter! +} + +input CueBallSpeedInput { + value: RangeFilter! +} + +input IntendedPocketTypeInput { + value: EnumFilter! +} + +input EnumFilter { + equals: String = null +} + +input ShotDirectionInput { + value: EnumFilter! +} + +type BucketSetGQL { + keyName: String! + feature: String! + buckets: [BucketGQL!]! +} + +type Mutation { + createBucketSet(params: CreateBucketSetInput!): BucketSetGQL! + processVideoSource(input: ProcessVideoSourceInput!): ProcessVideoSourceReturn! + createUploadStream(uploadMetadata: UploadMetadataInput, videoName: String = null): CreateUploadStreamReturn! + getUploadLink(videoId: Int!, chunkIndex: Int!): GetUploadLinkReturn! + terminateUploadStream(videoId: Int!): Boolean! +} + +input CreateBucketSetInput { + keyName: String! + feature: String! + buckets: [BucketInputGQL!]! +} + +type ProcessVideoSourceReturn { + val: Int! +} + +input ProcessVideoSourceInput { + val: Int! +} + +type CreateUploadStreamReturn { + videoId: Int! +} + +input UploadMetadataInput { + deviceType: DeviceTypeEnum = null + osVersion: String = null + appVersion: String = null + browserName: String = null + browserVersion: String = null + locale: String = null + timezone: String = null + networkType: String = null + ipAddress: String = null +} + +type GetUploadLinkReturn { + uploadUrl: String! + linksRequested: Int! + uploadsCompleted: Int! +}