Skip to content

Commit

Permalink
Aylien signal returns media field
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishokamp committed Nov 27, 2023
1 parent 6a5ef1e commit 7e69bcd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.0
0.3.1
13 changes: 9 additions & 4 deletions news_signals/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
from abc import abstractmethod
from collections import Counter, defaultdict
from typing import List
from typing import List, Optional
import json
import base64
from pathlib import Path
Expand Down Expand Up @@ -916,8 +916,13 @@ def add_wikimedia_pageviews_timeseries(
granularity='daily',
wikidata_client=wikidata_client,
wikimedia_endpoint=wikimedia_endpoint,
)
self.timeseries_df['wikimedia_pageviews'] = pageviews_df['wikimedia_pageviews'].values
)
try:
self.timeseries_df['wikimedia_pageviews'] = pageviews_df['wikimedia_pageviews'].values
except TypeError as e:
logger.error(e)
logger.warning('Retrieved wikimedia pageviews dataframe is None, not adding to signal')

return self


Expand All @@ -926,7 +931,7 @@ def __init__(
self,
name: str,
components: List[Signal],
metadata: dict = None
metadata: Optional[dict] = None
):
super().__init__(name, metadata=metadata)
self.components = components
Expand Down
3 changes: 2 additions & 1 deletion news_signals/signals_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

logger = create_logger(__name__, level=logging.INFO)

MAX_BODY_TOKENS = 500
MAX_BODY_TOKENS = 1000
DEFAULT_METADATA = {
'name': 'News Signals Dataset'
}
Expand Down Expand Up @@ -328,6 +328,7 @@ def reduce_aylien_story(
"categories": s["categories"],
"industries": s["industries"],
"smart_tagger_categories": smart_cats,
"media": s["media"],
"clusters": s["clusters"]
}, **{f: s[f] for f in additional_fields}
)
Expand Down

0 comments on commit 7e69bcd

Please sign in to comment.