Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple ecosystems per project #4056

Merged
merged 5 commits into from
Jan 31, 2024
Merged

Conversation

IvanIvanoff
Copy link
Member

@IvanIvanoff IvanIvanoff commented Jan 15, 2024

Changes

Note: The ecosystems will be imported by the backend team from a list of manually curated ecosystems.

Extend allProjectsByFunction

Get all projects with a given ecosystem. If more than 1 ecosystem is provided, it returns the projects that have all the ecosystems.

{
  allProjectsByFunction(function: "{\"name\": \"ecosystems\", \"args\": {\"ecosystems\": [\"ethereum\"]}}") {
    projects {
      slug
      name
    }
    stats {
      projectsCount
    }
  }
}
{
  "data": {
    "allProjectsByFunction": {
      "projects": [
        {
          "name": "j2dGtJd2gj",
          "slug": "gmU93so/cy"
        }
      ],
      "stats": {
        "projectsCount": 1
      }
    }
  }
}

Extend the getMetric selector

Get data separately for all projects with an ecosystem.

{
  getMetric(metric: "dev_activity_1d") {
    timeseriesDataPerSlug(selector: {ecosystems: ["ethereum"]}, from: "utc_now-2d", to: "utc_now") {
      data {
        slug
        value
      }
      datetime
    }
  }
}
{
  "data": {
    "getMetric": {
      "timeseriesDataPerSlug": [
        {
          "data": [
            {
              "slug": "ethereum",
              "value": 53
            },
            {
              "slug": "santiment",
              "value": 0
            }
          ],
          "datetime": "2024-01-21T00:00:00Z"
        },
        {
          "data": [
            {
              "slug": "ethereum",
              "value": 334
            },
            {
              "slug": "santiment",
              "value": 18
            }
          ],
          "datetime": "2024-01-22T00:00:00Z"
        }
      ]
    }
  }
}

Get aggregated data for all projects with an ecosystem

{
  getMetric(metric: "dev_activity_1d") {
    timeseriesData(selector: {ecosystems: ["ethereum"]}, from: "utc_now-2d", to: "utc_now") {
      value
      datetime
    }
  }
}
{
  "data": {
    "getMetric": {
      "timeseriesData": [
        {
          "datetime": "2024-01-21T00:00:00Z",
          "value": 1358
        },
        {
          "datetime": "2024-01-22T00:00:00Z",
          "value": 9003
        }
      ]
    }
  }
}

Add new getEcosystems API

{
  getEcosystems {
    name
    projects{
      slug
    }
  }
}
{
  "data": {
    "getEcosystems": [
      {
        "name": "bitcoin",
        "projects": [
          {
            "slug": "santiment"
          },
          {
            "slug": "h/vyT4TOxG"
          },
          {
            "slug": "gmU93so/cy"
          },
          {
            "slug": "D18tye+n1w"
          },
          {
            "slug": "AXmYWOYQPR"
          }
        ]
      },
      {
        "name": "ethereum",
        "projects": [
          {
            "slug": "santiment"
          },
          {
            "slug": "gmU93so/cy"
          },
          {
            "slug": "ethereum"
          }
        ]
      }
    ]
  }
}

Ticket

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have tried to find clearer solution before commenting hard-to-understand parts of code
  • I have added tests that prove my fix is effective or that my feature works

@IvanIvanoff IvanIvanoff force-pushed the rework-projects-ecosystem branch 3 times, most recently from 787c3fa to 95c8159 Compare January 19, 2024 14:50
@IvanIvanoff IvanIvanoff requested a review from tspenov January 23, 2024 10:32
@IvanIvanoff IvanIvanoff force-pushed the rework-projects-ecosystem branch 3 times, most recently from a83c8df to 8376385 Compare January 29, 2024 14:18
@IvanIvanoff IvanIvanoff force-pushed the rework-projects-ecosystem branch 2 times, most recently from 86b0589 to e9ba100 Compare January 31, 2024 12:02
@IvanIvanoff IvanIvanoff force-pushed the rework-projects-ecosystem branch from e9ba100 to ef84b04 Compare January 31, 2024 13:50
@IvanIvanoff IvanIvanoff merged commit fb2bead into master Jan 31, 2024
4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the rework-projects-ecosystem branch January 31, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants