|
| 1 | +DESCRIPTION > |
| 2 | + - `collection_contributor_dependency.pipe` serves the contributor dependency widget for a |
| 3 | + collection's Contributors tab - identifies contributors whose combined contributions reach or |
| 4 | + exceed 51% of total collection activity (bus factor analysis), aggregated across every project |
| 5 | + in the collection. |
| 6 | + - Collection-scoped counterpart to `contributor_dependency.pipe` - separate because that pipe |
| 7 | + references `contributors_leaderboard` (project-only) by name, and the collection-scale |
| 8 | + replacement for that table is `collection_contributors_leaderboard` (a differently-shaped |
| 9 | + pipe - see its own DESCRIPTION for why a naive collectionSlug branch on the single-project |
| 10 | + leaderboard pipe isn't used there either). |
| 11 | + - Combines data from `collection_contributors_leaderboard` and `active_contributors` (both |
| 12 | + already collectionSlug-aware) to provide dependency risk assessment at collection scale. |
| 13 | + - Parameters: |
| 14 | + - `collectionSlug`: Required collection slug (e.g., 'cncf') - inherited from `segments_filtered_by_collection`. |
| 15 | + - `repos`: Optional array of repository URLs for filtering (inherited from `segments_filtered_by_collection`) |
| 16 | + - `startDate`: Optional DateTime filter for activities after timestamp (e.g., '2024-01-01 00:00:00') |
| 17 | + - `endDate`: Optional DateTime filter for activities before timestamp (e.g., '2024-12-31 23:59:59') |
| 18 | + - `platform`: Optional string filter for source platform (e.g., 'github', 'discord', 'slack') |
| 19 | + - `activity_type`: Optional string filter for single activity type (e.g., 'authored-commit') |
| 20 | + - `includeCollaborations`: Optional boolean, defaults to false - same toggle as the single-project pipe. |
| 21 | + - `limit`: Optional integer, defaults to 100 - number of top contributors to rank before finding the 51% cutoff. |
| 22 | + - Response: `id`, `displayName`, `githubHandleArray`, `contributionCount`, `contributionPercentage`, `roles`, `contributionPercentageRunningTotal`, `totalContributorCount` |
| 23 | + |
| 24 | +TAGS "Insights, Widget", "Collection", "Contributors" |
| 25 | + |
| 26 | +NODE collection_contributions_percentage_running_total |
| 27 | +SQL > |
| 28 | + % |
| 29 | + SELECT t.*, active_contributors.contributorCount as "totalContributorCount" |
| 30 | + FROM |
| 31 | + ( |
| 32 | + SELECT |
| 33 | + id, |
| 34 | + displayName, |
| 35 | + githubHandleArray, |
| 36 | + contributionCount, |
| 37 | + contributionPercentage, |
| 38 | + roles, |
| 39 | + sum(contributionPercentage) OVER ( |
| 40 | + ORDER BY contributionPercentage DESC, id |
| 41 | + ) AS contributionPercentageRunningTotal |
| 42 | + FROM collection_contributors_leaderboard |
| 43 | + ) t |
| 44 | + cross join active_contributors |
| 45 | + WHERE |
| 46 | + contributionPercentageRunningTotal <= 51 |
| 47 | + OR (contributionPercentageRunningTotal - contributionPercentage < 51) |
| 48 | + ORDER BY contributionPercentageRunningTotal ASC |
0 commit comments