Message Boards Message Boards

Mathematica & APIs: Exceedance Conference Hackathon 2014 Winner

Hi there, I've used the ability of Mathematica to communicate with other APIs and the FindClusters function to win the Hackathon at the Risk Management Solutions (RMS) Exceedance Conference 2014. It shows what a great tool for quickly prototyping apps Mathematica is. Please see this short video for details:

Exceedance 2014 RMS(one) API Hackathon Winner 

The trickyest part was to make RMS(one) API work with URLFetch, but nothing that trial and error can't solve. For this particular case, I had to use the Apiary interface provided by RMS to fetch an authentication token ( see THIS ), which is passed as the "Authorization" parameter in the header as shown. 

token = URLFetch["",   "Headers" -> {"Authorization" ->       "Basic ZGV2dHJhY2thXEZlbGlwZUQ6RmVsaXBlREAxMjM="},   "Method" -> "POST",    "Parameters" -> {"Content-Type" -> "application/json"}];

Once this is done we can create helper functions to communicate with RMS(one) api, passing the token as a header in the way shown. In this case URLFetch retrieves data in "JSON" format, which I convert back to string. 

getContracts[pfID_, {offset_, limit_}] :=  ImportString[URLFetch["" <> ToString[pfID] <> "/contracts?offset=" <>     ToString[offset] <> "&limit=" <> ToString(*<>   "&RiskItemCount>0"*),   "Headers" -> {"Authorization" -> tokenP},   "Method" -> "GET"(*,   "Parameters"\[Rule]{"Content-Type"\[Rule]"application/json"}*)],   "JSON"]

One tricky bit was that the parameter "Parameters" doesn't need to be specified here (it is commented in the code above) but it is required to fetch the authentication token.

Any comments for the code above are mostly welcome. (I'm not sure RMS(one)'s mock server is working at the moment, so the code above will not work)

All the very best,
3 Replies


POSTED BY: Danielle Rommel

Hi Vitaliy,

The 2014 RMS Exceedance conference was held in Washington DC from 14th to 16th of April. For those who do not know, RMS is a world leader in risk management software and model development. Their products are used mostly by the (re)insurance industry. The 2014 conference focused on the release of their cloud-based modelling platform RMS(one), which includes the API. The idea is to allow their clients to develop their own analytical tools and models within RMS(one), and that's where Mathematica shines with its comprehensive catalogue of functions and great presentation capabilities.

To develop that app, it took me 3~4 of hours to figure out how to connect with RMS(one) API and learn how to browse through portfolios and contracts, plus something like 4 hours to create the prototype that I presented at the end of the competition. I believe it won because I was able to pack quite a lot of features - mapping, tooltip, graphing, statistical report, exporting KML - something that would have taken me days had I not used Mathematica.

I'm sending attached the code for Cluster Guy - to make it work it needs to point to a valid RMS(one) server, which I don't have access at the moment.

Have fun!.

Felipe, this is excellent, thanks for sharing!

Where did the conference happen and how long did it take you to write that wonderful application?

Would it be possible to share complete code - you could for example simply attach a notebook to the post.
POSTED BY: Vitaliy Kaurov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract