Created
April 3, 2025 20:40
-
-
Save ccerv1/887127eec86ab7b1e04d84bd57abe21e to your computer and use it in GitHub Desktop.
Lookup S7 Retro Funding rewards for a project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dotenv import load_dotenv | |
| import os | |
| import pandas as pd | |
| from pyoso import Client | |
| load_dotenv() | |
| OSO_API_KEY = os.environ['OSO_API_KEY'] | |
| client = Client(api_key=OSO_API_KEY) | |
| rewards = client.to_pandas(""" | |
| select | |
| p.display_name as project, | |
| m.display_name as funding_round, | |
| sum(tm.amount) AS rewards | |
| from oso.timeseries_metrics_by_project_v0 tm | |
| join oso.metrics_v0 m on tm.metric_id = m.metric_id | |
| join oso.projects_v1 p on tm.project_id = p.project_id | |
| join oso.artifacts_by_project_v1 abp on p.project_id = abp.project_id | |
| where | |
| m.metric_name like 'S7_%' # all Season 7 reward metrics are prefixed with S7 | |
| and abp.artifact_namespace = '' # put your GitHub org name here | |
| group by 1,2 | |
| order by 3 desc | |
| """) | |
| print(rewards['rewards'].sum()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment