Skip to content

Commit

Permalink
refactor(frontend-observable): adjust for sentiment trends
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpomerenke committed Aug 7, 2024
1 parent 52c469d commit a928b4c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 61 deletions.
32 changes: 26 additions & 6 deletions frontend-observable/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,40 @@ const keyword_trend = await queryApi('trend', {
const trend_plots = [
trend_plot(keyword_trend.trends, media_sources[media_source])
]
const sentiment_trend = await queryApi('trend', {
const sentiment_trend_a = await queryApi('trend', {
trend_type: 'sentiment',
media_source: media_source,
topic: 'climate_change'
topic: 'climate_change',
sentiment_target: 'activism'
})
if (sentiment_trend_a.applicability) {
trend_plots.push(
trend_plot(
sentiment_trend_a.trends,
media_sources[media_source].replace(
/coverage of climate/,
'sentiment on climate activism'
)
)
)
}
const sentiment_trend_b = await queryApi('trend', {
trend_type: 'sentiment',
media_source: media_source,
topic: 'climate_change',
sentiment_target: 'policy'
})
if (sentiment_trend.applicability) {
if (sentiment_trend_b.applicability) {
trend_plots.push(
trend_plot(
sentiment_trend.trends,
media_sources[media_source].replace(/coverage of/, 'sentiment of')
sentiment_trend_b.trends,
media_sources[media_source].replace(
/coverage of climate/,
'sentiment on climate policy'
)
)
)
}
// display(Inputs.table(trend))
```

```js
Expand Down
55 changes: 0 additions & 55 deletions frontend-observable/src/sentiment.md

This file was deleted.

0 comments on commit a928b4c

Please sign in to comment.