Skip to content

Commit 53c863c

Browse files
committed
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 <jmaia@contractor.linuxfoundation.org>
1 parent bf4c85f commit 53c863c

1 file changed

Lines changed: 30 additions & 14 deletions

File tree

services/libs/tinybird/pipes/org_page_kpis_copy_pipe.pipe

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,52 @@
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 counts only code contribution activity types (commits, PRs, code reviews).
45
Active contributors and critical projects use a 730-day (2-year) window.
56
Trend compares current 730-day period against the prior 730-day period (days 731–1460).
67

78
TAGS "Organization page"
89

10+
NODE org_page_kpis_code_activity_types
11+
DESCRIPTION >
12+
Code contribution activity types only
13+
14+
SQL >
15+
SELECT activityType, platform FROM activityTypes FINAL WHERE isCodeContribution
16+
917
NODE org_page_kpis_current_contributors
1018
DESCRIPTION >
11-
Active contributors per org in the last 730 days (2 years)
19+
Active code contributors per org in the last 730 days (2 years)
1220

1321
SQL >
14-
SELECT organizationId, uniq(memberId) AS activeContributors
15-
FROM activityRelations_deduplicated_cleaned_bucket_union
22+
SELECT ar.organizationId, uniq(ar.memberId) AS activeContributors
23+
FROM activityRelations_deduplicated_cleaned_bucket_union ar
24+
INNER JOIN
25+
org_page_kpis_code_activity_types at
26+
ON ar.type = at.activityType
27+
AND ar.platform = at.platform
1628
WHERE
17-
organizationId != ''
18-
AND timestamp >= toStartOfDay(now() - toIntervalDay(730))
19-
AND timestamp < toStartOfDay(now() + toIntervalDay(1))
20-
GROUP BY organizationId
29+
ar.organizationId != ''
30+
AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(730))
31+
AND ar.timestamp < toStartOfDay(now() + toIntervalDay(1))
32+
GROUP BY ar.organizationId
2133

2234
NODE org_page_kpis_previous_contributors
2335
DESCRIPTION >
24-
Active contributors per org in the prior 730-day window (days 731–1460, for trend calc)
36+
Active code contributors per org in the prior 730-day window (days 731–1460, for trend calc)
2537

2638
SQL >
27-
SELECT organizationId, uniq(memberId) AS activeContributorsPrevious
28-
FROM activityRelations_deduplicated_cleaned_bucket_union
39+
SELECT ar.organizationId, uniq(ar.memberId) AS activeContributorsPrevious
40+
FROM activityRelations_deduplicated_cleaned_bucket_union ar
41+
INNER JOIN
42+
org_page_kpis_code_activity_types at
43+
ON ar.type = at.activityType
44+
AND ar.platform = at.platform
2945
WHERE
30-
organizationId != ''
31-
AND timestamp >= toStartOfDay(now() - toIntervalDay(1460))
32-
AND timestamp < toStartOfDay(now() - toIntervalDay(730))
33-
GROUP BY organizationId
46+
ar.organizationId != ''
47+
AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(1460))
48+
AND ar.timestamp < toStartOfDay(now() - toIntervalDay(730))
49+
GROUP BY ar.organizationId
3450

3551
NODE org_page_kpis_maintainer_roles
3652
DESCRIPTION >

0 commit comments

Comments
 (0)