From 33985a7362fd7f0effa1a8d0962fafe85f7af19f Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 17 Jul 2026 16:22:50 +0100 Subject: [PATCH 1/8] feat: organization page Tinybird pipe improvements IN-1204 - org_page_kpis_copy_pipe: expand active contributors and critical projects windows from 365d to 730d (2 years); shift trend comparison window to 730-1460d; expand maintainer roles to include roles active in the last 730d (not just currently active) - org_page_projects: sort by contributorCount DESC (was technicalScore) - org_page_activities/contributors_timeseries_copy_pipe: switch fixed 2016-01-01 cutoff to rolling last 10 years - leaderboards_organizations: join organizations_populated_slug to expose real org slug for leaderboard row links Signed-off-by: Joana Maia --- .../pipes/leaderboards_organizations.pipe | 10 ++++---- .../pipes/org_page_activities_timeseries.pipe | 2 +- ..._page_activities_timeseries_copy_pipe.pipe | 5 ++-- .../org_page_contributors_timeseries.pipe | 2 +- ...age_contributors_timeseries_copy_pipe.pipe | 3 ++- .../pipes/org_page_kpis_copy_pipe.pipe | 24 ++++++++++++------- .../tinybird/pipes/org_page_projects.pipe | 2 +- 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/services/libs/tinybird/pipes/leaderboards_organizations.pipe b/services/libs/tinybird/pipes/leaderboards_organizations.pipe index 70c23910a9..d244bd1190 100644 --- a/services/libs/tinybird/pipes/leaderboards_organizations.pipe +++ b/services/libs/tinybird/pipes/leaderboards_organizations.pipe @@ -5,10 +5,12 @@ DESCRIPTION > NODE leaderboards_organizations_data DESCRIPTION > - Retrieves all organizations from the populated datasource + Retrieves all organizations from the populated datasource, including slug for page links SQL > - SELECT id, displayName, logo FROM organizations FINAL + SELECT o.id, o.displayName, o.logo, ops.slug + FROM organizations o FINAL + LEFT JOIN organizations_populated_slug ops ON o.id = ops.id NODE leaderboards_organizations_activity_types DESCRIPTION > @@ -67,7 +69,7 @@ SQL > p.id as id, '' as segmentId, p.displayName as name, - '' as slug, + p.slug as slug, p.logo as logoUrl, 'organizations' as leaderboardType, cast(coalesce(c.organizationActivityCount, 0) as Float64) as value, @@ -83,7 +85,7 @@ SQL > JOIN c.segmentIds as sid LEFT JOIN leaderboards_organizations_projects proj ON proj.segmentId = sid WHERE c.organizationActivityCount > 0 - GROUP BY p.id, p.displayName, p.logo, c.organizationActivityCount, pp.organizationActivityCount + GROUP BY p.id, p.displayName, p.logo, p.slug, c.organizationActivityCount, pp.organizationActivityCount ORDER BY value DESC LIMIT 100 diff --git a/services/libs/tinybird/pipes/org_page_activities_timeseries.pipe b/services/libs/tinybird/pipes/org_page_activities_timeseries.pipe index 45e8644268..5cc70a885b 100644 --- a/services/libs/tinybird/pipes/org_page_activities_timeseries.pipe +++ b/services/libs/tinybird/pipes/org_page_activities_timeseries.pipe @@ -1,5 +1,5 @@ DESCRIPTION > - Activity timeseries for a given organization, bucketed by year (all-time). + Contribution timeseries for a given organization, bucketed by year (last 10 years). TAGS "Organization page" diff --git a/services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe index ec4fb4c61a..880d146230 100644 --- a/services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe @@ -1,5 +1,6 @@ DESCRIPTION > - Nightly copy pipe that precomputes yearly activity counts per organization for the org page. + Nightly copy pipe that precomputes yearly contribution counts per organization for the org page. + Covers the last 10 years, bucketed by year. Writes one row per (organizationId, startDate) into org_page_activities_timeseries_copy_ds. TAGS "Organization page" @@ -13,7 +14,7 @@ SQL > count() AS activityCount, now() AS computedAt FROM activityRelations_deduplicated_cleaned_bucket_union - WHERE organizationId != '' AND timestamp >= '2016-01-01' + WHERE organizationId != '' AND timestamp >= toStartOfYear(now() - toIntervalYear(10)) GROUP BY organizationId, startDate, endDate TYPE COPY diff --git a/services/libs/tinybird/pipes/org_page_contributors_timeseries.pipe b/services/libs/tinybird/pipes/org_page_contributors_timeseries.pipe index 684edb208d..f69fbb48a6 100644 --- a/services/libs/tinybird/pipes/org_page_contributors_timeseries.pipe +++ b/services/libs/tinybird/pipes/org_page_contributors_timeseries.pipe @@ -1,5 +1,5 @@ DESCRIPTION > - Contributor count timeseries for a given organization, bucketed by year (all-time). + Contributor count timeseries for a given organization, bucketed by year (last 10 years). TAGS "Organization page" diff --git a/services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe index 2d594cc229..57f8ba5f1a 100644 --- a/services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe @@ -1,5 +1,6 @@ DESCRIPTION > Nightly copy pipe that precomputes yearly unique contributor counts per organization for the org page. + Covers the last 10 years, bucketed by year. Writes one row per (organizationId, startDate) into org_page_contributors_timeseries_copy_ds. TAGS "Organization page" @@ -13,7 +14,7 @@ SQL > uniq(memberId) AS contributorCount, now() AS computedAt FROM activityRelations_deduplicated_cleaned_bucket_union - WHERE organizationId != '' AND timestamp >= '2016-01-01' + WHERE organizationId != '' AND timestamp >= toStartOfYear(now() - toIntervalYear(10)) GROUP BY organizationId, startDate, endDate TYPE COPY diff --git a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe index 2424dcf6a2..e694aad129 100644 --- a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe @@ -1,48 +1,54 @@ DESCRIPTION > Nightly copy pipe that precomputes org-level KPIs for the org page. Writes one row per organizationId into org_page_kpis_copy_ds. + Active contributors and critical projects use a 730-day (2-year) window. + Trend compares current 730-day period against the prior 730-day period (days 731–1460). TAGS "Organization page" NODE org_page_kpis_current_contributors DESCRIPTION > - Active contributors per org in the last 365 days + Active contributors per org in the last 730 days (2 years) SQL > SELECT organizationId, uniq(memberId) AS activeContributors FROM activityRelations_deduplicated_cleaned_bucket_union WHERE organizationId != '' - AND timestamp >= toStartOfDay(now() - toIntervalDay(365)) + AND timestamp >= toStartOfDay(now() - toIntervalDay(730)) AND timestamp < toStartOfDay(now() + toIntervalDay(1)) GROUP BY organizationId NODE org_page_kpis_previous_contributors DESCRIPTION > - Active contributors per org in the prior 365-day window (for trend calc) + Active contributors per org in the prior 730-day window (days 731–1460, for trend calc) SQL > SELECT organizationId, uniq(memberId) AS activeContributorsPrevious FROM activityRelations_deduplicated_cleaned_bucket_union WHERE organizationId != '' - AND timestamp >= toStartOfDay(now() - toIntervalDay(730)) - AND timestamp < toStartOfDay(now() - toIntervalDay(365)) + AND timestamp >= toStartOfDay(now() - toIntervalDay(1460)) + AND timestamp < toStartOfDay(now() - toIntervalDay(730)) GROUP BY organizationId NODE org_page_kpis_maintainer_roles DESCRIPTION > - Count of active maintainer role assignments per org + Count of maintainer role assignments per org active at any point in the last 730 days (2 years) SQL > SELECT organizationId, uniq((memberId, insightsProjectId)) AS maintainerRoles FROM maintainers_roles_copy_ds - WHERE role = 'maintainer' AND toYear(endDate) <= 1970 AND organizationId != '' + WHERE + role = 'maintainer' + AND organizationId != '' + AND startDate <= now() + AND (toYear(endDate) <= 1970 OR endDate >= now() - toIntervalDay(730)) GROUP BY organizationId NODE org_page_kpis_critical_projects DESCRIPTION > - Count of distinct projects (segmentIds) an org contributed to in the last 365 days. + Count of distinct projects (segmentIds) an org contributed to in the last 730 days (2 years). Serves as the "critical projects" placeholder until a real criticality filter is added. SQL > @@ -50,7 +56,7 @@ SQL > FROM activityRelations_deduplicated_cleaned_bucket_union WHERE organizationId != '' - AND timestamp >= toStartOfDay(now() - toIntervalDay(365)) + AND timestamp >= toStartOfDay(now() - toIntervalDay(730)) AND timestamp < toStartOfDay(now() + toIntervalDay(1)) GROUP BY organizationId diff --git a/services/libs/tinybird/pipes/org_page_projects.pipe b/services/libs/tinybird/pipes/org_page_projects.pipe index 72994c47e6..8f89a177bd 100644 --- a/services/libs/tinybird/pipes/org_page_projects.pipe +++ b/services/libs/tinybird/pipes/org_page_projects.pipe @@ -30,6 +30,6 @@ SQL > technicalScore FROM org_page_projects_copy_ds FINAL WHERE organizationId = (SELECT id FROM org_slug_lookup) - ORDER BY technicalScore DESC, contributorCount DESC, activityCount DESC + ORDER BY contributorCount DESC, technicalScore DESC, activityCount DESC LIMIT {{ Int32(limit, 21, description="Page size + 1 for hasMore detection") }} OFFSET {{ Int32(offset, 0, description="Pagination offset") }} From 5863e399b4d9ea8a5b6f8e322f0fc49a7c263864 Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 17 Jul 2026 16:33:00 +0100 Subject: [PATCH 2/8] fix: filter timeseries pipes to code contribution activity types only IN-1204 Both org_page_activities_timeseries_copy_pipe and org_page_contributors_timeseries_copy_pipe previously counted all activity types. Add INNER JOIN on activityTypes WHERE isCodeContribution so the charts reflect only code contributions, matching the 'Contributions' label in the UI. Signed-off-by: Joana Maia --- ..._page_activities_timeseries_copy_pipe.pipe | 26 ++++++++++++++----- ...age_contributors_timeseries_copy_pipe.pipe | 26 ++++++++++++++----- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe index 880d146230..47baf68789 100644 --- a/services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe @@ -1,21 +1,33 @@ DESCRIPTION > - Nightly copy pipe that precomputes yearly contribution counts per organization for the org page. + Nightly copy pipe that precomputes yearly code contribution counts per organization for the org page. + Counts only code contribution activity types (commits, PRs, code reviews). Covers the last 10 years, bucketed by year. Writes one row per (organizationId, startDate) into org_page_activities_timeseries_copy_ds. TAGS "Organization page" +NODE org_page_activities_timeseries_code_activity_types +DESCRIPTION > + Code contribution activity types only + +SQL > + SELECT activityType, platform FROM activityTypes FINAL WHERE isCodeContribution + NODE org_page_activities_timeseries_copy_pipe_data SQL > SELECT - organizationId, - toStartOfYear(timestamp) AS startDate, - toDate(toStartOfYear(timestamp) + INTERVAL 1 YEAR - INTERVAL 1 DAY) AS endDate, + ar.organizationId, + toStartOfYear(ar.timestamp) AS startDate, + toDate(toStartOfYear(ar.timestamp) + INTERVAL 1 YEAR - INTERVAL 1 DAY) AS endDate, count() AS activityCount, now() AS computedAt - FROM activityRelations_deduplicated_cleaned_bucket_union - WHERE organizationId != '' AND timestamp >= toStartOfYear(now() - toIntervalYear(10)) - GROUP BY organizationId, startDate, endDate + FROM activityRelations_deduplicated_cleaned_bucket_union ar + INNER JOIN + org_page_activities_timeseries_code_activity_types at + ON ar.type = at.activityType + AND ar.platform = at.platform + WHERE ar.organizationId != '' AND ar.timestamp >= toStartOfYear(now() - toIntervalYear(10)) + GROUP BY ar.organizationId, startDate, endDate TYPE COPY TARGET_DATASOURCE org_page_activities_timeseries_copy_ds diff --git a/services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe index 57f8ba5f1a..5d2e8e3abb 100644 --- a/services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe @@ -1,21 +1,33 @@ DESCRIPTION > Nightly copy pipe that precomputes yearly unique contributor counts per organization for the org page. + Counts only contributors active via code contribution activity types (commits, PRs, code reviews). Covers the last 10 years, bucketed by year. Writes one row per (organizationId, startDate) into org_page_contributors_timeseries_copy_ds. TAGS "Organization page" +NODE org_page_contributors_timeseries_code_activity_types +DESCRIPTION > + Code contribution activity types only + +SQL > + SELECT activityType, platform FROM activityTypes FINAL WHERE isCodeContribution + NODE org_page_contributors_timeseries_copy_pipe_data SQL > SELECT - organizationId, - toStartOfYear(timestamp) AS startDate, - toDate(toStartOfYear(timestamp) + INTERVAL 1 YEAR - INTERVAL 1 DAY) AS endDate, - uniq(memberId) AS contributorCount, + ar.organizationId, + toStartOfYear(ar.timestamp) AS startDate, + toDate(toStartOfYear(ar.timestamp) + INTERVAL 1 YEAR - INTERVAL 1 DAY) AS endDate, + uniq(ar.memberId) AS contributorCount, now() AS computedAt - FROM activityRelations_deduplicated_cleaned_bucket_union - WHERE organizationId != '' AND timestamp >= toStartOfYear(now() - toIntervalYear(10)) - GROUP BY organizationId, startDate, endDate + FROM activityRelations_deduplicated_cleaned_bucket_union ar + INNER JOIN + org_page_contributors_timeseries_code_activity_types at + ON ar.type = at.activityType + AND ar.platform = at.platform + WHERE ar.organizationId != '' AND ar.timestamp >= toStartOfYear(now() - toIntervalYear(10)) + GROUP BY ar.organizationId, startDate, endDate TYPE COPY TARGET_DATASOURCE org_page_contributors_timeseries_copy_ds From 262c12b95f424584a0315d16dd68e2cd82762bbd Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 17 Jul 2026 16:51:32 +0100 Subject: [PATCH 3/8] fix: update org_page_kpis.pipe description to reflect 730-day trend window IN-1204 Signed-off-by: Joana Maia --- services/libs/tinybird/pipes/org_page_kpis.pipe | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/libs/tinybird/pipes/org_page_kpis.pipe b/services/libs/tinybird/pipes/org_page_kpis.pipe index b28bdb973b..78cd009561 100644 --- a/services/libs/tinybird/pipes/org_page_kpis.pipe +++ b/services/libs/tinybird/pipes/org_page_kpis.pipe @@ -1,6 +1,6 @@ DESCRIPTION > Returns KPIs for a given organization from the precomputed org_page_kpis_copy_ds. - Includes trend calculations comparing current to previous 365-day period. + Includes trend calculations comparing current to previous 730-day period. TAGS "Organization page" From bf4c85f8b8905d094a3ab3de8e21c9709c1935e4 Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 17 Jul 2026 16:55:25 +0100 Subject: [PATCH 4/8] fix: lint Signed-off-by: Joana Maia --- services/libs/tinybird/pipes/leaderboards_organizations.pipe | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/libs/tinybird/pipes/leaderboards_organizations.pipe b/services/libs/tinybird/pipes/leaderboards_organizations.pipe index d244bd1190..8c8a275a93 100644 --- a/services/libs/tinybird/pipes/leaderboards_organizations.pipe +++ b/services/libs/tinybird/pipes/leaderboards_organizations.pipe @@ -85,7 +85,8 @@ SQL > JOIN c.segmentIds as sid LEFT JOIN leaderboards_organizations_projects proj ON proj.segmentId = sid WHERE c.organizationActivityCount > 0 - GROUP BY p.id, p.displayName, p.logo, p.slug, c.organizationActivityCount, pp.organizationActivityCount + GROUP BY + p.id, p.displayName, p.logo, p.slug, c.organizationActivityCount, pp.organizationActivityCount ORDER BY value DESC LIMIT 100 From 53c863c9e2f79cea39de694209dad7fa26815370 Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 17 Jul 2026 17:04:26 +0100 Subject: [PATCH 5/8] fix: filter active contributors KPI to code contribution activity types only IN-1204 Apply isCodeContribution filter to both current and previous contributor nodes so the Active Contributors KPI counts only code contributors, consistent with its UI definition and the contributor chart. Signed-off-by: Joana Maia --- .../pipes/org_page_kpis_copy_pipe.pipe | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe index e694aad129..9987feb4d7 100644 --- a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe @@ -1,36 +1,52 @@ DESCRIPTION > Nightly copy pipe that precomputes org-level KPIs for the org page. Writes one row per organizationId into org_page_kpis_copy_ds. + Active contributors counts only code contribution activity types (commits, PRs, code reviews). Active contributors and critical projects use a 730-day (2-year) window. Trend compares current 730-day period against the prior 730-day period (days 731–1460). TAGS "Organization page" +NODE org_page_kpis_code_activity_types +DESCRIPTION > + Code contribution activity types only + +SQL > + SELECT activityType, platform FROM activityTypes FINAL WHERE isCodeContribution + NODE org_page_kpis_current_contributors DESCRIPTION > - Active contributors per org in the last 730 days (2 years) + Active code contributors per org in the last 730 days (2 years) SQL > - SELECT organizationId, uniq(memberId) AS activeContributors - FROM activityRelations_deduplicated_cleaned_bucket_union + SELECT ar.organizationId, uniq(ar.memberId) AS activeContributors + FROM activityRelations_deduplicated_cleaned_bucket_union ar + INNER JOIN + org_page_kpis_code_activity_types at + ON ar.type = at.activityType + AND ar.platform = at.platform WHERE - organizationId != '' - AND timestamp >= toStartOfDay(now() - toIntervalDay(730)) - AND timestamp < toStartOfDay(now() + toIntervalDay(1)) - GROUP BY organizationId + ar.organizationId != '' + AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(730)) + AND ar.timestamp < toStartOfDay(now() + toIntervalDay(1)) + GROUP BY ar.organizationId NODE org_page_kpis_previous_contributors DESCRIPTION > - Active contributors per org in the prior 730-day window (days 731–1460, for trend calc) + Active code contributors per org in the prior 730-day window (days 731–1460, for trend calc) SQL > - SELECT organizationId, uniq(memberId) AS activeContributorsPrevious - FROM activityRelations_deduplicated_cleaned_bucket_union + SELECT ar.organizationId, uniq(ar.memberId) AS activeContributorsPrevious + FROM activityRelations_deduplicated_cleaned_bucket_union ar + INNER JOIN + org_page_kpis_code_activity_types at + ON ar.type = at.activityType + AND ar.platform = at.platform WHERE - organizationId != '' - AND timestamp >= toStartOfDay(now() - toIntervalDay(1460)) - AND timestamp < toStartOfDay(now() - toIntervalDay(730)) - GROUP BY organizationId + ar.organizationId != '' + AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(1460)) + AND ar.timestamp < toStartOfDay(now() - toIntervalDay(730)) + GROUP BY ar.organizationId NODE org_page_kpis_maintainer_roles DESCRIPTION > From 142c40522b8ea7babde83616058fe13707bd6d88 Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 17 Jul 2026 17:06:24 +0100 Subject: [PATCH 6/8] fix: lint Signed-off-by: Joana Maia --- services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe index 9987feb4d7..0763218f59 100644 --- a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe @@ -22,9 +22,7 @@ SQL > SELECT ar.organizationId, uniq(ar.memberId) AS activeContributors FROM activityRelations_deduplicated_cleaned_bucket_union ar INNER JOIN - org_page_kpis_code_activity_types at - ON ar.type = at.activityType - AND ar.platform = at.platform + org_page_kpis_code_activity_types at ON ar.type = at.activityType AND ar.platform = at.platform WHERE ar.organizationId != '' AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(730)) @@ -39,9 +37,7 @@ SQL > SELECT ar.organizationId, uniq(ar.memberId) AS activeContributorsPrevious FROM activityRelations_deduplicated_cleaned_bucket_union ar INNER JOIN - org_page_kpis_code_activity_types at - ON ar.type = at.activityType - AND ar.platform = at.platform + org_page_kpis_code_activity_types at ON ar.type = at.activityType AND ar.platform = at.platform WHERE ar.organizationId != '' AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(1460)) From 03f843945e418bac3ad0503dd436fbcb4d1ae499 Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 17 Jul 2026 17:09:14 +0100 Subject: [PATCH 7/8] chore: fix grammar in org_page_kpis_copy_pipe description IN-1204 Co-Authored-By: Claude Opus 4.7 Signed-off-by: Joana Maia --- services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe index 0763218f59..31ab16e46d 100644 --- a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe @@ -1,7 +1,7 @@ DESCRIPTION > Nightly copy pipe that precomputes org-level KPIs for the org page. Writes one row per organizationId into org_page_kpis_copy_ds. - Active contributors counts only code contribution activity types (commits, PRs, code reviews). + Active contributors count only code contribution activity types (commits, PRs, code reviews). Active contributors and critical projects use a 730-day (2-year) window. Trend compares current 730-day period against the prior 730-day period (days 731–1460). From 2458074df1569bda065262f16127456ffd9f5815 Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Fri, 17 Jul 2026 17:26:30 +0100 Subject: [PATCH 8/8] fix: filter critical projects KPI to code contribution activity types only IN-1204 Aligns org_page_kpis_critical_projects with org_page_projects_copy_pipe which already filters to isCodeContribution. KPI and list now use the same population. Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Joana Maia --- .../tinybird/pipes/org_page_kpis_copy_pipe.pipe | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe index 31ab16e46d..2ad9af6c6a 100644 --- a/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe +++ b/services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe @@ -60,17 +60,19 @@ SQL > NODE org_page_kpis_critical_projects DESCRIPTION > - Count of distinct projects (segmentIds) an org contributed to in the last 730 days (2 years). + Count of distinct projects (segmentIds) an org made code contributions to in the last 730 days (2 years). Serves as the "critical projects" placeholder until a real criticality filter is added. SQL > - SELECT organizationId, uniq(segmentId) AS criticalProjects - FROM activityRelations_deduplicated_cleaned_bucket_union + SELECT ar.organizationId, uniq(ar.segmentId) AS criticalProjects + FROM activityRelations_deduplicated_cleaned_bucket_union ar + INNER JOIN + org_page_kpis_code_activity_types at ON ar.type = at.activityType AND ar.platform = at.platform WHERE - organizationId != '' - AND timestamp >= toStartOfDay(now() - toIntervalDay(730)) - AND timestamp < toStartOfDay(now() + toIntervalDay(1)) - GROUP BY organizationId + ar.organizationId != '' + AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(730)) + AND ar.timestamp < toStartOfDay(now() + toIntervalDay(1)) + GROUP BY ar.organizationId NODE org_page_kpis_final DESCRIPTION >