NYSenate.gov codebase contributed to Drupal

April 20, 2010

Last week the New York State Senate released version 1.0 of the computer code that runs our website as a collection of contributed modules for the Drupal content management system. The collection is available as a free download at http://drupal.org/project/nyss:

The code we released consists of 24 Drupal modules which constitute almost all of the custom code that is currently running on the Senate's website at http://www.nysenate.gov. The code is available as-is for use and adaptation by anyone who wishes to build a public-facing website for government or other agencies.

Much of the code is currently in the form of "glue" modules that are very specifically designed for the NY State Senate's content types, policy-driven needs and vendor choices that we have made for using outside services that provide video and other content on our site. Although they are tailored for our use, they provide functionality that may be very similar to what is needed by other websites. These modules include the following:

  • nyss_admin: Creates a custom Senator content admin page
  • nyss_blocks: A collection in code of the custom blocks that appear on the site. Each block is saved as a separate include file. The module also includes code which controls block display by context. For example, some blocks appear on the home page of the site but not on individual senator's pages.
  • nyss_carousel: Enables the photo carousels that appear on the home page of the site and also on the home page of each individual Senator.
  • nyss_committee: Manages retrieval and display of Committee information throughout the site, especially on the landing pages that exist for each Senate Committee. Each Committee page displays Committee-related reports, meetings, press releases, video, photos and other relevant information.
  • nyss_contact: Creates and handles the contact forms that constituents can use to contact their senator.
  • nyss_editors: Customizes access and editing permissions for the various people who edit the website. Each Senator's office has "office editors" who are allowed to post content on behalf of their Senator. Other Senate staff, such as our Media Services department, are authorized to post information that is of Senate-wide, and Senators' staff members can be authorized to post information to the pages of Committees chaired by that Senator.
  • nyss_event: Manages retrieval and display of Committee meetings, public hearings, Senate sessions and other Senate-related events, including related video, photos, testimony, legislation, etc. Since Senate-related business is now broadcast as live video (with video archives published after they end), the nyss_event module also keeps track of which events are currently occurring and automatically plays the video.
  • nyss_initiative: Manages display of information related to Senate initiatives. Examples include the Senate's "green jobs initiative," a Haiti relief effort, and initiatives related to the 2010 budget and support for the U.S. Census.
  • nyss_internalusers: Provides a separate stream of video and audio information for viewing by Senate staffers on our internal network. (This module exists mostly for load balancing purposes, so internal users of the website do not use bandwidth that we want to reserve for public use.)
  • nyss_leginfo: Displays lists of legislation sponsored by each individual Senator.
  • nyss_maps: Creates maps of Senate districts.
  • nyss_migrate: A one-off module that was used to import Senate information into Drupal from our prior legacy system.
  • nyss_misc: Provides miscellaneous functionality, mostly related to our OpenData project (see below).
  • nyss_node: Handles storage of information for OpenData.
  • nyss_opendata: Catalogs Senate-related information that has been published in a variety of file formats including CSV, PDF, text, etc.
  • nyss_search: Some customization of the site search form.
  • nyss_senator: Manages retrieval and display of information related to each individual senator, including their biographies, office address, contact information, sponsored legislation, press releases, photos, video, blog posts, and social networking links.
  • nyss_senator_search: Enables New York residents to enter their address and find out who is their Senator.
  • nyss_session: Retrieves internal API supplied by the Senate's Journal Clerk to provide an information block showing whether the Senate is currently in session, in recess, adjourned, etc.
  • nyss_signup: Lets people sign up to receive email notices from individual Senators.
  • nyss_videosettings: Provides some special configuration settings to control display of Senate video feeds.
  • nyss_views: A collection in code of the custom views used to create listings of senators, committees, initiatives, meetings, calendars, video archives, and other site content. The nyss_views module consists of some "wrapper" code and a separate .inc file for each individual view. We have found this framework useful for maintaining Drupal views in code. Each time we add or update a new view, we commit the change to our code repository, making it easy to propagate changes between our development site and our live site, and also modify or roll back changes when necessary.

Going forward, our plan is to turn as many as possible of the above modules into modules that will be general enough in scope to be usable as-is on other Drupal websites. Our primary immediate mission is serving the needs of the Senate as an institution, but we believe that everyone benefits if the code we develop can be used by others with similar needs. For example, we would like to evolve the "nyss_senator" module into a "public_official" module that can be easily provide similar functionality for senators, members of state assemblies, city council members and other officials in a variety of government institution. As this happens, we will release those modules as separate Drupal projects outside the "nyss" project. We have already released two Drupal modules in this fashion:

  • OpenLegislation, which retrieves legislation information via the search API of the New York State Senate's Java-powered OpenLegislation search engine at http://open.nysenate.gov/legislation. The OpenLegislation API supports HTML, JSON, XML and CSV. Its source code and documentation have been released separately and can be found at github: http://wiki.github.com/nysenatecio/OpenLeg
  • Whitelist, an input filter that can be used to specify and limit outside domain names that can be referenced in content created on a website.