Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Commit

Permalink
Simplify sentiment persistence
Browse files Browse the repository at this point in the history
The vast majority of services give us a sentiment in the range of
(negative)0 -- 0.6(neutral) -- 1(positive)

So it's much easier for us to store the sentiment value as a single
float. Also note that the frontend also requires the sentiment as a
single value (there are two values specified in the graphql schema but
only one of them is used by the client) which is further evidence that
we should only store one value.

Additionally, all sentiments (computedsentiment and avgsentiment) should
be the same number type so converting the computedtiles column from int
to float.
  • Loading branch information
c-w committed Jul 21, 2017
1 parent 207d57c commit 1d9d542
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions ops/storage-ddls/cassandra-setup.cql
Expand Up @@ -7,12 +7,6 @@ USE fortis;
* Types
*****************************************************************************/

DROP TYPE IF EXISTS computedsentiment;
CREATE TYPE computedsentiment (
pos_avg float,
neg_avg float
);

DROP TYPE IF EXISTS computedgender;
CREATE TYPE computedgender (
male_mentions int,
Expand All @@ -30,7 +24,7 @@ CREATE TYPE computedentities (
DROP TYPE IF EXISTS features;
CREATE TYPE features (
mentions int,
sentiment frozen<computedsentiment>,
sentiment float,
gender frozen<computedgender>,
entities frozen<set<computedentities>>
);
Expand Down Expand Up @@ -130,7 +124,7 @@ CREATE TABLE computedtiles (
tiley int,
externalsourceid text,
mentioncount int,
avgsentiment int,
avgsentiment float,
heatmap text,
placeids frozen<set<text>>,
insertion_time timestamp,
Expand Down

0 comments on commit 1d9d542

Please sign in to comment.