Integration with Sunlight API's ..

2007-07-04 23:36
Written by
Kieran Lal recently mentioned on the civicrm-dev list that he was interested in integration with the SunLightLabs API integration. This has been on my list for some time and I decided to take a peek at the API and while doing so decided to take a quick hack at integrating the API in CiviCRM trunk. You can see the changeset for my first attempt here (note, we've had issues with fisheye stability so this link might not work sometimes :( Here are my impressions and thoughts on where we can go with this.
  • The API is pretty well documented and works as expected. Integrating it was relatively trivial. Since I was doing HTML integration, I decided to go use the XML output rather than the JSON output. A future version can potentially do most of this work using JSON and on the browser side
  • I could not figure out why I am getting 3 representatives from various zip codes and / or city-state combinations. Hopefully we'll find and fix this issue. I decided to check the SunLightLabs Blog and was a bit disheartened to see that it has not been updated since March!. I hope the API does not disappear soon and we get more regular blog updates :)
  • We definitely need to implement caching on the CiviCRM server side and store stuff in the database to avoid making many calls to the sunlight db. The cache could have a short lifetime (1 week?) to minimize drift from the main database. I suspect there will be a lot of cache hits (since it currently only has federal information). Creating a set of DB tables to store the information we retrieve from it should be relatively easy
  • The current integration is a bit simple. Given a contact, there is a tab to see the elected official for that contact. We need deeper integration and do the reverse. Given a representative, show me all the contacts in the database that he/she represents (and potentially form a smart group of these contacts). I suspect we could do this by extending the contact table with district level information (federal, state and city?)
  • Would be so so useful if Sunlight also takes care of the state/city level problem and gives us similar information. I suspect a fair amount of groups using CiviCRM are interested in City/State/Local information.
  • Probably useful to expose this feature in the user dashboard as an option.
Would be great for some folks in the community to step up and take this integration to the next level and implement some of the ideas above :)
Filed under
Click thumbs up if you thought this blog post was useful (login to vote or to comment)