forked from turbot/steampipe-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedia_conversations.sp
99 lines (83 loc) · 2.01 KB
/
media_conversations.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
dashboard "Media_Conversations" {
tags = {
service = "Hypothesis"
}
container {
text {
width = 3
value = <<EOT
[Home](${local.host}/hypothesis.dashboard.Home)
🞄
Media_Conversations
EOT
}
}
input "groups" {
title = "Hypothesis group"
width = 3
sql = <<EOQ
with groups as (
select
jsonb_array_elements(groups) as group_info
from
hypothesis_profile
)
select
group_info->>'name' as label,
group_info->>'id' as value,
json_build_object('id', group_info->>'id') as tags
from
groups
EOQ
}
input "media_source" {
title = "media source (select or type another)"
type = "combo"
width = 4
sql = <<EOQ
with data(label, value) as (
values
('www.nytimes.com', 'www.nytimes.com'),
('www.washingtonpost.com', 'www.washingtonpost.com'),
('www.theatlantic.com', 'www.theatlantic.com'),
('www.latimes.com', 'www.latimes.com'),
('en.wikipedia.org', 'en.wikipedia.org'),
('www.jstor.org', 'www.jstor.org'),
('chem.libretexts.org', 'chem.libretexts.org'),
('www.americanyawp.com', 'www.americanyawp.com')
)
select * from data
EOQ
}
input "annotated_media_url" {
args = [
self.input.groups.value,
var.search_limit,
self.input.media_source.value
]
title = "recently-annotated urls"
width = 5
query = query.recently_annotated_urls
}
table {
title = "longest threads"
type = "table"
args = [
self.input.annotated_media_url.value,
self.input.groups.value
]
query = query.threads
column "top_level_id" {
href = "https://hypothes.is/a/{{.'top_level_id'}}"
}
}
hierarchy {
title = "conversations"
args = [
self.input.groups.value,
var.search_limit,
self.input.annotated_media_url.value
]
query = query.conversational_data
}
}