Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal.update() to include all fields #2

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

complementizer
Copy link
Contributor

Signal.update() includes anomalies, summaries and wikipedia-pageviews if present.
I changed signal.anomaly_signal() a bit to make it work and added a signal.copy() to all signal classes.

Copy link
Member

@chrishokamp chrishokamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@complementizer thank you for this
i will take a pass now and directly push to this PR if that's ok?
then we can sync next week

@@ -286,16 +292,17 @@ def anomaly_signal(
:param: history_length: history length
:param: history_interval: history interval (months, days, hours, ...)
"""
if not overwrite_existing and 'anomalies' in self.timeseries_df.columns:
if not self.timeseries_df["anomalies"].isnull().values.any():
return self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should check dependent on the dates specified by the user, not globally

@@ -399,6 +414,26 @@ def from_dict(data):
args['feeds_df'] = args.pop('stories_df')
return signal_type.from_dict(args)

def copy(self, included_columns=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we may be able to use self.from_dict for this, need to double check

@@ -510,6 +544,26 @@ def from_dict(data):
ts_column=data['ts_column'],
)

def copy(self, included_columns=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to put this on base class

@@ -643,7 +728,7 @@ def update(self, start=None, end=None, freq='D', ts_endpoint=None):
any new data while retaining the existing information as well
:param start: datetime
:param end: datetime
"""
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to put this on base class

@@ -677,22 +764,53 @@ def update(self, start=None, end=None, freq='D', ts_endpoint=None):
# we're only going to be clever about extending to the right,
# if user wants historical data (before the data we already have),
# everything's getting retrieved
if self.timeseries_df is not None and start in self.timeseries_df.index:
if self.timeseries_df is not None and start in self.timeseries_df.index:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note extra whitespace

period = self.pd_freq_to_aylien_period(freq)
aylien_ts_df = self.query_news_signals(start, end, period, ts_endpoint)
if self.timeseries_df is None:
self.timeseries_df = aylien_ts_df
else:
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note extra whitespace

@complementizer
Copy link
Contributor Author

@complementizer thank you for this
i will take a pass now and directly push to this PR if that's ok?
then we can sync next week

@chrishokamp yep sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants