Help extracting data for new insight

26 views
Skip to first unread message

Rahul Teja

unread,
Feb 27, 2015, 11:30:11 AM2/27/15
to thi...@googlegroups.com
Hi all

I am a newbie to ThinkUp and have been going through the documentation. I have set up the development environment and to get familiar with the code, I am trying to build a new insight. The insight very simply gives the number of followers of a user. I could successfully run the makeinsight script and necessary files have been created. However, I am unable to go ahead due difficulties with extracting the required data.

I am unable to figure out the nomenclature to call different data attributes. Looking through the documentation, I could not find anything in this regard. I am sure I am missing something. Can someone guide me through this?


Thanks
Rahul

Gina Trapani

unread,
Feb 27, 2015, 3:20:02 PM2/27/15
to thi...@googlegroups.com
Hi Rahul,

On Fri, Feb 27, 2015 at 11:30 AM, Rahul Teja <teja...@gmail.com> wrote:
I am a newbie to ThinkUp and have been going through the documentation. I have set up the development environment and to get familiar with the code, I am trying to build a new insight. The insight very simply gives the number of followers of a user. I could successfully run the makeinsight script and necessary files have been created.

Great!
 
I am unable to figure out the nomenclature to call different data attributes. Looking through the documentation, I could not find anything in this regard. I am sure I am missing something. Can someone guide me through this?

You'll see that the insight's generateInsight() function has a $user parameter passed in, which is a User object. You can see the User object and all its attributes in the code, here:


Or in our auto-generated class reference documentation:


So, to reference the user's follower count, you'd use $user->follower_count.

Of course, as you work, looking through the code or docs is too tedious way to find out an object's attributes. We use docblocks in our code to help IDEs and code editors auto-complete and add tooltips/hints as you type. 

At the moment I use SublimeText to work on ThinkUp with the SublimeCodeIntel plugin. That gives me something that looks like this when I type $user->


Eclipse PDT also has very powerful code hinting and auto-completion. More on setting that up here:


Hope that helps,
Gina





--

Rahul Teja

unread,
Mar 1, 2015, 4:24:37 AM3/1/15
to thi...@googlegroups.com
Hi Gina

Thanks for the links! I am up and running with the Eclipse PDT and have created a new insight. I am using a remote server and hence uploaded the following files - /insights/myfollowers.php and /view/myfollowers.tpl to remote server. However, I am unable to see my insight listed at /thinkup/account/?p=insightsgenerator#manage_plugin

Do I need to register the insight separately? From seeing the code, the insight file registers at the end.

Rahul
Reply all
Reply to author
Forward
0 new messages