diff --git a/apps/docs/docs/integrate/datasets/index.mdx b/apps/docs/docs/integrate/datasets/index.mdx index 673e8c240..f1dc6b30c 100644 --- a/apps/docs/docs/integrate/datasets/index.mdx +++ b/apps/docs/docs/integrate/datasets/index.mdx @@ -80,9 +80,26 @@ where project_name = 'uniswap' **Remember to replace 'YOUR_PROJECT_NAME' with the name of your project in the query.** -_Note: Unless the model name is versioned, expect that the model is unstable and should not be depended on +_Note: Unless the model name is versioned with a `v1` or higher, expect that the model is unstable and should not be depended on in a live production application._ +Some of our most popular v1 models include: + +- `projects_v1`: a list of all projects in the OSO data pipeline +- `artifacts_by_project_v1`: a list of all artifacts owned by a given project +- `projects_by_collection_v1`: a list of all projects in a given collection +- `code_metrics_by_project_v1`: a list of all code metrics for a given project +- `onchain_metrics_by_project_v1`: a list of all onchain metrics for a given project (by chain) + +Some of the v0 (WIP) models that we include in analysis but do not recommend for production use: + +- `timeseries_events_by_artifact_v0`: a list of all events for a given artifact (our unified event table) +- `oss_funding_v0`: a list of all funding grants to projects, indexed by project and funder +- `repositories_v0`: a list of all GitHub repositories, indexed by project +- `sboms_v0`: a list of package dependencies (software bill of materials), indexed by project +- `package_owners_v0`: a mapping of packages to GitHub repositories, indexed by project +- `contracts_v0`: a list of all discovered contracts, downstream from their deployers and/or factories + ### OSO Staging / Intermediate Models From source data, we produce a "universal event table", currently stored at diff --git a/warehouse/dbt/models/intermediate/funding/int_oss_funding_grants_to_project.sql b/warehouse/dbt/models/intermediate/funding/int_oss_funding_grants_to_project.sql index ceab7f289..ac2bc517b 100644 --- a/warehouse/dbt/models/intermediate/funding/int_oss_funding_grants_to_project.sql +++ b/warehouse/dbt/models/intermediate/funding/int_oss_funding_grants_to_project.sql @@ -12,7 +12,9 @@ with oss_funding_data as ( 'OSS_FUNDING' as event_source, lower(to_project_name) as to_project_name, lower(from_funder_name) as from_project_name, - coalesce(amount, 0) as amount + coalesce(amount, 0) as amount, + grant_pool_name, + parse_json(metadata_json) as metadata_json from {{ source('static_data_sources', 'oss_funding_v1') }} where to_project_name is not null @@ -31,31 +33,50 @@ gitcoin_data as ( concat('GITCOIN', '_', upper(oso_generated_round_label)) as event_source, oso_project_name as to_project_name, 'gitcoin' as from_project_name, - amount_in_usd as amount + amount_in_usd as amount, + oso_generated_round_label as grant_pool_name, + to_json(struct( + gitcoin_data_source, + gitcoin_round_id, + round_number, + round_type, + main_round_label, + round_name, + chain_id, + gitcoin_project_id, + project_application_title, + oso_project_id, + oso_display_name, + donor_address + )) as metadata_json from {{ ref('int_gitcoin_funding_events') }} ), grants as ( - select distinct + select oss_funding_data.time, oss_funding_data.event_type, oss_funding_data.event_source_id, oss_funding_data.event_source, oss_funding_data.to_project_name, oss_funding_data.from_project_name, - oss_funding_data.amount + oss_funding_data.amount, + oss_funding_data.grant_pool_name, + oss_funding_data.metadata_json from oss_funding_data union all - select distinct + select gitcoin_data.time, gitcoin_data.event_type, gitcoin_data.event_source_id, gitcoin_data.event_source, gitcoin_data.to_project_name, gitcoin_data.from_project_name, - gitcoin_data.amount + gitcoin_data.amount, + gitcoin_data.grant_pool_name, + gitcoin_data.metadata_json from gitcoin_data ) @@ -70,9 +91,11 @@ select grants.from_project_name, from_projects.project_id as from_project_id, 'WALLET' as from_type, - grants.amount + grants.amount, + grants.grant_pool_name, + grants.metadata_json from grants -inner join {{ ref('projects_v1') }} as to_projects +left join {{ ref('projects_v1') }} as to_projects on grants.to_project_name = to_projects.project_name inner join {{ ref('projects_v1') }} as from_projects on grants.from_project_name = from_projects.project_name diff --git a/warehouse/dbt/models/marts/events/oss_funding_v0.sql b/warehouse/dbt/models/marts/events/oss_funding_v0.sql new file mode 100644 index 000000000..41d05d2c4 --- /dev/null +++ b/warehouse/dbt/models/marts/events/oss_funding_v0.sql @@ -0,0 +1,29 @@ +{# + This model is used to store the oss funding grants to project events. + It is WIP and should not be used for production purposes. +#} + +{{ + config( + materialized='table', + meta = { + 'sync_to_db': True, + } + ) +}} + +select + time, + event_type, + event_source_id, + event_source, + to_project_name, + to_project_id, + to_type, + from_project_name, + from_project_id, + from_type, + amount, + grant_pool_name, + metadata_json +from {{ ref('int_oss_funding_grants_to_project') }}