Skip to content

Commit 5863e39

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

2 files changed

Lines changed: 38 additions & 14 deletions

File tree

services/libs/tinybird/pipes/org_page_activities_timeseries_copy_pipe.pipe

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
DESCRIPTION >
2-
Nightly copy pipe that precomputes yearly contribution counts per organization for the org page.
2+
Nightly copy pipe that precomputes yearly code contribution counts per organization for the org page.
3+
Counts only code contribution activity types (commits, PRs, code reviews).
34
Covers the last 10 years, bucketed by year.
45
Writes one row per (organizationId, startDate) into org_page_activities_timeseries_copy_ds.
56

67
TAGS "Organization page"
78

9+
NODE org_page_activities_timeseries_code_activity_types
10+
DESCRIPTION >
11+
Code contribution activity types only
12+
13+
SQL >
14+
SELECT activityType, platform FROM activityTypes FINAL WHERE isCodeContribution
15+
816
NODE org_page_activities_timeseries_copy_pipe_data
917
SQL >
1018
SELECT
11-
organizationId,
12-
toStartOfYear(timestamp) AS startDate,
13-
toDate(toStartOfYear(timestamp) + INTERVAL 1 YEAR - INTERVAL 1 DAY) AS endDate,
19+
ar.organizationId,
20+
toStartOfYear(ar.timestamp) AS startDate,
21+
toDate(toStartOfYear(ar.timestamp) + INTERVAL 1 YEAR - INTERVAL 1 DAY) AS endDate,
1422
count() AS activityCount,
1523
now() AS computedAt
16-
FROM activityRelations_deduplicated_cleaned_bucket_union
17-
WHERE organizationId != '' AND timestamp >= toStartOfYear(now() - toIntervalYear(10))
18-
GROUP BY organizationId, startDate, endDate
24+
FROM activityRelations_deduplicated_cleaned_bucket_union ar
25+
INNER JOIN
26+
org_page_activities_timeseries_code_activity_types at
27+
ON ar.type = at.activityType
28+
AND ar.platform = at.platform
29+
WHERE ar.organizationId != '' AND ar.timestamp >= toStartOfYear(now() - toIntervalYear(10))
30+
GROUP BY ar.organizationId, startDate, endDate
1931

2032
TYPE COPY
2133
TARGET_DATASOURCE org_page_activities_timeseries_copy_ds

services/libs/tinybird/pipes/org_page_contributors_timeseries_copy_pipe.pipe

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
DESCRIPTION >
22
Nightly copy pipe that precomputes yearly unique contributor counts per organization for the org page.
3+
Counts only contributors active via code contribution activity types (commits, PRs, code reviews).
34
Covers the last 10 years, bucketed by year.
45
Writes one row per (organizationId, startDate) into org_page_contributors_timeseries_copy_ds.
56

67
TAGS "Organization page"
78

9+
NODE org_page_contributors_timeseries_code_activity_types
10+
DESCRIPTION >
11+
Code contribution activity types only
12+
13+
SQL >
14+
SELECT activityType, platform FROM activityTypes FINAL WHERE isCodeContribution
15+
816
NODE org_page_contributors_timeseries_copy_pipe_data
917
SQL >
1018
SELECT
11-
organizationId,
12-
toStartOfYear(timestamp) AS startDate,
13-
toDate(toStartOfYear(timestamp) + INTERVAL 1 YEAR - INTERVAL 1 DAY) AS endDate,
14-
uniq(memberId) AS contributorCount,
19+
ar.organizationId,
20+
toStartOfYear(ar.timestamp) AS startDate,
21+
toDate(toStartOfYear(ar.timestamp) + INTERVAL 1 YEAR - INTERVAL 1 DAY) AS endDate,
22+
uniq(ar.memberId) AS contributorCount,
1523
now() AS computedAt
16-
FROM activityRelations_deduplicated_cleaned_bucket_union
17-
WHERE organizationId != '' AND timestamp >= toStartOfYear(now() - toIntervalYear(10))
18-
GROUP BY organizationId, startDate, endDate
24+
FROM activityRelations_deduplicated_cleaned_bucket_union ar
25+
INNER JOIN
26+
org_page_contributors_timeseries_code_activity_types at
27+
ON ar.type = at.activityType
28+
AND ar.platform = at.platform
29+
WHERE ar.organizationId != '' AND ar.timestamp >= toStartOfYear(now() - toIntervalYear(10))
30+
GROUP BY ar.organizationId, startDate, endDate
1931

2032
TYPE COPY
2133
TARGET_DATASOURCE org_page_contributors_timeseries_copy_ds

0 commit comments

Comments
 (0)