|
| 1 | +TOKEN "category_groups_oss_index_endpoint_read_7394" READ |
| 2 | + |
| 3 | +NODE category_groups_oss_index_agregates |
| 4 | +SQL > |
| 5 | + SELECT categoryGroupId, coalesce(sum(contributorCount), 0) as "totalContributors" |
| 6 | + FROM segments_aggregates_with_ids_datasource |
| 7 | + WHERE categoryGroupId != '' |
| 8 | + GROUP BY categoryGroupId |
| 9 | + ORDER BY totalContributors DESC |
| 10 | + |
| 11 | +NODE category_groups_oss_index_projects_deduplicated |
| 12 | +SQL > |
| 13 | + SELECT insightsProjects.id, insightsProjects.name, insightsProjects.logoUrl |
| 14 | + FROM insightsProjects FINAL |
| 15 | + |
| 16 | +NODE category_groups_oss_index_collections_deduplicated |
| 17 | +SQL > |
| 18 | + SELECT collections.id, collections.name FROM collections FINAL |
| 19 | + |
| 20 | +NODE category_groups_oss_index_projects_ranked_by_category_group |
| 21 | +SQL > |
| 22 | + SELECT |
| 23 | + categoryGroupId, |
| 24 | + projectId, |
| 25 | + sum(contributorCount) AS totalContributors, |
| 26 | + ROW_NUMBER() OVER (PARTITION BY categoryGroupId ORDER BY sum(contributorCount) DESC) AS rn |
| 27 | + FROM segments_aggregates_with_ids_datasource |
| 28 | + WHERE categoryGroupId != '' AND projectId != '' |
| 29 | + GROUP BY categoryGroupId, projectId |
| 30 | + |
| 31 | +NODE category_groups_oss_index_projects |
| 32 | +SQL > |
| 33 | + SELECT |
| 34 | + topProjects.categoryGroupId, |
| 35 | + topProjects.projectId, |
| 36 | + topProjects.totalContributors, |
| 37 | + pd.name AS projectName, |
| 38 | + pd.logoUrl AS projectLogo |
| 39 | + FROM category_groups_oss_index_projects_ranked_by_category_group topProjects |
| 40 | + JOIN category_groups_oss_index_projects_deduplicated pd ON pd.id = topProjects.projectId |
| 41 | + WHERE topProjects.rn <= 5 |
| 42 | + |
| 43 | +NODE category_groups_oss_index_collections_ranked_by_category_group |
| 44 | +SQL > |
| 45 | + SELECT |
| 46 | + categoryGroupId, |
| 47 | + collectionId, |
| 48 | + sum(contributorCount) AS totalContributors, |
| 49 | + ROW_NUMBER() OVER (PARTITION BY categoryGroupId ORDER BY sum(contributorCount) DESC) AS rn |
| 50 | + FROM segments_aggregates_with_ids_datasource |
| 51 | + WHERE categoryGroupId != '' AND collectionId != '' |
| 52 | + GROUP BY categoryGroupId, collectionId |
| 53 | + |
| 54 | +NODE category_groups_oss_index_collections |
| 55 | +SQL > |
| 56 | + SELECT |
| 57 | + topCollections.categoryGroupId, |
| 58 | + topCollections.collectionId, |
| 59 | + topCollections.totalContributors, |
| 60 | + cd.name AS collectionName |
| 61 | + FROM category_groups_oss_index_collections_ranked_by_category_group topCollections |
| 62 | + JOIN category_groups_oss_index_collections_deduplicated cd ON cd.id = topCollections.collectionId |
| 63 | + WHERE topCollections.rn <= 5 |
| 64 | + |
| 65 | +NODE category_groups_oss_index_category_groups_deduplicated |
| 66 | +SQL > |
| 67 | + % |
| 68 | + SELECT categoryGroups.id, categoryGroups.name, categoryGroups.type, categoryGroups.slug |
| 69 | + FROM categoryGroups FINAL |
| 70 | + {% if defined(type) %} |
| 71 | + WHERE |
| 72 | + categoryGroups.type |
| 73 | + = {{ String(type, description="Filter category group type", required=False) }} |
| 74 | + {% end %} |
| 75 | + |
| 76 | +NODE category_groups_oss_index_top_collections |
| 77 | +SQL > |
| 78 | + SELECT |
| 79 | + categoryGroupId, groupArray((collectionId, totalContributors, collectionName)) AS topCollections |
| 80 | + FROM category_groups_oss_index_collections |
| 81 | + GROUP BY categoryGroupId |
| 82 | + |
| 83 | +NODE category_groups_oss_index_top_projects |
| 84 | +SQL > |
| 85 | + SELECT |
| 86 | + categoryGroupId, |
| 87 | + groupArray((projectId, totalContributors, projectName, projectLogo)) AS topProjects |
| 88 | + FROM category_groups_oss_index_projects |
| 89 | + GROUP BY categoryGroupId |
| 90 | + |
| 91 | +NODE category_groups_oss_index_results |
| 92 | +SQL > |
| 93 | + SELECT |
| 94 | + a.categoryGroupId as "id", |
| 95 | + cgd.name as "name", |
| 96 | + cgd.type as "type", |
| 97 | + cgd.slug as "slug", |
| 98 | + a.totalContributors, |
| 99 | + c.topCollections, |
| 100 | + p.topProjects |
| 101 | + FROM category_groups_oss_index_agregates a |
| 102 | + LEFT JOIN category_groups_oss_index_top_collections c USING (categoryGroupId) |
| 103 | + LEFT JOIN category_groups_oss_index_top_projects p USING (categoryGroupId) |
| 104 | + JOIN |
| 105 | + category_groups_oss_index_category_groups_deduplicated |
| 106 | + cgd ON category_groups_oss_index_category_groups_deduplicated.id = a.categoryGroupId |
0 commit comments