I have a JSON file that represents my interaction with a Twitter conversation. I may have replied to a reply, created the original tweet and liked a reply, etc. I’m pulling tweet data down from the liked_tweets and tweets endpoints for my own user id and merging them into an array. The way I’ve done this may be problematic, which is what I’m here to explore.
When pulling the data, there are options to return a “conversation id” and also “referenced tweets” in addition to the core tweet (my reply, like, etc). The source resembles:
{ id: '2', conversationId: '1', referencedTweets: [{ id: '1', type: 'replied_to' }], text: 'my reply' }
I constructed more fleshed out data using their includes payload that had data like the above. So, my combined data might look like:
{ id: '2', conversationId: '1', referencedTweets: [{ id: '1', type: 'replied_to' }], text: 'my reply' },
{ id: '1', conversationId: '1', text: 'original tweet text' }
I believe that is “inverted” data, as in the refs are actually “parents”. I would like to group things in a way that would make it simple to display. I’m new-ish to data structures, and thought maybe a visualization would be helpful.
I’ve started a notebook Twitter conversation data / dmarr / Observable that has the data for a single conversation. I imagine there will be some feedback about that structure first. There is duplication which I’m not too worried about right now.
If there is help about an approach to group things better, so I could show:
tweet
- reply
- reply
- reply
That would be a big help.