Skip to main content

Specification

info

An impact metric is a quantitative measure of impact over a discrete period of time. Impact metrics are most commonly queried by project (eg, uniswap), although they can also be queried by individual artifact or at the collection level.

Principles


Impact metrics should be designed with the following principles in mind:

  • Verifiability: Metrics should be based on public data that can be independently verified. They should not rely on proprietary data sources or private APIs.
  • Reproducibility: Metrics should be easy to reproduce, simulate, and audit to ensure they are achieving the intended results. They should not have a "black box" element that makes them difficult to understand or replicate.
  • Consistency: Metrics should be consistent across projects and artifacts. They should be calculated using the same methodology and data sources to ensure that they are comparable.
  • Completeness: Metrics should be comprehensive and cover all projects and artifacts in the OSO database that fulfill basic requirements. They should not be highly sector-specific.
  • Simplicity: Metrics should have business logic that is easy to understand. They should not require a deep understanding of the underlying data or complex statistical methods to interpret.

Requirements


An impact metric must be:

  • A quantitative measure of impact on a continuous scale. Common examples include counts, sums, averages, and medians.
  • Available for all projects in the OSO database (even if many projects have a null value). Metrics should be extendable to any collection in the OSO database as well as any artifact in the same artifact namespace (eg, GitHub-related metrics, npm-related metrics, etc.).
  • Aggregated over a discrete period of time. Common time intervals include last 90 days (90 DAYS), last 6 months (6 MONTHS), and since inception (ALL). OSO has already bucketed event data in various time intervals to facilitate this.
  • Constructed from data that is available in one or more intermediate or mart models. Most impact metrics are currently powered from the int_events_daily_to_project model.

Schema

Every impact metric must include the following fields: project_id, impact_metric, and amount. For example:

{
"project_id": "jUda1pi-FdNlaUmgKq51B4h8x4wX3QTN2fZkKq6N0vw\u003d",
"impact_metric": "fork_count_6_months",
"amount": "125.0"
}

Currently all intermediate metrics are calculated here and consolidated metrics are available as metrics marts here.

Sample Metrics


The following are examples of impact metrics that can be queried from the OSO database. These examples are illustrative and do not represent an exhaustive list of all possible impact metrics. They make use of two "intermediate" tables that aggregate event data into timeseries buckets: int_events_monthly_to_project and int_events_daily_to_project. These tables are derived from the consolidated int_events table.

Forks in the Last 6 Months (Project Level)

The following is an example of a valid impact metric, expressed in SQL:

  select
project_id,
'fork_count_6_months' as impact_metric,
sum(amount) as amount
from `oso.int_events_monthly_to_project`
where
event_type = 'FORKED'
and DATE(bucket_month) >= DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH)
group by project_id

Gas Fees

Here's an example of an impact metric that calculates the sum of gas fees contributed by a project across all networks:

  select
project_id,
'gas_fees' as metric,
SUM(amount / 1e18) as amount
from `oso.int_events_monthly_to_project`
where
event_type = 'CONTRACT_INVOCATION_DAILY_L2_GAS_USED'
group by project_id

Daily Active Addresses in the Last 6 Months (Project Level)

Here's a more complex impact metric that uses several CTEs to calculate the number of daily active addresses for a project:

  with txns as (
select
project_id,
from_artifact_name,
bucket_day
from `oso.int_events_daily_to_project`
where
event_type = 'CONTRACT_INVOCATION_SUCCESS_DAILY_COUNT'
and DATE(bucket_day) >= DATE_SUB(CURRENT_DATE(), INTERVAL 6 MONTH)
),
daas as (
select
project_id,
bucket_day,
COUNT(distinct from_artifact_name) as active_addresses
from txns
group by
project_id,
bucket_day
),
total_days as (
select DATE_DIFF(max_day, min_day, day) + 1 as days
from (
select
MIN(bucket_day) as min_day,
MAX(bucket_day) as max_day
from txns
)
)

select
project_id,
'daily_active_addresses_6_months' as metric,
SUM(active_addresses) / (select days from total_days) as amount
from daas
group by
project_id

To contribute new metrics, please see our guide here.