Quick and easy Congressional District lookups for your CiviCRM contacts

By definition CiviCRM is used by many organizations in the political sphere. For those organizations working in the US one useful metric to have on your contacts is their congressional district. Up until now this has usually been accomplished with either custom code, or exporting your contacts, sending them through a bulk lookup tool, and re-importing them. There is now an easier way to get this with the CiviCRM Sunlight Congressional District module. Yes the name is long but verbosity is perhaps better than obscurity when naming your open source project* (Login Toboggan and Deadwood I'm looking at you).

As the name implies this module integrates with the excellent Sunlight API. The Sunlight API is a way for developers to easily fetch information about congressional districts and the members of congress that represent them. With this module you can now integrate this into CiviCRM with ease:

  1. Enable the module
  2. Create some custom fields in CiviCRM to store the congressional district
  3. Tell the module about your fields
  4. Watch as the module fetches information from Sunlight

The module also exposes its own API so that you can go even further to fit your site's needs (list all users in a district, show the members of congress for a district, etc. ). As an example of how to utilize this API it includes an additional module called "Congress" that provides a user tab showing the user's congress members, and a directory of all your user's districts.

The module is currently in Beta. There's some polishing that needs to be done to make the module useful in a wide variety of use cases. But don't let that hold you back. The module is used in production on at least one major site and has already done several hundred thousand lookups.

* The downside to such a long name is that through the rest of this blog post I need to refer to it as "the module" :P

This has been cross-posted to civicrm.org

Howard Johnson wrote 3 weeks 5 days ago

I've been 'following' the progress of this add-on for civiCRM and just got around to installing it to do some testing, on a site I use for dev etc that's currently running drupal 6.15 and civiCRM 3.1.2 - just a couple of questions that I'm sure are due to my heedlessness. But for the life of me I can't find any detailed, specific installation info. Looked at the documentation link on the drupal module page, looked at the readme in the download. It just says 'configure the module' but come on, that's really not helpful, is it? Your blog gives a couple of steps but there's no useful detail: "create some custom fields in civicrm to store the congressional district" for example. Exactly what fields, create them where, how? Then "tell the module about your fields." How would I do that? Having enabled the module, by the way, some errors come up on a couple of admin screens; hmm, for that feedback to be useful I suppose you'd want to know exactly which screens, and what the error messages were, eh? Do I need to get a Sunlight API key of my own, in order to use the module? BTW I think the thing is great, but there's just that last little bit of information needed to make it actually useable. Or, if the info is there and I've missed it, please point me in the right direction. Thanks!

Dave Hansen-Lange wrote 2 weeks 3 days ago

Hmmmm, not sure what version of the module you tried. There are basic installation instructions within the README.txt file, and detailed descriptions on the actual administration forms with hyperlinks to anywhere else that you need to go to (CiviCRM, The Sunlight API Key request form, etc.) Perhaps there just needs to be more info in the README stating that detailed information can be found on the admin forms.

Contact Us

About Dave Hansen-Lange

Dave Hansen-Lange has been developing websites since 2003 when he needed a web presence for the record label that he founded with several fellow musicians.

Advomatic on Twitter