|
35 | 35 | LEFT JOIN insights_projects_populated_ds p ON a.segmentId = p.segmentId |
36 | 36 | WHERE p.slug != '' |
37 | 37 |
|
| 38 | +NODE org_page_projects_with_scores |
| 39 | +DESCRIPTION > |
| 40 | + Join with org_dash_metric_copy_ds to compute technical influence score |
| 41 | + |
| 42 | +SQL > |
| 43 | + SELECT |
| 44 | + w.organizationId, |
| 45 | + w.segmentId, |
| 46 | + w.projectSlug, |
| 47 | + w.projectName, |
| 48 | + w.projectLogo, |
| 49 | + w.activityCount, |
| 50 | + w.contributorCount, |
| 51 | + ifNull(m.maintainersCount, 0) AS maintainersCount, |
| 52 | + ifNull(m.contributorCount, 0) AS totalContributors, |
| 53 | + ifNull(m.orgContributorCount, 0) AS orgContributors, |
| 54 | + ifNull(m.commits, 0) AS totalCommits, |
| 55 | + ifNull(m.orgCommits, 0) AS orgCommits, |
| 56 | + ifNull(m.prsOpened, 0) AS totalPrsOpened, |
| 57 | + ifNull(m.orgPrsOpened, 0) AS orgPrsOpened, |
| 58 | + ( |
| 59 | + -- Maintainers: 3 pts if org has at least 1 maintainer |
| 60 | + CASE WHEN ifNull(m.maintainersCount, 0) >= 1 THEN 3 ELSE 0 END |
| 61 | + -- Contributors: % of org contributors vs total |
| 62 | + + CASE |
| 63 | + WHEN ifNull(m.contributorCount, 0) = 0 THEN 0 |
| 64 | + WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 20 THEN 3 |
| 65 | + WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 5 THEN 2 |
| 66 | + WHEN ifNull(m.orgContributorCount, 0) * 100.0 / m.contributorCount >= 1 THEN 1 |
| 67 | + ELSE 0 |
| 68 | + END |
| 69 | + -- Commits: % of org commits vs total |
| 70 | + + CASE |
| 71 | + WHEN ifNull(m.commits, 0) = 0 THEN 0 |
| 72 | + WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 20 THEN 3 |
| 73 | + WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 5 THEN 2 |
| 74 | + WHEN ifNull(m.orgCommits, 0) * 100.0 / m.commits >= 1 THEN 1 |
| 75 | + ELSE 0 |
| 76 | + END |
| 77 | + -- PRs opened: % of org PRs vs total |
| 78 | + + CASE |
| 79 | + WHEN ifNull(m.prsOpened, 0) = 0 THEN 0 |
| 80 | + WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 20 THEN 3 |
| 81 | + WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 5 THEN 2 |
| 82 | + WHEN ifNull(m.orgPrsOpened, 0) * 100.0 / m.prsOpened >= 1 THEN 1 |
| 83 | + ELSE 0 |
| 84 | + END |
| 85 | + ) AS technicalScore, |
| 86 | + w.computedAt |
| 87 | + FROM org_page_projects_with_meta w |
| 88 | + LEFT JOIN org_dash_metric_copy_ds m |
| 89 | + ON w.organizationId = m.organizationId AND w.projectSlug = m.slug |
| 90 | + |
38 | 91 | TYPE COPY |
39 | 92 | TARGET_DATASOURCE org_page_projects_copy_ds |
40 | 93 | COPY_MODE replace |
|
0 commit comments