Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ DESCRIPTION >
- `status` is the status of the project ex: active or archived
- `maturity` is the project maturity stage (e.g. Sandbox, Incubating, Graduated). Empty string when not set.
- `lastVulnerabilityScanStatus` is the aggregated vulnerability scan status across all project repositories (`LowCardinality(Nullable(String))`). Possible values: `'success'` (all scans passed), `'no_packages_found'` (no dependency packages detected), `'failure'` (at least one scan failed), `'running'` (scan in progress). NULL when no scan records exist for the project's repositories.
- `healthScoreV2` is the Health Score v2 composite (0-100), copied from `project_insights_copy_ds`. NULL when fewer than 2 categories have data, and for archived projects and `korg`.
- `healthLabel` is the Health Score v2 band ('excellent' to 'critical'), computed on the normalized score. NULL when `healthScoreV2` is NULL.
- `healthScoreV2Normalized` is `healthScoreV2 * 100 / healthMaxScore` (0-100), so partial scores sort on one scale. NULL when `healthScoreV2` or `healthMaxScore` is NULL.
- `healthMaxScore` is the denominator of a partial `healthScoreV2` (60, 65, 75 or 100), copied from `project_insights_copy_ds`. NULL when `healthScoreV2` is NULL.

TAGS "Project metadata", "Analytics enrichment"

Expand Down Expand Up @@ -66,7 +70,11 @@ SCHEMA >
`status` String,
`maturity` LowCardinality(String),
`lastVulnerabilityScanStatus` Nullable(String),
`repoLicenses` Array(Tuple(String, String))
`repoLicenses` Array(Tuple(String, String)),
`healthScoreV2` Nullable(UInt8),
`healthLabel` Nullable(String),
`healthScoreV2Normalized` Nullable(Float64),
`healthMaxScore` Nullable(UInt8)

ENGINE MergeTree
ENGINE_PARTITION_KEY toYear(createdAt)
Expand Down
34 changes: 30 additions & 4 deletions services/libs/tinybird/pipes/categories_oss_index.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,27 @@ DESCRIPTION >
Returns only needed columns from insights projects

SQL >
SELECT id, name, logoUrl, description, healthScore
SELECT
id,
name,
logoUrl,
description,
healthScore,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore
FROM insights_projects_populated_ds
GROUP BY id, name, logoUrl, description, healthScore
GROUP BY
id,
name,
logoUrl,
description,
healthScore,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore

NODE categories_oss_index_collections_deduplicated
DESCRIPTION >
Expand Down Expand Up @@ -80,7 +98,11 @@ SQL >
pd.name AS projectName,
pd.logoUrl AS projectLogo,
pd.description AS description,
pd.healthScore AS healthScore
pd.healthScore AS healthScore,
pd.healthScoreV2 AS healthScoreV2,
pd.healthLabel AS healthLabel,
pd.healthScoreV2Normalized AS healthScoreV2Normalized,
pd.healthMaxScore AS healthMaxScore
FROM categories_oss_index_projects_ranked_by_category topProjects
JOIN categories_oss_index_projects_deduplicated pd ON pd.id = topProjects.projectId
WHERE topProjects.rn <= 5
Expand Down Expand Up @@ -160,7 +182,11 @@ SQL >
softwareValue,
avgScore,
healthScore,
description
description,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore
)
) AS topProjects
FROM categories_oss_index_projects
Expand Down
34 changes: 31 additions & 3 deletions services/libs/tinybird/pipes/category_groups_oss_index.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,29 @@ DESCRIPTION >
Returns only columns which we need from insights projects table

SQL >
SELECT id, name, logoUrl, description, healthScore, status
SELECT
id,
name,
logoUrl,
description,
healthScore,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore,
status
FROM insights_projects_populated_ds
GROUP BY id, name, logoUrl, description, healthScore, status
GROUP BY
id,
name,
logoUrl,
description,
healthScore,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore,
status

NODE category_groups_oss_index_collections_deduplicated
DESCRIPTION >
Expand Down Expand Up @@ -78,6 +98,10 @@ SQL >
pd.logoUrl AS projectLogo,
pd.description AS description,
pd.healthScore AS healthScore,
pd.healthScoreV2 AS healthScoreV2,
pd.healthLabel AS healthLabel,
pd.healthScoreV2Normalized AS healthScoreV2Normalized,
pd.healthMaxScore AS healthMaxScore,
pd.status as status
FROM category_groups_oss_index_projects_ranked_by_category_group topProjects
JOIN category_groups_oss_index_projects_deduplicated pd ON pd.id = topProjects.projectId
Expand Down Expand Up @@ -163,7 +187,11 @@ SQL >
avgScore,
healthScore,
description,
status
status,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore
)
) AS topProjects
FROM category_groups_oss_index_projects
Expand Down
36 changes: 33 additions & 3 deletions services/libs/tinybird/pipes/collections_oss_index.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,31 @@ DESCRIPTION >
Returns only needed columns from insights projects

