diff --git a/apps/docs/docs/how-oso-works/impact-metrics/index.mdx b/apps/docs/docs/how-oso-works/impact-metrics/index.mdx index 93638a616..63a43883f 100644 --- a/apps/docs/docs/how-oso-works/impact-metrics/index.mdx +++ b/apps/docs/docs/how-oso-works/impact-metrics/index.mdx @@ -36,18 +36,17 @@ An impact metric must be: ## Schema -Every impact metric must include the following fields: `project_id`, `event_source`, `time_interval`, `impact_metric`, and `amount`. For example: +Every impact metric must include the following fields: `project_id`, `impact_metric`, and `amount`. For example: ```json { "project_id": "jUda1pi-FdNlaUmgKq51B4h8x4wX3QTN2fZkKq6N0vw\u003d", - "event_source": "GITHUB", - "time_interval": "6 MONTHS", - "impact_metric": "fork_count", - "amount": 125 + "impact_metric": "fork_count_6_months", + "amount": "125.0" } ``` -Some may also include a `namespace` field to be explicit about the source of the event data to calculate the impact metric. This is useful, for instance, in the case of projects on multiple blockchain networks. +Currently all intermediate metrics are calculated [here](https://github.com/opensource-observer/oso/tree/main/warehouse/dbt/models/intermediate/metrics) and consolidated metrics are available as metrics marts [here](https://github.com/opensource-observer/oso/tree/main/warehouse/dbt/models/marts/metrics). + ## Sample Metrics diff --git a/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql b/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql index 33410d64b..09544c942 100644 --- a/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql +++ b/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql @@ -74,6 +74,7 @@ pivot_metrics as ( select pivot_metrics.project_id, projects_v1.project_name, + rf4_project_verification.check_oss_requirements, pivot_metrics.gas_fees, pivot_metrics.transaction_count, pivot_metrics.trusted_transaction_count, @@ -93,3 +94,5 @@ select from pivot_metrics left join {{ ref('projects_v1') }} on pivot_metrics.project_id = projects_v1.project_id +left join {{ ref('rf4_project_verification') }} + on pivot_metrics.project_id = rf4_project_verification.project_id diff --git a/warehouse/dbt/models/marts/superchain/rf4_project_verification.sql b/warehouse/dbt/models/marts/superchain/rf4_project_verification.sql index 0ac2f649b..5f106e366 100644 --- a/warehouse/dbt/models/marts/superchain/rf4_project_verification.sql +++ b/warehouse/dbt/models/marts/superchain/rf4_project_verification.sql @@ -63,7 +63,7 @@ checks as ( unique_addresses, date_first_transaction, days_with_onchain_activity_in_range, - ARRAY_LENGTH(eligible_repos) >= 1 as check_eligible_repos, + ARRAY_LENGTH(eligible_repos) >= 1 as check_oss_requirements, unique_addresses >= 420 as check_unique_addresses, date_first_transaction < '2024-03-01' as check_date_first_transaction, days_with_onchain_activity_in_range >= 10 @@ -77,13 +77,12 @@ select unique_addresses, date_first_transaction, days_with_onchain_activity_in_range, - check_eligible_repos, + check_oss_requirements, check_unique_addresses, check_date_first_transaction, check_days_with_onchain_activity_in_range, ( - check_eligible_repos - and check_unique_addresses + check_unique_addresses and check_date_first_transaction and check_days_with_onchain_activity_in_range ) as meets_all_requirements