FlashGraffer Information File

The files referred to below are contained in the downloadable file FlashGrafferWrapper.zip.  Included are:
* FlashGraffer.htm
* crp_HADM_110_names.csv (There are 36 similar files, one for each committee)
* Senate_110.csv and House_110.csv
* Senate110_curl.php and House110_curl.php
* N00000010_industry110.txt (540 similar files were downloaded from CRP, one for each member of the 110th Congress)
* canvaspluskd.as (compiled by mtasc.exe into canvaspluskd.swf, providing the drawing canvas).
* Canvaspluskd.swf and canvaspluskd.bat
* read_crpapi_data.php
* NewBSDlicense.txt (New BSD license under which the code files contained in FlashGrafferWrapper.zip are provided.)


Description of data files and software used in page 2 of www.polinetworks.com

1. List of 110th Congress' House and Senate committees.  Thirty-six committees are referenced. This list, from which selections are made by the user, is incorporated as an array in the Javascript code of FlashGraffer.htm.
2. A file for each of the 36 House and Senate committees contains the name and number for each member.  The number is assigned by the Center for Responsive Politics (hereafter CRP).  A sample file is: crp_HADM_110_names.csv .
3. List of names and CRP identification numbers  for all members of the 110th Congress are contained in two files, one for the Senate and one for the House:  Senate_110.csv and House_110.csv.  Both of these files are contained in the zipped download file.
4. Programs Senate110_curl.php and House110_curl.php used the files in 3. (above) to retrieve the data supplied by CRP via their APIs.  Each name resulted in an API download of the named member of congress and contributions from the 20 industries from which the member received the most contributions.  Not all of the files could be retrieved in one setting.  CRP limits the number of retrievals of the same type to 200 per time period.  In practice, it seemed that no more than about 50 to 60 could be retrieved in a single run.  Therefore in House110_curl.php there is a dummy read loop where the first n files are ignored, with a second loop with a limit of 50 which actually retrieved the files. As CRP makes these files available on a controlled basis, only one sample file-N00000010_industry110.txt is contained in the zipped download file. A user should obtain his or her own API key and insert it in these PHP programs before using them.  These programs, of course, must run on a server.  I used Apache for this purpose, running it locally.
5. The graphs created and displayed on www.polinetworks.com are drawn onto a drawing canvas supplied by Adobe Systems Flash(r) system.  Consequently any user of www.polinetworks.com must have Adobe Flash Player installed.  In addition, Internet Explorer, version 7 is the only browser on which the software has been tested.  The open source compiler mtasc.exe (http://www.mtasc.org) was used to compile the file canvaspluskd.as and create the necessary swf file, canvaspluskd.swf.  The batch file canvaspluskd.bat was used to execute mtasc.exe and carry out the compilation.  These procedures and coding followed the Example 22-12. Canvas.as in Chapter 22 of Flanagan. The file canvaspluskd.swf is incorporated into FlashGraffer.htm with the <object> syntax.
6. Javascript code in FlashGraffer.htm is the heart of this project. When the user selects a committee name from the popup list this name is passed to read_crpapi_data.php. This latter program, running on the server, retrieves the file that contains the list of members of the selected committee, and uses that list to read the XML files that were downloaded from CRP relevant to the committee.  This program parses these files and passes the data to FlashGraffer, which incorporates the data from all of the members of the selected committee into a single array, each row of which corresponds to the total (PAC plus individuals) contributions for an industry to a committee member. FlashGraffer then calculates subtotals for each member of all contributions received, and for each industry of all contributions made to members of the committee.  These subtotals are written to the two columns that appear on the canvas, and lines showing the links between industries and members are drawn. Other features of FlashGraffer are described on the home page of www.polinetworks.com.  
7. Links to PHP ,  Apache, CURL, and MTASC open source swf compiler , all used in this project..

Additional comments

As I practically started from scratch with the languages and methods used here, I relied heavily on various sources.  The following books were particularly helpful:

Ballard, Phil, Ajax Starter Kit: Quick Start Guide, SAMS, 2007.

Ballard, Phil and Michael Moncur, Sams Teach Yourself Ajax, JavaScript and PHP All in One, SAMS, 2009.

Flanagan, David, JavaScript: The Definitive Guide, O'Reilly(r), Fifth Edition, 2006.

Meloni, Julie C., Sams Teach Yourself PHP, MySQL and Apache All in One, SAMS,  Fourth Edition, 2008.


In addition, my son Laurence P. Toenjes, a professional programmer, helped me immensely in dealing with what, for me, was a bewildering array of new technologies.

www.polinetworks.com resides on GoDaddy's web services, and Microsoft's FrontPage(r) was used to help create it, although only a minor subset of its features are utilized.
