Skip to content

Commit f9417d2

Browse files
committed
chore: add changes to health score pipes
1 parent dffbb63 commit f9417d2

12 files changed

Lines changed: 44 additions & 3 deletions

services/libs/tinybird/pipes/health_score_active_contributors.pipe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ SQL >
3131
AND (type, platform) IN (SELECT activityType, platform FROM activityTypes_filtered)
3232
AND timestamp >= toStartOfQuarter(now() - toIntervalQuarter(1))
3333
AND timestamp < toStartOfQuarter(now())
34+
AND (channel, segmentId) NOT IN (
35+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
36+
)
3437
GROUP BY segmentId
3538
{% end %}
3639

services/libs/tinybird/pipes/health_score_active_days.pipe

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ SQL >
2121
{% else %}
2222
SELECT segmentId, countDistinct(DATE(timestamp)) AS activeDaysCount
2323
FROM activityRelations_deduplicated_cleaned_bucket_union
24-
WHERE timestamp >= toStartOfDay(now() - toIntervalDay(365)) AND timestamp < toStartOfDay(now())
24+
WHERE
25+
timestamp >= toStartOfDay(now() - toIntervalDay(365))
26+
AND timestamp < toStartOfDay(now())
27+
AND (channel, segmentId) NOT IN (
28+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
29+
)
2530
GROUP BY segmentId
2631
{% end %}
2732

services/libs/tinybird/pipes/health_score_contributions_outside_work_hours.pipe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ SQL >
2626
{% else %}
2727
AND timestamp >= toStartOfDay(now() - toIntervalDay(365))
2828
AND timestamp < toStartOfDay(now() + toIntervalDay(1))
29+
AND (channel, segmentId) NOT IN (
30+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
31+
)
2932
{% end %}
3033
GROUP BY segmentId
3134

services/libs/tinybird/pipes/health_score_contributor_dependency.pipe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ SQL >
2929
AND (type, platform) IN (SELECT activityType, platform FROM activityTypes_filtered)
3030
AND timestamp >= toStartOfDay(now() - INTERVAL 365 DAY)
3131
AND timestamp < toStartOfDay(now() + INTERVAL 1 DAY)
32+
AND (channel, segmentId) NOT IN (
33+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
34+
)
3235
GROUP BY segmentId, memberId
3336
ORDER by contributionCount DESC
3437
{% end %}

services/libs/tinybird/pipes/health_score_forks.pipe

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ SQL >
2424
{% else %}
2525
SELECT segmentId, count() AS forks
2626
FROM activityRelations_deduplicated_cleaned_bucket_union
27-
WHERE type = 'fork'
27+
WHERE
28+
type = 'fork'
29+
AND (channel, segmentId) NOT IN (
30+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
31+
)
2832
GROUP BY segmentId
2933
{% end %}
3034

services/libs/tinybird/pipes/health_score_issues_resolution.pipe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ SQL >
3232
openedAt >= toStartOfDay(now()) - INTERVAL 365 DAY
3333
AND openedAt < toStartOfDay(now()) + INTERVAL 1 DAY
3434
AND closedAt IS NOT NULL
35+
AND (channel, segmentId) NOT IN (
36+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
37+
)
3538
GROUP BY segmentId
3639
{% end %}
3740

services/libs/tinybird/pipes/health_score_merge_lead_time.pipe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ SQL >
2323
{% else %}
2424
AND openedAt >= toStartOfDay(now() - toIntervalDay(365))
2525
AND openedAt < toStartOfDay(now() + toIntervalDay(1))
26+
AND (channel, segmentId) NOT IN (
27+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
28+
)
2629
{% end %}
2730
GROUP BY segmentId
2831

services/libs/tinybird/pipes/health_score_organization_dependency.pipe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ SQL >
2828
AND (type, platform) IN (SELECT activityType, platform FROM activityTypes_filtered)
2929
AND timestamp >= toStartOfDay(now() - INTERVAL 365 DAY)
3030
AND timestamp < toStartOfDay(now() + INTERVAL 1 DAY)
31+
AND (channel, segmentId) NOT IN (
32+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
33+
)
3134
GROUP BY segmentId, organizationId
3235
{% end %}
3336

services/libs/tinybird/pipes/health_score_pull_requests.pipe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ SQL >
3737
)
3838
AND timestamp >= toStartOfDay(now() - toIntervalDay(365))
3939
AND timestamp < toStartOfDay(now() + toIntervalDay(1))
40+
AND (channel, segmentId) NOT IN (
41+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
42+
)
4043
GROUP BY segmentId
4144
{% end %}
4245

services/libs/tinybird/pipes/health_score_retention.pipe

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ SQL >
3131
FROM activityRelations_deduplicated_cleaned_bucket_union
3232
WHERE
3333
memberId != ''
34+
AND (channel, segmentId) NOT IN (
35+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
36+
)
3437
{% if defined(endDate) %}
3538
AND timestamp >= toStartOfQuarter(
3639
parseDateTimeBestEffort(
@@ -81,6 +84,9 @@ SQL >
8184
FROM activityRelations_deduplicated_cleaned_bucket_union
8285
WHERE
8386
memberId != ''
87+
AND (channel, segmentId) NOT IN (
88+
SELECT url, segmentId FROM repositories FINAL WHERE excluded = true AND isNull(deletedAt)
89+
)
8490
{% if defined(endDate) %}
8591
AND timestamp >= toStartOfQuarter(
8692
parseDateTimeBestEffort(

0 commit comments

Comments
 (0)