|
1 | 1 | DESCRIPTION > |
2 | 2 | Nightly copy pipe that precomputes org-level KPIs for the org page. |
3 | 3 | Writes one row per organizationId into org_page_kpis_copy_ds. |
| 4 | + Active contributors count only code contribution activity types (commits, PRs, code reviews). |
| 5 | + Active contributors and critical projects use a 730-day (2-year) window. |
| 6 | + Trend compares current 730-day period against the prior 730-day period (days 731–1460). |
4 | 7 |
|
5 | 8 | TAGS "Organization page" |
6 | 9 |
|
| 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 | + |
7 | 17 | NODE org_page_kpis_current_contributors |
8 | 18 | DESCRIPTION > |
9 | | - Active contributors per org in the last 365 days |
| 19 | + Active code contributors per org in the last 730 days (2 years) |
10 | 20 |
|
11 | 21 | SQL > |
12 | | - SELECT organizationId, uniq(memberId) AS activeContributors |
13 | | - 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 ON ar.type = at.activityType AND ar.platform = at.platform |
14 | 26 | WHERE |
15 | | - organizationId != '' |
16 | | - AND timestamp >= toStartOfDay(now() - toIntervalDay(365)) |
17 | | - AND timestamp < toStartOfDay(now() + toIntervalDay(1)) |
18 | | - GROUP BY organizationId |
| 27 | + ar.organizationId != '' |
| 28 | + AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(730)) |
| 29 | + AND ar.timestamp < toStartOfDay(now() + toIntervalDay(1)) |
| 30 | + GROUP BY ar.organizationId |
19 | 31 |
|
20 | 32 | NODE org_page_kpis_previous_contributors |
21 | 33 | DESCRIPTION > |
22 | | - Active contributors per org in the prior 365-day window (for trend calc) |
| 34 | + Active code contributors per org in the prior 730-day window (days 731–1460, for trend calc) |
23 | 35 |
|
24 | 36 | SQL > |
25 | | - SELECT organizationId, uniq(memberId) AS activeContributorsPrevious |
26 | | - FROM activityRelations_deduplicated_cleaned_bucket_union |
| 37 | + SELECT ar.organizationId, uniq(ar.memberId) AS activeContributorsPrevious |
| 38 | + FROM activityRelations_deduplicated_cleaned_bucket_union ar |
| 39 | + INNER JOIN |
| 40 | + org_page_kpis_code_activity_types at ON ar.type = at.activityType AND ar.platform = at.platform |
27 | 41 | WHERE |
28 | | - organizationId != '' |
29 | | - AND timestamp >= toStartOfDay(now() - toIntervalDay(730)) |
30 | | - AND timestamp < toStartOfDay(now() - toIntervalDay(365)) |
31 | | - GROUP BY organizationId |
| 42 | + ar.organizationId != '' |
| 43 | + AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(1460)) |
| 44 | + AND ar.timestamp < toStartOfDay(now() - toIntervalDay(730)) |
| 45 | + GROUP BY ar.organizationId |
32 | 46 |
|
33 | 47 | NODE org_page_kpis_maintainer_roles |
34 | 48 | DESCRIPTION > |
35 | | - Count of active maintainer role assignments per org |
| 49 | + Count of maintainer role assignments per org active at any point in the last 730 days (2 years) |
36 | 50 |
|
37 | 51 | SQL > |
38 | 52 | SELECT organizationId, uniq((memberId, insightsProjectId)) AS maintainerRoles |
39 | 53 | FROM maintainers_roles_copy_ds |
40 | | - WHERE role = 'maintainer' AND toYear(endDate) <= 1970 AND organizationId != '' |
| 54 | + WHERE |
| 55 | + role = 'maintainer' |
| 56 | + AND organizationId != '' |
| 57 | + AND startDate <= now() |
| 58 | + AND (toYear(endDate) <= 1970 OR endDate >= now() - toIntervalDay(730)) |
41 | 59 | GROUP BY organizationId |
42 | 60 |
|
43 | 61 | NODE org_page_kpis_critical_projects |
44 | 62 | DESCRIPTION > |
45 | | - Count of distinct projects (segmentIds) an org contributed to in the last 365 days. |
| 63 | + Count of distinct projects (segmentIds) an org made code contributions to in the last 730 days (2 years). |
46 | 64 | Serves as the "critical projects" placeholder until a real criticality filter is added. |
47 | 65 |
|
48 | 66 | SQL > |
49 | | - SELECT organizationId, uniq(segmentId) AS criticalProjects |
50 | | - FROM activityRelations_deduplicated_cleaned_bucket_union |
| 67 | + SELECT ar.organizationId, uniq(ar.segmentId) AS criticalProjects |
| 68 | + FROM activityRelations_deduplicated_cleaned_bucket_union ar |
| 69 | + INNER JOIN |
| 70 | + org_page_kpis_code_activity_types at ON ar.type = at.activityType AND ar.platform = at.platform |
51 | 71 | WHERE |
52 | | - organizationId != '' |
53 | | - AND timestamp >= toStartOfDay(now() - toIntervalDay(365)) |
54 | | - AND timestamp < toStartOfDay(now() + toIntervalDay(1)) |
55 | | - GROUP BY organizationId |
| 72 | + ar.organizationId != '' |
| 73 | + AND ar.timestamp >= toStartOfDay(now() - toIntervalDay(730)) |
| 74 | + AND ar.timestamp < toStartOfDay(now() + toIntervalDay(1)) |
| 75 | + GROUP BY ar.organizationId |
56 | 76 |
|
57 | 77 | NODE org_page_kpis_final |
58 | 78 | DESCRIPTION > |
|
0 commit comments