Skip to content

Commit 33985a7

Browse files
committed
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 <jmaia@contractor.linuxfoundation.org>
1 parent 91aa11e commit 33985a7

7 files changed

Lines changed: 29 additions & 19 deletions

services/libs/tinybird/pipes/leaderboards_organizations.pipe

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ DESCRIPTION >
55

66
NODE leaderboards_organizations_data
77
DESCRIPTION >
8-
Retrieves all organizations from the populated datasource
8+
Retrieves all organizations from the populated datasource, including slug for page links
99

1010
SQL >
11-
SELECT id, displayName, logo FROM organizations FINAL
11+
SELECT o.id, o.displayName, o.logo, ops.slug
12+
FROM organizations o FINAL
13+
LEFT JOIN organizations_populated_slug ops ON o.id = ops.id
1214

1315
NODE leaderboards_organizations_activity_types
1416
DESCRIPTION >
@@ -67,7 +69,7 @@ SQL >
6769
p.id as id,
6870
'' as segmentId,
6971
p.displayName as name,
70-
'' as slug,
72+
p.slug as slug,
7173
p.logo as logoUrl,
7274
'organizations' as leaderboardType,
7375
cast(coalesce(c.organizationActivityCount, 0) as Float64) as value,
@@ -83,7 +85,7 @@ SQL >
8385
JOIN c.segmentIds as sid
8486
LEFT JOIN leaderboards_organizations_projects proj ON proj.segmentId = sid
8587
WHERE c.organizationActivityCount > 0
86-
GROUP BY p.id, p.displayName, p.logo, c.organizationActivityCount, pp.organizationActivityCount
88+
GROUP BY p.id, p.displayName, p.logo, p.slug, c.organizationActivityCount, pp.organizationActivityCount
8789
ORDER BY value DESC
8890
LIMIT 100
8991

services/libs/tinybird/pipes/org_page_activities_timeseries.pipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
DESCRIPTION >
2-
Activity timeseries for a given organization, bucketed by year (all-time).
2+
Contribution timeseries for a given organization, bucketed by year (last 10 years).
33

44
TAGS "Organization page"
55

services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
DESCRIPTION >
2-
Nightly copy pipe that precomputes yearly activity counts per organization for the org page.
2+
Nightly copy pipe that precomputes yearly contribution counts per organization for the org page.
3+
Covers the last 10 years, bucketed by year.
34
Writes one row per (organizationId, startDate) into org_page_activities_timeseries_copy_ds.
45

56
TAGS "Organization page"
@@ -13,7 +14,7 @@ SQL >
1314
count() AS activityCount,
1415
now() AS computedAt
1516
FROM activityRelations_deduplicated_cleaned_bucket_union
16-
WHERE organizationId != '' AND timestamp >= '2016-01-01'
17+
WHERE organizationId != '' AND timestamp >= toStartOfYear(now() - toIntervalYear(10))
1718
GROUP BY organizationId, startDate, endDate
1819

1920
TYPE COPY

services/libs/tinybird/pipes/org_page_contributors_timeseries.pipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
DESCRIPTION >
2-
Contributor count timeseries for a given organization, bucketed by year (all-time).
2+
Contributor count timeseries for a given organization, bucketed by year (last 10 years).
33

44
TAGS "Organization page"
55

services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
DESCRIPTION >
22
Nightly copy pipe that precomputes yearly unique contributor counts per organization for the org page.
3+
Covers the last 10 years, bucketed by year.
34
Writes one row per (organizationId, startDate) into org_page_contributors_timeseries_copy_ds.
45

56
TAGS "Organization page"
@@ -13,7 +14,7 @@ SQL >
1314
uniq(memberId) AS contributorCount,
1415
now() AS computedAt
1516
FROM activityRelations_deduplicated_cleaned_bucket_union
16-
WHERE organizationId != '' AND timestamp >= '2016-01-01'
17+
WHERE organizationId != '' AND timestamp >= toStartOfYear(now() - toIntervalYear(10))
1718
GROUP BY organizationId, startDate, endDate
1819

1920
TYPE COPY