SQL >
SELECT id, name, slug, logoUrl, description, healthScore, status
SELECT
id,
name,
slug,
logoUrl,
description,
healthScore,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore,
status
FROM insights_projects_populated_ds
GROUP BY id, name, slug, logoUrl, description, healthScore, status
GROUP BY
id,
name,
slug,
logoUrl,
description,
healthScore,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore,
status

NODE collections_oss_index_projects_ranked_by_collection
DESCRIPTION >
Expand Down Expand Up @@ -77,6 +99,10 @@ SQL >
pd.logoUrl AS projectLogo,
pd.description,
pd.healthScore,
pd.healthScoreV2,
pd.healthLabel,
pd.healthScoreV2Normalized,
pd.healthMaxScore,
pd.status
FROM collections_oss_index_projects_ranked_by_collection topProjects
JOIN collections_oss_index_projects_deduplicated pd ON pd.id = topProjects.projectId
Expand Down Expand Up @@ -112,7 +138,11 @@ SQL >
healthScore,
description,
projectSlug,
status
status,
healthScoreV2,
healthLabel,
healthScoreV2Normalized,
healthMaxScore
)
) AS topProjects
FROM collections_oss_index_projects
Expand Down
4 changes: 4 additions & 0 deletions services/libs/tinybird/pipes/insightsProjects_filtered.pipe
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ SQL >
insights_projects_populated_ds.firstCommitUrl,
insights_projects_populated_ds.repoData,
insights_projects_populated_ds.healthScore,
insights_projects_populated_ds.healthScoreV2,
insights_projects_populated_ds.healthLabel,
insights_projects_populated_ds.healthScoreV2Normalized,
insights_projects_populated_ds.healthMaxScore,
insights_projects_populated_ds.communityPlatforms,
insights_projects_populated_ds.communityKeywords,
insights_projects_populated_ds.communityLanguages,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ NODE insights_projects_populated_copy_health_score_deduplicated
SQL >
SELECT id, overallScore as healthScore FROM health_score_copy_ds

NODE insights_projects_populated_copy_health_v2
DESCRIPTION >
Health Score v2 per project from project_insights_copy_ds, plus the score normalized to a 0-100 scale

SQL >
SELECT
id,
healthScoreV2,
healthLabel,
if(healthMaxScore > 0, healthScoreV2 * 100.0 / healthMaxScore, NULL) AS healthScoreV2Normalized,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalized score disagrees with label

Medium Severity

healthScoreV2Normalized is computed from the stored healthScoreV2, which is already toUInt8(round(...)), while healthLabel is copied from the pre-round sum divided by healthMaxScore. On partial denominators such as 60, rounding by less than a point can cross a band threshold, so the index pill and the normalized sort disagree.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 84e7b83. Configure here.

healthMaxScore
FROM project_insights_copy_ds
WHERE type = 'project'

NODE archived_excluded_repositories
DESCRIPTION >
Get the archived and excluded repositories for each segment and insightsProject
Expand Down Expand Up @@ -244,7 +258,13 @@ SQL >
any (insights_projects_populated_copy_mentions.communityLanguages) as communityLanguages,
any (segments.status) as status,
any (segments.maturity) as maturity,
any (last_vulnerability_scan_status.lastVulnerabilityScanStatus) as lastVulnerabilityScanStatus
any (last_vulnerability_scan_status.lastVulnerabilityScanStatus) as lastVulnerabilityScanStatus,
any (insights_projects_populated_copy_health_v2.healthScoreV2) as healthScoreV2,
any (insights_projects_populated_copy_health_v2.healthLabel) as healthLabel,
any (
insights_projects_populated_copy_health_v2.healthScoreV2Normalized
) as healthScoreV2Normalized,
any (insights_projects_populated_copy_health_v2.healthMaxScore) as healthMaxScore
FROM insightsProjects FINAL
LEFT JOIN
insights_projects_populated_copy_collections_slugs
Expand Down Expand Up @@ -274,6 +294,9 @@ SQL >
last_vulnerability_scan_status
ON last_vulnerability_scan_status.insightsProjectId = insightsProjects.id
LEFT JOIN segments ON segments.id = insightsProjects.segmentId
LEFT JOIN
insights_projects_populated_copy_health_v2
ON insights_projects_populated_copy_health_v2.id = insightsProjects.id
WHERE isNull (insightsProjects.deletedAt) AND insightsProjects.enabled = 1
group by 1

Expand Down
Loading
Loading