|
1 | 1 | DESCRIPTION > |
2 | | - - `collection_insights_aggregate.pipe` serves aggregate insights metrics for a collection (an arbitrary list of projects). |
3 | | - - Returns a single row with metrics aggregated across all projects in the list, not one row per project. |
| 2 | + - `collection_insights_aggregate.pipe` serves aggregate insights metrics for a collection. |
| 3 | + - Returns a single row with metrics aggregated across every project in the collection, not one row per project. |
4 | 4 | - Parameters: |
5 | | - - `ids`: Required array of project ids (as returned by `project_insights.pipe`'s `id`/`ids`) to aggregate over. |
| 5 | + - `collectionSlug`: Required collection slug. insights_projects_populated_ds.collectionsSlugs already lists |
| 6 | + every collection each project belongs to (see insightsProjects_filtered.pipe for the same filter pattern), |
| 7 | + so this pipe resolves collection membership directly rather than requiring the caller to first look up a |
| 8 | + project id list. |
6 | 9 | - Response: |
7 | | - - `projectCount`: count of distinct project ids from the input list that matched an existing project. |
8 | | - - `uniqueContributorCount`: total unique contributors across all matched projects, deduplicated (a contributor active on multiple projects in the list is counted once). |
9 | | - - `avgHealthScore`: average of each matched project's health score, rounded. |
| 10 | + - `projectCount`: count of distinct projects in the collection. |
| 11 | + - `uniqueContributorCount`: total unique contributors across all projects in the collection, deduplicated (a contributor active on multiple projects in the collection is counted once). |
| 12 | + - `avgHealthScore`: average of each project's health score in the collection, rounded. |
10 | 13 |
|
11 | 14 | TAGS "Insights, Widget", "Collection" |
12 | 15 |
|
13 | 16 | NODE collection_insights_aggregate_projects |
14 | 17 | DESCRIPTION > |
15 | | - Resolves the input project ids to their segment ids, since activity data is keyed by segmentId, not project id |
| 18 | + Resolves the collection's member projects to their segment ids and health scores directly via |
| 19 | + collectionsSlugs, matching the same has(collectionsSlugs, ...) filter already used by |
| 20 | + insightsProjects_filtered.pipe. |
16 | 21 |
|
17 | 22 | SQL > |
18 | 23 | % |
19 | 24 | SELECT id, segmentId, healthScore |
20 | | - FROM project_insights_copy_ds |
| 25 | + FROM insights_projects_populated_ds |
21 | 26 | WHERE |
22 | | - type = 'project' |
23 | | - AND id IN {{ Array(ids, 'String', description="Filter by project id list", required=True) }} |
| 27 | + enabled = 1 |
| 28 | + AND has( |
| 29 | + collectionsSlugs, |
| 30 | + {{ String(collectionSlug, description="Filter by collection slug", required=True) }} |
| 31 | + ) |
24 | 32 |
|
25 | 33 | NODE collection_insights_aggregate_results |
26 | 34 | DESCRIPTION > |
|
0 commit comments