From 4641ac8286c63cfc5c81d381b36c5b264f917a47 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 13:59:46 -0700 Subject: [PATCH 01/50] add metric value endpoint --- .../hasura/endpoints/faros_metric_value.gql | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 init/resources/hasura/endpoints/faros_metric_value.gql diff --git a/init/resources/hasura/endpoints/faros_metric_value.gql b/init/resources/hasura/endpoints/faros_metric_value.gql new file mode 100644 index 00000000..239a1a35 --- /dev/null +++ b/init/resources/hasura/endpoints/faros_metric_value.gql @@ -0,0 +1,29 @@ +mutation insert_faros_metric_value( + $data_uid: String! + $data_computedAt: timestamptz! + $data_value: String! + $data_definition: String! + $data_origin: String +) { + insert_faros_MetricValue_one( + object: { + uid: $data_uid + computedAt: $data_computedAt + value: $data_value + definition: $data_definition + origin: $data_origin + } + on_conflict: { + constraint: faros_MetricValue_pkey + update_columns: [ + computedAt + value + definition + origin + refreshedAt + ] + } + ) { + id + } +} From 9c95172a817879b532d795f1f40fa4b724cb9d1f Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 14:06:09 -0700 Subject: [PATCH 02/50] add metric definition endpoint --- .../endpoints/faros_metric_definition.gql | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 init/resources/hasura/endpoints/faros_metric_definition.gql diff --git a/init/resources/hasura/endpoints/faros_metric_definition.gql b/init/resources/hasura/endpoints/faros_metric_definition.gql new file mode 100644 index 00000000..e1ff4286 --- /dev/null +++ b/init/resources/hasura/endpoints/faros_metric_definition.gql @@ -0,0 +1,22 @@ +mutation insert_faros_metric_definition( + $data_uid: String! + $data_name: String! + $data_origin: String +) { + insert_faros_MetricDefinition_one( + object: { + uid: $data_uid + name: $data_name + origin: $data_origin + } + on_conflict: { + constraint: faros_MetricDefinition_pkey + update_columns: [ + origin + refreshedAt + ] + } + ) { + id + } +} From 2b12d05c61a20e989f3e4fce45eec29f2e36fc45 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 14:15:38 -0700 Subject: [PATCH 03/50] tag endpoint --- init/resources/hasura/endpoints/faros_tag.gql | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 init/resources/hasura/endpoints/faros_tag.gql diff --git a/init/resources/hasura/endpoints/faros_tag.gql b/init/resources/hasura/endpoints/faros_tag.gql new file mode 100644 index 00000000..9b3ed4a9 --- /dev/null +++ b/init/resources/hasura/endpoints/faros_tag.gql @@ -0,0 +1,27 @@ +mutation insert_faros_tag( + $data_uid: String! + $data_key: String! + $data_value: String! + $data_origin: String +) { + insert_faros_Tag_one( + object: { + uid: $data_uid + key: $data_key + value: $data_value + origin: $data_origin + } + on_conflict: { + constraint: faros_Tag_pkey + update_columns: [ + key + value + origin + refreshedAt + ] + } + ) { + id + } +} + From 05015b48ebf7f7fb86e741c7d64a1aa8146268a3 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 14:39:50 -0700 Subject: [PATCH 04/50] metric value tag endpoint --- .../endpoints/faros_metric_value_tag.gql | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 init/resources/hasura/endpoints/faros_metric_value_tag.gql diff --git a/init/resources/hasura/endpoints/faros_metric_value_tag.gql b/init/resources/hasura/endpoints/faros_metric_value_tag.gql new file mode 100644 index 00000000..b8d17049 --- /dev/null +++ b/init/resources/hasura/endpoints/faros_metric_value_tag.gql @@ -0,0 +1,30 @@ +mutation insert_faros_metric_value_tag( + $data_value_uid: String! + $data_value_definition_uid: String! + $data_tag_id: String! + $data_origin: String +) { + insert_faros_MetricValueTag_one( + object: { + tag: $data_tag_id + faros_MetricValue: { + data: { + uid: $data_value_uid + definition: $data_value_definition_uid + } + on_conflict: {constraint: faros_MetricValue_pkey, update_columns: refreshedAt} + } + origin: $data_origin + } + on_conflict: { + constraint: faros_MetricValueTag_pkey + update_columns: [ + origin + refreshedAt + ] + } + ) { + id + } +} + From 3c8765747c24ae801746643eaf1655840c2fa585 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 15:04:26 -0700 Subject: [PATCH 05/50] user tool endpoint --- .../hasura/endpoints/vcs_user_tool.gql | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 init/resources/hasura/endpoints/vcs_user_tool.gql diff --git a/init/resources/hasura/endpoints/vcs_user_tool.gql b/init/resources/hasura/endpoints/vcs_user_tool.gql new file mode 100644 index 00000000..916f650c --- /dev/null +++ b/init/resources/hasura/endpoints/vcs_user_tool.gql @@ -0,0 +1,47 @@ +mutation insert_vcs_user_tool( + $data_user_uid: String! + $data_user_source: String! + $data_org_uid: String! + $data_org_source: String! + $data_tool: jsonb! + $data_inactive: Boolean! + $data_started_at: timestamptz! + $data_ended_at: timestamptz! + $data_origin: String +) { + insert_vcs_UserTool_one( + object: { + vcs_User: { + data: { + uid: $data_user_uid + source: $data_user_source + } + on_conflict: {constraint: vcs_User_pkey, update_columns: refreshedAt} + } + vcs_Organization: { + data: { + uid: $data_org_uid + source: $data_org_source + } + on_conflict: {constraint: vcs_Organization_pkey, update_columns: refreshedAt} + } + tool: $data_tool + inactive: $data_inactive + startedAt: $data_started_at + endedAt: $data_ended_at + origin: $data_origin + } + on_conflict: { + constraint: vcs_UserTool_pkey + update_columns: [ + inactive + startedAt + endedAt + origin + refreshedAt + ] + } + ) { + id + } +} From fb279639179003063b925f29a9883719eb660f64 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 15:11:13 -0700 Subject: [PATCH 06/50] add hasura functions and mock data test writes --- mock-data/src/hasura.ts | 118 ++++++++++++++++++++++++++++++++++++++ mock-data/src/mockdata.ts | 38 ++++++++++++ 2 files changed, 156 insertions(+) diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index 89c80288..4f404424 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -111,6 +111,47 @@ export class Hasura { }); } + async postMetricDefinition( + uid: string, + name: string, + origin: string + ): Promise { + await this.api.post('faros_metric_definition', { + data_uid: uid, + data_name: name, + data_origin: origin, + }); + } + + async postMetricValue( + uid: string, + computedAt: DateTime, + value: string, + definition: string, + origin: string + ): Promise { + await this.api.post('faros_metric_value', { + data_uid: uid, + data_computedAt: computedAt, + data_value: value, + data_definition: definition, + data_origin: origin, + }); + } + + async postMetricValueTag( + value: any, + tag: string, + origin: string + ): Promise { + await this.api.post('faros_metric_value_tag', { + data_value_uid: value.uid, + data_value_definition_uid: value.definition, + data_tag_id: tag, + data_origin: origin, + }); + } + async postPullRequest( id: string, author: string, @@ -159,6 +200,20 @@ export class Hasura { }); } + async postTag( + uid: string, + key: string, + value: string, + origin: string + ): Promise { + await this.api.post('faros_tag', { + data_uid: uid, + data_key: key, + data_value: value, + data_origin: origin, + }); + } + async postTask( taskId: string, createdAt: DateTime, @@ -188,6 +243,39 @@ export class Hasura { }); } + async postUserTool( + user: any, + organization: any, + tool: any, + inactive: boolean, + startedAt: DateTime, + endedAt: DateTime, + origin: string, + ): Promise { + await this.api.post('vcs_user_tool', { + data_user_uid: user.uid, + data_user_source: user.source, + data_org_uid: organization.uid, + data_org_source: organization.source, + data_tool: tool, + data_inactive: inactive, + data_started_at: startedAt, + data_ended_at: endedAt, + data_origin: origin + }); + } + + async postUserToolUsage( + userTool: any, + usedAt: DateTime, + refreshedAt: DateTime, + origin: string + ): Promise { + await this.api.post('vcs_user_tool_usage', { + data_origin: origin, + }); + } + async deleteArtifactCommitAssociation(origin: string): Promise { await this.api.post('delete_cicd_artifact_commit_association', { data_origin: origin, @@ -280,4 +368,34 @@ export class Hasura { data_origin: origin, }); } + + async deleteMetricValue(origin: string): Promise { + await this.api.post('delete_faros_metric_value', { + data_origin: origin, + }); + } + + async deleteMetricValueTag(origin: string): Promise { + await this.api.post('delete_faros_metric_value_tag', { + data_origin: origin, + }); + } + + async deleteTag(origin: string): Promise { + await this.api.post('delete_faros_tag', { + data_origin: origin, + }); + } + + async deleteUserTool(origin: string): Promise { + await this.api.post('delete_vcs_user_tool', { + data_origin: origin, + }); + } + + async deleteUserToolUsage(origin: string): Promise { + await this.api.post('delete_vcs_user_tool_usage', { + data_origin: origin, + }); + } } diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 97344210..5a093704 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -86,6 +86,44 @@ export class MockData { } await this.writeTasks(week, weekStart); } + + // test writes + await this.hasura.postMetricDefinition( + 'myuid', + 'myname', + ORIGIN + ); + + await this.hasura.postMetricValue( + 'uid', + DateTime.now(), + 'value', + 'DailyGeneratedLineCount_Discard', + ORIGIN + ); + + await this.hasura.postTag( + 'uid', + 'key', + 'value', + ORIGIN + ); + + await this.hasura.postMetricValueTag( + {uid: 'uid', definition: 'myuid'}, + 'uid', + ORIGIN + ); + + await this.hasura.postUserTool( + {uid: 'octocat', source:'GitHub'}, + {uid: 'github', source: 'GitHub'}, + {category: 'GitHubCopilot'}, + false, + DateTime.now(), + DateTime.now(), + ORIGIN + ); } /** From 7309669c3fcca33c1ddad165c603f4342ebca1f1 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 16:16:34 -0700 Subject: [PATCH 07/50] giant user tool usage --- .../hasura/endpoints/vcs_user_tool_usage.gql | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 init/resources/hasura/endpoints/vcs_user_tool_usage.gql diff --git a/init/resources/hasura/endpoints/vcs_user_tool_usage.gql b/init/resources/hasura/endpoints/vcs_user_tool_usage.gql new file mode 100644 index 00000000..3744d00e --- /dev/null +++ b/init/resources/hasura/endpoints/vcs_user_tool_usage.gql @@ -0,0 +1,115 @@ +mutation insert_vcs_user_tool_usage( + $data_user_uid: String! + $data_user_source: String! + $data_org_uid: String! + $data_org_source: String! + $data_tool: jsonb! + $data_used_at: timestamptz! + $data_recorded_at: timestamptz + $data_branch_name: String + $data_branch_repo_name: String + $data_branch_org_uid: String + $data_branch_org_source: String + $data_repo_name: String + $data_repo_org_uid: String + $data_repo_org_source: String + $data_file_uid: String + $data_file_repo_name: String + $data_file_repo_org_uid: String + $data_file_repo_org_source: String + $data_characters_added: Int + $data_origin: String +) { + insert_vcs_UserToolUsage_one( + object: { + vcs_UserTool: { + data: { + vcs_User: { + data: { + uid: $data_user_uid + source: $data_user_source + } + on_conflict: {constraint: vcs_User_pkey, update_columns: refreshedAt} + } + vcs_Organization: { + data: { + uid: $data_org_uid + source: $data_org_source + } + on_conflict: {constraint: vcs_Organization_pkey, update_columns: refreshedAt} + } + tool: $data_tool + } + on_conflict: {constraint: vcs_UserTool_pkey, update_columns: refreshedAt} + } + usedAt: $data_used_at + recordedAt: $data_recorded_at + vcs_Branch: { + data: { + name: $data_branch_name + vcs_Repository: { + data: { + name: $data_branch_repo_name + vcs_Organization: { + data: { + uid: $data_branch_org_uid + source: $data_branch_org_source + } + on_conflict: {constraint: vcs_Organization_pkey, update_columns:refreshedAt} + } + } + on_conflict: {constraint: vcs_Repository_pkey, update_columns: refreshedAt} + } + } + on_conflict: {constraint: vcs_Branch_pkey, update_columns: refreshedAt} + } + vcs_Repository: { + data: { + name: $data_repo_name + vcs_Organization: { + data: { + uid: $data_repo_org_uid + source: $data_repo_org_source + } + on_conflict: {constraint: vcs_Organization_pkey, update_columns:refreshedAt} + } + } + on_conflict: {constraint: vcs_Repository_pkey, update_columns: refreshedAt} + } + vcs_File: { + data: { + uid: $data_file_uid + vcs_Repository: { + data: { + name: $data_file_repo_name + vcs_Organization: { + data: { + uid: $data_file_repo_org_uid + source: $data_file_repo_org_source + } + on_conflict: {constraint: vcs_Organization_pkey, update_columns:refreshedAt} + } + } + on_conflict: {constraint: vcs_Repository_pkey, update_columns: refreshedAt} + } + } + } + charactersAdded: $data_characters_added + origin: $data_origin + } + on_conflict: { + constraint: vcs_UserToolUsage_pkey + update_columns: [ + recordedAt + branch + repository + file + charactersAdded + origin + refreshedAt + ] + } + ) { + id + } +} From b1b90d126804c83ae4351ea3c00fce7629a6d21c Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 16:19:44 -0700 Subject: [PATCH 08/50] shrink to essential usage params with mock data test --- .../hasura/endpoints/vcs_user_tool_usage.gql | 63 ------------------- mock-data/src/hasura.ts | 13 +++- mock-data/src/mockdata.ts | 11 ++++ 3 files changed, 21 insertions(+), 66 deletions(-) diff --git a/init/resources/hasura/endpoints/vcs_user_tool_usage.gql b/init/resources/hasura/endpoints/vcs_user_tool_usage.gql index 3744d00e..0d762d41 100644 --- a/init/resources/hasura/endpoints/vcs_user_tool_usage.gql +++ b/init/resources/hasura/endpoints/vcs_user_tool_usage.gql @@ -6,18 +6,6 @@ mutation insert_vcs_user_tool_usage( $data_tool: jsonb! $data_used_at: timestamptz! $data_recorded_at: timestamptz - $data_branch_name: String - $data_branch_repo_name: String - $data_branch_org_uid: String - $data_branch_org_source: String - $data_repo_name: String - $data_repo_org_uid: String - $data_repo_org_source: String - $data_file_uid: String - $data_file_repo_name: String - $data_file_repo_org_uid: String - $data_file_repo_org_source: String - $data_characters_added: Int $data_origin: String ) { insert_vcs_UserToolUsage_one( @@ -44,57 +32,6 @@ mutation insert_vcs_user_tool_usage( } usedAt: $data_used_at recordedAt: $data_recorded_at - vcs_Branch: { - data: { - name: $data_branch_name - vcs_Repository: { - data: { - name: $data_branch_repo_name - vcs_Organization: { - data: { - uid: $data_branch_org_uid - source: $data_branch_org_source - } - on_conflict: {constraint: vcs_Organization_pkey, update_columns:refreshedAt} - } - } - on_conflict: {constraint: vcs_Repository_pkey, update_columns: refreshedAt} - } - } - on_conflict: {constraint: vcs_Branch_pkey, update_columns: refreshedAt} - } - vcs_Repository: { - data: { - name: $data_repo_name - vcs_Organization: { - data: { - uid: $data_repo_org_uid - source: $data_repo_org_source - } - on_conflict: {constraint: vcs_Organization_pkey, update_columns:refreshedAt} - } - } - on_conflict: {constraint: vcs_Repository_pkey, update_columns: refreshedAt} - } - vcs_File: { - data: { - uid: $data_file_uid - vcs_Repository: { - data: { - name: $data_file_repo_name - vcs_Organization: { - data: { - uid: $data_file_repo_org_uid - source: $data_file_repo_org_source - } - on_conflict: {constraint: vcs_Organization_pkey, update_columns:refreshedAt} - } - } - on_conflict: {constraint: vcs_Repository_pkey, update_columns: refreshedAt} - } - } - } - charactersAdded: $data_characters_added origin: $data_origin } on_conflict: { diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index 4f404424..5911f1a9 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -266,12 +266,19 @@ export class Hasura { } async postUserToolUsage( - userTool: any, + tool: any, usedAt: DateTime, - refreshedAt: DateTime, - origin: string + recordedAt: DateTime, + origin: string, ): Promise { await this.api.post('vcs_user_tool_usage', { + data_user_uid: tool.user.uid, + data_user_source: tool.user.source, + data_org_uid: tool.organization.uid, + data_org_source: tool.organization.source, + data_tool: tool.tool, + data_used_at: usedAt, + data_recorded_at: recordedAt, data_origin: origin, }); } diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 5a093704..39442ccf 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -124,6 +124,17 @@ export class MockData { DateTime.now(), ORIGIN ); + + await this.hasura.postUserToolUsage( + { + user: {uid: 'octocat', source: 'GitHub'}, + organization: {uid: 'github', source: 'GitHub'}, + tool: {category: 'GitHubCopilot'} + }, + DateTime.now(), + DateTime.now(), + ORIGIN, + ); } /** From fffebd8d1c7070bc36af6a5b48d5944312e68a85 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 16:29:58 -0700 Subject: [PATCH 09/50] comment --- mock-data/src/hasura.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index 5911f1a9..77a4afac 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -265,6 +265,7 @@ export class Hasura { }); } + // currently excludes branch, repo, file, and charactersAdded async postUserToolUsage( tool: any, usedAt: DateTime, From 693c6aca2f9015f97272405a65a0f08a55a148ff Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 23 Oct 2024 16:47:48 -0700 Subject: [PATCH 10/50] tags and metric defs --- mock-data/src/mockdata.ts | 182 ++++++++++++++++++++++++++++---------- 1 file changed, 133 insertions(+), 49 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 39442ccf..00f0df75 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -85,58 +85,12 @@ export class MockData { num++; } await this.writeTasks(week, weekStart); + await this.writeCopilot(week, weekStart); } - - // test writes - await this.hasura.postMetricDefinition( - 'myuid', - 'myname', - ORIGIN - ); - - await this.hasura.postMetricValue( - 'uid', - DateTime.now(), - 'value', - 'DailyGeneratedLineCount_Discard', - ORIGIN - ); - - await this.hasura.postTag( - 'uid', - 'key', - 'value', - ORIGIN - ); - - await this.hasura.postMetricValueTag( - {uid: 'uid', definition: 'myuid'}, - 'uid', - ORIGIN - ); - - await this.hasura.postUserTool( - {uid: 'octocat', source:'GitHub'}, - {uid: 'github', source: 'GitHub'}, - {category: 'GitHubCopilot'}, - false, - DateTime.now(), - DateTime.now(), - ORIGIN - ); - - await this.hasura.postUserToolUsage( - { - user: {uid: 'octocat', source: 'GitHub'}, - organization: {uid: 'github', source: 'GitHub'}, - tool: {category: 'GitHubCopilot'} - }, - DateTime.now(), - DateTime.now(), - ORIGIN, - ); } + // TODO add deletes!!!! + /** * Deletes mock data, i.e. data uploaded by the upload script of * this module. Data is deleted in the order of table foreign key @@ -359,5 +313,135 @@ export class MockData { ORIGIN ); } + } + + private async writeCopilot(weekNum: number, week: DateTime): Promise { + // test writes + await this.hasura.postMetricDefinition( + 'myuid', + 'myname', + ORIGIN + ); + + await this.hasura.postMetricValue( + 'uid', + DateTime.now(), + 'value', + 'DailyGeneratedLineCount_Discard', + ORIGIN + ); + + await this.hasura.postTag( + 'uid', + 'key', + 'value', + ORIGIN + ); + + await this.hasura.postMetricValueTag( + {uid: 'uid', definition: 'myuid'}, + 'uid', + ORIGIN + ); + + await this.hasura.postUserTool( + {uid: 'octocat', source:'GitHub'}, + {uid: 'github', source: 'GitHub'}, + {category: 'GitHubCopilot'}, + false, + DateTime.now(), + DateTime.now(), + ORIGIN + ); + + await this.hasura.postUserToolUsage( + { + user: {uid: 'octocat', source: 'GitHub'}, + organization: {uid: 'github', source: 'GitHub'}, + tool: {category: 'GitHubCopilot'} + }, + DateTime.now(), + DateTime.now(), + ORIGIN, + ); + + const languageTags = [ + 'c++', + 'go', + 'java', + 'python', + 'ruby', + 'scala', + 'sql', + 'typescript', + 'xlsx', + 'yaml', + ].map((lang) => { + return { + faros_Tag: { + uid: 'copilotLanguage__' + lang, + key: 'copilotLanguage', + value: lang, + }, + }; + }); + for (const tag of languageTags) { + await this.hasura.postTag( + tag.faros_Tag.uid, + tag.faros_Tag.key, + tag.faros_Tag.value, + ORIGIN + ); + } + + const ideTags = ['jetbrains', 'neovim', 'vscode'].map((i) => { + return { + faros_Tag: { + uid: 'copilotEditor__' + i, + key: 'copilotEditor', + value: i, + }, + }; + }); + + for (const tag of [...languageTags, ...ideTags]) { + await this.hasura.postTag( + tag.faros_Tag.uid, + tag.faros_Tag.key, + tag.faros_Tag.value, + ORIGIN + ); + } + + const metricDefs = [ + 'DailyActiveUserTrend', + 'DailyGeneratedLineCount_Accept', + 'DailyGeneratedLineCount_Discard', + 'DailySuggestionReferenceCount_Accept', + 'DailySuggestionReferenceCount_Discard', + 'DailyActiveChatUserTrend', + 'DailyChatAcceptanceCount', + 'DailyChatTurnCount', + ].map((d) => { + return { + faros_MetricDefinition: { + uid: d, + name: d, + valueType: {category: 'Numeric'}, + }, + }; + }); + + for (const def of metricDefs) { + await this.hasura.postMetricDefinition( + def.faros_MetricDefinition.uid, + def.faros_MetricDefinition.name, + ORIGIN + ); + } + + + + } } From fd64126f85f41e86bdb7d103ed72cfe6a4c8d44c Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 24 Oct 2024 09:32:36 -0700 Subject: [PATCH 11/50] add metric values with tags --- mock-data/src/mockdata.ts | 62 +++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 00f0df75..6888c7cf 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -364,18 +364,12 @@ export class MockData { DateTime.now(), ORIGIN, ); + // end test const languageTags = [ - 'c++', 'go', - 'java', 'python', - 'ruby', - 'scala', - 'sql', 'typescript', - 'xlsx', - 'yaml', ].map((lang) => { return { faros_Tag: { @@ -385,16 +379,8 @@ export class MockData { }, }; }); - for (const tag of languageTags) { - await this.hasura.postTag( - tag.faros_Tag.uid, - tag.faros_Tag.key, - tag.faros_Tag.value, - ORIGIN - ); - } - const ideTags = ['jetbrains', 'neovim', 'vscode'].map((i) => { + const ideTags = ['jetbrains', 'vscode'].map((i) => { return { faros_Tag: { uid: 'copilotEditor__' + i, @@ -440,6 +426,50 @@ export class MockData { ); } + const metricDefToFun: Record number> = { + DailyActiveUserTrend: (): number => MockData.randomInt(3, 1), + DailyGeneratedLineCount_Accept: (): number => MockData.randomInt(10, 2), + DailyGeneratedLineCount_Discard: (): number => MockData.randomInt(100, 10), + DailySuggestionReferenceCount_Accept: (): number => MockData.randomInt(10, 2), + DailySuggestionReferenceCount_Discard: (): number => MockData.randomInt(100, 10), + DailyActiveChatUserTrend: (): number => MockData.randomInt(3, 1), + DailyChatAcceptanceCount: (): number => MockData.randomInt(10, 1), + DailyChatTurnCount: (): number => MockData.randomInt(20, 3), + }; + + for (let i = 1; i <= 10; i++) { + for (const def of metricDefs) { + + const metricValue = { + uid: `mv-week${weekNum}-${i}`, + computedAt: week.plus({days: MockData.randomInt(6)}), + value: metricDefToFun[def.faros_MetricDefinition.name]().toString(), + definition: def.faros_MetricDefinition.uid, + origin: ORIGIN + }; + + await this.hasura.postMetricValue( + metricValue.uid, + metricValue.computedAt, + metricValue.value, + metricValue.definition, + metricValue.origin, + ); + + await this.hasura.postMetricValueTag( + metricValue, + languageTags[MockData.randomInt(languageTags.length)].faros_Tag.uid, + ORIGIN + ); + + await this.hasura.postMetricValueTag( + metricValue, + ideTags[MockData.randomInt(ideTags.length)].faros_Tag.uid, + ORIGIN + ); + + } + } From a7038477b7dbbba86def44a857bee6bc1f9afbd3 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 24 Oct 2024 11:57:12 -0700 Subject: [PATCH 12/50] fix user tool endpoint metric definition --- init/resources/hasura/endpoints/faros_metric_value.gql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init/resources/hasura/endpoints/faros_metric_value.gql b/init/resources/hasura/endpoints/faros_metric_value.gql index 239a1a35..5c747887 100644 --- a/init/resources/hasura/endpoints/faros_metric_value.gql +++ b/init/resources/hasura/endpoints/faros_metric_value.gql @@ -10,7 +10,12 @@ mutation insert_faros_metric_value( uid: $data_uid computedAt: $data_computedAt value: $data_value - definition: $data_definition + faros_MetricDefinition: { + data: { + uid: $data_definition + } + on_conflict: {constraint: faros_MetricDefinition_pkey, update_columns:refreshedAt} + } origin: $data_origin } on_conflict: { From f9595de278a9c2ee0e838b0ea030d52e46eaeba5 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 24 Oct 2024 12:48:08 -0700 Subject: [PATCH 13/50] add value type --- init/resources/hasura/endpoints/faros_metric_definition.gql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init/resources/hasura/endpoints/faros_metric_definition.gql b/init/resources/hasura/endpoints/faros_metric_definition.gql index e1ff4286..4fc26ca7 100644 --- a/init/resources/hasura/endpoints/faros_metric_definition.gql +++ b/init/resources/hasura/endpoints/faros_metric_definition.gql @@ -1,12 +1,14 @@ mutation insert_faros_metric_definition( $data_uid: String! $data_name: String! + $data_value_type: jsonb $data_origin: String ) { insert_faros_MetricDefinition_one( object: { uid: $data_uid name: $data_name + valueType: $data_value_type origin: $data_origin } on_conflict: { From d781495d949652a1d6b2cd6b7c09a4ad1403ff10 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 24 Oct 2024 12:49:15 -0700 Subject: [PATCH 14/50] add deletes and fixes --- .../delete_faros_metric_definition.gql | 5 + .../endpoints/delete_faros_metric_value.gql | 5 + .../delete_faros_metric_value_tag.gql | 5 + .../hasura/endpoints/delete_faros_tag.gql | 5 + .../hasura/endpoints/delete_vcs_user_tool.gql | 5 + .../endpoints/delete_vcs_user_tool_usage.gql | 5 + .../endpoints/faros_metric_value_tag.gql | 7 +- .../hasura/endpoints/vcs_user_tool.gql | 2 +- mock-data/src/hasura.ts | 10 +- mock-data/src/mockdata.ts | 126 +++++++++++------- 10 files changed, 125 insertions(+), 50 deletions(-) create mode 100644 init/resources/hasura/endpoints/delete_faros_metric_definition.gql create mode 100644 init/resources/hasura/endpoints/delete_faros_metric_value.gql create mode 100644 init/resources/hasura/endpoints/delete_faros_metric_value_tag.gql create mode 100644 init/resources/hasura/endpoints/delete_faros_tag.gql create mode 100644 init/resources/hasura/endpoints/delete_vcs_user_tool.gql create mode 100644 init/resources/hasura/endpoints/delete_vcs_user_tool_usage.gql diff --git a/init/resources/hasura/endpoints/delete_faros_metric_definition.gql b/init/resources/hasura/endpoints/delete_faros_metric_definition.gql new file mode 100644 index 00000000..d05538d0 --- /dev/null +++ b/init/resources/hasura/endpoints/delete_faros_metric_definition.gql @@ -0,0 +1,5 @@ +mutation delete_faros_metric_definition($data_origin: String) { + delete_faros_MetricDefinition(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/delete_faros_metric_value.gql b/init/resources/hasura/endpoints/delete_faros_metric_value.gql new file mode 100644 index 00000000..daa20cc5 --- /dev/null +++ b/init/resources/hasura/endpoints/delete_faros_metric_value.gql @@ -0,0 +1,5 @@ +mutation delete_faros_metric_value($data_origin: String) { + delete_faros_MetricValue(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/delete_faros_metric_value_tag.gql b/init/resources/hasura/endpoints/delete_faros_metric_value_tag.gql new file mode 100644 index 00000000..5f5018a4 --- /dev/null +++ b/init/resources/hasura/endpoints/delete_faros_metric_value_tag.gql @@ -0,0 +1,5 @@ +mutation delete_faros_metric_value_tag($data_origin: String) { + delete_faros_MetricValueTag(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/delete_faros_tag.gql b/init/resources/hasura/endpoints/delete_faros_tag.gql new file mode 100644 index 00000000..a62597fc --- /dev/null +++ b/init/resources/hasura/endpoints/delete_faros_tag.gql @@ -0,0 +1,5 @@ +mutation delete_faros_tag($data_origin: String) { + delete_faros_Tag(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/delete_vcs_user_tool.gql b/init/resources/hasura/endpoints/delete_vcs_user_tool.gql new file mode 100644 index 00000000..9642dedd --- /dev/null +++ b/init/resources/hasura/endpoints/delete_vcs_user_tool.gql @@ -0,0 +1,5 @@ +mutation delete_vcs_user_tool($data_origin: String) { + delete_vcs_UserTool(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/delete_vcs_user_tool_usage.gql b/init/resources/hasura/endpoints/delete_vcs_user_tool_usage.gql new file mode 100644 index 00000000..df16b2e1 --- /dev/null +++ b/init/resources/hasura/endpoints/delete_vcs_user_tool_usage.gql @@ -0,0 +1,5 @@ +mutation delete_vcs_user_tool_usage($data_origin: String) { + delete_vcs_UserToolUsage(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/faros_metric_value_tag.gql b/init/resources/hasura/endpoints/faros_metric_value_tag.gql index b8d17049..06beab67 100644 --- a/init/resources/hasura/endpoints/faros_metric_value_tag.gql +++ b/init/resources/hasura/endpoints/faros_metric_value_tag.gql @@ -6,7 +6,12 @@ mutation insert_faros_metric_value_tag( ) { insert_faros_MetricValueTag_one( object: { - tag: $data_tag_id + faros_Tag: { + data: { + uid: $data_tag_id + } + on_conflict: {constraint: faros_Tag_pkey, update_columns: refreshedAt} + } faros_MetricValue: { data: { uid: $data_value_uid diff --git a/init/resources/hasura/endpoints/vcs_user_tool.gql b/init/resources/hasura/endpoints/vcs_user_tool.gql index 916f650c..85619295 100644 --- a/init/resources/hasura/endpoints/vcs_user_tool.gql +++ b/init/resources/hasura/endpoints/vcs_user_tool.gql @@ -6,7 +6,7 @@ mutation insert_vcs_user_tool( $data_tool: jsonb! $data_inactive: Boolean! $data_started_at: timestamptz! - $data_ended_at: timestamptz! + $data_ended_at: timestamptz $data_origin: String ) { insert_vcs_UserTool_one( diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index 77a4afac..e5c58460 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -114,11 +114,13 @@ export class Hasura { async postMetricDefinition( uid: string, name: string, + valueType: any, origin: string ): Promise { await this.api.post('faros_metric_definition', { data_uid: uid, data_name: name, + data_value_type: valueType, data_origin: origin, }); } @@ -249,7 +251,7 @@ export class Hasura { tool: any, inactive: boolean, startedAt: DateTime, - endedAt: DateTime, + endedAt: DateTime | null | undefined, origin: string, ): Promise { await this.api.post('vcs_user_tool', { @@ -377,6 +379,12 @@ export class Hasura { }); } + async deleteMetricDefinition(origin: string): Promise { + await this.api.post('delete_faros_metric_definition', { + data_origin: origin, + }); + } + async deleteMetricValue(origin: string): Promise { await this.api.post('delete_faros_metric_value', { data_origin: origin, diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 6888c7cf..c9110441 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -103,9 +103,15 @@ export class MockData { this.hasura.deleteIncidentApplicationImpact(ORIGIN), this.hasura.deletePullRequestReview(ORIGIN), this.hasura.deleteTask(ORIGIN), + this.hasura.deleteUserToolUsage(ORIGIN), + this.hasura.deleteUserTool(ORIGIN), + this.hasura.deleteMetricValue(ORIGIN), + this.hasura.deleteMetricValueTag(ORIGIN), + this.hasura.deleteTag(ORIGIN), ]); await Promise.all([ + this.hasura.deleteMetricDefinition(ORIGIN), this.hasura.deleteArtifact(ORIGIN), this.hasura.deleteDeployment(ORIGIN), this.hasura.deleteIncident(ORIGIN), @@ -317,53 +323,53 @@ export class MockData { private async writeCopilot(weekNum: number, week: DateTime): Promise { // test writes - await this.hasura.postMetricDefinition( - 'myuid', - 'myname', - ORIGIN - ); - - await this.hasura.postMetricValue( - 'uid', - DateTime.now(), - 'value', - 'DailyGeneratedLineCount_Discard', - ORIGIN - ); - - await this.hasura.postTag( - 'uid', - 'key', - 'value', - ORIGIN - ); - - await this.hasura.postMetricValueTag( - {uid: 'uid', definition: 'myuid'}, - 'uid', - ORIGIN - ); - - await this.hasura.postUserTool( - {uid: 'octocat', source:'GitHub'}, - {uid: 'github', source: 'GitHub'}, - {category: 'GitHubCopilot'}, - false, - DateTime.now(), - DateTime.now(), - ORIGIN - ); - - await this.hasura.postUserToolUsage( - { - user: {uid: 'octocat', source: 'GitHub'}, - organization: {uid: 'github', source: 'GitHub'}, - tool: {category: 'GitHubCopilot'} - }, - DateTime.now(), - DateTime.now(), - ORIGIN, - ); + // await this.hasura.postMetricDefinition( + // 'myuid', + // 'myname', + // ORIGIN + // ); + + // await this.hasura.postMetricValue( + // 'uid', + // DateTime.now(), + // 'value', + // 'DailyGeneratedLineCount_Discard', + // ORIGIN + // ); + + // await this.hasura.postTag( + // 'uid', + // 'key', + // 'value', + // ORIGIN + // ); + + // await this.hasura.postMetricValueTag( + // {uid: 'uid', definition: 'DailyGeneratedLineCount_Discard'}, + // 'uid', + // ORIGIN + // ); + + // await this.hasura.postUserTool( + // {uid: 'octocat', source:'GitHub'}, + // {uid: 'github', source: 'GitHub'}, + // {category: 'GitHubCopilot'}, + // false, + // DateTime.now(), + // DateTime.now(), + // ORIGIN + // ); + + // await this.hasura.postUserToolUsage( + // { + // user: {uid: 'octocat', source: 'GitHub'}, + // organization: {uid: 'github', source: 'GitHub'}, + // tool: {category: 'GitHubCopilot'} + // }, + // DateTime.now(), + // DateTime.now(), + // ORIGIN, + // ); // end test const languageTags = [ @@ -422,6 +428,7 @@ export class MockData { await this.hasura.postMetricDefinition( def.faros_MetricDefinition.uid, def.faros_MetricDefinition.name, + def.faros_MetricDefinition.valueType, ORIGIN ); } @@ -437,6 +444,31 @@ export class MockData { DailyChatTurnCount: (): number => MockData.randomInt(20, 3), }; + const tools = [1, 2, 3].map((u) => { + return { + user: {uid: `author-${u}`, source: SOURCE}, + organization: {uid: ORG, source: SOURCE}, + tool: {category: 'GitHubCopilot'}, + inactive: false, + startedAt: DateTime.now().minus({weeks: MockData.randomInt(4, 2)}), + endedAt: DateTime.now(), + origin: ORIGIN, + }; + }); + + for (const t of tools) { + await this.hasura.postUserTool( + t.user, + t.organization, + t.tool, + t.inactive, + t.startedAt, + t.endedAt, + t.origin + ); + } + + for (let i = 1; i <= 10; i++) { for (const def of metricDefs) { From d272f191eee8f7da1b52989cfc093de81512132c Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 24 Oct 2024 12:54:53 -0700 Subject: [PATCH 15/50] user tool usage --- mock-data/src/mockdata.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index c9110441..b6b0e1d0 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -500,6 +500,14 @@ export class MockData { ORIGIN ); + const usedAt = week.plus({days: MockData.randomInt(6)}); + await this.hasura.postUserToolUsage( + tools[MockData.randomInt(tools.length, 1)], + usedAt, + usedAt.plus({hours: 2}), + ORIGIN + ); + } } From e78d0e3ac7a8b2c9f94c7a6ae3d3a7103b982776 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 24 Oct 2024 13:01:47 -0700 Subject: [PATCH 16/50] reorder deletes --- mock-data/src/mockdata.ts | 64 ++++----------------------------------- 1 file changed, 6 insertions(+), 58 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index b6b0e1d0..c2eca4fc 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -89,8 +89,6 @@ export class MockData { } } - // TODO add deletes!!!! - /** * Deletes mock data, i.e. data uploaded by the upload script of * this module. Data is deleted in the order of table foreign key @@ -103,15 +101,9 @@ export class MockData { this.hasura.deleteIncidentApplicationImpact(ORIGIN), this.hasura.deletePullRequestReview(ORIGIN), this.hasura.deleteTask(ORIGIN), - this.hasura.deleteUserToolUsage(ORIGIN), - this.hasura.deleteUserTool(ORIGIN), - this.hasura.deleteMetricValue(ORIGIN), - this.hasura.deleteMetricValueTag(ORIGIN), - this.hasura.deleteTag(ORIGIN), ]); await Promise.all([ - this.hasura.deleteMetricDefinition(ORIGIN), this.hasura.deleteArtifact(ORIGIN), this.hasura.deleteDeployment(ORIGIN), this.hasura.deleteIncident(ORIGIN), @@ -121,17 +113,23 @@ export class MockData { await Promise.all([ this.hasura.deleteComputeApplication(ORIGIN), this.hasura.deleteCommit(ORIGIN), + this.hasura.deleteMetricValueTag(ORIGIN), + this.hasura.deleteUserToolUsage(ORIGIN), ]); await Promise.all([ this.hasura.deleteCICDRepository(ORIGIN), this.hasura.deleteVCSRepository(ORIGIN), + this.hasura.deleteMetricValue(ORIGIN), + this.hasura.deleteTag(ORIGIN), + this.hasura.deleteUserTool(ORIGIN), ]); await Promise.all([ this.hasura.deleteCICDOrganization(ORIGIN), this.hasura.deleteVCSUser(ORIGIN), this.hasura.deleteVCSOrganization(ORIGIN), + this.hasura.deleteMetricDefinition(ORIGIN), ]); } @@ -322,56 +320,6 @@ export class MockData { } private async writeCopilot(weekNum: number, week: DateTime): Promise { - // test writes - // await this.hasura.postMetricDefinition( - // 'myuid', - // 'myname', - // ORIGIN - // ); - - // await this.hasura.postMetricValue( - // 'uid', - // DateTime.now(), - // 'value', - // 'DailyGeneratedLineCount_Discard', - // ORIGIN - // ); - - // await this.hasura.postTag( - // 'uid', - // 'key', - // 'value', - // ORIGIN - // ); - - // await this.hasura.postMetricValueTag( - // {uid: 'uid', definition: 'DailyGeneratedLineCount_Discard'}, - // 'uid', - // ORIGIN - // ); - - // await this.hasura.postUserTool( - // {uid: 'octocat', source:'GitHub'}, - // {uid: 'github', source: 'GitHub'}, - // {category: 'GitHubCopilot'}, - // false, - // DateTime.now(), - // DateTime.now(), - // ORIGIN - // ); - - // await this.hasura.postUserToolUsage( - // { - // user: {uid: 'octocat', source: 'GitHub'}, - // organization: {uid: 'github', source: 'GitHub'}, - // tool: {category: 'GitHubCopilot'} - // }, - // DateTime.now(), - // DateTime.now(), - // ORIGIN, - // ); - // end test - const languageTags = [ 'go', 'python', From df8b21529dd55dfc3181badd579c0ad0468b6014 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 30 Oct 2024 14:27:22 -0700 Subject: [PATCH 17/50] coordiante tool usage with metrics --- mock-data/src/mockdata.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index c2eca4fc..811e10a6 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -418,11 +418,20 @@ export class MockData { for (let i = 1; i <= 10; i++) { + const computedAt = week.plus({days: MockData.randomInt(6)}); + + const usedAt = computedAt; + await this.hasura.postUserToolUsage( + tools[MockData.randomInt(tools.length, 1)], + usedAt, + usedAt.plus({hours: 2}), + ORIGIN + ); for (const def of metricDefs) { const metricValue = { uid: `mv-week${weekNum}-${i}`, - computedAt: week.plus({days: MockData.randomInt(6)}), + computedAt, value: metricDefToFun[def.faros_MetricDefinition.name]().toString(), definition: def.faros_MetricDefinition.uid, origin: ORIGIN @@ -447,19 +456,7 @@ export class MockData { ideTags[MockData.randomInt(ideTags.length)].faros_Tag.uid, ORIGIN ); - - const usedAt = week.plus({days: MockData.randomInt(6)}); - await this.hasura.postUserToolUsage( - tools[MockData.randomInt(tools.length, 1)], - usedAt, - usedAt.plus({hours: 2}), - ORIGIN - ); - } } - - - } } From 225380c0d715377d1df3ce94dc8914e79c56872a Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 30 Oct 2024 14:27:40 -0700 Subject: [PATCH 18/50] add copilot dashboard --- .../metabase/dashboards/copilot.json | 325 ++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100644 init/resources/metabase/dashboards/copilot.json diff --git a/init/resources/metabase/dashboards/copilot.json b/init/resources/metabase/dashboards/copilot.json new file mode 100644 index 00000000..523c932c --- /dev/null +++ b/init/resources/metabase/dashboards/copilot.json @@ -0,0 +1,325 @@ +{ + "name": "AI Copilot Evaluation - Adoption & Usage", + "cards": [ + { + "name": "Copilot Metrics", + "description": null, + "display": "table", + "table_id": {{ table "faros_MetricValue" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "faros_MetricValue" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "faros_MetricValueTag" }}, + "condition": [ + "=", + [ + "field", + {{ field "faros_MetricValue.id" }}, + null + ], + [ + "field", + {{ field "faros_MetricValueTag.value" }}, + { + "join-alias": "Faros MetricValueTag" + } + ] + ], + "alias": "Faros MetricValueTag" + }, + { + "fields": "all", + "source-table": {{ table "faros_Tag" }}, + "condition": [ + "=", + [ + "field", + {{ field "faros_MetricValueTag.tag" }}, + { + "join-alias": "Faros MetricValueTag" + } + ], + [ + "field", + {{ field "faros_Tag.id" }}, + { + "join-alias": "Faros Tag - Tag" + } + ] + ], + "alias": "Faros Tag - Tag" + } + ] + } + }, + "visualization_settings": {} + }, + { + "name": "Number of Devs with Licenses", + "description": null, + "display": "line", + "table_id": {{ table "vcs_UserTool" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "vcs_UserTool" }}, + "breakout": [ + [ + "field", + {{ field "vcs_UserTool.startedAt" }}, + { + "temporal-unit": "week" + } + ] + ], + "aggregation": [ + [ + "cum-count" + ] + ] + } + }, + "visualization_settings": { + "graph.dimensions": [ + "startedAt" + ], + "graph.metrics": [ + "count" + ] + } + }, + { + "name": "Daily Active User Count", + "description": null, + "display": "line", + "table_id": {{ table "vcs_UserToolUsage" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "vcs_UserToolUsage" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "vcs_UserTool" }}, + "condition": [ + "=", + [ + "field", + {{ field "vcs_UserToolUsage.userTool" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.id" }}, + { + "join-alias": "Vcs UserTool - UserTool" + } + ] + ], + "alias": "Vcs UserTool - UserTool" + } + ], + "breakout": [ + [ + "field", + {{ field "vcs_UserToolUsage.usedAt" }}, + { + "temporal-unit": "day" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_UserTool.user" }}, + { + "join-alias": "Vcs UserTool - UserTool" + } + ] + ], + { + "name": "Daily Active Users", + "display-name": "Daily Active Users" + } + ] + ] + } + }, + "visualization_settings": { + "graph.dimensions": [ + "usedAt" + ], + "graph.metrics": [ + "count" + ] + } + }, + { + "name": "metric value keys", + "description": null, + "display": "table", + "table_id": {{ table "faros_MetricValue" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "breakout": [ + [ + "field", + {{ field "faros_Tag.key" }}, + { + "join-alias": "Faros Tag - Tag" + } + ] + ] + } + }, + "visualization_settings": {} + }, + { + "name": "Copilot Metrics", + "description": null, + "display": "table", + "table_id": {{ table "faros_MetricValue" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "faros_MetricValue" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "faros_MetricValueTag" }}, + "condition": [ + "=", + [ + "field", + {{ field "faros_MetricValue.id" }}, + null + ], + [ + "field", + {{ field "faros_MetricValueTag.value" }}, + { + "join-alias": "Faros MetricValueTag" + } + ] + ], + "alias": "Faros MetricValueTag" + }, + { + "fields": "all", + "source-table": {{ table "faros_Tag" }}, + "condition": [ + "=", + [ + "field", + {{ field "faros_MetricValueTag.tag" }}, + { + "join-alias": "Faros MetricValueTag" + } + ], + [ + "field", + {{ field "faros_Tag.id" }}, + { + "join-alias": "Faros Tag - Tag" + } + ] + ], + "alias": "Faros Tag - Tag" + } + ] + } + }, + "visualization_settings": {} + } + ], + "parameters": [ + { + "name": "Date", + "slug": "date", + "id": "b8769942", + "type": "date/all-options", + "sectionId": "date", + "default": "past3months" + } + ], + "layout": [ + { + "row": 0, + "col": 0, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Number of Devs with Licenses" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Number of Devs with Licenses" }}, + "target": [ + "dimension", + [ + "field", + {{ field "vcs_UserTool.startedAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 0, + "col": 5, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Daily Active User Count" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Daily Active User Count" }}, + "target": [ + "dimension", + [ + "field", + {{ field "vcs_UserToolUsage.usedAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 4, + "col": 0, + "sizeX": 4, + "sizeY": 3, + "card_id": {{ card "metric value keys" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 0, + "col": 10, + "sizeX": 4, + "sizeY": 3, + "card_id": {{ card "Copilot Metrics" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + } + ], + "path": "/Faros CE/GitHub/Copilot" +} + From 5eab84ddc676ef2a0e25bbc78264f202bc2c3c8a Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 30 Oct 2024 14:53:24 -0700 Subject: [PATCH 19/50] copilot metrics and lines of code by team --- .../metabase/dashboards/copilot.json | 177 ++++++------------ 1 file changed, 58 insertions(+), 119 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot.json b/init/resources/metabase/dashboards/copilot.json index 523c932c..bc8bc3b1 100644 --- a/init/resources/metabase/dashboards/copilot.json +++ b/init/resources/metabase/dashboards/copilot.json @@ -5,58 +5,18 @@ "name": "Copilot Metrics", "description": null, "display": "table", - "table_id": {{ table "faros_MetricValue" }}, + "table_id": null, "dataset_query": { - "type": "query", - "query": { - "source-table": {{ table "faros_MetricValue" }}, - "joins": [ - { - "fields": "all", - "source-table": {{ table "faros_MetricValueTag" }}, - "condition": [ - "=", - [ - "field", - {{ field "faros_MetricValue.id" }}, - null - ], - [ - "field", - {{ field "faros_MetricValueTag.value" }}, - { - "join-alias": "Faros MetricValueTag" - } - ] - ], - "alias": "Faros MetricValueTag" - }, - { - "fields": "all", - "source-table": {{ table "faros_Tag" }}, - "condition": [ - "=", - [ - "field", - {{ field "faros_MetricValueTag.tag" }}, - { - "join-alias": "Faros MetricValueTag" - } - ], - [ - "field", - {{ field "faros_Tag.id" }}, - { - "join-alias": "Faros Tag - Tag" - } - ] - ], - "alias": "Faros Tag - Tag" - } - ] + "type": "native", + "native": { + "query": "SELECT \"public\".\"faros_MetricValue\".\"id\" AS \"id\", \"public\".\"faros_MetricValue\".\"definition\" AS \"definition\", \"public\".\"faros_MetricValue\".\"computedAt\" AS \"computedAt\", \"public\".\"faros_MetricValue\".\"value\" :: integer AS \"value\", max(CASE WHEN \"Faros Tag - Tag\".\"key\" = 'copilotEditor' THEN coalesce(\"Faros Tag - Tag\".\"value\", 'all_editors') END) AS \"copilotEditor\", max(CASE WHEN \"Faros Tag - Tag\".\"key\" = 'copilotLanguage' THEN coalesce(\"Faros Tag - Tag\".\"value\", 'all_languages') END) AS \"copilotLanguage\", max(CASE WHEN \"Faros Tag - Tag\".\"key\" = 'copilotOrg' THEN coalesce(\"Faros Tag - Tag\".\"value\", 'all_orgs') END) AS \"copilotOrg\", max(CASE WHEN \"Faros Tag - Tag\".\"key\" = 'copilotTeam' THEN coalesce(\"Faros Tag - Tag\".\"value\", 'all_teams') END) AS \"copilotTeam\"\nFROM \"public\".\"faros_MetricValue\"\nLEFT JOIN \"public\".\"faros_MetricValueTag\" \"Faros MetricValueTag\" ON \"public\".\"faros_MetricValue\".\"id\" = \"Faros MetricValueTag\".\"value\" LEFT JOIN \"public\".\"faros_Tag\" \"Faros Tag - Tag\" ON \"Faros MetricValueTag\".\"tag\" = \"Faros Tag - Tag\".\"id\"\nGROUP BY \"public\".\"faros_MetricValue\".\"id\", \"public\".\"faros_MetricValue\".\"definition\", \"public\".\"faros_MetricValue\".\"computedAt\", \"public\".\"faros_MetricValue\".\"value\"\nORDER BY \"public\".\"faros_MetricValue\".\"id\" ASC, \"public\".\"faros_MetricValue\".\"definition\" ASC, \"public\".\"faros_MetricValue\".\"computedAt\" ASC, \"public\".\"faros_MetricValue\".\"value\" ASC", + "template-tags": {} } }, - "visualization_settings": {} + "visualization_settings": { + "table.pivot_column": "origin", + "table.cell_column": "value_3" + } }, { "name": "Number of Devs with Licenses", @@ -163,10 +123,10 @@ } }, { - "name": "metric value keys", + "name": "Lines of Code Accepted by GitHub Team", "description": null, - "display": "table", - "table_id": {{ table "faros_MetricValue" }}, + "display": "line", + "table_id": null, "dataset_query": { "type": "query", "query": { @@ -174,72 +134,61 @@ "breakout": [ [ "field", - {{ field "faros_Tag.key" }}, + "copilotOrg", + { + "base-type": "type/Text" + } + ], + [ + "field", + "computedAt", { - "join-alias": "Faros Tag - Tag" + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" } ] - ] - } - }, - "visualization_settings": {} - }, - { - "name": "Copilot Metrics", - "description": null, - "display": "table", - "table_id": {{ table "faros_MetricValue" }}, - "dataset_query": { - "type": "query", - "query": { - "source-table": {{ table "faros_MetricValue" }}, - "joins": [ - { - "fields": "all", - "source-table": {{ table "faros_MetricValueTag" }}, - "condition": [ - "=", - [ - "field", - {{ field "faros_MetricValue.id" }}, - null - ], - [ - "field", - {{ field "faros_MetricValueTag.value" }}, - { - "join-alias": "Faros MetricValueTag" - } - ] - ], - "alias": "Faros MetricValueTag" - }, - { - "fields": "all", - "source-table": {{ table "faros_Tag" }}, - "condition": [ - "=", - [ - "field", - {{ field "faros_MetricValueTag.tag" }}, - { - "join-alias": "Faros MetricValueTag" - } - ], + ], + "filter": [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + "aggregation": [ + [ + "aggregation-options", + [ + "sum", [ "field", - {{ field "faros_Tag.id" }}, + "value", { - "join-alias": "Faros Tag - Tag" + "base-type": "type/Integer" } ] ], - "alias": "Faros Tag - Tag" - } + { + "name": "Lines Accepted", + "display-name": "Lines Accepted" + } + ] ] } }, - "visualization_settings": {} + "visualization_settings": { + "graph.dimensions": [ + "computedAt", + "copilotOrg" + ], + "graph.metrics": [ + "Lines Accepted" + ] + } } ], "parameters": [ @@ -302,19 +251,9 @@ { "row": 4, "col": 0, - "sizeX": 4, - "sizeY": 3, - "card_id": {{ card "metric value keys" }}, - "series": [], - "parameter_mappings": [], - "visualization_settings": {} - }, - { - "row": 0, - "col": 10, - "sizeX": 4, - "sizeY": 3, - "card_id": {{ card "Copilot Metrics" }}, + "sizeX": 18, + "sizeY": 5, + "card_id": {{ card "Lines of Code Accepted by GitHub Team" }}, "series": [], "parameter_mappings": [], "visualization_settings": {} From 0033d5f6ef3ddc23b9819ebb6197f51c2358bd13 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 30 Oct 2024 15:17:43 -0700 Subject: [PATCH 20/50] more charts --- .../metabase/dashboards/copilot.json | 1366 ++++++++++++++++- 1 file changed, 1365 insertions(+), 1 deletion(-) diff --git a/init/resources/metabase/dashboards/copilot.json b/init/resources/metabase/dashboards/copilot.json index bc8bc3b1..4ef40547 100644 --- a/init/resources/metabase/dashboards/copilot.json +++ b/init/resources/metabase/dashboards/copilot.json @@ -189,6 +189,1231 @@ "Lines Accepted" ] } + }, + { + "name": "Lines Generated", + "description": null, + "display": "bar", + "table_id": null, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "breakout": [ + [ + "field", + "computedAt", + { + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ] + ], + { + "name": "Accepted Lines", + "display-name": "Accepted Lines" + } + ], + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ], + { + "name": "Discarded Lines", + "display-name": "Discarded Lines" + } + ], + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ], + { + "name": "Total Lines", + "display-name": "Total Lines" + } + ], + [ + "aggregation-options", + [ + "/", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ] + ], + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ] + ], + { + "name": "Acceptance Rate", + "display-name": "Acceptance Rate" + } + ] + ] + } + }, + "visualization_settings": { + "stackable.stack_type": "stacked", + "graph.dimensions": [ + "computedAt" + ], + "series_settings": { + "Discarded Lines": { + "color": "#EF8C8C" + } + }, + "column_settings": { + "[\"name\",\"Acceptance Rate\"]": { + "number_style": "percent" + } + }, + "graph.metrics": [ + "Accepted Lines", + "Discarded Lines" + ] + } + }, + { + "name": "Acceptance Rate", + "description": null, + "display": "bar", + "table_id": null, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "breakout": [ + [ + "field", + "computedAt", + { + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ] + ], + { + "name": "Accepted Lines", + "display-name": "Accepted Lines" + } + ], + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ], + { + "name": "Discarded Lines", + "display-name": "Discarded Lines" + } + ], + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ], + { + "name": "Total Lines", + "display-name": "Total Lines" + } + ], + [ + "aggregation-options", + [ + "/", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ] + ], + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ] + ], + { + "name": "Acceptance Rate", + "display-name": "Acceptance Rate" + } + ] + ] + } + }, + "visualization_settings": { + "stackable.stack_type": "stacked", + "graph.dimensions": [ + "computedAt" + ], + "series_settings": { + "Discarded Lines": { + "color": "#EF8C8C" + } + }, + "column_settings": { + "[\"name\",\"Acceptance Rate\"]": { + "number_style": "percent" + } + }, + "graph.metrics": [ + "Acceptance Rate" + ] + } + }, + { + "name": "Lines Generated by Language", + "description": null, + "display": "pie", + "table_id": null, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "breakout": [ + [ + "field", + "copilotLanguage", + { + "base-type": "type/Text" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ], + { + "name": "Total Lines", + "display-name": "Total Lines" + } + ] + ] + } + }, + "visualization_settings": { + "stackable.stack_type": "stacked", + "graph.dimensions": [ + "computedAt" + ], + "series_settings": { + "Discarded Lines": { + "color": "#EF8C8C" + } + }, + "column_settings": { + "[\"name\",\"Acceptance Rate\"]": { + "number_style": "percent" + } + }, + "graph.metrics": [ + "Accepted Lines", + "Discarded Lines" + ] + } + }, + { + "name": "Acceptance Rate by Editor", + "description": null, + "display": "line", + "table_id": null, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "breakout": [ + [ + "field", + "copilotEditor", + { + "base-type": "type/Text" + } + ], + [ + "field", + "computedAt", + { + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ] + ], + { + "name": "Accepted Lines", + "display-name": "Accepted Lines" + } + ], + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ], + { + "name": "Discarded Lines", + "display-name": "Discarded Lines" + } + ], + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ], + { + "name": "Total Lines", + "display-name": "Total Lines" + } + ], + [ + "aggregation-options", + [ + "/", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ] + ], + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ] + ], + { + "name": "Acceptance Rate", + "display-name": "Acceptance Rate" + } + ] + ] + } + }, + "visualization_settings": { + "stackable.stack_type": null, + "graph.dimensions": [ + "computedAt", + "copilotEditor" + ], + "series_settings": { + "Discarded Lines": { + "color": "#EF8C8C" + } + }, + "graph.series_order_dimension": null, + "graph.series_order": null, + "column_settings": { + "[\"name\",\"Acceptance Rate\"]": { + "number_style": "percent" + } + }, + "graph.metrics": [ + "Acceptance Rate" + ] + } + }, + { + "name": "Acceptance Rate by Language", + "description": null, + "display": "row", + "table_id": null, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "breakout": [ + [ + "field", + "copilotLanguage", + { + "base-type": "type/Text" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ] + ], + { + "name": "Accepted Lines", + "display-name": "Accepted Lines" + } + ], + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ], + { + "name": "Discarded Lines", + "display-name": "Discarded Lines" + } + ], + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ], + { + "name": "Total Lines", + "display-name": "Total Lines" + } + ], + [ + "aggregation-options", + [ + "/", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ] + ], + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ] + ], + { + "name": "Acceptance Rate", + "display-name": "Acceptance Rate" + } + ] + ], + "order-by": [ + [ + "desc", + [ + "aggregation", + 3, + null + ] + ] + ] + } + }, + "visualization_settings": { + "stackable.stack_type": null, + "graph.dimensions": [ + "copilotLanguage" + ], + "series_settings": { + "Discarded Lines": { + "color": "#EF8C8C" + } + }, + "column_settings": { + "[\"name\",\"Acceptance Rate\"]": { + "number_style": "percent" + } + }, + "graph.metrics": [ + "Acceptance Rate" + ] + } + }, + { + "name": "Lines Generated by Editor", + "description": null, + "display": "line", + "table_id": null, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "breakout": [ + [ + "field", + "computedAt", + { + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" + } + ], + [ + "field", + "copilotEditor", + { + "base-type": "type/Text" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "sum-where", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ], + [ + "or", + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Accept" + ], + [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyGeneratedLineCount_Discard" + ] + ] + ], + { + "name": "Total Lines", + "display-name": "Total Lines" + } + ] + ] + } + }, + "visualization_settings": { + "stackable.stack_type": "stacked", + "graph.dimensions": [ + "computedAt", + "copilotEditor" + ], + "series_settings": { + "Discarded Lines": { + "color": "#EF8C8C" + } + }, + "column_settings": { + "[\"name\",\"Acceptance Rate\"]": { + "number_style": "percent" + } + }, + "graph.metrics": [ + "Total Lines" + ] + } + }, + { + "name": "Avg Daily Active Users", + "description": null, + "display": "bar", + "table_id": null, + "dataset_query": { + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "filter": [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyActiveUserTrend" + ], + "breakout": [ + [ + "field", + "computedAt", + { + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "avg", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ] + ], + { + "name": "Avg Daily Active Users", + "display-name": "Avg Daily Active Users" + } + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "computedAt" + ], + "graph.metrics": [ + "Avg Daily Active Users" + ] + } + }, + { + "name": "Daily Active Users by Language", + "description": null, + "display": "row", + "table_id": null, + "dataset_query": { + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "filter": [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyActiveUserTrend" + ], + "breakout": [ + [ + "field", + "copilotLanguage", + { + "base-type": "type/Text" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "avg", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ] + ], + { + "name": "Avg Daily Active Users", + "display-name": "Avg Daily Active Users" + } + ] + ], + "order-by": [ + [ + "desc", + [ + "aggregation", + 0, + null + ] + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "copilotLanguage" + ], + "graph.metrics": [ + "Avg Daily Active Users" + ] + } + }, + { + "name": "Daily Active Users by Editor", + "description": null, + "display": "line", + "table_id": null, + "dataset_query": { + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "filter": [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyActiveUserTrend" + ], + "breakout": [ + [ + "field", + "copilotEditor", + { + "base-type": "type/Text" + } + ], + [ + "field", + "computedAt", + { + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "avg", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ] + ], + { + "name": "Avg Daily Active Users", + "display-name": "Avg Daily Active Users" + } + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "computedAt", + "copilotEditor" + ], + "graph.series_order_dimension": null, + "graph.series_order": null, + "graph.metrics": [ + "Avg Daily Active Users" + ] + } } ], "parameters": [ @@ -199,6 +1424,34 @@ "type": "date/all-options", "sectionId": "date", "default": "past3months" + }, + { + "name": "Org", + "slug": "org", + "id": "66a8f2ae", + "type": "string/=", + "sectionId": "string" + }, + { + "name": "Team", + "slug": "team", + "id": "a6b0f41", + "type": "string/=", + "sectionId": "string" + }, + { + "name": "Language", + "slug": "language", + "id": "817645db", + "type": "string/=", + "sectionId": "string" + }, + { + "name": "Editor", + "slug": "editor", + "id": "7ab27be3", + "type": "string/=", + "sectionId": "string" } ], "layout": [ @@ -228,7 +1481,7 @@ { "row": 0, "col": 5, - "sizeX": 5, + "sizeX": 13, "sizeY": 4, "card_id": {{ card "Daily Active User Count" }}, "series": [], @@ -257,6 +1510,117 @@ "series": [], "parameter_mappings": [], "visualization_settings": {} + }, + { + "row": 9, + "col": 0, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Lines Generated" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 13, + "col": 0, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Acceptance Rate" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 9, + "col": 5, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Lines Generated by Language" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 13, + "col": 10, + "sizeX": 8, + "sizeY": 4, + "card_id": {{ card "Acceptance Rate by Editor" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 13, + "col": 5, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Acceptance Rate by Language" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 9, + "col": 10, + "sizeX": 8, + "sizeY": 4, + "card_id": {{ card "Lines Generated by Editor" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 21, + "col": 0, + "sizeX": 18, + "sizeY": 1, + "card_id": null, + "series": [], + "parameter_mappings": [], + "visualization_settings": { + "virtual_card": { + "name": null, + "display": "text", + "visualization_settings": {}, + "dataset_query": {}, + "archived": false + }, + "text": "## Copilot Chat", + "text.align_vertical": "middle", + "dashcard.background": false + } + }, + { + "row": 17, + "col": 0, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Avg Daily Active Users" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 17, + "col": 5, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Daily Active Users by Language" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 17, + "col": 10, + "sizeX": 8, + "sizeY": 4, + "card_id": {{ card "Daily Active Users by Editor" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} } ], "path": "/Faros CE/GitHub/Copilot" From 9301c4f24186c17a72e85ae044c7b73823997bba Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 30 Oct 2024 15:30:10 -0700 Subject: [PATCH 21/50] more charts and filters --- .../metabase/dashboards/copilot.json | 818 +++++++++++++++++- 1 file changed, 791 insertions(+), 27 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot.json b/init/resources/metabase/dashboards/copilot.json index 4ef40547..d5ca36e5 100644 --- a/init/resources/metabase/dashboards/copilot.json +++ b/init/resources/metabase/dashboards/copilot.json @@ -1414,6 +1414,209 @@ "Avg Daily Active Users" ] } + }, + { + "name": "Avg Daily Chat Turns", + "description": null, + "display": "bar", + "table_id": null, + "dataset_query": { + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "filter": [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyChatTurnCount" + ], + "breakout": [ + [ + "field", + "computedAt", + { + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "avg", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ] + ], + { + "name": "Avg Daily Chat Turns", + "display-name": "Avg Daily Chat Turns" + } + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "computedAt" + ], + "series_settings": { + "Avg Daily Chat Turns": { + "color": "#A989C5" + } + }, + "graph.metrics": [ + "Avg Daily Chat Turns" + ] + } + }, + { + "name": "Avg Daily Chat Users", + "description": null, + "display": "bar", + "table_id": null, + "dataset_query": { + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "filter": [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyActiveChatUserTrend" + ], + "breakout": [ + [ + "field", + "computedAt", + { + "temporal-unit": "week", + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "avg", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ] + ], + { + "name": "Avg Daily Active Users", + "display-name": "Avg Daily Active Users" + } + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "computedAt" + ], + "series_settings": { + "Avg Daily Active Users": { + "color": "#F9D45C" + } + }, + "graph.metrics": [ + "Avg Daily Active Users" + ] + } + }, + { + "name": "Chat Acceptances by GitHub Team", + "description": null, + "display": "bar", + "table_id": null, + "dataset_query": { + "query": { + "source-table": {{ card "Copilot Metrics" }}, + "filter": [ + "=", + [ + "field", + "definition", + { + "base-type": "type/Text" + } + ], + "DailyChatAcceptanceCount" + ], + "breakout": [ + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ], + [ + "expression", + "group" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "avg", + [ + "field", + "value", + { + "base-type": "type/Integer" + } + ] + ], + { + "name": "Avg Daily Chat Acceptances", + "display-name": "Avg Daily Chat Acceptances" + } + ] + ], + "expressions": { + "group": [ + "trim", + "" + ] + } + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "group", + "copilotTeam" + ], + "graph.series_order_dimension": null, + "graph.series_order": null, + "graph.x_axis.labels_enabled": false, + "graph.metrics": [ + "Avg Daily Chat Turns" + ] + } } ], "parameters": [ @@ -1438,20 +1641,6 @@ "id": "a6b0f41", "type": "string/=", "sectionId": "string" - }, - { - "name": "Language", - "slug": "language", - "id": "817645db", - "type": "string/=", - "sectionId": "string" - }, - { - "name": "Editor", - "slug": "editor", - "id": "7ab27be3", - "type": "string/=", - "sectionId": "string" } ], "layout": [ @@ -1508,7 +1697,36 @@ "sizeY": 5, "card_id": {{ card "Lines of Code Accepted by GitHub Team" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Lines of Code Accepted by GitHub Team" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Lines of Code Accepted by GitHub Team" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} }, { @@ -1518,7 +1736,50 @@ "sizeY": 4, "card_id": {{ card "Lines Generated" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Lines Generated" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Lines Generated" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Lines Generated" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} }, { @@ -1528,17 +1789,103 @@ "sizeY": 4, "card_id": {{ card "Acceptance Rate" }}, "series": [], - "parameter_mappings": [], - "visualization_settings": {} - }, - { + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Acceptance Rate" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Acceptance Rate" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Acceptance Rate" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], + "visualization_settings": {} + }, + { "row": 9, "col": 5, "sizeX": 5, "sizeY": 4, "card_id": {{ card "Lines Generated by Language" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Lines Generated by Language" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Lines Generated by Language" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Lines Generated by Language" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} }, { @@ -1548,7 +1895,50 @@ "sizeY": 4, "card_id": {{ card "Acceptance Rate by Editor" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Acceptance Rate by Editor" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Acceptance Rate by Editor" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Acceptance Rate by Editor" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} }, { @@ -1558,7 +1948,50 @@ "sizeY": 4, "card_id": {{ card "Acceptance Rate by Language" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Acceptance Rate by Language" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Acceptance Rate by Language" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Acceptance Rate by Language" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} }, { @@ -1568,7 +2001,50 @@ "sizeY": 4, "card_id": {{ card "Lines Generated by Editor" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Lines Generated by Editor" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Lines Generated by Editor" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Lines Generated by Editor" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} }, { @@ -1599,7 +2075,50 @@ "sizeY": 4, "card_id": {{ card "Avg Daily Active Users" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Avg Daily Active Users" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Avg Daily Active Users" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Avg Daily Active Users" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} }, { @@ -1609,7 +2128,50 @@ "sizeY": 4, "card_id": {{ card "Daily Active Users by Language" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Daily Active Users by Language" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Daily Active Users by Language" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Daily Active Users by Language" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} }, { @@ -1619,7 +2181,209 @@ "sizeY": 4, "card_id": {{ card "Daily Active Users by Editor" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Daily Active Users by Editor" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Daily Active Users by Editor" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Daily Active Users by Editor" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 22, + "col": 6, + "sizeX": 6, + "sizeY": 4, + "card_id": {{ card "Avg Daily Chat Turns" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Avg Daily Chat Turns" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Avg Daily Chat Turns" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Avg Daily Chat Turns" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 22, + "col": 0, + "sizeX": 6, + "sizeY": 4, + "card_id": {{ card "Avg Daily Chat Users" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Avg Daily Chat Users" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Avg Daily Chat Users" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Avg Daily Chat Users" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 22, + "col": 12, + "sizeX": 6, + "sizeY": 4, + "card_id": {{ card "Chat Acceptances by GitHub Team" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "b8769942", + "card_id": {{ card "Chat Acceptances by GitHub Team" }}, + "target": [ + "dimension", + [ + "field", + "computedAt", + { + "base-type": "type/DateTimeWithLocalTZ" + } + ] + ] + }, + { + "parameter_id": "66a8f2ae", + "card_id": {{ card "Chat Acceptances by GitHub Team" }}, + "target": [ + "dimension", + [ + "field", + "copilotOrg", + { + "base-type": "type/Text" + } + ] + ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Chat Acceptances by GitHub Team" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] + } + ], "visualization_settings": {} } ], From 57d7ea8d772f619597e668eb38e7e7cce27c1c1c Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 30 Oct 2024 15:30:45 -0700 Subject: [PATCH 22/50] include current month --- init/resources/metabase/dashboards/copilot.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/resources/metabase/dashboards/copilot.json b/init/resources/metabase/dashboards/copilot.json index d5ca36e5..3c1d56e8 100644 --- a/init/resources/metabase/dashboards/copilot.json +++ b/init/resources/metabase/dashboards/copilot.json @@ -1626,7 +1626,7 @@ "id": "b8769942", "type": "date/all-options", "sectionId": "date", - "default": "past3months" + "default": "past3months~" }, { "name": "Org", From 6c8b5358885fd04dd0c9d70bbfbf403b99c50329 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 31 Oct 2024 16:26:30 -0700 Subject: [PATCH 23/50] add copilot impact dashboard --- .../metabase/dashboards/copilot-impact.json | 1434 +++++++++++++++++ 1 file changed, 1434 insertions(+) create mode 100644 init/resources/metabase/dashboards/copilot-impact.json diff --git a/init/resources/metabase/dashboards/copilot-impact.json b/init/resources/metabase/dashboards/copilot-impact.json new file mode 100644 index 00000000..fb54753a --- /dev/null +++ b/init/resources/metabase/dashboards/copilot-impact.json @@ -0,0 +1,1434 @@ +{ + "name": "AI Copilot Evaluation - Impact", + "cards": [ + { + "name": "Pull Request Merge Rate with Tool", + "description": null, + "display": "bar", + "table_id": {{ table "vcs_PullRequest" }}, + "dataset_query": { + "query": { + "source-table": {{ table "vcs_PullRequest" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "vcs_UserTool" }}, + "condition": [ + "=", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.user" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + "alias": "Vcs UserTool - Author" + } + ], + "expressions": { + "Tool": [ + "case", + [ + [ + [ + "and", + [ + ">", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.startedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "or", + [ + "is-null", + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "<", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + [ + "coalesce", + [ + "field", + {{ field "vcs_UserTool.toolDetail" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ], + [ + "field", + {{ field "vcs_UserTool.toolCategory" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + { + "default": "No Tool" + } + ], + "group": [ + "trim", + "" + ] + }, + "breakout": [ + [ + "expression", + "Tool" + ], + [ + "expression", + "group" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.id" }}, + null + ] + ], + { + "name": "PR Count", + "display-name": "PR Count" + } + ], + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ] + ], + { + "name": "Author Count", + "display-name": "Author Count" + } + ], + [ + "aggregation-options", + [ + "/", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.id" }}, + null + ] + ], + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ] + ] + ], + { + "name": "PRs Merged per User", + "display-name": "PRs Merged per User" + } + ] + ], + "filter": [ + "not-null", + [ + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "group", + "Tool" + ], + "graph.series_order_dimension": "Tool", + "graph.series_order": [ + { + "key": "No Tool", + "color": "#88BF4D", + "enabled": true, + "name": "No Tool" + }, + { + "key": "GitHubCopilot", + "color": "#7172AD", + "enabled": true, + "name": "GitHubCopilot" + } + ], + "graph.x_axis.labels_enabled": false, + "graph.metrics": [ + "PRs Merged per User" + ] + } + }, + { + "name": "Pull Request Merge Time with Tool over Time", + "description": null, + "display": "line", + "table_id": {{ table "vcs_PullRequest" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "vcs_PullRequest" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "vcs_UserTool" }}, + "condition": [ + "=", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.user" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + "alias": "Vcs UserTool - Author" + } + ], + "expressions": { + "Tool": [ + "case", + [ + [ + [ + "and", + [ + ">", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.startedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "or", + [ + "is-null", + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "<", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + [ + "coalesce", + [ + "field", + {{ field "vcs_UserTool.toolDetail" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ], + [ + "field", + {{ field "vcs_UserTool.toolCategory" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + { + "default": "No Tool" + } + ], + "Merge Time Hours": [ + "datetime-diff", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null + ], + "hour" + ] + }, + "breakout": [ + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + { + "temporal-unit": "week" + } + ], + [ + "expression", + "Tool" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.id" }}, + null + ] + ], + { + "name": "PR Count", + "display-name": "PR Count" + } + ], + [ + "aggregation-options", + [ + "avg", + [ + "expression", + "Merge Time Hours" + ] + ], + { + "name": "Average Merge Time", + "display-name": "Average Merge Time" + } + ] + ], + "filter": [ + "not-null", + [ + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null + ] + ] + } + }, + "visualization_settings": { + "graph.dimensions": [ + "createdAt", + "Tool" + ], + "graph.series_order_dimension": null, + "graph.series_order": null, + "column_settings": { + "[\"name\",\"Average Merge Time\"]": { + "suffix": " h", + "decimals": 1 + } + }, + "graph.metrics": [ + "Average Merge Time" + ] + } + }, + { + "name": "Pull Request Merge Rate with Tool over Time", + "description": null, + "display": "line", + "table_id": {{ table "vcs_PullRequest" }}, + "dataset_query": { + "query": { + "source-table": {{ table "vcs_PullRequest" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "vcs_UserTool" }}, + "condition": [ + "=", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.user" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + "alias": "Vcs UserTool - Author" + } + ], + "expressions": { + "Tool": [ + "case", + [ + [ + [ + "and", + [ + ">", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.startedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "or", + [ + "is-null", + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "<", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + [ + "coalesce", + [ + "field", + {{ field "vcs_UserTool.toolDetail" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ], + [ + "field", + {{ field "vcs_UserTool.toolCategory" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + { + "default": "No Tool" + } + ] + }, + "breakout": [ + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + { + "temporal-unit": "week" + } + ], + [ + "expression", + "Tool" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.id" }}, + null + ] + ], + { + "name": "PR Count", + "display-name": "PR Count" + } + ], + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ] + ], + { + "name": "Author Count", + "display-name": "Author Count" + } + ], + [ + "aggregation-options", + [ + "/", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.id" }}, + null + ] + ], + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ] + ] + ], + { + "name": "PRs Merged per User", + "display-name": "PRs Merged per User" + } + ] + ], + "filter": [ + "not-null", + [ + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "createdAt", + "Tool" + ], + "graph.series_order_dimension": null, + "graph.series_order": null, + "graph.metrics": [ + "PRs Merged per User" + ] + } + }, + { + "name": "Pull Request Merge Time with Tool", + "description": null, + "display": "bar", + "table_id": {{ table "vcs_PullRequest" }}, + "dataset_query": { + "query": { + "source-table": {{ table "vcs_PullRequest" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "vcs_UserTool" }}, + "condition": [ + "=", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.user" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + "alias": "Vcs UserTool - Author" + } + ], + "expressions": { + "Tool": [ + "case", + [ + [ + [ + "and", + [ + ">", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.startedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "or", + [ + "is-null", + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "<", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + [ + "coalesce", + [ + "field", + {{ field "vcs_UserTool.toolDetail" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ], + [ + "field", + {{ field "vcs_UserTool.toolCategory" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + { + "default": "No Tool" + } + ], + "Merge Time Hours": [ + "datetime-diff", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null + ], + "hour" + ], + "group": [ + "trim", + "" + ] + }, + "breakout": [ + [ + "expression", + "Tool" + ], + [ + "expression", + "group" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.id" }}, + null + ] + ], + { + "name": "PR Count", + "display-name": "PR Count" + } + ], + [ + "aggregation-options", + [ + "avg", + [ + "expression", + "Merge Time Hours" + ] + ], + { + "name": "Average Merge Time", + "display-name": "Average Merge Time" + } + ] + ], + "filter": [ + "not-null", + [ + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.dimensions": [ + "group", + "Tool" + ], + "graph.series_order_dimension": "Tool", + "graph.series_order": [ + { + "key": "No Tool", + "color": "#88BF4D", + "enabled": true, + "name": "No Tool" + }, + { + "key": "GitHubCopilot", + "color": "#7172AD", + "enabled": true, + "name": "GitHubCopilot" + } + ], + "graph.x_axis.labels_enabled": false, + "column_settings": { + "[\"name\",\"Average Merge Time\"]": { + "suffix": " h", + "decimals": 1 + } + }, + "graph.metrics": [ + "Average Merge Time" + ] + } + }, + { + "name": "Pull Request Size with Tool over Time", + "description": null, + "display": "line", + "table_id": {{ table "vcs_PullRequest" }}, + "dataset_query": { + "query": { + "source-table": {{ table "vcs_PullRequest" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "vcs_UserTool" }}, + "condition": [ + "=", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.user" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + "alias": "Vcs UserTool - Author" + } + ], + "expressions": { + "Tool": [ + "case", + [ + [ + [ + "and", + [ + ">", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.startedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "or", + [ + "is-null", + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "<", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + [ + "coalesce", + [ + "field", + {{ field "vcs_UserTool.toolDetail" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ], + [ + "field", + {{ field "vcs_UserTool.toolCategory" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + { + "default": "No Tool" + } + ] + }, + "breakout": [ + [ + "expression", + "Tool" + ], + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + { + "temporal-unit": "week" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.id" }}, + null + ] + ], + { + "name": "PR Count", + "display-name": "PR Count" + } + ], + [ + "aggregation-options", + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesAdded" }}, + null + ] + ], + { + "name": "Median Lines Added", + "display-name": "Median Lines Added" + } + ], + [ + "aggregation-options", + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesDeleted" }}, + null + ] + ], + { + "name": "Median Lines Deleted", + "display-name": "Median Lines Deleted" + } + ], + [ + "aggregation-options", + [ + "-", + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesAdded" }}, + null + ] + ], + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesDeleted" }}, + null + ] + ] + ], + { + "name": "Net Lines Added", + "display-name": "Net Lines Added" + } + ] + ], + "filter": [ + "not-null", + [ + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null + ] + ], + "order-by": [ + [ + "desc", + [ + "expression", + "Tool" + ] + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.x_axis.labels_enabled": false, + "graph.series_order": null, + "graph.series_order_dimension": null, + "graph.dimensions": [ + "createdAt", + "Tool" + ], + "series_settings": { + "Median Lines Deleted": { + "color": "#EF8C8C" + } + }, + "graph.metrics": [ + "Net Lines Added" + ] + } + }, + { + "name": "Pull Request Size with Tool", + "description": null, + "display": "bar", + "table_id": {{ table "vcs_PullRequest" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "vcs_PullRequest" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "vcs_UserTool" }}, + "condition": [ + "=", + [ + "field", + {{ field "vcs_PullRequest.author" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.user" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + "alias": "Vcs UserTool - Author" + } + ], + "expressions": { + "Tool": [ + "case", + [ + [ + [ + "and", + [ + ">", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.startedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "or", + [ + "is-null", + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ], + [ + "<", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ], + [ + "field", + {{ field "vcs_UserTool.endedAt" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + [ + "coalesce", + [ + "field", + {{ field "vcs_UserTool.toolDetail" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ], + [ + "field", + {{ field "vcs_UserTool.toolCategory" }}, + { + "join-alias": "Vcs UserTool - Author" + } + ] + ] + ] + ], + { + "default": "No Tool" + } + ] + }, + "breakout": [ + [ + "expression", + "Tool" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "vcs_PullRequest.id" }}, + null + ] + ], + { + "name": "PR Count", + "display-name": "PR Count" + } + ], + [ + "aggregation-options", + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesAdded" }}, + null + ] + ], + { + "name": "Median Lines Added", + "display-name": "Median Lines Added" + } + ], + [ + "aggregation-options", + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesDeleted" }}, + null + ] + ], + { + "name": "Median Lines Deleted", + "display-name": "Median Lines Deleted" + } + ], + [ + "aggregation-options", + [ + "-", + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesAdded" }}, + null + ] + ], + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesDeleted" }}, + null + ] + ] + ], + { + "name": "Net Lines Added", + "display-name": "Net Lines Added" + } + ] + ], + "filter": [ + "not-null", + [ + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null + ] + ], + "order-by": [ + [ + "desc", + [ + "expression", + "Tool" + ] + ] + ] + } + }, + "visualization_settings": { + "graph.x_axis.labels_enabled": false, + "graph.series_order": [ + { + "key": "No Tool", + "color": "#88BF4D", + "enabled": true, + "name": "No Tool" + }, + { + "key": "GitHubCopilot", + "color": "#7172AD", + "enabled": true, + "name": "GitHubCopilot" + } + ], + "graph.series_order_dimension": "Tool", + "graph.dimensions": [ + "Tool" + ], + "series_settings": { + "Median Lines Deleted": { + "color": "#EF8C8C" + } + }, + "graph.metrics": [ + "Median Lines Added", + "Median Lines Deleted", + "Net Lines Added" + ] + } + } + ], + "parameters": [ + { + "name": "Date", + "slug": "date", + "id": "f8b47360", + "type": "date/all-options", + "sectionId": "date", + "default": "past3months~" + } + ], + "layout": [ + { + "row": 0, + "col": 0, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Pull Request Merge Rate with Tool" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "f8b47360", + "card_id": {{ card "Pull Request Merge Rate with Tool" }}, + "target": [ + "dimension", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 4, + "col": 5, + "sizeX": 10, + "sizeY": 4, + "card_id": {{ card "Pull Request Merge Time with Tool over Time" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "f8b47360", + "card_id": {{ card "Pull Request Merge Time with Tool over Time" }}, + "target": [ + "dimension", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 0, + "col": 5, + "sizeX": 10, + "sizeY": 4, + "card_id": {{ card "Pull Request Merge Rate with Tool over Time" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "f8b47360", + "card_id": {{ card "Pull Request Merge Rate with Tool over Time" }}, + "target": [ + "dimension", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 4, + "col": 0, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Pull Request Merge Time with Tool" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "f8b47360", + "card_id": {{ card "Pull Request Merge Time with Tool" }}, + "target": [ + "dimension", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 8, + "col": 5, + "sizeX": 10, + "sizeY": 4, + "card_id": {{ card "Pull Request Size with Tool over Time" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "f8b47360", + "card_id": {{ card "Pull Request Size with Tool over Time" }}, + "target": [ + "dimension", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 8, + "col": 0, + "sizeX": 5, + "sizeY": 4, + "card_id": {{ card "Pull Request Size with Tool" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "f8b47360", + "card_id": {{ card "Pull Request Size with Tool" }}, + "target": [ + "dimension", + [ + "field", + {{ field "vcs_PullRequest.createdAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + } + ], + "path": "/Faros CE/GitHub/Copilot" +} + From 2d9eb17d9af24103a1954a2efe615b63e34089a2 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 31 Oct 2024 16:46:26 -0700 Subject: [PATCH 24/50] add pr size info --- init/resources/hasura/endpoints/vcs_pull_request.gql | 6 ++++++ mock-data/src/hasura.ts | 4 ++++ mock-data/src/mockdata.ts | 3 +++ 3 files changed, 13 insertions(+) diff --git a/init/resources/hasura/endpoints/vcs_pull_request.gql b/init/resources/hasura/endpoints/vcs_pull_request.gql index 110e906c..8b9fa773 100644 --- a/init/resources/hasura/endpoints/vcs_pull_request.gql +++ b/init/resources/hasura/endpoints/vcs_pull_request.gql @@ -5,6 +5,8 @@ mutation insert_vcs_pull_request( $data_merge_commit_sha: String! $data_pull_request_create_time: timestamptz! $data_pull_request_merge_time: timestamptz! + $data_pull_request_lines_added: Int + $data_pull_request_lines_deleted: Int $data_pull_request_repository: String! $data_pull_request_organization: String! $data_pull_request_source: String! @@ -16,6 +18,10 @@ mutation insert_vcs_pull_request( state: $data_pull_request_state createdAt: $data_pull_request_create_time mergedAt: $data_pull_request_merge_time + diffStats: { + linesAdded: $data_pull_request_lines_added + linesDeleted: $data_pull_request_lines_deleted + } vcs_User: { data: { uid: $data_pull_request_author diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index e5c58460..99566bae 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -161,6 +161,8 @@ export class Hasura { commitSha: string, createTime: DateTime, mergeTime: DateTime, + linesAdded: number, + linesDeleted: number, repository: string, organization: string, source: string, @@ -173,6 +175,8 @@ export class Hasura { data_merge_commit_sha: commitSha, data_pull_request_create_time: createTime, data_pull_request_merge_time: mergeTime, + data_pull_request_lines_added: linesAdded, + data_pull_request_lines_deleted: linesDeleted, data_pull_request_repository: repository, data_pull_request_organization: organization, data_pull_request_source: source, diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 811e10a6..261c93dd 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -1,6 +1,7 @@ import {DateTime} from 'luxon'; import {Hasura} from './hasura'; +import { randomBytes } from 'crypto'; const ORIGIN = 'faros-ce-mock-data'; const SOURCE = 'FarosCE-MockData'; @@ -147,6 +148,8 @@ export class MockData { commitSha, prCreateTime, mergedAt, + MockData.randomInt(200, 2000), + MockData.randomInt(0, 1000), REPO, ORG, SOURCE, From 966ead8a39820eb2de915b6f8358768cea46d6e2 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 31 Oct 2024 16:48:18 -0700 Subject: [PATCH 25/50] fix pr size chart --- .../metabase/dashboards/copilot-impact.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot-impact.json b/init/resources/metabase/dashboards/copilot-impact.json index fb54753a..40f8ed35 100644 --- a/init/resources/metabase/dashboards/copilot-impact.json +++ b/init/resources/metabase/dashboards/copilot-impact.json @@ -1048,7 +1048,6 @@ "display": "bar", "table_id": {{ table "vcs_PullRequest" }}, "dataset_query": { - "type": "query", "query": { "source-table": {{ table "vcs_PullRequest" }}, "joins": [ @@ -1244,7 +1243,8 @@ ] ] ] - } + }, + "type": "query" }, "visualization_settings": { "graph.x_axis.labels_enabled": false, @@ -1268,7 +1268,14 @@ ], "series_settings": { "Median Lines Deleted": { - "color": "#EF8C8C" + "color": "#EF8C8C", + "axis": "left" + }, + "Median Lines Added": { + "axis": "left" + }, + "Net Lines Added": { + "axis": "left" } }, "graph.metrics": [ From b859f3df49e3eae8b7ffb27b033b2d520c447e63 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 31 Oct 2024 16:49:39 -0700 Subject: [PATCH 26/50] rename dashboards --- .../dashboards/{copilot-impact.json => copilot_impact.json} | 0 .../metabase/dashboards/{copilot.json => copilot_usage.json} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename init/resources/metabase/dashboards/{copilot-impact.json => copilot_impact.json} (100%) rename init/resources/metabase/dashboards/{copilot.json => copilot_usage.json} (100%) diff --git a/init/resources/metabase/dashboards/copilot-impact.json b/init/resources/metabase/dashboards/copilot_impact.json similarity index 100% rename from init/resources/metabase/dashboards/copilot-impact.json rename to init/resources/metabase/dashboards/copilot_impact.json diff --git a/init/resources/metabase/dashboards/copilot.json b/init/resources/metabase/dashboards/copilot_usage.json similarity index 100% rename from init/resources/metabase/dashboards/copilot.json rename to init/resources/metabase/dashboards/copilot_usage.json From 4f04a33851220a83f71551d47f76a7f5293318da Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Mon, 4 Nov 2024 13:51:30 -0800 Subject: [PATCH 27/50] layout --- .../metabase/dashboards/copilot_usage.json | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot_usage.json b/init/resources/metabase/dashboards/copilot_usage.json index 3c1d56e8..b75eab8a 100644 --- a/init/resources/metabase/dashboards/copilot_usage.json +++ b/init/resources/metabase/dashboards/copilot_usage.json @@ -1691,7 +1691,7 @@ "visualization_settings": {} }, { - "row": 4, + "row": 5, "col": 0, "sizeX": 18, "sizeY": 5, @@ -1730,7 +1730,7 @@ "visualization_settings": {} }, { - "row": 9, + "row": 10, "col": 0, "sizeX": 5, "sizeY": 4, @@ -1783,7 +1783,7 @@ "visualization_settings": {} }, { - "row": 13, + "row": 14, "col": 0, "sizeX": 5, "sizeY": 4, @@ -1836,7 +1836,7 @@ "visualization_settings": {} }, { - "row": 9, + "row": 10, "col": 5, "sizeX": 5, "sizeY": 4, @@ -1889,7 +1889,7 @@ "visualization_settings": {} }, { - "row": 13, + "row": 14, "col": 10, "sizeX": 8, "sizeY": 4, @@ -1942,7 +1942,7 @@ "visualization_settings": {} }, { - "row": 13, + "row": 14, "col": 5, "sizeX": 5, "sizeY": 4, @@ -1995,7 +1995,7 @@ "visualization_settings": {} }, { - "row": 9, + "row": 10, "col": 10, "sizeX": 8, "sizeY": 4, @@ -2048,7 +2048,7 @@ "visualization_settings": {} }, { - "row": 21, + "row": 22, "col": 0, "sizeX": 18, "sizeY": 1, @@ -2069,7 +2069,7 @@ } }, { - "row": 17, + "row": 18, "col": 0, "sizeX": 5, "sizeY": 4, @@ -2122,7 +2122,7 @@ "visualization_settings": {} }, { - "row": 17, + "row": 18, "col": 5, "sizeX": 5, "sizeY": 4, @@ -2175,7 +2175,7 @@ "visualization_settings": {} }, { - "row": 17, + "row": 18, "col": 10, "sizeX": 8, "sizeY": 4, @@ -2228,7 +2228,7 @@ "visualization_settings": {} }, { - "row": 22, + "row": 23, "col": 6, "sizeX": 6, "sizeY": 4, @@ -2281,7 +2281,7 @@ "visualization_settings": {} }, { - "row": 22, + "row": 23, "col": 0, "sizeX": 6, "sizeY": 4, @@ -2334,7 +2334,7 @@ "visualization_settings": {} }, { - "row": 22, + "row": 23, "col": 12, "sizeX": 6, "sizeY": 4, @@ -2385,6 +2385,27 @@ } ], "visualization_settings": {} + }, + { + "row": 4, + "col": 0, + "sizeX": 18, + "sizeY": 1, + "card_id": null, + "series": [], + "parameter_mappings": [], + "visualization_settings": { + "virtual_card": { + "name": null, + "display": "text", + "visualization_settings": {}, + "dataset_query": {}, + "archived": false + }, + "text": "", + "text.align_vertical": "middle", + "dashcard.background": false + } } ], "path": "/Faros CE/GitHub/Copilot" From 6af8a58bf6af85456191e1a1d04fa2ef6c6ca0eb Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Mon, 4 Nov 2024 15:30:18 -0800 Subject: [PATCH 28/50] add survey endpoints --- .../hasura/endpoints/survey_question.gql | 39 ++++++++++++++++ .../endpoints/survey_question_response.gql | 46 +++++++++++++++++++ .../hasura/endpoints/survey_survey.gql | 32 +++++++++++++ .../survey_survey_question_association.gql | 34 ++++++++++++++ 4 files changed, 151 insertions(+) create mode 100644 init/resources/hasura/endpoints/survey_question.gql create mode 100644 init/resources/hasura/endpoints/survey_question_response.gql create mode 100644 init/resources/hasura/endpoints/survey_survey.gql create mode 100644 init/resources/hasura/endpoints/survey_survey_question_association.gql diff --git a/init/resources/hasura/endpoints/survey_question.gql b/init/resources/hasura/endpoints/survey_question.gql new file mode 100644 index 00000000..e9280350 --- /dev/null +++ b/init/resources/hasura/endpoints/survey_question.gql @@ -0,0 +1,39 @@ +mutation insert_survey_question( + $data_uid: String! + $data_question: String + $data_response_category: String + $data_response_detail: String + $data_question_category: String + $data_question_detail: String + $data_source: String! + $data_origin: String! +) { + insert_survey_Question_one( + object: { + uid: $data_uid + question: $data_question + responseType: { + category: $data_response_category + detail: $data_response_detail + } + questionCategory: { + category: $data_question_category + detail: $data_question_detail + } + source: $data_source + origin: $data_origin + } + on_conflict: { + constraint: survey_Question_pkey + update_columns: [ + question + responseType + questionCategory + origin + refreshedAt + ] + } + ) { + id + } +} \ No newline at end of file diff --git a/init/resources/hasura/endpoints/survey_question_response.gql b/init/resources/hasura/endpoints/survey_question_response.gql new file mode 100644 index 00000000..a151299f --- /dev/null +++ b/init/resources/hasura/endpoints/survey_question_response.gql @@ -0,0 +1,46 @@ +mutation insert_survey_question_response( + $data_uid: String! + $data_origin: String! + $data_submitted_at: timestamptz + $data_response: String + $data_survey_uid: String + $data_survey_source: String + $data_question_uid: String + $data_question_source:String +) { + insert_survey_QuestionResponse_one( + object: { + uid: $data_uid + submittedAt: $data_submitted_at + response: $data_response + survey_SurveyQuestionAssociation: { + data: { + survey_Survey: { + data: { + uid: $data_survey_uid + source: $data_survey_source + } + on_conflict: {constraint: survey_Survey_pkey, update_columns: refreshedAt} + } + survey_Question: { + data: { + uid: $data_question_uid + source: $data_question_source + } + } + } + on_conflict: {constraint: survey_SurveyQuestionAssociation_pkey, update_columns: refreshedAt} + } + origin: $data_origin + } + on_conflict: { + constraint: survey_QuestionResponse_pkey + update_columns: [ + origin + refreshedAt + ] + } + ) { + id + } +} \ No newline at end of file diff --git a/init/resources/hasura/endpoints/survey_survey.gql b/init/resources/hasura/endpoints/survey_survey.gql new file mode 100644 index 00000000..7b0a2a2c --- /dev/null +++ b/init/resources/hasura/endpoints/survey_survey.gql @@ -0,0 +1,32 @@ +mutation insert_survey_survey( + $data_uid: String! + $data_name: String + $data_typeCategory: String + $data_typeDetail: String + $data_source: String! + $data_origin: String +) { + insert_survey_Survey_one( + object: { + uid: $data_uid + name: $data_name + type: { + category: $data_typeCategory + detail: $data_typeDetail + } + source: $data_source + origin: $data_origin + } + on_conflict: { + constraint: survey_Survey_pkey + update_columns: [ + name + type + origin + refreshedAt + ] + } + ) { + id + } +} \ No newline at end of file diff --git a/init/resources/hasura/endpoints/survey_survey_question_association.gql b/init/resources/hasura/endpoints/survey_survey_question_association.gql new file mode 100644 index 00000000..d0f4960a --- /dev/null +++ b/init/resources/hasura/endpoints/survey_survey_question_association.gql @@ -0,0 +1,34 @@ +mutation insert_survey_question( + $data_survey_uid: String! + $data_survey_source: String! + $data_question_uid: String! + $data_question_source: String! +) { + insert_survey_SurveyQuestionAssociation_one( + object: { + survey_Survey: { + data: { + uid: $data_survey_uid + source: $data_survey_source + } + on_conflict: {constraint: survey_Survey_pkey, update_columns: refreshedAt} + } + survey_Question: { + data: { + uid: $data_question_uid + source: $data_question_source + } + on_conflict: {constraint: survey_Question_pkey, update_columns: refreshedAt} + } + } + on_conflict: { + constraint: survey_SurveyQuestionAssociation_pkey + update_columns: [ + origin + refreshedAt + ] + } + ) { + id + } +} \ No newline at end of file From bc0fcfe23eb64d6991ec7a0f04ff25c3a953a790 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Mon, 4 Nov 2024 15:52:21 -0800 Subject: [PATCH 29/50] add delete survey endpoints --- init/resources/hasura/endpoints/delete_survey_question.gql | 5 +++++ .../hasura/endpoints/delete_survey_question_response.gql | 5 +++++ init/resources/hasura/endpoints/delete_survey_survey.gql | 5 +++++ .../endpoints/delete_survey_survey_question_association.gql | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 init/resources/hasura/endpoints/delete_survey_question.gql create mode 100644 init/resources/hasura/endpoints/delete_survey_question_response.gql create mode 100644 init/resources/hasura/endpoints/delete_survey_survey.gql create mode 100644 init/resources/hasura/endpoints/delete_survey_survey_question_association.gql diff --git a/init/resources/hasura/endpoints/delete_survey_question.gql b/init/resources/hasura/endpoints/delete_survey_question.gql new file mode 100644 index 00000000..2f080d54 --- /dev/null +++ b/init/resources/hasura/endpoints/delete_survey_question.gql @@ -0,0 +1,5 @@ +mutation delete_survey_question($data_origin: String) { + delete_survey_Question(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/delete_survey_question_response.gql b/init/resources/hasura/endpoints/delete_survey_question_response.gql new file mode 100644 index 00000000..6ba99980 --- /dev/null +++ b/init/resources/hasura/endpoints/delete_survey_question_response.gql @@ -0,0 +1,5 @@ +mutation delete_survey_question_response($data_origin: String) { + delete_survey_QuestionResponse(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/delete_survey_survey.gql b/init/resources/hasura/endpoints/delete_survey_survey.gql new file mode 100644 index 00000000..36ff1334 --- /dev/null +++ b/init/resources/hasura/endpoints/delete_survey_survey.gql @@ -0,0 +1,5 @@ +mutation delete_survey_survey($data_origin: String) { + delete_survey_Survey(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} diff --git a/init/resources/hasura/endpoints/delete_survey_survey_question_association.gql b/init/resources/hasura/endpoints/delete_survey_survey_question_association.gql new file mode 100644 index 00000000..6d16cf3c --- /dev/null +++ b/init/resources/hasura/endpoints/delete_survey_survey_question_association.gql @@ -0,0 +1,5 @@ +mutation delete_survey_survey_question_association($data_origin: String) { + delete_survey_SurveyQuestionAssociation(where: { origin: { _eq: $data_origin } }) { + affected_rows + } +} From e400c60e6c26c6bcb6caf6b80940afeb4c93164b Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Mon, 4 Nov 2024 15:52:57 -0800 Subject: [PATCH 30/50] add post/delete survey functions, call delete functions --- mock-data/src/hasura.ts | 93 +++++++++++++++++++++++++++++++++++++++ mock-data/src/mockdata.ts | 4 ++ 2 files changed, 97 insertions(+) diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index 99566bae..046edaff 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -206,6 +206,75 @@ export class Hasura { }); } + async postSurveyQuestion( + uid: string, + question: string, + response: any, + questionType: any, + source: string, + origin: string + ): Promise { + await this.api.post('survey_question', { + data_uid: uid, + data_question: question, + data_response_category: response.category, + data_response_detail: response.detail, + data_question_category: questionType.category, + data_question_detail: questionType.detail, + data_source: source, + data_origin: origin, + }); + } + + async postSurveyQuestionResponse( + uid: string, + origin: string, + submittedAt: DateTime, + response: string, + survey: any, + question: any + ): Promise { + await this.api.post('survey_question_response', { + data_uid: uid, + data_origin: origin, + data_submitted_at: submittedAt, + data_response: response, + data_survey_uid: survey.uid, + data_survey_source: survey.source, + data_question_uid: question.uid, + data_question_source: question.source, + }); + } + + async postSurveySurvey( + uid: string, + name: string, + type: any, + source: string, + origin: string + ): Promise { + await this.api.post('survey_survey', { + data_uid: uid, + data_name: name, + data_type_category: type.category, + data_type_detail: type.detail, + data_source: source, + data_origin: origin, + }); + } + + async postSurveyQuestionAssociation( + survey: any, + question: any + ): Promise { + await this.api.post('survey_question_association', { + data_survey_uid: survey.uid, + data_survey_source: survey.source, + data_question_uid: question.uid, + data_question_source: question.source, + }); + } + async postTag( uid: string, key: string, @@ -418,4 +487,28 @@ export class Hasura { data_origin: origin, }); } + + async deleteSurveyQuestion(origin: string): Promise { + await this.api.post('delete_survey_question', { + data_origin: origin, + }); + } + + async deleteSurveyQuestionResponse(origin: string): Promise { + await this.api.post('delete_survey_question_response', { + data_origin: origin, + }); + } + + async deleteSurveySurvey(origin: string): Promise { + await this.api.post('delete_survey_survey', { + data_origin: origin, + }); + } + + async deleteSurveyQuestionAssociation(origin: string): Promise { + await this.api.post('delete_survey_question_association', { + data_origin: origin, + }); + } } diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 261c93dd..2b10250a 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -116,6 +116,7 @@ export class MockData { this.hasura.deleteCommit(ORIGIN), this.hasura.deleteMetricValueTag(ORIGIN), this.hasura.deleteUserToolUsage(ORIGIN), + this.hasura.deleteSurveyQuestionResponse(ORIGIN), ]); await Promise.all([ @@ -124,6 +125,7 @@ export class MockData { this.hasura.deleteMetricValue(ORIGIN), this.hasura.deleteTag(ORIGIN), this.hasura.deleteUserTool(ORIGIN), + this.hasura.deleteSurveyQuestionAssociation(ORIGIN), ]); await Promise.all([ @@ -131,6 +133,8 @@ export class MockData { this.hasura.deleteVCSUser(ORIGIN), this.hasura.deleteVCSOrganization(ORIGIN), this.hasura.deleteMetricDefinition(ORIGIN), + this.hasura.deleteSurveySurvey(ORIGIN), + this.hasura.deleteSurveyQuestion(ORIGIN) ]); } From ae1d6b158015f3d70cb40ac1c0bb2382d5fe0a05 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Mon, 4 Nov 2024 15:58:15 -0800 Subject: [PATCH 31/50] fix names --- mock-data/src/hasura.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index 046edaff..c5a7b512 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -267,7 +267,7 @@ export class Hasura { survey: any, question: any ): Promise { - await this.api.post('survey_question_association', { + await this.api.post('survey_survey_question_association', { data_survey_uid: survey.uid, data_survey_source: survey.source, data_question_uid: question.uid, @@ -507,7 +507,7 @@ export class Hasura { } async deleteSurveyQuestionAssociation(origin: string): Promise { - await this.api.post('delete_survey_question_association', { + await this.api.post('delete_survey_survey_question_association', { data_origin: origin, }); } From e73817dac5e13b824cb82b73ae20e8b67c6f7244 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Tue, 5 Nov 2024 11:04:08 -0800 Subject: [PATCH 32/50] fix endpoints --- .../hasura/endpoints/survey_question_response.gql | 1 + init/resources/hasura/endpoints/survey_survey.gql | 8 ++++---- .../endpoints/survey_survey_question_association.gql | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/init/resources/hasura/endpoints/survey_question_response.gql b/init/resources/hasura/endpoints/survey_question_response.gql index a151299f..22800ba4 100644 --- a/init/resources/hasura/endpoints/survey_question_response.gql +++ b/init/resources/hasura/endpoints/survey_question_response.gql @@ -27,6 +27,7 @@ mutation insert_survey_question_response( uid: $data_question_uid source: $data_question_source } + on_conflict: {constraint: survey_Question_pkey, update_columns: refreshedAt} } } on_conflict: {constraint: survey_SurveyQuestionAssociation_pkey, update_columns: refreshedAt} diff --git a/init/resources/hasura/endpoints/survey_survey.gql b/init/resources/hasura/endpoints/survey_survey.gql index 7b0a2a2c..d9fa7801 100644 --- a/init/resources/hasura/endpoints/survey_survey.gql +++ b/init/resources/hasura/endpoints/survey_survey.gql @@ -1,8 +1,8 @@ mutation insert_survey_survey( $data_uid: String! $data_name: String - $data_typeCategory: String - $data_typeDetail: String + $data_type_category: String + $data_type_detail: String $data_source: String! $data_origin: String ) { @@ -11,8 +11,8 @@ mutation insert_survey_survey( uid: $data_uid name: $data_name type: { - category: $data_typeCategory - detail: $data_typeDetail + category: $data_type_category + detail: $data_type_detail } source: $data_source origin: $data_origin diff --git a/init/resources/hasura/endpoints/survey_survey_question_association.gql b/init/resources/hasura/endpoints/survey_survey_question_association.gql index d0f4960a..9bd9b5ee 100644 --- a/init/resources/hasura/endpoints/survey_survey_question_association.gql +++ b/init/resources/hasura/endpoints/survey_survey_question_association.gql @@ -3,6 +3,7 @@ mutation insert_survey_question( $data_survey_source: String! $data_question_uid: String! $data_question_source: String! + $data_origin: String! ) { insert_survey_SurveyQuestionAssociation_one( object: { @@ -20,6 +21,7 @@ mutation insert_survey_question( } on_conflict: {constraint: survey_Question_pkey, update_columns: refreshedAt} } + origin: $data_origin } on_conflict: { constraint: survey_SurveyQuestionAssociation_pkey From 0e919e1e3dda114120e804356bf0649000c019b2 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Tue, 5 Nov 2024 11:04:26 -0800 Subject: [PATCH 33/50] first survey data --- mock-data/src/hasura.ts | 10 ++-- mock-data/src/mockdata.ts | 104 +++++++++++++++++++++++++++++++++++++- 2 files changed, 109 insertions(+), 5 deletions(-) diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index c5a7b512..531db0db 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -209,7 +209,7 @@ export class Hasura { async postSurveyQuestion( uid: string, question: string, - response: any, + responseType: any, questionType: any, source: string, origin: string @@ -217,8 +217,8 @@ export class Hasura { await this.api.post('survey_question', { data_uid: uid, data_question: question, - data_response_category: response.category, - data_response_detail: response.detail, + data_response_category: responseType.category, + data_response_detail: responseType.detail, data_question_category: questionType.category, data_question_detail: questionType.detail, data_source: source, @@ -265,13 +265,15 @@ export class Hasura { async postSurveyQuestionAssociation( survey: any, - question: any + question: any, + origin: string ): Promise { await this.api.post('survey_survey_question_association', { data_survey_uid: survey.uid, data_survey_source: survey.source, data_question_uid: question.uid, data_question_source: question.source, + data_origin: origin }); } diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 2b10250a..5ed83cfb 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -1,7 +1,7 @@ import {DateTime} from 'luxon'; import {Hasura} from './hasura'; -import { randomBytes } from 'crypto'; +import { randomBytes, randomInt } from 'crypto'; const ORIGIN = 'faros-ce-mock-data'; const SOURCE = 'FarosCE-MockData'; @@ -87,6 +87,7 @@ export class MockData { } await this.writeTasks(week, weekStart); await this.writeCopilot(week, weekStart); + await this.writeSurveys(numWeeks); } } @@ -466,4 +467,105 @@ export class MockData { } } } + + + + private async writeSurveys(numWeeks: number): Promise { + const nResponses = 10; + const likerts = [ + 'Strongly Disagree', + 'Disagree', + 'Neutral', + 'Agree', + 'Strongly Agree', + ]; + + + + // Cadence Surveys + const cSurvey = { + uid: 'survey-1', + name: 'Copilot Weekly Survey', + type: {category: 'Custom', detail: 'AI Transformation'}, + source: SOURCE, + origin: ORIGIN + }; + + await this.hasura.postSurveySurvey( + cSurvey.uid, + cSurvey.name, + cSurvey.type, + cSurvey.source, + cSurvey.origin + ); + + interface questionInfo { + question: string; + responseType?: {category: string; detail: string}; + generateResponse: () => string; + } + + const cQuestions: questionInfo[] = [ + { + question: 'How often are you using your coding assistant?', + responseType: {category: 'MultipleChoice', detail: 'MultipleChoice'}, + generateResponse: (): string => { + const opts = [ + 'I have not started to use it yet', + 'I used it for some time, but not anymore', + 'Rarely', + 'Frequently', + 'Very Frequently', + ]; + return opts[randomInt(0, opts.length)]; + } + } + ]; + + let qid = 0; + for (const qi of cQuestions) { + const q = { + uid: `question-${qid}`, + source: SOURCE + }; + await this.hasura.postSurveyQuestion( + q.uid, + qi.question, + {category: 'CodingAssistants', detail: 'CodingAssistants'}, + qi.responseType, + SOURCE, + ORIGIN + ); + qid++; + await this.hasura.postSurveyQuestionAssociation(cSurvey, q, ORIGIN); + for (let i = 0; i <= nResponses; i++) { + await this.hasura.postSurveyQuestionResponse( + `response-${i}`, + ORIGIN, + DateTime.now().minus({days: randomInt(0, numWeeks * 7)}), + qi.generateResponse(), + cSurvey, + q + ); + } + } + + + + // PR Surveys + const PRSurvey = { + uid: 'survey-2', + name: 'GitHub Copilot Survey', + type: {category: 'Custom', detail: 'AI Transformation'}, + }; + + // await this.hasura.postSurveySurvey( + // PRSurvey.uid, + // PRSurvey.name, + // PRSurvey.type, + // SOURCE, + // ORIGIN + // ); + + } } From b106dd0901a25f2745ac924c2a6ec8a505e89e4a Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Tue, 5 Nov 2024 11:34:32 -0800 Subject: [PATCH 34/50] add cadence survey questions --- mock-data/src/mockdata.ts | 43 ++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 5ed83cfb..32d8bb58 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -479,7 +479,7 @@ export class MockData { 'Agree', 'Strongly Agree', ]; - + function randArr(arr: any[]): any {return arr[randomInt(0, arr.length)]}; // Cadence Surveys @@ -509,17 +509,36 @@ export class MockData { { question: 'How often are you using your coding assistant?', responseType: {category: 'MultipleChoice', detail: 'MultipleChoice'}, - generateResponse: (): string => { - const opts = [ - 'I have not started to use it yet', - 'I used it for some time, but not anymore', - 'Rarely', - 'Frequently', - 'Very Frequently', - ]; - return opts[randomInt(0, opts.length)]; - } - } + generateResponse: (): string => randArr([ + 'I have not started to use it yet', + 'I used it for some time, but not anymore', + 'Rarely', + 'Frequently', + 'Very Frequently', + ]) + }, + { + question: 'On average how many hours per day did you save ' + + 'in the past week?', + responseType: {category: 'NumericEntry', detail: 'NumericEntry'}, + generateResponse: () => randomInt(0, 10).toString() + }, ...[ + 'Understanding code', + 'Preparing to code', + 'Writing new code', + 'Debugging code', + 'Refactoring code', + 'Reviewing code', + 'Documenting code', + 'Writing tests', + ].map((task) => { + return { + question: 'In the past week, Copilot helped me with the following ' + + `tasks: [${task}]`, + responseType: {category: 'LikertScale', detail: 'LikertScale'}, + generateResponse: () => randArr(likerts), + }; + }) ]; let qid = 0; From 687103c3562333fcb4bc7206099782e092ec8de7 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Tue, 5 Nov 2024 12:02:10 -0800 Subject: [PATCH 35/50] add pr questions and refactor writeQuestions --- mock-data/src/mockdata.ts | 106 +++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 36 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 32d8bb58..63889577 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -505,6 +505,40 @@ export class MockData { generateResponse: () => string; } + async function writeQuestions( + questions: questionInfo[], + survey: any, + hasura: Hasura + ): Promise { + let qid = 0; + for (const qi of questions) { + const q = { + uid: `question-${qid}`, + source: SOURCE + }; + await hasura.postSurveyQuestion( + q.uid, + qi.question, + {category: 'CodingAssistants', detail: 'CodingAssistants'}, + qi.responseType, + SOURCE, + ORIGIN + ); + qid++; + await hasura.postSurveyQuestionAssociation(cSurvey, q, ORIGIN); + for (let i = 0; i <= nResponses; i++) { + await hasura.postSurveyQuestionResponse( + `response-${i}`, + ORIGIN, + DateTime.now().minus({days: randomInt(0, numWeeks * 7)}), + qi.generateResponse(), + survey, + q + ); + } + } + } + const cQuestions: questionInfo[] = [ { question: 'How often are you using your coding assistant?', @@ -540,51 +574,51 @@ export class MockData { }; }) ]; - - let qid = 0; - for (const qi of cQuestions) { - const q = { - uid: `question-${qid}`, - source: SOURCE - }; - await this.hasura.postSurveyQuestion( - q.uid, - qi.question, - {category: 'CodingAssistants', detail: 'CodingAssistants'}, - qi.responseType, - SOURCE, - ORIGIN - ); - qid++; - await this.hasura.postSurveyQuestionAssociation(cSurvey, q, ORIGIN); - for (let i = 0; i <= nResponses; i++) { - await this.hasura.postSurveyQuestionResponse( - `response-${i}`, - ORIGIN, - DateTime.now().minus({days: randomInt(0, numWeeks * 7)}), - qi.generateResponse(), - cSurvey, - q - ); - } - } + await writeQuestions(cQuestions, cSurvey, this.hasura); // PR Surveys - const PRSurvey = { + const prSurvey = { uid: 'survey-2', name: 'GitHub Copilot Survey', type: {category: 'Custom', detail: 'AI Transformation'}, + source: SOURCE, + origin: ORIGIN }; + await this.hasura.postSurveySurvey( + prSurvey.uid, + prSurvey.name, + prSurvey.type, + prSurvey.source, + prSurvey.origin + ); - // await this.hasura.postSurveySurvey( - // PRSurvey.uid, - // PRSurvey.name, - // PRSurvey.type, - // SOURCE, - // ORIGIN - // ); + const prQuestions: questionInfo[] = [ + { + question: + 'Based on your experience, estimate how much total coding time' + + 'you saved using copilot for this PR? (in minutes)', + responseType: {category: 'NumericEntry', detail: 'NumericEntry'}, + generateResponse: () => randomInt(5, 60).toString(), + }, ...[ + 'Be happier in my job', + 'Be more productive', + 'Deal with repetitive tasks', + 'Improve Productivity', + 'Learn new skills', + 'Refactor or debug code', + 'Stay in flow', + 'Write better code', + ].map((task) => { + return { + question: `(optional) Copilot helps me to: [${task}]`, + responseType: {category: 'LikertScale', detail: 'LikertScale'}, + generateResponse: () => randArr(likerts), + }; + }) + ]; + await writeQuestions(prQuestions, prSurvey, this.hasura); } } From 15393be0b801a4f1738d8dc2838b7dae66bc6932 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 6 Nov 2024 13:31:32 -0800 Subject: [PATCH 36/50] fix survey uid and association --- mock-data/src/mockdata.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 63889577..d4d24132 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -505,12 +505,12 @@ export class MockData { generateResponse: () => string; } + let qid = 0; async function writeQuestions( questions: questionInfo[], survey: any, hasura: Hasura ): Promise { - let qid = 0; for (const qi of questions) { const q = { uid: `question-${qid}`, @@ -525,7 +525,7 @@ export class MockData { ORIGIN ); qid++; - await hasura.postSurveyQuestionAssociation(cSurvey, q, ORIGIN); + await hasura.postSurveyQuestionAssociation(survey, q, ORIGIN); for (let i = 0; i <= nResponses; i++) { await hasura.postSurveyQuestionResponse( `response-${i}`, From bab5f4d8c9570b7fe49611df709d077acb67e3fd Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 6 Nov 2024 13:31:55 -0800 Subject: [PATCH 37/50] add surveys dashboard --- .../metabase/dashboards/copilot_surveys.json | 488 ++++++++++++++++++ 1 file changed, 488 insertions(+) create mode 100644 init/resources/metabase/dashboards/copilot_surveys.json diff --git a/init/resources/metabase/dashboards/copilot_surveys.json b/init/resources/metabase/dashboards/copilot_surveys.json new file mode 100644 index 00000000..20a2fd40 --- /dev/null +++ b/init/resources/metabase/dashboards/copilot_surveys.json @@ -0,0 +1,488 @@ +{ + "name": "AI Copilot Evaluation - Surveys", + "cards": [ + { + "name": "AI Transformation Surveys", + "description": null, + "display": "table", + "table_id": {{ table "survey_Survey" }}, + "dataset_query": { + "query": { + "source-table": {{ table "survey_Survey" }}, + "filter": [ + "=", + [ + "field", + {{ field "survey_Survey.typeDetail" }}, + null + ], + "AI Transformation" + ], + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_Survey.id" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation" + }, + { + "fields": "all", + "source-table": {{ table "survey_Question" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ], + [ + "field", + {{ field "survey_Question.id" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "alias": "Survey Question - Question" + } + ], + "breakout": [ + [ + "field", + {{ field "survey_Survey.id" }}, + null + ], + [ + "field", + {{ field "survey_Survey.name" }}, + null + ], + [ + "field", + {{ field "survey_Survey.startedAt" }}, + { + "temporal-unit": "minute" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ] + ], + { + "name": "Question Count", + "display-name": "Question Count" + } + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "table.pivot_column": "startedAt", + "table.cell_column": "Question Count" + } + }, + { + "name": "Survey Responses over Time", + "description": null, + "display": "line", + "table_id": {{ table "survey_QuestionResponse" }}, + "dataset_query": { + "query": { + "source-table": {{ table "survey_QuestionResponse" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.surveyQuestion" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.id" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + }, + { + "fields": "all", + "source-table": {{ table "survey_Survey" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Survey.id" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ], + "alias": "Survey Survey - Survey" + }, + { + "fields": "all", + "source-table": {{ table "survey_Question" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Question.id" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "alias": "Survey Question - Question" + } + ], + "filter": [ + "=", + [ + "field", + {{ field "survey_Survey.typeDetail" }}, + { + "join-alias": "Survey Survey - Survey" + } + ], + "AI Transformation" + ], + "breakout": [ + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + { + "temporal-unit": "week" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "table.pivot_column": "origin", + "table.cell_column": "order", + "graph.dimensions": [ + "submittedAt" + ], + "graph.metrics": [ + "count" + ] + } + }, + { + "name": "Copilot helps me to:", + "description": null, + "display": "row", + "table_id": {{ table "survey_QuestionResponse" }}, + "dataset_query": { + "query": { + "source-table": {{ table "survey_QuestionResponse" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.surveyQuestion" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.id" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + }, + { + "fields": "all", + "source-table": {{ table "survey_Question" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Question.id" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "alias": "Survey Question - Question" + }, + { + "fields": "all", + "source-table": {{ table "survey_Survey" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Survey.id" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ], + "alias": "Survey Survey - Survey" + } + ], + "expressions": { + "Task Type": [ + "regex-match-first", + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ], + "In the past week, Copilot helped me with the following tasks: \\[(.+)\\]" + ], + "Activity": [ + "regex-match-first", + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ], + "\\(optional\\) Copilot helps me to: \\[(.+)\\]" + ], + "all_tasks": [ + "coalesce", + [ + "expression", + "Task Type" + ], + [ + "expression", + "Activity" + ] + ] + }, + "breakout": [ + [ + "expression", + "all_tasks" + ], + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "aggregation": [ + [ + "count" + ] + ], + "filter": [ + "not-null", + [ + "expression", + "all_tasks" + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "series_settings": { + "Strongly Agree": { + "color": "#689636" + }, + "Agree": { + "color": "#A7D07C" + }, + "Strongly Disagree": { + "color": "#E75454" + }, + "Disagree": { + "color": "#EF8C8C" + }, + "Neutral": { + "color": "#F9D45C" + } + }, + "table.pivot_column": "Task Type", + "table.cell_column": "question", + "graph.dimensions": [ + "all_tasks", + "response" + ], + "graph.series_order_dimension": "response", + "graph.series_order": [ + { + "key": "Strongly Disagree", + "color": "#7172AD", + "enabled": true, + "name": "Strongly Disagree" + }, + { + "key": "Disagree", + "color": "#98D9D9", + "enabled": true, + "name": "Disagree" + }, + { + "key": "Neutral", + "color": "#88BF4D", + "enabled": true, + "name": "Neutral" + }, + { + "key": "Agree", + "color": "#F9D45C", + "enabled": true, + "name": "Agree" + }, + { + "key": "Strongly Agree", + "color": "#509EE3", + "enabled": true, + "name": "Strongly Agree" + } + ], + "stackable.stack_type": "stacked", + "graph.metrics": [ + "count" + ] + } + } + ], + "parameters": [ + { + "name": "Date", + "slug": "date", + "id": "15e648d4", + "type": "date/all-options", + "sectionId": "date", + "default": "past3months~" + }, + { + "name": "Team", + "slug": "team", + "id": "56548982", + "type": "string/=", + "sectionId": "string" + }, + { + "name": "Survey Name", + "slug": "survey_name", + "id": "a0143bc7", + "type": "string/=", + "sectionId": "string" + } + ], + "layout": [ + { + "row": 0, + "col": 0, + "sizeX": 13, + "sizeY": 4, + "card_id": {{ card "AI Transformation Surveys" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 0, + "col": 13, + "sizeX": 4, + "sizeY": 3, + "card_id": {{ card "Survey Responses over Time" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + }, + { + "row": 4, + "col": 0, + "sizeX": 11, + "sizeY": 9, + "card_id": {{ card "Copilot helps me to:" }}, + "series": [], + "parameter_mappings": [], + "visualization_settings": {} + } + ], + "path": "/Faros CE/GitHub/Copilot" +} + From 045feb9bd5078f785ef92e53a6a8bd6a80ac40b5 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 6 Nov 2024 13:38:07 -0800 Subject: [PATCH 38/50] add copilot tasks chart and move dashboard folder --- .../metabase/dashboards/copilot_impact.json | 2 +- .../metabase/dashboards/copilot_surveys.json | 75 +++++++++++-------- .../metabase/dashboards/copilot_usage.json | 2 +- 3 files changed, 44 insertions(+), 35 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot_impact.json b/init/resources/metabase/dashboards/copilot_impact.json index 40f8ed35..b897bab3 100644 --- a/init/resources/metabase/dashboards/copilot_impact.json +++ b/init/resources/metabase/dashboards/copilot_impact.json @@ -1436,6 +1436,6 @@ "visualization_settings": {} } ], - "path": "/Faros CE/GitHub/Copilot" + "path": "/Faros CE/AI Copilot Evaluation" } diff --git a/init/resources/metabase/dashboards/copilot_surveys.json b/init/resources/metabase/dashboards/copilot_surveys.json index 20a2fd40..7a93fb06 100644 --- a/init/resources/metabase/dashboards/copilot_surveys.json +++ b/init/resources/metabase/dashboards/copilot_surveys.json @@ -350,7 +350,14 @@ ], "aggregation": [ [ - "count" + "aggregation-options", + [ + "count" + ], + { + "name": "Response Count", + "display-name": "Response Count" + } ] ], "filter": [ @@ -364,66 +371,68 @@ "type": "query" }, "visualization_settings": { - "series_settings": { - "Strongly Agree": { - "color": "#689636" - }, - "Agree": { - "color": "#A7D07C" - }, - "Strongly Disagree": { - "color": "#E75454" - }, - "Disagree": { - "color": "#EF8C8C" - }, - "Neutral": { - "color": "#F9D45C" - } - }, - "table.pivot_column": "Task Type", + "graph.y_axis.title_text": "Response Count", "table.cell_column": "question", - "graph.dimensions": [ - "all_tasks", - "response" - ], "graph.series_order_dimension": "response", + "graph.x_axis.title_text": "Tasks", + "graph.metrics": [ + "Response Count" + ], "graph.series_order": [ { "key": "Strongly Disagree", - "color": "#7172AD", + "color": "#E75454", "enabled": true, "name": "Strongly Disagree" }, { "key": "Disagree", - "color": "#98D9D9", + "color": "#EF8C8C", "enabled": true, "name": "Disagree" }, { "key": "Neutral", - "color": "#88BF4D", + "color": "#F9D45C", "enabled": true, "name": "Neutral" }, { "key": "Agree", - "color": "#F9D45C", + "color": "#A7D07C", "enabled": true, "name": "Agree" }, { "key": "Strongly Agree", - "color": "#509EE3", + "color": "#689636", "enabled": true, "name": "Strongly Agree" } ], - "stackable.stack_type": "stacked", - "graph.metrics": [ - "count" - ] + "table.pivot_column": "Task Type", + "series_settings": { + "Strongly Agree": { + "color": "#689636" + }, + "Agree": { + "color": "#A7D07C" + }, + "Strongly Disagree": { + "color": "#E75454" + }, + "Disagree": { + "color": "#EF8C8C" + }, + "Neutral": { + "color": "#F9D45C" + } + }, + "graph.dimensions": [ + "all_tasks", + "response" + ], + "stackable.stack_type": "stacked" } } ], @@ -483,6 +492,6 @@ "visualization_settings": {} } ], - "path": "/Faros CE/GitHub/Copilot" + "path": "/Faros CE/AI Copilot Evaluation" } diff --git a/init/resources/metabase/dashboards/copilot_usage.json b/init/resources/metabase/dashboards/copilot_usage.json index b75eab8a..355c0377 100644 --- a/init/resources/metabase/dashboards/copilot_usage.json +++ b/init/resources/metabase/dashboards/copilot_usage.json @@ -2408,6 +2408,6 @@ } } ], - "path": "/Faros CE/GitHub/Copilot" + "path": "/Faros CE/AI Copilot Evaluation" } From 51802af96a1653f7c1c3e4a3fa91e8e3978f54dd Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Wed, 6 Nov 2024 14:05:29 -0800 Subject: [PATCH 39/50] time savings --- .../metabase/dashboards/copilot_surveys.json | 245 ++++++++++++++++-- 1 file changed, 224 insertions(+), 21 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot_surveys.json b/init/resources/metabase/dashboards/copilot_surveys.json index 7a93fb06..c760ade1 100644 --- a/init/resources/metabase/dashboards/copilot_surveys.json +++ b/init/resources/metabase/dashboards/copilot_surveys.json @@ -227,6 +227,7 @@ "display": "row", "table_id": {{ table "survey_QuestionResponse" }}, "dataset_query": { + "type": "query", "query": { "source-table": {{ table "survey_QuestionResponse" }}, "joins": [ @@ -361,14 +362,27 @@ ] ], "filter": [ - "not-null", + "and", [ - "expression", - "all_tasks" + "not-null", + [ + "expression", + "all_tasks" + ] + ], + [ + "=", + [ + "field", + {{ field "survey_Question.responseTypeCategory" }}, + { + "join-alias": "Survey Question - Question" + } + ], + "CodingAssistants" ] ] - }, - "type": "query" + } }, "visualization_settings": { "graph.y_axis.title_text": "Response Count", @@ -434,6 +448,91 @@ ], "stackable.stack_type": "stacked" } + }, + { + "name": "Cumulative Time Savings", + "description": null, + "display": "line", + "table_id": null, + "dataset_query": { + "type": "native", + "native": { + "query": "SELECT\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n ) AS \"Submitted At\",\n sum(\n \"public\".\"survey_QuestionResponse\".\"response\" :: integer\n ) AS \"Time Saved (min)\",\n sum(\n sum(\n \"public\".\"survey_QuestionResponse\".\"response\" :: integer\n )\n ) OVER (\n ORDER BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n )\n ) AS \"Cumulative Time Saved (min)\"\nFROM\n \"public\".\"survey_QuestionResponse\"\n LEFT JOIN \"public\".\"survey_SurveyQuestionAssociation\" \"Survey SurveyQuestionAssociation - SurveyQuestion\" ON \"public\".\"survey_QuestionResponse\".\"surveyQuestion\" = \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"id\"\n LEFT JOIN \"public\".\"survey_Question\" \"Survey Question - Question\" ON \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"question\" = \"Survey Question - Question\".\"id\"\n LEFT JOIN \"public\".\"survey_Survey\" \"Survey Survey - Survey\" ON \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"survey\" = \"Survey Survey - Survey\".\"id\"\nWHERE\n (\n \"Survey Question - Question\".\"responseTypeCategory\" = 'CodingAssistants'\n AND (\n \"Survey Question - Question\".\"question\" = 'Based on your experience, estimate how much total coding timeyou saved using copilot for this PR? (in minutes)'\n OR \"Survey Question - Question\".\"question\" = 'On average how many hours per day did you save in the past week?'\n ) [[AND \"Survey Survey - Survey\".\"name\" = <>]]\n )\nGROUP BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n )\nORDER BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n ) ASC", + "template-tags": { + "survey_name": { + "id": "3f790505-ef25-cfdc-1f83-096409adca5d", + "name": "survey_name", + "display-name": "Survey name", + "type": "text" + } + } + } + }, + "visualization_settings": { + "graph.show_trendline": true, + "graph.y_axis.title_text": "Total Time Saved (min)", + "graph.show_values": true, + "table.cell_column": "question", + "graph.series_order_dimension": "response", + "graph.x_axis.title_text": "Response Submitted At", + "graph.metrics": [ + "Cumulative Time Saved (min)" + ], + "graph.series_order": [ + { + "key": "Strongly Disagree", + "color": "#E75454", + "enabled": true, + "name": "Strongly Disagree" + }, + { + "key": "Disagree", + "color": "#EF8C8C", + "enabled": true, + "name": "Disagree" + }, + { + "key": "Neutral", + "color": "#F9D45C", + "enabled": true, + "name": "Neutral" + }, + { + "key": "Agree", + "color": "#A7D07C", + "enabled": true, + "name": "Agree" + }, + { + "key": "Strongly Agree", + "color": "#689636", + "enabled": true, + "name": "Strongly Agree" + } + ], + "table.pivot_column": "Task Type", + "series_settings": { + "Strongly Agree": { + "color": "#689636" + }, + "Agree": { + "color": "#A7D07C" + }, + "Strongly Disagree": { + "color": "#E75454" + }, + "Disagree": { + "color": "#EF8C8C" + }, + "Neutral": { + "color": "#F9D45C" + } + }, + "graph.dimensions": [ + "Submitted At" + ], + "stackable.stack_type": "stacked" + } } ], "parameters": [ @@ -445,13 +544,6 @@ "sectionId": "date", "default": "past3months~" }, - { - "name": "Team", - "slug": "team", - "id": "56548982", - "type": "string/=", - "sectionId": "string" - }, { "name": "Survey Name", "slug": "survey_name", @@ -468,27 +560,138 @@ "sizeY": 4, "card_id": {{ card "AI Transformation Surveys" }}, "series": [], - "parameter_mappings": [], - "visualization_settings": {} + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "AI Transformation Surveys" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + null + ] + ] + } + ], + "visualization_settings": { + "column_settings": { + "[\"ref\",[\"field\",{{ field "survey_Survey.name" }},null]]": { + "click_behavior": { + "type": "crossfilter", + "parameterMapping": { + "a0143bc7": { + "source": { + "type": "column", + "id": "name", + "name": "Name" + }, + "target": { + "type": "parameter", + "id": "a0143bc7" + }, + "id": "a0143bc7" + } + } + } + } + } + } }, { - "row": 0, - "col": 13, - "sizeX": 4, - "sizeY": 3, + "row": 4, + "col": 0, + "sizeX": 12, + "sizeY": 5, "card_id": {{ card "Survey Responses over Time" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "15e648d4", + "card_id": {{ card "Survey Responses over Time" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + null + ] + ] + }, + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Survey Responses over Time" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + } + ], "visualization_settings": {} }, { - "row": 4, + "row": 14, "col": 0, "sizeX": 11, "sizeY": 9, "card_id": {{ card "Copilot helps me to:" }}, "series": [], - "parameter_mappings": [], + "parameter_mappings": [ + { + "parameter_id": "15e648d4", + "card_id": {{ card "Copilot helps me to:" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + null + ] + ] + }, + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Copilot helps me to:" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 9, + "col": 0, + "sizeX": 12, + "sizeY": 5, + "card_id": {{ card "Cumulative Time Savings" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Cumulative Time Savings" }}, + "target": [ + "variable", + [ + "template-tag", + "survey_name" + ] + ] + } + ], "visualization_settings": {} } ], From e04273afd134aab961c176547e05139fc6b7d6f8 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 08:19:12 -0800 Subject: [PATCH 40/50] tasks and activity charts --- .../metabase/dashboards/copilot_surveys.json | 297 +++++++++++++++--- 1 file changed, 259 insertions(+), 38 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot_surveys.json b/init/resources/metabase/dashboards/copilot_surveys.json index c760ade1..194d7192 100644 --- a/init/resources/metabase/dashboards/copilot_surveys.json +++ b/init/resources/metabase/dashboards/copilot_surveys.json @@ -227,7 +227,6 @@ "display": "row", "table_id": {{ table "survey_QuestionResponse" }}, "dataset_query": { - "type": "query", "query": { "source-table": {{ table "survey_QuestionResponse" }}, "joins": [ @@ -297,17 +296,6 @@ } ], "expressions": { - "Task Type": [ - "regex-match-first", - [ - "field", - {{ field "survey_Question.question" }}, - { - "join-alias": "Survey Question - Question" - } - ], - "In the past week, Copilot helped me with the following tasks: \\[(.+)\\]" - ], "Activity": [ "regex-match-first", [ @@ -318,24 +306,9 @@ } ], "\\(optional\\) Copilot helps me to: \\[(.+)\\]" - ], - "all_tasks": [ - "coalesce", - [ - "expression", - "Task Type" - ], - [ - "expression", - "Activity" - ] ] }, "breakout": [ - [ - "expression", - "all_tasks" - ], [ "field", {{ field "survey_QuestionResponse.response" }}, @@ -347,6 +320,10 @@ { "join-alias": "Survey Question - Question" } + ], + [ + "expression", + "Activity" ] ], "aggregation": [ @@ -363,13 +340,6 @@ ], "filter": [ "and", - [ - "not-null", - [ - "expression", - "all_tasks" - ] - ], [ "=", [ @@ -380,9 +350,17 @@ } ], "CodingAssistants" + ], + [ + "not-empty", + [ + "expression", + "Activity" + ] ] ] - } + }, + "type": "query" }, "visualization_settings": { "graph.y_axis.title_text": "Response Count", @@ -443,7 +421,7 @@ } }, "graph.dimensions": [ - "all_tasks", + "Activity", "response" ], "stackable.stack_type": "stacked" @@ -533,6 +511,212 @@ ], "stackable.stack_type": "stacked" } + }, + { + "name": "Copilot helped me with the following tasks", + "description": null, + "display": "row", + "table_id": {{ table "survey_QuestionResponse" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "survey_QuestionResponse" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.surveyQuestion" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.id" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + }, + { + "fields": "all", + "source-table": {{ table "survey_Question" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Question.id" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "alias": "Survey Question - Question" + }, + { + "fields": "all", + "source-table": {{ table "survey_Survey" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Survey.id" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ], + "alias": "Survey Survey - Survey" + } + ], + "expressions": { + "Task Type": [ + "regex-match-first", + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ], + "In the past week, Copilot helped me with the following tasks: \\[(.+)\\]" + ] + }, + "breakout": [ + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ], + [ + "expression", + "Task Type" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "count" + ], + { + "name": "Response Count", + "display-name": "Response Count" + } + ] + ], + "filter": [ + "and", + [ + "=", + [ + "field", + {{ field "survey_Question.responseTypeCategory" }}, + { + "join-alias": "Survey Question - Question" + } + ], + "CodingAssistants" + ], + [ + "not-empty", + [ + "expression", + "Task Type" + ] + ] + ] + } + }, + "visualization_settings": { + "graph.y_axis.title_text": "Response Count", + "table.cell_column": "question", + "graph.series_order_dimension": "response", + "graph.x_axis.title_text": "Tasks", + "graph.metrics": [ + "Response Count" + ], + "graph.series_order": [ + { + "key": "Strongly Disagree", + "color": "#E75454", + "enabled": true, + "name": "Strongly Disagree" + }, + { + "key": "Disagree", + "color": "#EF8C8C", + "enabled": true, + "name": "Disagree" + }, + { + "key": "Neutral", + "color": "#F9D45C", + "enabled": true, + "name": "Neutral" + }, + { + "key": "Agree", + "color": "#A7D07C", + "enabled": true, + "name": "Agree" + }, + { + "key": "Strongly Agree", + "color": "#689636", + "enabled": true, + "name": "Strongly Agree" + } + ], + "table.pivot_column": "Task Type", + "series_settings": { + "Strongly Agree": { + "color": "#689636" + }, + "Agree": { + "color": "#A7D07C" + }, + "Strongly Disagree": { + "color": "#E75454" + }, + "Disagree": { + "color": "#EF8C8C" + }, + "Neutral": { + "color": "#F9D45C" + } + }, + "graph.dimensions": [ + "Task Type", + "response" + ], + "stackable.stack_type": "stacked" + } } ], "parameters": [ @@ -638,8 +822,8 @@ { "row": 14, "col": 0, - "sizeX": 11, - "sizeY": 9, + "sizeX": 13, + "sizeY": 5, "card_id": {{ card "Copilot helps me to:" }}, "series": [], "parameter_mappings": [ @@ -693,6 +877,43 @@ } ], "visualization_settings": {} + }, + { + "row": 19, + "col": 0, + "sizeX": 13, + "sizeY": 5, + "card_id": {{ card "Copilot helped me with the following tasks" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "15e648d4", + "card_id": {{ card "Copilot helped me with the following tasks" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + null + ] + ] + }, + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Copilot helped me with the following tasks" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + } + ], + "visualization_settings": {} } ], "path": "/Faros CE/AI Copilot Evaluation" From e3318e56b8949d8f9c56b6ebcf5701585c0606ad Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 10:49:27 -0800 Subject: [PATCH 41/50] align filters --- .../metabase/dashboards/copilot_surveys.json | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot_surveys.json b/init/resources/metabase/dashboards/copilot_surveys.json index 194d7192..6ad7510a 100644 --- a/init/resources/metabase/dashboards/copilot_surveys.json +++ b/init/resources/metabase/dashboards/copilot_surveys.json @@ -340,23 +340,23 @@ ], "filter": [ "and", + [ + "not-empty", + [ + "expression", + "Activity" + ] + ], [ "=", [ "field", - {{ field "survey_Question.responseTypeCategory" }}, + {{ field "survey_Survey.typeDetail" }}, { - "join-alias": "Survey Question - Question" + "join-alias": "Survey Survey - Survey" } ], - "CodingAssistants" - ], - [ - "not-empty", - [ - "expression", - "Activity" - ] + "AI Transformation" ] ] }, @@ -366,7 +366,7 @@ "graph.y_axis.title_text": "Response Count", "table.cell_column": "question", "graph.series_order_dimension": "response", - "graph.x_axis.title_text": "Tasks", + "graph.x_axis.title_text": "Activity", "graph.metrics": [ "Response Count" ], @@ -518,7 +518,6 @@ "display": "row", "table_id": {{ table "survey_QuestionResponse" }}, "dataset_query": { - "type": "query", "query": { "source-table": {{ table "survey_QuestionResponse" }}, "joins": [ @@ -632,26 +631,27 @@ ], "filter": [ "and", + [ + "not-empty", + [ + "expression", + "Task Type" + ] + ], [ "=", [ "field", - {{ field "survey_Question.responseTypeCategory" }}, + {{ field "survey_Survey.typeDetail" }}, { - "join-alias": "Survey Question - Question" + "join-alias": "Survey Survey - Survey" } ], - "CodingAssistants" - ], - [ - "not-empty", - [ - "expression", - "Task Type" - ] + "AI Transformation" ] ] - } + }, + "type": "query" }, "visualization_settings": { "graph.y_axis.title_text": "Response Count", From 875ce66fddbc327b2e9535e602766651fe8990a8 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 12:09:02 -0800 Subject: [PATCH 42/50] fix space --- mock-data/src/mockdata.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index d4d24132..df2db76a 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -597,7 +597,7 @@ export class MockData { const prQuestions: questionInfo[] = [ { question: - 'Based on your experience, estimate how much total coding time' + + 'Based on your experience, estimate how much total coding time ' + 'you saved using copilot for this PR? (in minutes)', responseType: {category: 'NumericEntry', detail: 'NumericEntry'}, generateResponse: () => randomInt(5, 60).toString(), From 1e898257ad0dc8bcc081eda92abf225505e49046 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 12:09:22 -0800 Subject: [PATCH 43/50] fix sql charts, add summary numbers, fix layout --- .../metabase/dashboards/copilot_surveys.json | 1615 +++++++++++++++-- 1 file changed, 1476 insertions(+), 139 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot_surveys.json b/init/resources/metabase/dashboards/copilot_surveys.json index 6ad7510a..a9427bf0 100644 --- a/init/resources/metabase/dashboards/copilot_surveys.json +++ b/init/resources/metabase/dashboards/copilot_surveys.json @@ -7,6 +7,7 @@ "display": "table", "table_id": {{ table "survey_Survey" }}, "dataset_query": { + "type": "query", "query": { "source-table": {{ table "survey_Survey" }}, "filter": [ @@ -60,6 +61,28 @@ ] ], "alias": "Survey Question - Question" + }, + { + "fields": "all", + "source-table": {{ table "survey_QuestionResponse" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.id" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ], + [ + "field", + {{ field "survey_QuestionResponse.surveyQuestion" }}, + { + "join-alias": "Survey QuestionResponse" + } + ] + ], + "alias": "Survey QuestionResponse" } ], "breakout": [ @@ -98,10 +121,26 @@ "name": "Question Count", "display-name": "Question Count" } + ], + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "survey_QuestionResponse.id" }}, + { + "join-alias": "Survey QuestionResponse" + } + ] + ], + { + "name": "Response Count", + "display-name": "Response Count" + } ] ] - }, - "type": "query" + } }, "visualization_settings": { "table.pivot_column": "startedAt", @@ -227,6 +266,7 @@ "display": "row", "table_id": {{ table "survey_QuestionResponse" }}, "dataset_query": { + "type": "query", "query": { "source-table": {{ table "survey_QuestionResponse" }}, "joins": [ @@ -358,9 +398,17 @@ ], "AI Transformation" ] + ], + "order-by": [ + [ + "asc", + [ + "expression", + "Activity" + ] + ] ] - }, - "type": "query" + } }, "visualization_settings": { "graph.y_axis.title_text": "Response Count", @@ -435,7 +483,7 @@ "dataset_query": { "type": "native", "native": { - "query": "SELECT\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n ) AS \"Submitted At\",\n sum(\n \"public\".\"survey_QuestionResponse\".\"response\" :: integer\n ) AS \"Time Saved (min)\",\n sum(\n sum(\n \"public\".\"survey_QuestionResponse\".\"response\" :: integer\n )\n ) OVER (\n ORDER BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n )\n ) AS \"Cumulative Time Saved (min)\"\nFROM\n \"public\".\"survey_QuestionResponse\"\n LEFT JOIN \"public\".\"survey_SurveyQuestionAssociation\" \"Survey SurveyQuestionAssociation - SurveyQuestion\" ON \"public\".\"survey_QuestionResponse\".\"surveyQuestion\" = \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"id\"\n LEFT JOIN \"public\".\"survey_Question\" \"Survey Question - Question\" ON \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"question\" = \"Survey Question - Question\".\"id\"\n LEFT JOIN \"public\".\"survey_Survey\" \"Survey Survey - Survey\" ON \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"survey\" = \"Survey Survey - Survey\".\"id\"\nWHERE\n (\n \"Survey Question - Question\".\"responseTypeCategory\" = 'CodingAssistants'\n AND (\n \"Survey Question - Question\".\"question\" = 'Based on your experience, estimate how much total coding timeyou saved using copilot for this PR? (in minutes)'\n OR \"Survey Question - Question\".\"question\" = 'On average how many hours per day did you save in the past week?'\n ) [[AND \"Survey Survey - Survey\".\"name\" = <>]]\n )\nGROUP BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n )\nORDER BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n ) ASC", + "query": "SELECT\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n ) AS \"Submitted At\",\n sum(\n CASE\n WHEN \"Survey Question - Question\".\"question\" = 'Based on your experience, estimate how much total coding time you saved using copilot for this PR? (in minutes)' THEN (\n \"public\".\"survey_QuestionResponse\".\"response\" :: float\n ) / 60\n WHEN \"Survey Question - Question\".\"question\" = 'On average how many hours per day did you save in the past week?' THEN (\n \"public\".\"survey_QuestionResponse\".\"response\" :: float\n ) * 5\n END\n ) AS \"Time Saved hours\",\n sum(\n sum(\n CASE\n WHEN \"Survey Question - Question\".\"question\" = 'Based on your experience, estimate how much total coding time you saved using copilot for this PR? (in minutes)' THEN (\n \"public\".\"survey_QuestionResponse\".\"response\" :: float\n ) / 60\n WHEN \"Survey Question - Question\".\"question\" = 'On average how many hours per day did you save in the past week?' THEN (\n \"public\".\"survey_QuestionResponse\".\"response\" :: float\n ) * 5\n END\n )\n ) OVER (\n ORDER BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n )\n ) AS \"Cumulative Time Saved hours\"\nFROM\n \"public\".\"survey_QuestionResponse\"\n LEFT JOIN \"public\".\"survey_SurveyQuestionAssociation\" \"Survey SurveyQuestionAssociation - SurveyQuestion\" ON \"public\".\"survey_QuestionResponse\".\"surveyQuestion\" = \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"id\"\n LEFT JOIN \"public\".\"survey_Question\" \"Survey Question - Question\" ON \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"question\" = \"Survey Question - Question\".\"id\"\n LEFT JOIN \"public\".\"survey_Survey\" \"Survey Survey - Survey\" ON \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"survey\" = \"Survey Survey - Survey\".\"id\"\nWHERE\n (\n \"Survey Question - Question\".\"responseTypeCategory\" = 'CodingAssistants'\n AND (\n \"Survey Question - Question\".\"question\" = 'Based on your experience, estimate how much total coding time you saved using copilot for this PR? (in minutes)'\n OR \"Survey Question - Question\".\"question\" = 'On average how many hours per day did you save in the past week?'\n ) [[AND \"Survey Survey - Survey\".\"name\" = <>]]\n )\nGROUP BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n )\nORDER BY\n (\n CAST(\n date_trunc(\n 'week',\n (\n \"public\".\"survey_QuestionResponse\".\"submittedAt\" + (INTERVAL '1 day')\n )\n ) AS timestamp\n ) + (INTERVAL '-1 day')\n ) ASC", "template-tags": { "survey_name": { "id": "3f790505-ef25-cfdc-1f83-096409adca5d", @@ -448,13 +496,13 @@ }, "visualization_settings": { "graph.show_trendline": true, - "graph.y_axis.title_text": "Total Time Saved (min)", + "graph.y_axis.title_text": "Total Time Saved", "graph.show_values": true, "table.cell_column": "question", "graph.series_order_dimension": "response", "graph.x_axis.title_text": "Response Submitted At", "graph.metrics": [ - "Cumulative Time Saved (min)" + "Cumulative Time Saved hours" ], "graph.series_order": [ { @@ -489,6 +537,15 @@ } ], "table.pivot_column": "Task Type", + "column_settings": { + "[\"name\",\"Cumulative Time Saved hours\"]": { + "prefix": "", + "suffix": " h" + }, + "[\"name\",\"Time Saved hours\"]": { + "suffix": " h" + } + }, "series_settings": { "Strongly Agree": { "color": "#689636" @@ -518,6 +575,7 @@ "display": "row", "table_id": {{ table "survey_QuestionResponse" }}, "dataset_query": { + "type": "query", "query": { "source-table": {{ table "survey_QuestionResponse" }}, "joins": [ @@ -649,9 +707,17 @@ ], "AI Transformation" ] + ], + "order-by": [ + [ + "asc", + [ + "expression", + "Task Type" + ] + ] ] - }, - "type": "query" + } }, "visualization_settings": { "graph.y_axis.title_text": "Response Count", @@ -717,156 +783,1096 @@ ], "stackable.stack_type": "stacked" } - } - ], - "parameters": [ - { - "name": "Date", - "slug": "date", - "id": "15e648d4", - "type": "date/all-options", - "sectionId": "date", - "default": "past3months~" }, { - "name": "Survey Name", - "slug": "survey_name", - "id": "a0143bc7", - "type": "string/=", - "sectionId": "string" - } - ], - "layout": [ - { - "row": 0, - "col": 0, - "sizeX": 13, - "sizeY": 4, - "card_id": {{ card "AI Transformation Surveys" }}, - "series": [], - "parameter_mappings": [ - { - "parameter_id": "a0143bc7", - "card_id": {{ card "AI Transformation Surveys" }}, - "target": [ - "dimension", + "name": "Number of Surveys", + "description": null, + "display": "scalar", + "table_id": {{ table "survey_Survey" }}, + "dataset_query": { + "query": { + "source-table": {{ table "survey_Survey" }}, + "filter": [ + "=", [ "field", - {{ field "survey_Survey.name" }}, + {{ field "survey_Survey.typeDetail" }}, null - ] - ] - } - ], - "visualization_settings": { - "column_settings": { - "[\"ref\",[\"field\",{{ field "survey_Survey.name" }},null]]": { - "click_behavior": { - "type": "crossfilter", - "parameterMapping": { - "a0143bc7": { - "source": { - "type": "column", - "id": "name", - "name": "Name" - }, - "target": { - "type": "parameter", - "id": "a0143bc7" - }, - "id": "a0143bc7" - } - } - } - } - } - } - }, - { - "row": 4, - "col": 0, - "sizeX": 12, - "sizeY": 5, - "card_id": {{ card "Survey Responses over Time" }}, - "series": [], - "parameter_mappings": [ - { - "parameter_id": "15e648d4", - "card_id": {{ card "Survey Responses over Time" }}, - "target": [ - "dimension", + ], + "AI Transformation" + ], + "aggregation": [ [ - "field", - {{ field "survey_QuestionResponse.submittedAt" }}, - null + "count" ] ] }, - { - "parameter_id": "a0143bc7", - "card_id": {{ card "Survey Responses over Time" }}, - "target": [ - "dimension", - [ - "field", - {{ field "survey_Survey.name" }}, - { - "join-alias": "Survey Survey - Survey" - } - ] - ] - } - ], + "type": "query" + }, "visualization_settings": {} }, { - "row": 14, - "col": 0, - "sizeX": 13, - "sizeY": 5, - "card_id": {{ card "Copilot helps me to:" }}, - "series": [], - "parameter_mappings": [ - { - "parameter_id": "15e648d4", - "card_id": {{ card "Copilot helps me to:" }}, - "target": [ - "dimension", - [ - "field", - {{ field "survey_QuestionResponse.submittedAt" }}, - null - ] - ] - }, - { - "parameter_id": "a0143bc7", - "card_id": {{ card "Copilot helps me to:" }}, - "target": [ - "dimension", + "name": "Number of Questions Asked", + "description": null, + "display": "scalar", + "table_id": {{ table "survey_Question" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "survey_Question" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_Question.id" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation" + }, + { + "fields": "all", + "source-table": {{ table "survey_Survey" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ], + [ + "field", + {{ field "survey_Survey.id" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ], + "alias": "Survey Survey - Survey" + } + ], + "filter": [ + "=", [ "field", - {{ field "survey_Survey.name" }}, + {{ field "survey_Survey.typeDetail" }}, { "join-alias": "Survey Survey - Survey" } + ], + "AI Transformation" + ], + "aggregation": [ + [ + "count" ] ] } - ], + }, "visualization_settings": {} }, { - "row": 9, - "col": 0, - "sizeX": 12, - "sizeY": 5, - "card_id": {{ card "Cumulative Time Savings" }}, - "series": [], - "parameter_mappings": [ - { - "parameter_id": "a0143bc7", - "card_id": {{ card "Cumulative Time Savings" }}, + "name": "Survey Response Count", + "description": null, + "display": "scalar", + "table_id": {{ table "survey_QuestionResponse" }}, + "dataset_query": { + "query": { + "source-table": {{ table "survey_QuestionResponse" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.surveyQuestion" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.id" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + }, + { + "fields": "all", + "source-table": {{ table "survey_Survey" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Survey.id" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ], + "alias": "Survey Survey - Survey" + }, + { + "fields": "all", + "source-table": {{ table "survey_Question" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Question.id" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "alias": "Survey Question - Question" + } + ], + "filter": [ + "=", + [ + "field", + {{ field "survey_Survey.typeDetail" }}, + { + "join-alias": "Survey Survey - Survey" + } + ], + "AI Transformation" + ], + "aggregation": [ + [ + "count" + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "table.pivot_column": "origin", + "table.cell_column": "order", + "graph.dimensions": [ + "submittedAt" + ], + "graph.metrics": [ + "count" + ] + } + }, + { + "name": "Survey Questions", + "description": null, + "display": "table", + "table_id": {{ table "survey_Survey" }}, + "dataset_query": { + "query": { + "source-table": {{ table "survey_Survey" }}, + "filter": [ + "=", + [ + "field", + {{ field "survey_Survey.typeDetail" }}, + null + ], + "AI Transformation" + ], + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_Survey.id" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation" + }, + { + "fields": "all", + "source-table": {{ table "survey_Question" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ], + [ + "field", + {{ field "survey_Question.id" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "alias": "Survey Question - Question" + }, + { + "fields": "all", + "source-table": {{ table "survey_QuestionResponse" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.id" }}, + { + "join-alias": "Survey SurveyQuestionAssociation" + } + ], + [ + "field", + {{ field "survey_QuestionResponse.surveyQuestion" }}, + { + "join-alias": "Survey QuestionResponse" + } + ] + ], + "alias": "Survey QuestionResponse" + } + ], + "breakout": [ + [ + "field", + {{ field "survey_Survey.name" }}, + null + ], + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "survey_QuestionResponse.id" }}, + { + "join-alias": "Survey QuestionResponse" + } + ] + ], + { + "name": "Response Count", + "display-name": "Response Count" + } + ], + [ + "aggregation-options", + [ + "distinct", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + { + "join-alias": "Survey QuestionResponse" + } + ] + ], + { + "name": "Unique Responses", + "display-name": "Unique Responses" + } + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "table.pivot_column": "startedAt", + "table.cell_column": "Question Count", + "pivot_table.column_split": { + "rows": [ + [ + "field", + {{ field "survey_Survey.name" }}, + null + ], + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "columns": [], + "values": [ + [ + "aggregation", + 0 + ], + [ + "aggregation", + 1 + ] + ] + }, + "column_settings": { + "[\"ref\",[\"field\",{{ field "survey_Survey.name" }},null]]": { + "pivot_table.column_show_totals": false, + "column_title": "Survey Name" + }, + "[\"ref\",[\"field\",{{ field "survey_Question.question" }},null]]": { + "column_title": "Question" + } + } + } + }, + { + "name": "Net Promoter Score - Tasks", + "description": "Net Promoter Score is the difference between \"Agree\" responses and \"Disagree\" responses as a percentage of total responses.", + "display": "table", + "table_id": {{ table "survey_QuestionResponse" }}, + "dataset_query": { + "query": { + "source-table": {{ table "survey_QuestionResponse" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.surveyQuestion" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.id" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + }, + { + "fields": "all", + "source-table": {{ table "survey_Question" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Question.id" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "alias": "Survey Question - Question" + }, + { + "fields": "all", + "source-table": {{ table "survey_Survey" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Survey.id" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ], + "alias": "Survey Survey - Survey" + } + ], + "expressions": { + "Task Type": [ + "regex-match-first", + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ], + "In the past week, Copilot helped me with the following tasks: \\[(.+)\\]" + ] + }, + "breakout": [ + [ + "expression", + "Task Type" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "/", + [ + "-", + [ + "count-where", + [ + "or", + [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + "Strongly Agree" + ], + [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + "Agree" + ] + ] + ], + [ + "count-where", + [ + "or", + [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + "Strongly Disagree" + ], + [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + "Disagree" + ] + ] + ] + ], + [ + "count" + ] + ], + { + "name": "Net Promtoer Score", + "display-name": "Net Promtoer Score" + } + ] + ], + "filter": [ + "and", + [ + "not-empty", + [ + "expression", + "Task Type" + ] + ], + [ + "=", + [ + "field", + {{ field "survey_Survey.typeDetail" }}, + { + "join-alias": "Survey Survey - Survey" + } + ], + "AI Transformation" + ] + ], + "order-by": [ + [ + "asc", + [ + "expression", + "Task Type" + ] + ] + ] + }, + "type": "query" + }, + "visualization_settings": { + "graph.y_axis.title_text": "Net Promoter Score", + "table.cell_column": "question", + "graph.series_order_dimension": "response", + "graph.x_axis.title_text": "Tasks", + "graph.metrics": [ + "Net Promtoer Score" + ], + "graph.series_order": [ + { + "key": "Strongly Disagree", + "color": "#E75454", + "enabled": true, + "name": "Strongly Disagree" + }, + { + "key": "Disagree", + "color": "#EF8C8C", + "enabled": true, + "name": "Disagree" + }, + { + "key": "Neutral", + "color": "#F9D45C", + "enabled": true, + "name": "Neutral" + }, + { + "key": "Agree", + "color": "#A7D07C", + "enabled": true, + "name": "Agree" + }, + { + "key": "Strongly Agree", + "color": "#689636", + "enabled": true, + "name": "Strongly Agree" + } + ], + "table.pivot_column": "Task Type", + "column_settings": { + "[\"name\",\"Net Promtoer Score\"]": { + "number_style": "percent", + "decimals": 1, + "show_mini_bar": true + } + }, + "series_settings": { + "Strongly Agree": { + "color": "#689636" + }, + "Agree": { + "color": "#A7D07C" + }, + "Strongly Disagree": { + "color": "#E75454" + }, + "Disagree": { + "color": "#EF8C8C" + }, + "Neutral": { + "color": "#F9D45C" + } + }, + "graph.dimensions": [ + "Task Type" + ], + "stackable.stack_type": "stacked" + } + }, + { + "name": "Net Promoter Score - Activity", + "description": "Net Promoter Score is the difference between \"Agree\" responses and \"Disagree\" responses as a percentage of total responses.", + "display": "table", + "table_id": {{ table "survey_QuestionResponse" }}, + "dataset_query": { + "type": "query", + "query": { + "source-table": {{ table "survey_QuestionResponse" }}, + "joins": [ + { + "fields": "all", + "source-table": {{ table "survey_SurveyQuestionAssociation" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.surveyQuestion" }}, + null + ], + [ + "field", + {{ field "survey_SurveyQuestionAssociation.id" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ] + ], + "alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + }, + { + "fields": "all", + "source-table": {{ table "survey_Question" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.question" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Question.id" }}, + { + "join-alias": "Survey Question - Question" + } + ] + ], + "alias": "Survey Question - Question" + }, + { + "fields": "all", + "source-table": {{ table "survey_Survey" }}, + "condition": [ + "=", + [ + "field", + {{ field "survey_SurveyQuestionAssociation.survey" }}, + { + "join-alias": "Survey SurveyQuestionAssociation - SurveyQuestion" + } + ], + [ + "field", + {{ field "survey_Survey.id" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ], + "alias": "Survey Survey - Survey" + } + ], + "expressions": { + "Activity": [ + "regex-match-first", + [ + "field", + {{ field "survey_Question.question" }}, + { + "join-alias": "Survey Question - Question" + } + ], + "\\(optional\\) Copilot helps me to: \\[(.+)\\]" + ] + }, + "breakout": [ + [ + "expression", + "Activity" + ] + ], + "aggregation": [ + [ + "aggregation-options", + [ + "/", + [ + "-", + [ + "count-where", + [ + "or", + [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + "Strongly Agree" + ], + [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + "Agree" + ] + ] + ], + [ + "count-where", + [ + "or", + [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + "Strongly Disagree" + ], + [ + "=", + [ + "field", + {{ field "survey_QuestionResponse.response" }}, + null + ], + "Disagree" + ] + ] + ] + ], + [ + "count" + ] + ], + { + "name": "Net Promoter Score", + "display-name": "Net Promoter Score" + } + ] + ], + "filter": [ + "and", + [ + "not-empty", + [ + "expression", + "Activity" + ] + ], + [ + "=", + [ + "field", + {{ field "survey_Survey.typeDetail" }}, + { + "join-alias": "Survey Survey - Survey" + } + ], + "AI Transformation" + ] + ], + "order-by": [ + [ + "asc", + [ + "expression", + "Activity" + ] + ] + ] + } + }, + "visualization_settings": { + "graph.y_axis.title_text": "Response Count", + "table.cell_column": "question", + "graph.series_order_dimension": "response", + "graph.x_axis.title_text": "Activity", + "graph.metrics": [ + "Response Count", + "Net Promoter Score" + ], + "table.column_formatting": [], + "graph.series_order": [ + { + "key": "Strongly Disagree", + "color": "#E75454", + "enabled": true, + "name": "Strongly Disagree" + }, + { + "key": "Disagree", + "color": "#EF8C8C", + "enabled": true, + "name": "Disagree" + }, + { + "key": "Neutral", + "color": "#F9D45C", + "enabled": true, + "name": "Neutral" + }, + { + "key": "Agree", + "color": "#A7D07C", + "enabled": true, + "name": "Agree" + }, + { + "key": "Strongly Agree", + "color": "#689636", + "enabled": true, + "name": "Strongly Agree" + } + ], + "table.pivot_column": "Task Type", + "column_settings": { + "[\"name\",\"Net Promoter Score\"]": { + "show_mini_bar": true, + "number_style": "percent", + "decimals": 1 + } + }, + "series_settings": { + "Strongly Agree": { + "color": "#689636" + }, + "Agree": { + "color": "#A7D07C" + }, + "Strongly Disagree": { + "color": "#E75454" + }, + "Disagree": { + "color": "#EF8C8C" + }, + "Neutral": { + "color": "#F9D45C" + } + }, + "graph.dimensions": [ + "Activity", + "response" + ], + "stackable.stack_type": "stacked" + } + }, + { + "name": "Total Time Saved (hours)", + "description": null, + "display": "scalar", + "table_id": null, + "dataset_query": { + "type": "native", + "native": { + "query": "SELECT\n sum(\n CASE\n WHEN \"Survey Question - Question\".\"question\" = 'Based on your experience, estimate how much total coding time you saved using copilot for this PR? (in minutes)' THEN (\n \"public\".\"survey_QuestionResponse\".\"response\" :: float\n ) / 60\n WHEN \"Survey Question - Question\".\"question\" = 'On average how many hours per day did you save in the past week?' THEN (\n \"public\".\"survey_QuestionResponse\".\"response\" :: float\n ) * 5\n END\n ) AS \"Total Time Saved\"\nFROM\n \"public\".\"survey_QuestionResponse\"\n LEFT JOIN \"public\".\"survey_SurveyQuestionAssociation\" \"Survey SurveyQuestionAssociation - SurveyQuestion\" ON \"public\".\"survey_QuestionResponse\".\"surveyQuestion\" = \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"id\"\n LEFT JOIN \"public\".\"survey_Survey\" \"Survey Survey - Survey\" ON \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"survey\" = \"Survey Survey - Survey\".\"id\"\n LEFT JOIN \"public\".\"survey_Question\" \"Survey Question - Question\" ON \"Survey SurveyQuestionAssociation - SurveyQuestion\".\"question\" = \"Survey Question - Question\".\"id\"\nWHERE\n (\n \"Survey Survey - Survey\".\"typeDetail\" = 'AI Transformation'\n AND (\n \"Survey Question - Question\".\"question\" = 'Based on your experience, estimate how much total coding time you saved using copilot for this PR? (in minutes)'\n OR \"Survey Question - Question\".\"question\" = 'On average how many hours per day did you save in the past week?'\n )\n [[AND \"Survey Survey - Survey\".\"name\" = <>]]\n )", + "template-tags": { + "survey_name": { + "id": "fc334638-6a77-7ed6-fc8d-f2c943fe5452", + "name": "survey_name", + "display-name": "Survey name", + "type": "text" + } + } + } + }, + "visualization_settings": { + "table.pivot_column": "origin", + "table.cell_column": "order", + "graph.dimensions": [ + "submittedAt" + ], + "graph.metrics": [ + "count" + ] + } + } + ], + "parameters": [ + { + "name": "Date", + "slug": "date", + "id": "15e648d4", + "type": "date/all-options", + "sectionId": "date", + "default": "past3months~" + }, + { + "name": "Survey Name", + "slug": "survey_name", + "id": "a0143bc7", + "type": "string/=", + "sectionId": "string" + } + ], + "layout": [ + { + "row": 1, + "col": 4, + "sizeX": 14, + "sizeY": 4, + "card_id": {{ card "AI Transformation Surveys" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "AI Transformation Surveys" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + null + ] + ] + } + ], + "visualization_settings": { + "column_settings": { + "[\"ref\",[\"field\",{{ field "survey_Survey.name" }},null]]": { + "click_behavior": { + "type": "crossfilter", + "parameterMapping": { + "a0143bc7": { + "source": { + "type": "column", + "id": "name", + "name": "Name" + }, + "target": { + "type": "parameter", + "id": "a0143bc7" + }, + "id": "a0143bc7" + } + } + } + } + } + } + }, + { + "row": 10, + "col": 5, + "sizeX": 13, + "sizeY": 5, + "card_id": {{ card "Survey Responses over Time" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "15e648d4", + "card_id": {{ card "Survey Responses over Time" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + null + ] + ] + }, + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Survey Responses over Time" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 30, + "col": 5, + "sizeX": 13, + "sizeY": 7, + "card_id": {{ card "Copilot helps me to:" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "15e648d4", + "card_id": {{ card "Copilot helps me to:" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + null + ] + ] + }, + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Copilot helps me to:" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 16, + "col": 5, + "sizeX": 13, + "sizeY": 5, + "card_id": {{ card "Cumulative Time Savings" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Cumulative Time Savings" }}, "target": [ "variable", [ @@ -879,10 +1885,10 @@ "visualization_settings": {} }, { - "row": 19, - "col": 0, + "row": 22, + "col": 5, "sizeX": 13, - "sizeY": 5, + "sizeY": 7, "card_id": {{ card "Copilot helped me with the following tasks" }}, "series": [], "parameter_mappings": [ @@ -914,6 +1920,337 @@ } ], "visualization_settings": {} + }, + { + "row": 1, + "col": 0, + "sizeX": 4, + "sizeY": 4, + "card_id": {{ card "Number of Surveys" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Number of Surveys" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 5, + "col": 0, + "sizeX": 4, + "sizeY": 4, + "card_id": {{ card "Number of Questions Asked" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Number of Questions Asked" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 10, + "col": 0, + "sizeX": 5, + "sizeY": 5, + "card_id": {{ card "Survey Response Count" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Survey Response Count" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + }, + { + "parameter_id": "15e648d4", + "card_id": {{ card "Survey Response Count" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 5, + "col": 4, + "sizeX": 14, + "sizeY": 4, + "card_id": {{ card "Survey Questions" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Survey Questions" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + null + ] + ] + } + ], + "visualization_settings": { + "column_settings": { + "[\"ref\",[\"field\",{{ field "survey_Survey.name" }},null]]": { + "click_behavior": { + "type": "crossfilter", + "parameterMapping": { + "a0143bc7": { + "source": { + "type": "column", + "id": "name", + "name": "Name" + }, + "target": { + "type": "parameter", + "id": "a0143bc7" + }, + "id": "a0143bc7" + } + } + } + } + } + } + }, + { + "row": 29, + "col": 0, + "sizeX": 18, + "sizeY": 1, + "card_id": null, + "series": [], + "parameter_mappings": [], + "visualization_settings": { + "virtual_card": { + "name": null, + "display": "text", + "visualization_settings": {}, + "dataset_query": {}, + "archived": false + }, + "text": "## Satisfaction", + "text.align_vertical": "middle", + "dashcard.background": false + } + }, + { + "row": 21, + "col": 0, + "sizeX": 18, + "sizeY": 1, + "card_id": null, + "series": [], + "parameter_mappings": [], + "visualization_settings": { + "virtual_card": { + "name": null, + "display": "text", + "visualization_settings": {}, + "dataset_query": {}, + "archived": false + }, + "text": "## Benefits", + "text.align_vertical": "middle", + "dashcard.background": false + } + }, + { + "row": 9, + "col": 0, + "sizeX": 18, + "sizeY": 1, + "card_id": null, + "series": [], + "parameter_mappings": [], + "visualization_settings": { + "virtual_card": { + "name": null, + "display": "text", + "visualization_settings": {}, + "dataset_query": {}, + "archived": false + }, + "text": "## Engagement", + "text.align_vertical": "middle", + "dashcard.background": false + } + }, + { + "row": 15, + "col": 0, + "sizeX": 18, + "sizeY": 1, + "card_id": null, + "series": [], + "parameter_mappings": [], + "visualization_settings": { + "virtual_card": { + "name": null, + "display": "text", + "visualization_settings": {}, + "dataset_query": {}, + "archived": false + }, + "text": "## Time Savings", + "text.align_vertical": "middle", + "dashcard.background": false + } + }, + { + "row": 22, + "col": 0, + "sizeX": 5, + "sizeY": 7, + "card_id": {{ card "Net Promoter Score - Tasks" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Net Promoter Score - Tasks" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + }, + { + "parameter_id": "15e648d4", + "card_id": {{ card "Net Promoter Score - Tasks" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 30, + "col": 0, + "sizeX": 5, + "sizeY": 7, + "card_id": {{ card "Net Promoter Score - Activity" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Net Promoter Score - Activity" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_Survey.name" }}, + { + "join-alias": "Survey Survey - Survey" + } + ] + ] + }, + { + "parameter_id": "15e648d4", + "card_id": {{ card "Net Promoter Score - Activity" }}, + "target": [ + "dimension", + [ + "field", + {{ field "survey_QuestionResponse.submittedAt" }}, + null + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 16, + "col": 0, + "sizeX": 5, + "sizeY": 5, + "card_id": {{ card "Total Time Saved (hours)" }}, + "series": [], + "parameter_mappings": [ + { + "parameter_id": "a0143bc7", + "card_id": {{ card "Total Time Saved (hours)" }}, + "target": [ + "variable", + [ + "template-tag", + "survey_name" + ] + ] + } + ], + "visualization_settings": {} + }, + { + "row": 0, + "col": 0, + "sizeX": 18, + "sizeY": 1, + "card_id": null, + "series": [], + "parameter_mappings": [], + "visualization_settings": { + "virtual_card": { + "name": null, + "display": "text", + "visualization_settings": {}, + "dataset_query": {}, + "archived": false + }, + "text": "## Surveys", + "text.align_vertical": "middle", + "dashcard.background": false + } } ], "path": "/Faros CE/AI Copilot Evaluation" From ba984d3e0b9e2baf0a80fa4712acffa62c77cada Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 13:17:30 -0800 Subject: [PATCH 44/50] small updates --- .../metabase/dashboards/copilot_surveys.json | 11 ++- .../metabase/dashboards/copilot_usage.json | 87 ++++++++++++++----- 2 files changed, 74 insertions(+), 24 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot_surveys.json b/init/resources/metabase/dashboards/copilot_surveys.json index a9427bf0..9c17a911 100644 --- a/init/resources/metabase/dashboards/copilot_surveys.json +++ b/init/resources/metabase/dashboards/copilot_surveys.json @@ -540,10 +540,12 @@ "column_settings": { "[\"name\",\"Cumulative Time Saved hours\"]": { "prefix": "", - "suffix": " h" + "suffix": " h", + "decimals": 0 }, "[\"name\",\"Time Saved hours\"]": { - "suffix": " h" + "suffix": " h", + "decimals": 0 } }, "series_settings": { @@ -1719,6 +1721,11 @@ "graph.dimensions": [ "submittedAt" ], + "column_settings": { + "[\"name\",\"Total Time Saved\"]": { + "decimals": 0 + } + }, "graph.metrics": [ "count" ] diff --git a/init/resources/metabase/dashboards/copilot_usage.json b/init/resources/metabase/dashboards/copilot_usage.json index 355c0377..423ca7fa 100644 --- a/init/resources/metabase/dashboards/copilot_usage.json +++ b/init/resources/metabase/dashboards/copilot_usage.json @@ -55,7 +55,7 @@ { "name": "Daily Active User Count", "description": null, - "display": "line", + "display": "bar", "table_id": {{ table "vcs_UserToolUsage" }}, "dataset_query": { "type": "query", @@ -117,8 +117,16 @@ "graph.dimensions": [ "usedAt" ], + "series_settings": { + "Daily Active Users": { + "line.missing": "zero" + } + }, + "column_settings": { + "[\"name\",\"Daily Active Users\"]": {} + }, "graph.metrics": [ - "count" + "Daily Active Users" ] } }, @@ -134,7 +142,7 @@ "breakout": [ [ "field", - "copilotOrg", + "copilotTeam", { "base-type": "type/Text" } @@ -183,7 +191,7 @@ "visualization_settings": { "graph.dimensions": [ "computedAt", - "copilotOrg" + "copilotTeam" ], "graph.metrics": [ "Lines Accepted" @@ -1645,7 +1653,7 @@ ], "layout": [ { - "row": 0, + "row": 1, "col": 0, "sizeX": 5, "sizeY": 4, @@ -1668,7 +1676,7 @@ "visualization_settings": {} }, { - "row": 0, + "row": 1, "col": 5, "sizeX": 13, "sizeY": 4, @@ -1691,7 +1699,7 @@ "visualization_settings": {} }, { - "row": 5, + "row": 6, "col": 0, "sizeX": 18, "sizeY": 5, @@ -1725,12 +1733,26 @@ } ] ] + }, + { + "parameter_id": "a6b0f41", + "card_id": {{ card "Lines of Code Accepted by GitHub Team" }}, + "target": [ + "dimension", + [ + "field", + "copilotTeam", + { + "base-type": "type/Text" + } + ] + ] } ], "visualization_settings": {} }, { - "row": 10, + "row": 11, "col": 0, "sizeX": 5, "sizeY": 4, @@ -1783,7 +1805,7 @@ "visualization_settings": {} }, { - "row": 14, + "row": 15, "col": 0, "sizeX": 5, "sizeY": 4, @@ -1836,7 +1858,7 @@ "visualization_settings": {} }, { - "row": 10, + "row": 11, "col": 5, "sizeX": 5, "sizeY": 4, @@ -1889,7 +1911,7 @@ "visualization_settings": {} }, { - "row": 14, + "row": 15, "col": 10, "sizeX": 8, "sizeY": 4, @@ -1942,7 +1964,7 @@ "visualization_settings": {} }, { - "row": 14, + "row": 15, "col": 5, "sizeX": 5, "sizeY": 4, @@ -1995,7 +2017,7 @@ "visualization_settings": {} }, { - "row": 10, + "row": 11, "col": 10, "sizeX": 8, "sizeY": 4, @@ -2048,7 +2070,7 @@ "visualization_settings": {} }, { - "row": 22, + "row": 23, "col": 0, "sizeX": 18, "sizeY": 1, @@ -2069,7 +2091,7 @@ } }, { - "row": 18, + "row": 19, "col": 0, "sizeX": 5, "sizeY": 4, @@ -2122,7 +2144,7 @@ "visualization_settings": {} }, { - "row": 18, + "row": 19, "col": 5, "sizeX": 5, "sizeY": 4, @@ -2175,7 +2197,7 @@ "visualization_settings": {} }, { - "row": 18, + "row": 19, "col": 10, "sizeX": 8, "sizeY": 4, @@ -2228,7 +2250,7 @@ "visualization_settings": {} }, { - "row": 23, + "row": 24, "col": 6, "sizeX": 6, "sizeY": 4, @@ -2281,7 +2303,7 @@ "visualization_settings": {} }, { - "row": 23, + "row": 24, "col": 0, "sizeX": 6, "sizeY": 4, @@ -2334,7 +2356,7 @@ "visualization_settings": {} }, { - "row": 23, + "row": 24, "col": 12, "sizeX": 6, "sizeY": 4, @@ -2387,7 +2409,28 @@ "visualization_settings": {} }, { - "row": 4, + "row": 5, + "col": 0, + "sizeX": 18, + "sizeY": 1, + "card_id": null, + "series": [], + "parameter_mappings": [], + "visualization_settings": { + "virtual_card": { + "name": null, + "display": "text", + "visualization_settings": {}, + "dataset_query": {}, + "archived": false + }, + "text": "## Usage", + "text.align_vertical": "middle", + "dashcard.background": false + } + }, + { + "row": 0, "col": 0, "sizeX": 18, "sizeY": 1, @@ -2402,7 +2445,7 @@ "dataset_query": {}, "archived": false }, - "text": "", + "text": "## Adoption", "text.align_vertical": "middle", "dashcard.background": false } From a7b1eb4fb65e093d19cd1fa25f80a2983c36c3da Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 13:24:31 -0800 Subject: [PATCH 45/50] newlines --- init/resources/hasura/endpoints/faros_metric_value_tag.gql | 1 - init/resources/hasura/endpoints/faros_tag.gql | 1 - init/resources/hasura/endpoints/survey_question.gql | 2 +- init/resources/hasura/endpoints/survey_question_response.gql | 2 +- init/resources/hasura/endpoints/survey_survey.gql | 2 +- .../hasura/endpoints/survey_survey_question_association.gql | 2 +- 6 files changed, 4 insertions(+), 6 deletions(-) diff --git a/init/resources/hasura/endpoints/faros_metric_value_tag.gql b/init/resources/hasura/endpoints/faros_metric_value_tag.gql index 06beab67..8d571aef 100644 --- a/init/resources/hasura/endpoints/faros_metric_value_tag.gql +++ b/init/resources/hasura/endpoints/faros_metric_value_tag.gql @@ -32,4 +32,3 @@ mutation insert_faros_metric_value_tag( id } } - diff --git a/init/resources/hasura/endpoints/faros_tag.gql b/init/resources/hasura/endpoints/faros_tag.gql index 9b3ed4a9..7bd2b5d4 100644 --- a/init/resources/hasura/endpoints/faros_tag.gql +++ b/init/resources/hasura/endpoints/faros_tag.gql @@ -24,4 +24,3 @@ mutation insert_faros_tag( id } } - diff --git a/init/resources/hasura/endpoints/survey_question.gql b/init/resources/hasura/endpoints/survey_question.gql index e9280350..78dcfa46 100644 --- a/init/resources/hasura/endpoints/survey_question.gql +++ b/init/resources/hasura/endpoints/survey_question.gql @@ -36,4 +36,4 @@ mutation insert_survey_question( ) { id } -} \ No newline at end of file +} diff --git a/init/resources/hasura/endpoints/survey_question_response.gql b/init/resources/hasura/endpoints/survey_question_response.gql index 22800ba4..476c17f0 100644 --- a/init/resources/hasura/endpoints/survey_question_response.gql +++ b/init/resources/hasura/endpoints/survey_question_response.gql @@ -44,4 +44,4 @@ mutation insert_survey_question_response( ) { id } -} \ No newline at end of file +} diff --git a/init/resources/hasura/endpoints/survey_survey.gql b/init/resources/hasura/endpoints/survey_survey.gql index d9fa7801..78fd9d9a 100644 --- a/init/resources/hasura/endpoints/survey_survey.gql +++ b/init/resources/hasura/endpoints/survey_survey.gql @@ -29,4 +29,4 @@ mutation insert_survey_survey( ) { id } -} \ No newline at end of file +} diff --git a/init/resources/hasura/endpoints/survey_survey_question_association.gql b/init/resources/hasura/endpoints/survey_survey_question_association.gql index 9bd9b5ee..a982a457 100644 --- a/init/resources/hasura/endpoints/survey_survey_question_association.gql +++ b/init/resources/hasura/endpoints/survey_survey_question_association.gql @@ -33,4 +33,4 @@ mutation insert_survey_question( ) { id } -} \ No newline at end of file +} From a34a05b910dbd3901e851674846af931e820681f Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 13:40:31 -0800 Subject: [PATCH 46/50] fix import --- mock-data/src/mockdata.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index df2db76a..50e81d67 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -1,7 +1,6 @@ import {DateTime} from 'luxon'; import {Hasura} from './hasura'; -import { randomBytes, randomInt } from 'crypto'; const ORIGIN = 'faros-ce-mock-data'; const SOURCE = 'FarosCE-MockData'; @@ -479,7 +478,9 @@ export class MockData { 'Agree', 'Strongly Agree', ]; - function randArr(arr: any[]): any {return arr[randomInt(0, arr.length)]}; + function randArr(arr: any[]): any { + return arr[MockData.randomInt(0, arr.length)] + } // Cadence Surveys @@ -530,7 +531,7 @@ export class MockData { await hasura.postSurveyQuestionResponse( `response-${i}`, ORIGIN, - DateTime.now().minus({days: randomInt(0, numWeeks * 7)}), + DateTime.now().minus({days: MockData.randomInt(0, numWeeks * 7)}), qi.generateResponse(), survey, q @@ -555,7 +556,7 @@ export class MockData { question: 'On average how many hours per day did you save ' + 'in the past week?', responseType: {category: 'NumericEntry', detail: 'NumericEntry'}, - generateResponse: () => randomInt(0, 10).toString() + generateResponse: () => MockData.randomInt(0, 10).toString() }, ...[ 'Understanding code', 'Preparing to code', @@ -600,7 +601,7 @@ export class MockData { 'Based on your experience, estimate how much total coding time ' + 'you saved using copilot for this PR? (in minutes)', responseType: {category: 'NumericEntry', detail: 'NumericEntry'}, - generateResponse: () => randomInt(5, 60).toString(), + generateResponse: () => MockData.randomInt(5, 60).toString(), }, ...[ 'Be happier in my job', 'Be more productive', From 7105ea5aff3ac7d0fef079fc73bd29463f4a8f5b Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 13:41:38 -0800 Subject: [PATCH 47/50] lint --- mock-data/src/mockdata.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index 50e81d67..f0682704 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -391,9 +391,12 @@ export class MockData { const metricDefToFun: Record number> = { DailyActiveUserTrend: (): number => MockData.randomInt(3, 1), DailyGeneratedLineCount_Accept: (): number => MockData.randomInt(10, 2), - DailyGeneratedLineCount_Discard: (): number => MockData.randomInt(100, 10), - DailySuggestionReferenceCount_Accept: (): number => MockData.randomInt(10, 2), - DailySuggestionReferenceCount_Discard: (): number => MockData.randomInt(100, 10), + DailyGeneratedLineCount_Discard: (): number => + MockData.randomInt(100, 10), + DailySuggestionReferenceCount_Accept: (): number => + MockData.randomInt(10, 2), + DailySuggestionReferenceCount_Discard: (): number => + MockData.randomInt(100, 10), DailyActiveChatUserTrend: (): number => MockData.randomInt(3, 1), DailyChatAcceptanceCount: (): number => MockData.randomInt(10, 1), DailyChatTurnCount: (): number => MockData.randomInt(20, 3), @@ -479,7 +482,7 @@ export class MockData { 'Strongly Agree', ]; function randArr(arr: any[]): any { - return arr[MockData.randomInt(0, arr.length)] + return arr[MockData.randomInt(0, arr.length)]; } From 4596cca7fd9a439390a8b7455fcf13d1eb26a170 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Thu, 7 Nov 2024 13:43:00 -0800 Subject: [PATCH 48/50] lint --- mock-data/src/hasura.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mock-data/src/hasura.ts b/mock-data/src/hasura.ts index 531db0db..f69fee9f 100644 --- a/mock-data/src/hasura.ts +++ b/mock-data/src/hasura.ts @@ -5,11 +5,11 @@ export class Hasura { private readonly api: AxiosInstance; constructor(private readonly baseURL: string, adminSecret?: string) { this.api = axios.create( - { + { baseURL: `${baseURL}/api/rest/`, headers: { - "Content-Type": "application/json", - ...(adminSecret && {"X-Hasura-Admin-Secret": adminSecret}), + 'Content-Type': 'application/json', + ...(adminSecret && {'X-Hasura-Admin-Secret': adminSecret}), } } ); From 29e850f493c1c03f24b7043344833626207eb033 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Tue, 12 Nov 2024 07:54:08 -0800 Subject: [PATCH 49/50] pr size to 2 bars --- .../metabase/dashboards/copilot_impact.json | 222 +++++++++--------- 1 file changed, 108 insertions(+), 114 deletions(-) diff --git a/init/resources/metabase/dashboards/copilot_impact.json b/init/resources/metabase/dashboards/copilot_impact.json index b897bab3..7483e4f4 100644 --- a/init/resources/metabase/dashboards/copilot_impact.json +++ b/init/resources/metabase/dashboards/copilot_impact.json @@ -1049,28 +1049,88 @@ "table_id": {{ table "vcs_PullRequest" }}, "dataset_query": { "query": { - "source-table": {{ table "vcs_PullRequest" }}, - "joins": [ - { - "fields": "all", - "source-table": {{ table "vcs_UserTool" }}, - "condition": [ - "=", + "aggregation": [ + [ + "aggregation-options", + [ + "distinct", [ "field", - {{ field "vcs_PullRequest.author" }}, + {{ field "vcs_PullRequest.id" }}, null - ], + ] + ], + { + "display-name": "PR Count", + "name": "PR Count" + } + ], + [ + "aggregation-options", + [ + "median", [ "field", - {{ field "vcs_UserTool.user" }}, - { - "join-alias": "Vcs UserTool - Author" - } + {{ field "vcs_PullRequest.linesAdded" }}, + null ] ], - "alias": "Vcs UserTool - Author" - } + { + "display-name": "Median Lines Added", + "name": "Median Lines Added" + } + ], + [ + "aggregation-options", + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesDeleted" }}, + null + ] + ], + { + "display-name": "Median Lines Deleted", + "name": "Median Lines Deleted" + } + ], + [ + "aggregation-options", + [ + "-", + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesAdded" }}, + null + ] + ], + [ + "median", + [ + "field", + {{ field "vcs_PullRequest.linesDeleted" }}, + null + ] + ] + ], + { + "display-name": "Net Lines Added", + "name": "Net Lines Added" + } + ] + ], + "breakout": [ + [ + "expression", + "Tool" + ], + [ + "expression", + "group" + ] ], "expressions": { "Tool": [ @@ -1145,94 +1205,41 @@ { "default": "No Tool" } + ], + "group": [ + "trim", + "" ] }, - "breakout": [ + "filter": [ + "not-null", [ - "expression", - "Tool" + "field", + {{ field "vcs_PullRequest.mergedAt" }}, + null ] ], - "aggregation": [ - [ - "aggregation-options", - [ - "distinct", - [ - "field", - {{ field "vcs_PullRequest.id" }}, - null - ] - ], - { - "name": "PR Count", - "display-name": "PR Count" - } - ], - [ - "aggregation-options", - [ - "median", - [ - "field", - {{ field "vcs_PullRequest.linesAdded" }}, - null - ] - ], - { - "name": "Median Lines Added", - "display-name": "Median Lines Added" - } - ], - [ - "aggregation-options", - [ - "median", + "joins": [ + { + "alias": "Vcs UserTool - Author", + "condition": [ + "=", [ "field", - {{ field "vcs_PullRequest.linesDeleted" }}, + {{ field "vcs_PullRequest.author" }}, null - ] - ], - { - "name": "Median Lines Deleted", - "display-name": "Median Lines Deleted" - } - ], - [ - "aggregation-options", - [ - "-", - [ - "median", - [ - "field", - {{ field "vcs_PullRequest.linesAdded" }}, - null - ] ], [ - "median", - [ - "field", - {{ field "vcs_PullRequest.linesDeleted" }}, - null - ] + "field", + {{ field "vcs_UserTool.user" }}, + { + "join-alias": "Vcs UserTool - Author" + } ] ], - { - "name": "Net Lines Added", - "display-name": "Net Lines Added" - } - ] - ], - "filter": [ - "not-null", - [ - "field", - {{ field "vcs_PullRequest.mergedAt" }}, - null - ] + "fields": "all", + "source-table": {{ table "vcs_UserTool" }} + } ], "order-by": [ [ @@ -1242,45 +1249,32 @@ "Tool" ] ] - ] + ], + "source-table": {{ table "vcs_PullRequest" }} }, "type": "query" }, "visualization_settings": { - "graph.x_axis.labels_enabled": false, - "graph.series_order": [ - { - "key": "No Tool", - "color": "#88BF4D", - "enabled": true, - "name": "No Tool" - }, - { - "key": "GitHubCopilot", - "color": "#7172AD", - "enabled": true, - "name": "GitHubCopilot" - } - ], - "graph.series_order_dimension": "Tool", "graph.dimensions": [ + "group", "Tool" ], + "graph.series_order": null, + "graph.series_order_dimension": null, + "graph.x_axis.labels_enabled": false, "series_settings": { - "Median Lines Deleted": { - "color": "#EF8C8C", - "axis": "left" - }, "Median Lines Added": { "axis": "left" }, + "Median Lines Deleted": { + "axis": "left", + "color": "#EF8C8C" + }, "Net Lines Added": { "axis": "left" } }, "graph.metrics": [ - "Median Lines Added", - "Median Lines Deleted", "Net Lines Added" ] } From b0379fd9261a5e68690db60742bd0dcfb1a6a8e3 Mon Sep 17 00:00:00 2001 From: Chris Rupley Date: Tue, 12 Nov 2024 07:57:09 -0800 Subject: [PATCH 50/50] only 2 tool users out of 3 --- mock-data/src/mockdata.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mock-data/src/mockdata.ts b/mock-data/src/mockdata.ts index f0682704..a16b62ec 100644 --- a/mock-data/src/mockdata.ts +++ b/mock-data/src/mockdata.ts @@ -402,7 +402,7 @@ export class MockData { DailyChatTurnCount: (): number => MockData.randomInt(20, 3), }; - const tools = [1, 2, 3].map((u) => { + const tools = [1, 2].map((u) => { return { user: {uid: `author-${u}`, source: SOURCE}, organization: {uid: ORG, source: SOURCE},