-
Notifications
You must be signed in to change notification settings - Fork 731
Expand file tree
/
Copy pathproject_insights.pipe
More file actions
89 lines (87 loc) · 3.51 KB
/
project_insights.pipe
File metadata and controls
89 lines (87 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
DESCRIPTION >
- `project_insights.pipe` serves project insights data for a specific project.
- Returns comprehensive metrics including project metadata (name, logoUrl, isLF), health score with category breakdowns (contributors, popularity, development, security), contributor count, software value, contributor and organization dependency metrics, leaderboard achievements, and activity metrics for both current and previous 365-day periods.
- Parameters:
- `slug`: Optional string for a single project slug (e.g., 'kubernetes')
- `slugs`: Optional array of project slugs for multi-project query (e.g., ['kubernetes', 'tensorflow'])
- `ids`: Optional array of project ids for multi-project query
- At least one of `slug`, `slugs`, or `ids` should be provided.
- `isLfx`: Optional integer (1 = LFX, 0 = non-LFX) to filter by LFX project status
- `orderByField`: Optional string specifying sort field, defaults to 'name'
- `orderByDirection`: Optional string ('asc' or 'desc'), defaults to 'asc'
- `pageSize`: Optional integer for result limit, defaults to 10
- `page`: Optional integer for pagination offset calculation, defaults to 0
- Response: Project records with all insights metrics including achievements as array of (leaderboardType, rank, totalCount) tuples
TAGS "Insights, Widget", "Project"
NODE project_insights_endpoint
SQL >
%
SELECT
id,
name,
slug,
logoUrl,
isLF,
status,
contributorCount,
organizationCount,
softwareValue,
contributorDependencyCount,
contributorDependencyPercentage,
organizationDependencyCount,
organizationDependencyPercentage,
achievements,
healthScore,
contributorHealthScore,
popularityHealthScore,
developmentHealthScore,
securityHealthScore,
firstCommit,
starsLast365Days,
forksLast365Days,
activeContributorsLast365Days,
activeOrganizationsLast365Days,
starsPrevious365Days,
forksPrevious365Days,
activeContributorsPrevious365Days,
activeOrganizationsPrevious365Days
FROM project_insights_copy_ds
WHERE
type = 'project'
{% if defined(slug) %}
AND slug = {{ String(slug, description="Project slug", required=False) }}
{% end %}
{% if defined(slugs) %}
AND slug
IN {{ Array(slugs, 'String', description="Filter by project slug list", required=False) }}
{% end %}
{% if defined(ids) %}
AND id
IN {{ Array(ids, 'String', description="Filter by project id list", required=False) }}
{% end %}
{% if defined(isLfx) %}
AND isLF
= {{
UInt8(
isLfx, description="Filter by LFX project (1 = LFX, 0 = non-LFX)", required=False
)
}}
{% end %}
ORDER BY
{{ column(String(orderByField, "name", description="Order by field.", required=False)) }}
{% if String(
orderByDirection,
'asc',
description="Order by direction. ASC or DESC",
required=False,
) == 'asc' or String(
orderByDirection,
'asc',
description="Order by direction. ASC or DESC",
required=False,
) == 'ASC' %} ASC
{% else %} DESC
{% end %},
name ASC
LIMIT {{ Int32(pageSize, 10) }}
OFFSET {{ Int32(page, 0) * Int32(pageSize, 10) }}