services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,62 @@
11
DESCRIPTION >
22
Nightly copy pipe that precomputes org-level KPIs for the org page.
33
Writes one row per organizationId into org_page_kpis_copy_ds.
4+
Active contributors and critical projects use a 730-day (2-year) window.
5+
Trend compares current 730-day period against the prior 730-day period (days 731–1460).
46

57
TAGS "Organization page"
68

79
NODE org_page_kpis_current_contributors
810
DESCRIPTION >
9-
Active contributors per org in the last 365 days
11+
Active contributors per org in the last 730 days (2 years)
1012

1113
SQL >
1214
SELECT organizationId, uniq(memberId) AS activeContributors
1315
FROM activityRelations_deduplicated_cleaned_bucket_union
1416
WHERE
1517
organizationId != ''
16-
AND timestamp >= toStartOfDay(now() - toIntervalDay(365))
18+
AND timestamp >= toStartOfDay(now() - toIntervalDay(730))
1719
AND timestamp < toStartOfDay(now() + toIntervalDay(1))
1820
GROUP BY organizationId
1921

2022
NODE org_page_kpis_previous_contributors
2123
DESCRIPTION >
22-
Active contributors per org in the prior 365-day window (for trend calc)
24+
Active contributors per org in the prior 730-day window (days 731–1460, for trend calc)
2325

2426
SQL >
2527
SELECT organizationId, uniq(memberId) AS activeContributorsPrevious
2628
FROM activityRelations_deduplicated_cleaned_bucket_union
2729
WHERE
2830
organizationId != ''
29-
AND timestamp >= toStartOfDay(now() - toIntervalDay(730))
30-
AND timestamp < toStartOfDay(now() - toIntervalDay(365))
31+
AND timestamp >= toStartOfDay(now() - toIntervalDay(1460))
32+
AND timestamp < toStartOfDay(now() - toIntervalDay(730))
3133
GROUP BY organizationId
3234

3335
NODE org_page_kpis_maintainer_roles
3436
DESCRIPTION >
35-
Count of active maintainer role assignments per org
37+
Count of maintainer role assignments per org active at any point in the last 730 days (2 years)
3638

3739
SQL >
3840
SELECT organizationId, uniq((memberId, insightsProjectId)) AS maintainerRoles
3941
FROM maintainers_roles_copy_ds
40-
WHERE role = 'maintainer' AND toYear(endDate) <= 1970 AND organizationId != ''
42+
WHERE
43+
role = 'maintainer'
44+
AND organizationId != ''
45+
AND startDate <= now()
46+
AND (toYear(endDate) <= 1970 OR endDate >= now() - toIntervalDay(730))
4147
GROUP BY organizationId
4248

4349
NODE org_page_kpis_critical_projects
4450
DESCRIPTION >
45-
Count of distinct projects (segmentIds) an org contributed to in the last 365 days.
51+
Count of distinct projects (segmentIds) an org contributed to in the last 730 days (2 years).
4652
Serves as the "critical projects" placeholder until a real criticality filter is added.
4753

4854
SQL >
4955
SELECT organizationId, uniq(segmentId) AS criticalProjects
5056
FROM activityRelations_deduplicated_cleaned_bucket_union
5157
WHERE
5258
organizationId != ''
53-
AND timestamp >= toStartOfDay(now() - toIntervalDay(365))
59+
AND timestamp >= toStartOfDay(now() - toIntervalDay(730))
5460
AND timestamp < toStartOfDay(now() + toIntervalDay(1))
5561
GROUP BY organizationId
5662

services/libs/tinybird/pipes/org_page_projects.pipe

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ SQL >
3030
technicalScore
3131
FROM org_page_projects_copy_ds FINAL
3232
WHERE organizationId = (SELECT id FROM org_slug_lookup)
33-
ORDER BY technicalScore DESC, contributorCount DESC, activityCount DESC
33+
ORDER BY contributorCount DESC, technicalScore DESC, activityCount DESC
3434
LIMIT {{ Int32(limit, 21, description="Page size + 1 for hasMore detection") }}
3535
OFFSET {{ Int32(offset, 0, description="Pagination offset") }}

0 commit comments

Comments
 (0)