vCard Implementation for EOC

By peterm, 23 February, 2010

Tags

I worked with Chief Trapp and Emergency Planner Gaylord to finalize our requirements around managing the contact information for Emergency Operations Center (EOC) members. The EOC is a functional approach to managing operations associated with emergencies that range from large protests to earthquakes. I've previously written on the subject of EOC Contact Management.

Use Case

We had previously used a laminated paper card as the method to distribute contact information for EOC members. The downside of this method is revision control, membership changes and ease of use. Imagine trying to read 4 point type on a pink card in a power outage while under stress. We've decided to try to manage this data set within our Drupal site. By using profiles and extending the basic profile with the fields we need to track; mainly multiple phone numbers. Data entry is delegated to a single person (Emergency Planner);so that we're not asking our executives or their assistants to maintain the data integrity. We think this is more efficient and has incremental workload overhead. Within a secured area of our site, we use a view to display a basic phone list. One of the columns displayed allows for the user to click and download the vCard. This can be done from a workstation and with the expansion of smart phones, we think that we can develop processes to handle the distribution and maintenance of this data.

vCard

vCard is a Drupal module intended to create a download vCard link from a users profile. I began with this module and extended the basic profile with additional fields for multiple phones. In researching how the module worked, I ended up patching the vCard module based on this post. I found that one limitation of the module (even patched) was that the vCard output was limited to a single telephone entry. So I reviewed the module code and started looking at the vCard standard. I found some great vCard references which are listed below. While I typically don't put my own code into production, it appeared that the module could easily be modified by adding additional entries to the vCard object. In the example below, the module is setting a variable $tel, based on a mapping it has pulled from array of fields coming from the profile. In the second block, you can see that I'm pulling the value out of the profile_home_telephone field and adding it to the $vcard array.

// Telephone $tel = vcard_get_field('telephone', $account); if (!empty($tel)) { $vcard->addTelephone($tel); } // PSM modifications below if (!empty($account->;profile_home_telephone)) { $vcard->;addTelephone($account->;profile_home_telephone); }

In researching the vCard standard, I came to find that there are some other properties that were not part of the vCard module. Specifically, I added a Title and Note property to the module's _vcard_properties() function. This allows me to map on the Title field. In the Note field, I was able to add information for Assistant and Assistant Phone. In a later revision, we'd probably try to implement the X-Assistant property, but for now, we simply concatenate the values and stick them into the Note field. Also, note that we're using a different method to set the value. See the PEAR documentation for examples of how the build function is put together, http://pear.php.net/manual/en/package.fileformats.contact-vcard-build.us....

if (!empty($account->;profile_assistant)) { $asst_info = "Assistant: " . $account->;profile_assistant . " - " . $account->;profile_assistant_phone; $vcard->setNote($asst_info); }

I also added a Revision entry so we could track our distribution of vCards over time. Based on the Chief's request, I also created an Other Contacts field to hold any additional contacts that we'd like to track on. These are appended into the Notes field as is the Assistant info.

 

Next Steps

I'm thinking that it will be easier to maintain this overtime if I can turn into a feature and then do revision control on it. I'm also planning to do some research to add my changes back to the community if anyone wants them.

Resources

Here's a list of useful vCard links. http://en.wikipedia.org/wiki/VCard http://vcardmaker.com/http://drupal.org/project/vcard http://drupal.org/node/216583 -- patch comment