mirror of
https://github.com/supabase/supabase.git
synced 2026-10-14 05:39:11 +03:00
fix: chart data
This commit is contained in:
1 parent
d33fdb82a6
commit
bf3cf44564
15 files changed
+212
-89
No files matched your search
@@ -3,14 +3,37 @@ import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
function generateAICodingToolsSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
return `
|
||||
SELECT
|
||||
unnest(ai_coding_tools) AS technology,
|
||||
COUNT(*) AS total
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY technology
|
||||
ORDER BY total DESC;
|
||||
`
|
||||
return `WITH ai_coding_tools_mapping AS (
|
||||
SELECT
|
||||
id,
|
||||
CASE
|
||||
WHEN technology IN (
|
||||
'Cursor',
|
||||
'Windsurf',
|
||||
'Cline',
|
||||
'Visual Studio Code',
|
||||
'Lovable',
|
||||
'Bolt',
|
||||
'v0',
|
||||
'Tempo',
|
||||
'None'
|
||||
) THEN technology
|
||||
WHEN LOWER(technology) LIKE '%claude%' THEN 'Claude or Claude Code'
|
||||
WHEN LOWER(technology) = 'chatgpt' THEN 'ChatGPT'
|
||||
ELSE 'Other'
|
||||
END AS technology_clean
|
||||
FROM (
|
||||
SELECT id, unnest(ai_coding_tools) AS technology
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
) sub
|
||||
)
|
||||
SELECT
|
||||
technology_clean AS technology,
|
||||
COUNT(DISTINCT id) AS total
|
||||
FROM ai_coding_tools_mapping
|
||||
GROUP BY technology_clean
|
||||
ORDER BY total DESC;`
|
||||
}
|
||||
|
||||
export function AICodingToolsChart() {
|
||||
|
||||
@@ -3,12 +3,36 @@ import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
function generateAIModelsSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
return `SELECT
|
||||
unnest(ai_models_used) AS model,
|
||||
COUNT(*) AS total
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY model
|
||||
ORDER BY total DESC;`
|
||||
return `WITH ai_models_used_mapping AS (
|
||||
SELECT
|
||||
id,
|
||||
CASE
|
||||
WHEN technology IN (
|
||||
'OpenAI',
|
||||
'Anthropic/Claude',
|
||||
'Hugging Face',
|
||||
'Custom models',
|
||||
'SageMaker',
|
||||
'Bedrock',
|
||||
'Cohere',
|
||||
'Mistral'
|
||||
) THEN technology
|
||||
WHEN LOWER(technology) LIKE '%gemini%' THEN 'Gemini'
|
||||
WHEN LOWER(technology) = 'deepseek' THEN 'DeepSeek'
|
||||
ELSE 'Other'
|
||||
END AS technology_clean
|
||||
FROM (
|
||||
SELECT id, unnest(ai_models_used) AS technology
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
) sub
|
||||
)
|
||||
SELECT
|
||||
technology_clean AS technology,
|
||||
COUNT(DISTINCT id) AS total
|
||||
FROM ai_models_used_mapping
|
||||
GROUP BY technology_clean
|
||||
ORDER BY total DESC;`
|
||||
}
|
||||
|
||||
export function AIModelsChart() {
|
||||
|
||||
@@ -11,7 +11,7 @@ function generateAcceleratorParticipationSQL(activeFilters: Record<string, strin
|
||||
WHEN accelerator_participation = 'Did not participate in an accelerator' THEN NULL
|
||||
ELSE 'Other'
|
||||
END AS accelerator_clean
|
||||
FROM responses_c_2025
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
)
|
||||
SELECT
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
|
||||
// Generate SQL query for team count chart
|
||||
function generateBiggestChallengeSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters, ['biggest_challenge IS NOT NULL'])
|
||||
|
||||
@@ -13,7 +12,7 @@ function generateBiggestChallengeSQL(activeFilters: Record<string, string>) {
|
||||
WHEN biggest_challenge IN ('Customer acquisition', 'Technical complexity', 'Product-market fit', 'Product-market fit', 'Fundraising', 'Hiring', 'Other') THEN biggest_challenge
|
||||
ELSE 'Other'
|
||||
END AS biggest_challenge_clean
|
||||
FROM responses_c_2025
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
)
|
||||
SELECT
|
||||
|
||||
@@ -3,12 +3,33 @@ import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
function generateDatabasesSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
return `SELECT
|
||||
unnest(databases) AS technology,
|
||||
COUNT(*) AS total
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY technology
|
||||
ORDER BY total DESC;`
|
||||
return `WITH database_mapping AS (
|
||||
SELECT
|
||||
id,
|
||||
CASE
|
||||
WHEN technology IN (
|
||||
'Supabase',
|
||||
'PostgreSQL',
|
||||
'MySQL',
|
||||
'MongoDB',
|
||||
'Redis',
|
||||
'Firebase',
|
||||
'SQLite'
|
||||
) THEN technology
|
||||
ELSE 'Other'
|
||||
END AS technology_clean
|
||||
FROM (
|
||||
SELECT id, unnest(databases) AS technology
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
) sub
|
||||
)
|
||||
SELECT
|
||||
technology_clean AS technology,
|
||||
COUNT(DISTINCT id) AS total
|
||||
FROM database_mapping
|
||||
GROUP BY technology_clean
|
||||
ORDER BY total DESC;`
|
||||
}
|
||||
|
||||
export function DatabasesChart() {
|
||||
|
||||
@@ -6,7 +6,7 @@ function generateFrontendStackSQL(activeFilters: Record<string, string>) {
|
||||
return `SELECT
|
||||
unnest(frontend_stack) AS technology,
|
||||
COUNT(*) AS total
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
FROM responses_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY technology
|
||||
ORDER BY total DESC;
|
||||
`
|
||||
|
||||
@@ -6,7 +6,7 @@ function generateFundingStageSQL(activeFilters: Record<string, string>) {
|
||||
return `SELECT
|
||||
funding_stage,
|
||||
COUNT(*) AS total
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
FROM responses_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY funding_stage
|
||||
ORDER BY CASE
|
||||
WHEN funding_stage = 'Bootstrapped' THEN 1
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
|
||||
// Generate SQL query for team count chart
|
||||
function generateIndustrySQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters, ['industry IS NOT NULL'])
|
||||
|
||||
@@ -13,7 +12,7 @@ function generateIndustrySQL(activeFilters: Record<string, string>) {
|
||||
WHEN industry IN ('SaaS', 'Dev tools', 'AI / ML', 'Consumer', 'Education', 'eCommerce', 'Fintech', 'Healthtech') THEN industry
|
||||
ELSE 'Other'
|
||||
END AS industry_clean
|
||||
FROM responses_c_2025
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
)
|
||||
SELECT
|
||||
|
||||
@@ -3,15 +3,34 @@ import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
function generateInitialPayingCustomersSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
return `SELECT
|
||||
source,
|
||||
COUNT(DISTINCT id) AS respondents
|
||||
FROM (
|
||||
SELECT id, unnest(initial_paying_customers) AS source
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
) sub
|
||||
GROUP BY source
|
||||
ORDER BY respondents DESC;`
|
||||
return `WITH customer_source_mapping AS (
|
||||
SELECT
|
||||
id,
|
||||
CASE
|
||||
WHEN source IN (
|
||||
'Personal/professional network',
|
||||
'Inbound from social media (Twitter, LinkedIn, etc.)',
|
||||
'Cold outreach or sales',
|
||||
'Content (blog, newsletter, SEO)',
|
||||
'Developer communities (Discord, Slack, Reddit, etc.)',
|
||||
'Open source users who converted',
|
||||
'Accelerators/incubators',
|
||||
'Hacker News or Product Hunt'
|
||||
) THEN source
|
||||
ELSE 'Other'
|
||||
END AS source_clean
|
||||
FROM (
|
||||
SELECT id, unnest(initial_paying_customers) AS source
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
) sub
|
||||
)
|
||||
SELECT
|
||||
source_clean AS source,
|
||||
COUNT(DISTINCT id) AS respondents
|
||||
FROM customer_source_mapping
|
||||
GROUP BY source_clean
|
||||
ORDER BY respondents DESC;`
|
||||
}
|
||||
|
||||
export function InitialPayingCustomersChart() {
|
||||
|
||||
@@ -6,7 +6,7 @@ function generateLocationSQL(activeFilters: Record<string, string>) {
|
||||
return `SELECT
|
||||
location,
|
||||
COUNT(*) AS total
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
FROM responses_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY location
|
||||
ORDER BY total DESC;`
|
||||
}
|
||||
|
||||
@@ -1,20 +1,38 @@
|
||||
import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
|
||||
function generateNewIdeasSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters, [
|
||||
'must_have_dev_tools IS NOT NULL',
|
||||
"must_have_dev_tools != ''",
|
||||
])
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
return `SELECT
|
||||
avenue,
|
||||
COUNT(DISTINCT id) AS respondents
|
||||
FROM (
|
||||
SELECT id, unnest(new_ideas) AS avenue
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
) sub
|
||||
GROUP BY avenue
|
||||
ORDER BY respondents DESC;`
|
||||
return `WITH new_ideas_mapping AS (
|
||||
SELECT
|
||||
id,
|
||||
CASE
|
||||
WHEN avenue IN (
|
||||
'Hacker News',
|
||||
'GitHub',
|
||||
'Product Hunt',
|
||||
'Twitter/X',
|
||||
'Reddit',
|
||||
'YouTube',
|
||||
'Podcasts',
|
||||
'Blogs / Newsletters',
|
||||
'Discord / Slack communities',
|
||||
'Conferences / Meetups'
|
||||
) THEN avenue
|
||||
ELSE 'Other'
|
||||
END AS avenue_clean
|
||||
FROM (
|
||||
SELECT id, unnest(new_ideas) AS avenue
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
) sub
|
||||
)
|
||||
SELECT
|
||||
avenue_clean AS avenue,
|
||||
COUNT(DISTINCT id) AS total
|
||||
FROM new_ideas_mapping
|
||||
GROUP BY avenue_clean
|
||||
ORDER BY total DESC;`
|
||||
}
|
||||
|
||||
export function NewIdeasChart() {
|
||||
|
||||
@@ -3,29 +3,39 @@ import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
function generateRegularSocialMediaUseSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
return `WITH founders AS (
|
||||
SELECT id, regular_social_media_use
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
)
|
||||
SELECT
|
||||
platform AS label,
|
||||
COUNT(*) AS total
|
||||
FROM (
|
||||
SELECT id, unnest(regular_social_media_use) AS platform
|
||||
FROM founders
|
||||
) t
|
||||
GROUP BY platform
|
||||
ORDER BY total DESC;
|
||||
`
|
||||
return `WITH regular_social_media_use_mapping AS (
|
||||
SELECT
|
||||
id,
|
||||
CASE
|
||||
WHEN platform IN (
|
||||
'X (Twitter)',
|
||||
'Threads',
|
||||
'BlueSky',
|
||||
'LinkedIn',
|
||||
'Reddit',
|
||||
'TikTok',
|
||||
'Instagram',
|
||||
'YouTube',
|
||||
'Mastodon',
|
||||
'Discord',
|
||||
'I’ve given up social media'
|
||||
) THEN platform
|
||||
ELSE 'Other'
|
||||
END AS platform_clean
|
||||
FROM (
|
||||
SELECT id, unnest(regular_social_media_use) AS platform
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
) sub
|
||||
)
|
||||
SELECT
|
||||
platform_clean AS platform,
|
||||
COUNT(DISTINCT id) AS total
|
||||
FROM regular_social_media_use_mapping
|
||||
GROUP BY platform_clean
|
||||
ORDER BY total DESC;`
|
||||
}
|
||||
|
||||
// SELECT
|
||||
// unnest(regular_social_media_use) AS social_media,
|
||||
// COUNT(*) AS total
|
||||
// FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
// GROUP BY social_media
|
||||
// ORDER BY total DESC;
|
||||
|
||||
export function RegularSocialMediaUseChart() {
|
||||
return (
|
||||
<SurveyChart
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
|
||||
// Generate SQL query for team count chart
|
||||
function generateRoleSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
@@ -11,7 +10,7 @@ function generateRoleSQL(activeFilters: Record<string, string>) {
|
||||
ELSE 'Other'
|
||||
END AS role,
|
||||
COUNT(*) AS total
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
FROM responses_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY CASE
|
||||
WHEN role = 'Founder / Co-founder' THEN 'Founder'
|
||||
WHEN role IN ('Engineer', 'Founder / Co-founder') THEN role
|
||||
@@ -21,13 +20,6 @@ ORDER BY total DESC;
|
||||
`
|
||||
}
|
||||
|
||||
// SELECT
|
||||
// person_role_normalized,
|
||||
// COUNT(*) AS total
|
||||
// FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
// GROUP BY person_role_normalized
|
||||
// ORDER BY total DESC
|
||||
|
||||
export function RoleChart() {
|
||||
return (
|
||||
<SurveyChart
|
||||
|
||||
@@ -3,14 +3,33 @@ import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
function generateSalesToolsSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
return `
|
||||
return `WITH customer_tool_mapping AS (
|
||||
SELECT
|
||||
id,
|
||||
CASE
|
||||
WHEN tool IN (
|
||||
'HubSpot',
|
||||
'Salesforce',
|
||||
'Pipedrive',
|
||||
'Close.com',
|
||||
'Notion / Airtable',
|
||||
'Google Sheets',
|
||||
'We don’t have a formal CRM or sales tool yet'
|
||||
) THEN tool
|
||||
ELSE 'Other'
|
||||
END AS tool_clean
|
||||
FROM (
|
||||
SELECT id, unnest(sales_tools) AS tool
|
||||
FROM responses_2025
|
||||
${whereClause}
|
||||
) sub
|
||||
)
|
||||
SELECT
|
||||
unnest(sales_tools) AS tool_name,
|
||||
COUNT(*) AS total
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY tool_name
|
||||
ORDER BY total DESC;
|
||||
`
|
||||
tool_clean AS tool,
|
||||
COUNT(DISTINCT id) AS respondents
|
||||
FROM customer_tool_mapping
|
||||
GROUP BY tool_clean
|
||||
ORDER BY respondents DESC;`
|
||||
}
|
||||
|
||||
export function SalesToolsChart() {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { SurveyChart, buildWhereClause } from '../SurveyChart'
|
||||
|
||||
// Generate SQL query for team count chart
|
||||
function generateWorldOutlookSQL(activeFilters: Record<string, string>) {
|
||||
const whereClause = buildWhereClause(activeFilters)
|
||||
|
||||
@@ -8,7 +7,7 @@ function generateWorldOutlookSQL(activeFilters: Record<string, string>) {
|
||||
world_outlook,
|
||||
COUNT(*) AS total
|
||||
--ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER (), 2) AS percentage
|
||||
FROM responses_c_2025${whereClause ? '\n' + whereClause : ''}
|
||||
FROM responses_2025${whereClause ? '\n' + whereClause : ''}
|
||||
GROUP BY world_outlook
|
||||
ORDER BY total DESC;`
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user