After much intrest in Predictive Custom R Scripts and Lumira Data Access Extension to acquire Google Spreadsheets, i tought my next project would be connecting to “Twitter”
It’s again a great information source and completes my strategy that i should demonstrate how it is different methods and technics to utilize cloud data. So let’s create our “Twitter Extractor”
1) First Steps – Create A Twitter APP
Twitter requires you to create an “APP” so it will give you some keys and will recognize you when you ask for data programmatically.
login to twitter and visit https://apps.twitter.com/ and create your new app from there.
Afterwards, check your keys tab to note down you api key and secret :
2) Hardest or Easiest Part : Creating the “Extension”
Language : Different from the visualization extensions, this time Lumira is looking for an independent executable file to speak to. This gives you unlimited freedom in options. I really had no idea how to create an “.exe” file, but i’ve been hearing Python from the communities. After hearing there are options to pack Python programs into exe files, i decided to give it a go. Ok it’s not so easy to figure out programming at first 🙂 But don’t give up. Theres nothing you can’t do after few sleepless nights and lots of caffeine.
Extension guide : As always, help.sap.com is our home. I found “SAP Lumira Data Access Extensions Developer Guide”. You’ll figure it out very easily. You just need to implement Preview, Edit and Refresh modes, and handle parameters and send the data in a specific format.
3) Most Of It’s Already Done By Someone Else
What seemed impossible at the first place, really looked doable after a few days. Python is famous with lots of packages for almost anything you want to do. I used tweepy for twitter connections, dpapi for encryption, easygui for dialogs etc. Tkinter seemed uber-complex for a first timer. Special thanks to everyone who are kind enough to contribute to open source software and make those packages available for everyone.
You can see the complete code and download the executable in my github repository
4) Use Your New Extension And Get Insights
Now lets see there’s any insight to be found in Twitter… Hint : Of course there is!
First step would be to use our extension as “external data source” to download twitter data. After that we can even “refresh” anytime we want.
And now… We’re ready to get insights :
Tweets sent from an iphone are getting more retweets compared to others.
5) Final Comments, Code, Executable And Call To Action
An extensibility is really worth a thousand features. Because the big SAP Community can contribute and adapt our software to virtually any need. I also want to contribute and make my codes and executables available here on github. Did i tell you that this is an “extension” and the extension code is not supported by SAP. It is not supported by me either, use at your own risk and feel free to enhance it even further.
Do you know a specific data source that Lumira currently does not support and your customer needs? Please share your toughts and comments below here and let’s discuss.