Skip to main content

Deep Dive into a Project

Analyze detailed metrics for a specific project. New to OSO? Check out our Getting Started guide to set up your API access.

tip

All projects are defined as YAML files in OSS Directory. View our current projects here.

Getting Started

Before running any analysis, you'll need to set up your environment:

Start your Python notebook with the following:

import os
import pandas as pd
from pyoso import Client

OSO_API_KEY = os.environ['OSO_API_KEY']
client = Client(api_key=OSO_API_KEY)

For more details on setting up Python notebooks, see our guide on writing Python notebooks.

Find a Project

Search for projects by name:

query = """
SELECT
project_id,
project_name,
display_name
FROM projects_v1
WHERE lower(display_name) LIKE lower('%merkle%')
"""
df = client.to_pandas(query)

Find a Project by Artifact

Find projects associated with specific artifacts:

query = """
SELECT
project_id,
project_name,
artifact_namespace as github_owner,
artifact_name as github_repo
FROM artifacts_by_project_v1
WHERE
artifact_source = 'GITHUB'
AND artifact_namespace LIKE '%uniswap%'
"""
df = client.to_pandas(query)

Code Metrics

Get code metrics for a specific project:

query = """
SELECT
tm.sample_date,
m.metric_name,
tm.amount
FROM timeseries_metrics_by_project_v0 AS tm
JOIN metrics_v0 AS m
ON tm.metric_id = m.metric_id
JOIN projects_v1 AS p
ON tm.project_id = p.project_id
WHERE
p.project_name = 'opensource-observer'
AND m.metric_name IN (
'GITHUB_stars_daily',
'GITHUB_forks_daily',
'GITHUB_commits_daily',
'GITHUB_contributors_daily'
)
ORDER BY tm.sample_date DESC
"""
df = client.to_pandas(query)

Timeseries Metrics

Get historical metrics for a project:

query = """
SELECT
tm.sample_date,
m.metric_name,
tm.amount
FROM timeseries_metrics_by_project_v0 AS tm
JOIN metrics_v0 AS m
ON tm.metric_id = m.metric_id
JOIN projects_v1 AS p
ON tm.project_id = p.project_id
WHERE p.project_name = 'wevm'
ORDER BY sample_date DESC
"""
df = client.to_pandas(query)

Repository Snapshot

Get a snapshot of a project's GitHub repositories:

query = """
SELECT
r.artifact_url,
r.star_count,
r.fork_count,
r.license_name,
r.language
FROM repositories_v0 AS r
JOIN projects_v1 AS p
ON r.project_id = p.project_id
WHERE
p.project_name = 'wevm'
ORDER BY r.star_count DESC
"""
df = client.to_pandas(query)

Adding Projects

Projects are defined as YAML files in our OSS Directory repo. You can add or update your own projects or project artifacts by submitting a pull request.

For more information on how projects work, see our guide here.