New insight: Twitter birthday #1514

Closed
ginatrapani opened this Issue Mar 23, 2013 · 4 comments

Comments

Projects
None yet
2 participants
Owner

ginatrapani commented Mar 23, 2013

One-liner

Celebrates the day you joined Twitter and shows you which of your friends joined around the same time.

Full explainer

How does it make the user feel? What is the goal of this insight?

This insight celebrates your Twitter birthday. It gives you a sense of accomplishment and perspective about how much time you've been on Twitter, and lets you know which people you follow joined Twitter around the same time.

Audience for the insight

Which networks, if any, are excluded from this insight? All except Twitter. ThinkUp's crawler doesn't capture a user's joined date from any other networks.

Does this insight serve users with less or more activity? Neither. Every single user has a joined date.

First-run: does this insight show up on a user's first crawl? No, only on the user's Twitter birthday.

How often this insight runs

  • Weekly
  • Monthly
  • Yearly
  • Triggered by a data event

If weekly or monthly or yearly, what day of the week or month or year? The user's joined date anniversary.

Headline

  • Happy Twitter birthday!

Since this insight runs only once a year, we don't have to worry about varying the headline much because it's so rare.

Body

  • %username joined Twitter %total years ago today, before 67% of the people %username follows did. SpotSmith just beat %username, joining 3 hours earlier, and DickSmith was a little slower, getting on Twitter 2 days later.
    ** SpotSmith
    ** DickSmith

Criteria and logic

Describe the rules for when this insight runs.

  • What data does this insight need?

This insight needs the tu_users.joined field and will only appear if the current month/day matches the month/day of the joined field.

In order to generate this insight, the InsightPlugin::generateInsight function needs access to the User object associated with the instance. (Otherwise, this insight would have to query for the User every single crawl which is too inefficient. Other new insights could make good use of the User object as well.)

To do that, in InsightsGeneratorPlugin::crawl, there's a call to $insights_plugin_registrar->runRegisteredPluginsInsightGeneration. That call should pass along the user object. Then, in PluginRegistrarInsights::runRegisteredPluginsInsightGeneration, the call to $this->emitObjectFunction('generateInsight', array($instance, $last_week_of_posts, $number_days)) should pass along the user, and then every insight's generateInsight function should accept the new user parameter.

This is a significant refactor, but the user object gives insights access to things like avatar, joined, url, location, etc, and we can generate a few new insights from that data.

  • Are there baseline comparisons? What is the logic around the comparison?

The insight needs to calculate the percentage of friends joined after the user. This will require (a possibly expensive) query agains tu_follows joined with tu_users.

  • Are there special copy cases? (for example, if the baseline comparison matches)

The insight also needs the user's friends who also joined around the same time. Get all friends who joined 3 days before and 3 days after the user. Then, get the closest friend before and after, and use those to generate the second line of body copy. Omit the before friend or the after friend or both if that data is not available.

Technical implementation notes: in the FollowDAO, retrieve all the followers that joined within a week of the current user, so getFollowersJoinedInTimeFrame, with $earliest_date set to 3 days before, and $latest_date set to 3 days after the user's join date.

Main concern is that ThinkUp doesn't have an index on tu_users.joined, so this query will be slow, and adding an index is a lot of insertion overhead for a once-a-year insight. I wonder if we can take advantage of our existing indexes and do something (admittedly hacky) like look for the closest user ID's versus the join date. This won't work for any network beside Twitter, but that's okay - this insight is Twitter only right now anyway.

  • Is there a minimum threshold for any bit of data before the insight should get generated?

Every single Twitter user has a joined date, so this insight will show up for every user.

Included elements

  • Headline
  • Body
  • Hero image
  • User(s) - if there are friends who joined near before or after the user
  • Post(s)
  • Link(s)
  • Line chart
  • Bar chart
  • Other viz
  • Other graphic treatment

Should I append a "registered_at" attribute to Instance, I guess?

Owner

ginatrapani commented Apr 13, 2013

Nope, just use the joined field in the users table.

Done.

2013-04-19 17:27:55 | 8.6MB | INFO | zuck | NetworkAnniversaryInsight::generateInsight,93 | text: Happy Twitter birthday! 5 years ago today, you joined Twitter, and since then you've put out 84 characters, 140 (or fewer!) at a time. It's likely you've spent about 3 hours and 3 minutes tweeting in those 5 years. You've asked your 7 followers 1 question. And 67% of your tweets have smileys in them! That deserves one more. :)
2013-04-19 17:27:55 | 8.6MB | INFO | zuck | NetworkAnniversaryInsight::generateInsight,98 | Done generating insight

I'll finish with the documentation, then rebase and pull request :)

Owner

ginatrapani commented Apr 20, 2013

Hooray!

ksiomelo pushed a commit to ksiomelo/ThinkUp that referenced this issue Apr 22, 2013

ksiomelo pushed a commit to ksiomelo/ThinkUp that referenced this issue Apr 30, 2013

@ginatrapani ginatrapani changed the title from New insight: Network joining anniversary to New insight: Twitter birthday Apr 29, 2014

cdmoyer added a commit to cdmoyer/ThinkUp that referenced this issue May 22, 2014

Twitter Birthday Insight
Each year on your anniversary of joining twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

References #1514

cdmoyer added a commit to cdmoyer/ThinkUp that referenced this issue May 22, 2014

Twitter Birthday Insight
Each year on your anniversary of joining twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

References #1514

cdmoyer added a commit to cdmoyer/ThinkUp that referenced this issue May 22, 2014

Twitter Birthday Insight
Each year on your anniversary of joining twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

References #1514

cdmoyer added a commit to cdmoyer/ThinkUp that referenced this issue May 22, 2014

Twitter Birthday Insight
Each year on your anniversary of joining twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

References #1514

cdmoyer added a commit that referenced this issue May 29, 2014

New insight: Twitter Birthday
Each year on your anniversary of joining Twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

closes #1514, closes #1956

AaronKalair added a commit to AaronKalair/ThinkUp that referenced this issue Jun 9, 2014

New insight: Twitter Birthday
Each year on your anniversary of joining Twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

closes #1514, closes #1956

@cdmoyer cdmoyer referenced this issue Jun 23, 2014

Closed

New Insight: Join date anniversary #2019

5 of 19 tasks complete

cdmoyer added a commit that referenced this issue Jul 21, 2014

New insight: Twitter Birthday
Each year on your anniversary of joining Twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

closes #1514, closes #1956

cdmoyer added a commit that referenced this issue Jul 21, 2014

New insight: Twitter Birthday
Each year on your anniversary of joining Twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

closes #1514, closes #1956

cdmoyer added a commit that referenced this issue Jul 21, 2014

New insight: Twitter Birthday
Each year on your anniversary of joining Twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

closes #1514, closes #1956

cdmoyer added a commit that referenced this issue Aug 14, 2014

New insight: Twitter Birthday
Each year on your anniversary of joining Twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

closes #1514, closes #1956

cdmoyer added a commit that referenced this issue Sep 4, 2014

New insight: Twitter Birthday
Each year on your anniversary of joining Twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

closes #1514, closes #1956

cdmoyer added a commit that referenced this issue Jan 8, 2015

New insight: Twitter Birthday
Each year on your anniversary of joining Twitter, gives you an insight.
Shows people you follow that joined just before and after you.
Added getFollowersJoinedInTimeFrame and countTotalFriendsJoinedAfterDate to FollowDAO

closes #1514, closes #1956
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment