From 3cfb6443498591d88821c77bc8ae7e250cd1d6fd Mon Sep 17 00:00:00 2001 From: Nina Di Cara Date: Tue, 24 Aug 2021 10:04:34 +0100 Subject: [PATCH] Update query name and comments --- backend/datasets/live.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/datasets/live.py b/backend/datasets/live.py index 0863eac..5d2cf7c 100644 --- a/backend/datasets/live.py +++ b/backend/datasets/live.py @@ -62,7 +62,9 @@ SOURCE_ZOE_SUPPORT_LA = pd.read_csv(p_live("help_need20200531.csv"), nrows=3).T SOURCE_ZOE_SUPPORT_LA.reset_index(level=0, inplace=True) -query = """SELECT AVG(vader_comp_avg),lsoa,lsoa_name from +# This query gets the average sentiment for the past seven days, linked to local authority areas. +# This is then queried from the twitter data collection database. +VADER_QUERY = """SELECT AVG(vader_comp_avg),lsoa,lsoa_name from ( SELECT AVG(tweets.vader_comp) as vader_comp_avg, tweets.author_id, matchedplaces.lsoa, matchedplaces.lsoa_name FROM tweets @@ -75,7 +77,8 @@ """ SOURCE_TWEET_SENTIMENT_LA = pd.read_sql( - query, con=sqlite3.connect(os.path.join(LIVE_RAW_DATA_FOLDER, "phw_tweets.db")), + VADER_QUERY, + con=sqlite3.connect(os.path.join(LIVE_RAW_DATA_FOLDER, "phw_tweets.db")), ) # Labelling this as a pct, it's not really but ensures it doesn't get changed.