You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: services/libs/tinybird/pipes/activities_filtered.pipe
+4-8Lines changed: 4 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -2,18 +2,17 @@ DESCRIPTION >
2
2
- `activities_filtered.pipe` is the core filtering infrastructure pipe for activity data across the entire analytics platform.
3
3
- This pipe serves as the foundation for most activity-related widgets, by providing a consistent, filtered view of contribution activities.
4
4
- It filters activities from `activityRelations_deduplicated_cleaned_ds` datasource based on project segment, time ranges, repositories, platforms, and activity types.
5
-
- By default, this pipe returns only contribution activities (`isContribution = 1`) unless explicitly overridden with `onlyContributions = 0`.
6
5
- The pipe automatically scopes data to the current project using `segments_filtered` pipe for security and data isolation.
7
6
- Parameters:
8
7
- `project`: Inherited from `segments_filtered`, project slug (e.g., 'k8s', 'tensorflow')
9
-
- `repos`: Inherited from `segments_filtered`, array of repository URLs for filtering
8
+
- `repos`: Optional array of repository URLs for filtering (e.g., ['https://github.com/kubernetes/kubernetes']). Inherited from `segments_filtered`.
10
9
- `startDate`: Optional DateTime filter for activities after timestamp (e.g., '2024-01-01 00:00:00')
11
10
- `endDate`: Optional DateTime filter for activities before timestamp (e.g., '2024-12-31 23:59:59')
12
-
- `repos`: Optional array of repository URLs (e.g., ['https://github.com/kubernetes/kubernetes'])
- `activity_type`: Optional string filter for single activity type (e.g., 'authored-commit')
15
13
- `activity_types`: Optional array of activity types (e.g., ['authored-commit', 'co-authored-commit'])
16
-
- `onlyContributions`: Optional boolean, defaults to 1 (contributions only), set to 0 for all activities
14
+
- `includeCodeContributions`: Optional boolean to include code contribution activities. Defaults to 1. Set to 0 to exclude. Inherited from activityTypes_filtered.
15
+
- `includeCollaborations`: Optional boolean to include or exclude collaboration activities. Inherited from activityTypes_filtered.
- `activity_type`: Optional string filter for single activity type (e.g., 'authored-commit')
16
16
- `activity_types`: Optional array of activity types (e.g., ['authored-commit', 'co-authored-commit'])
17
-
- `onlyContributions`: Optional boolean, defaults to 1 (contributions only), set to 0 for all activities
17
+
- `includeCodeContributions`: Optional boolean to include code contribution activities. Defaults to 1. Set to 0 to exclude. Inherited from activityTypes_filtered.
18
+
- `includeCollaborations`: Optional boolean to include or exclude collaboration activities. Inherited from activityTypes_filtered.
- `activity_type`: Optional string filter for single activity type (e.g., 'authored-commit')
15
15
- `activity_types`: Optional array of activity types (e.g., ['authored-commit', 'co-authored-commit'])
16
-
- `onlyContributions`: Optional boolean, defaults to 1 (contributions only), set to 0 for all activities
16
+
- `includeCodeContributions`: Optional boolean to include code contribution activities. Defaults to 1. Set to 0 to exclude. Inherited from activityTypes_filtered.
17
+
- `includeCollaborations`: Optional boolean to include or exclude collaboration activities. Inherited from activityTypes_filtered.
17
18
- `granularity`: Required string for time aggregation and period extension ('daily', 'weekly', 'monthly', 'quarterly', 'yearly')
- `activityTypes_filtered.pipe` allows filtering activityTypes from the respective data source.
3
+
- By default, this only returns code contribution activities (`includeCodeContributions = 1`).
4
+
- To return all activities, set `includeCodeContributions = 1`, `includeCollaborations = 1`, and `includeOtherContributions = 1`.
5
+
- Parameters:
6
+
- `includeCodeContributions`: Optional boolean to include code contribution activities. Defaults to 1. Set to 0 to exclude.
7
+
- `includeCollaborations`: Optional boolean to include or exclude collaboration activities.
8
+
- `includeOtherContributions`: Optional boolean to include other contribution activities (activities that are neither code contributions nor collaborations).
9
+
- Response: `activityType`, `platform`.
10
+
- This pipe is used by other downstream pipes as an auxiliary method of filtering data by activity types.
11
+
12
+
NODE activityTypes_selected
13
+
SQL >
14
+
%
15
+
WITH
16
+
{{ UInt8(includeCodeContributions, default=1) }} AS icc,
17
+
{{ UInt8(includeCollaborations, default=0) }} AS icol,
18
+
{{ UInt8(includeOtherContributions, default=0) }} AS ioc
19
+
SELECT activityType, platform
20
+
FROM activityTypes
21
+
WHERE
22
+
(icc = 1 AND isCodeContribution = 1)
23
+
OR (icol = 1 AND isCollaboration = 1)
24
+
OR (ioc = 1 AND isCodeContribution = 0 AND isCollaboration = 0)
0 commit comments