Skip to content

Commit

Permalink
feat: social media artifacts (#2078)
Browse files Browse the repository at this point in the history
* Just pull it from the oss-directory and expose as artifacts
  • Loading branch information
ryscheng authored Sep 5, 2024
1 parent 3684b6a commit fc28ad3
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,69 @@
with projects as (
select
project_id,
websites,
social,
github,
npm,
blockchain
from {{ ref('stg_ossd__current_projects') }}
),

all_websites as (
select
projects.project_id,
websites.url as artifact_source_id,
"WWW" as artifact_source,
"WWW" as artifact_namespace,
websites.url as artifact_name,
websites.url as artifact_url,
"WEBSITE" as artifact_type
from projects
cross join
UNNEST(projects.websites) as websites
),

all_farcaster as (
select
projects.project_id,
farcaster.url as artifact_source_id,
"FARCASTER" as artifact_source,
"FARCASTER" as artifact_namespace,
farcaster.url as artifact_url,
"SOCIAL_HANDLE" as artifact_type,
case
when
farcaster.url like "https://warpcast.com/%"
then SUBSTR(farcaster.url, 22)
else farcaster.url
end as artifact_name
from projects
cross join
UNNEST(projects.social.farcaster) as farcaster
),

all_twitter as (
select
projects.project_id,
twitter.url as artifact_source_id,
"TWITTER" as artifact_source,
"TWITTER" as artifact_namespace,
twitter.url as artifact_url,
"SOCIAL_HANDLE" as artifact_type,
case
when
twitter.url like "https://twitter.com/%"
then SUBSTR(twitter.url, 21)
when
twitter.url like "https://x.com/%"
then SUBSTR(twitter.url, 15)
else twitter.url
end as artifact_name
from projects
cross join
UNNEST(projects.social.twitter) as twitter
),

github_repos as (
select
"GITHUB" as artifact_source,
Expand Down Expand Up @@ -41,10 +98,11 @@ all_npm_raw as (
case
when
npm.url like "https://npmjs.com/package/%"
then SUBSTR(npm.url, 28)
then SUBSTR(npm.url, 27)
when
npm.url like "https://www.npmjs.com/package/%"
then SUBSTR(npm.url, 31)
else npm.url
end as artifact_name
from projects
cross join
Expand Down Expand Up @@ -83,6 +141,39 @@ ossd_blockchain as (
),

all_artifacts as (
select
project_id,
artifact_source_id,
artifact_source,
artifact_type,
artifact_namespace,
artifact_name,
artifact_url
from
all_websites
union all
select
project_id,
artifact_source_id,
artifact_source,
artifact_type,
artifact_namespace,
artifact_name,
artifact_url
from
all_farcaster
union all
select
project_id,
artifact_source_id,
artifact_source,
artifact_type,
artifact_namespace,
artifact_name,
artifact_url
from
all_twitter
union all
select
project_id,
artifact_source_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ select
projects.name as project_name,
projects.display_name,
projects.description,
projects.websites,
projects.social,
projects.github,
projects.npm,
projects.blockchain,
Expand Down

0 comments on commit fc28ad3

Please sign in to comment.