26

When I find a good post, I like to see its timeline. Just in case that some people don't know what it is and how to get it, here is an example with the most famous Q & A: How to make a great R reproducible example Its URL is

https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

So the post ID is 5963269. Now try this URL: https://stackoverflow.com/posts/5963269/timeline and we can see many useful actions in time series: votes, favorite, comments, revision, etc.

The timeline of an answer can be obtained as such. If you click the "share" of an answer, you get a permanent link. For example, If I do this for the accepted answer of the above Q & A, I get https://stackoverflow.com/a/5963610/4891738. Now the post ID is 5963610 and that 4891738 is my own user ID, so its timeline is https://stackoverflow.com/posts/5963610/timeline.

A timeline is very informative in my view. It may inform:

  1. is this post useful in a long run?
  2. does bounty or revision make a post more popular?

For example, let me sketch a time series of an answer (I deliberately don't give the link):

We see that this answer is getting increasingly popular, as the vote count increases super linearly.

At the moment I manually enter those data into a file and process it with R software. I am wondering, is it possible, we can have a site feature that can exports the timeline into a text file, say a ".csv" file?

0

2 Answers 2

25

You can do these type of analysis by means of the Stack Exchange Data Explorer.

This query generates votes, posthistory (edits, close, notices etc) and review events you'll also find in the timeline:

select creationdate
     , [type]
     , [typeid] as [History, vote or post typeid]
     , name
from
(
-- all posthistory events
select creationdate
     , 'hist' [type]
     , posthistorytypeid as typeid
     , name
from posthistory
inner join posthistorytypes pht on pht.id = posthistorytypeid
where postid = ##postid?5963269##
union all
-- all votes
select creationdate
     , 'votes' 
     , votetypeid
     , name
from votes
inner join votetypes vt on vt.id = votetypeid
where postid = ##postid?5963269##
union all
-- all answers (for questions)
select creationdate
     , 'answer'
     , posttypeid
     , 'answer added'
from posts
where parentid = ##postid?5963269##
union all
select creationdate
     , 'review'
     , reviewtasktypeid
     , name
from reviewtasks
inner join reviewtaskstates rts on rts.id = ReviewTaskStateId
where postid = ##postid?5963269##
) data
order by creationdate desc

SEDE does allow input parameters (in this case for a postid) and it has an option to export its results to CSV:

enter image description here

If you're interested in the full data schema see: Database schema documentation for the public data dump and SEDE There you'll find the data-definition of the values for the votetypeid (in the votes table), the posthistorytypeid (in the posthistory table) and the reviewtypeid (in the reviewtasks table).

Keep in mind SEDE is only update once a week, on Sunday morning. If you're new to SEDE you might like the tutorial and if you have additional questions, feel free to hop in SEDE Chat

0
13

If you'd prefer more up-to-date data than SEDE provides, you can also get the question timeline in JSON format via the Stack Exchange API. Parsing and iterating over the JSON data is left as an exercise, but it's not terribly complicated — it's basically just a list of event records. For tracking up/down votes, you'll specifically want the records with a timeline_type of vote_aggregate.

Note that the API timeline seems to work a bit differently than the HTML one: in particular, the timeline for each question also automatically includes all events on its answers, whereas trying to directly use an answer ID in the query gives no results. So if you're just interested in a single post and not the whole thread, you'll need to filter the results by the post_id key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .