TogetherCrew / twitter-analytics

This repository is in responsible of twitter analytics tasks of TogetherCrew.
1 stars 0 forks source link

Metrics: "Your account activity" section #9

Open amindadgar opened 1 year ago

amindadgar commented 1 year ago

In this issue, we're sharing the queries that compute the "Your account activity" section of twitter dashboard. Basically, the metrics that should be computed are

amindadgar commented 1 year ago

Query for the metric Number of posts the user made

MATCH (a:TwitterAccount  {userId: '{userId}'} )-[r:TWEETED]->(t:Tweet) 
WHERE r.createdAt >= {Epoch7days}
RETURN COUNT(r) as post_count

Note: The Epoch7days is representative of 7 days ago timestamp.

amindadgar commented 1 year ago

Query for the metric Number of replies the user made

MATCH (t:Tweet  {authorId: '{userId}'} )-[r:REPLIED]->(m:Tweet)
WHERE r.createdAt >= {Epoch7days} AND m.authorId <> t.authorId
RETURN COUNT(r) as reply_count

Note: The Epoch7days is representative of 7 days ago timestamp.

amindadgar commented 1 year ago

Query for the metric Number of retweets the user made

MATCH (t:Tweet  {authorId: '{userId}'} )-[r:RETWEETED]->(m:Tweet)
WHERE r.createdAt >= {Epoch7days} AND m.authorId <> t.authorId
RETURN COUNT(r) as retweet_count

Note: The Epoch7days is representative of 7 days ago timestamp.

amindadgar commented 1 year ago

Query for the metric Number of likes the user made

MATCH (a:TwitterAccount  {userId: '{userId}'} )-[r:LIKED]->(m:Tweet)
WHERE m.createdAt >= {Epoch7days} AND m.userId <> t.authorId
RETURN COUNT(r) as like_counts

Note: Epoch7days is the timestamp of 7 day ago. Note 2: This will work in case of twitter extraction running daily. we need to define another way of doing this.

amindadgar commented 1 year ago

Query for the metric Number of mentions the user made

MATCH (t:Tweet  {authorId: '{userId}'} )-[r:MENTIONED]->(a:TwitterAccount)
WHERE r.createdAt >= {Epoch7days} AND t.authorId <> a.userId
RETURN COUNT(r) as mention_count

Note: Epoch7days is the timestamp of 7 day ago.