HW7.png
Sample Display

ICT-4540 Homework 7

Purpose

This optional exercise enables you to register as a ProPublica developer, and extract an XML document for formatting. The exercise could also be performed with the JSON data.

What to Hand In

The result page will be generated by an XQuery which obtains data from a URl you will construct. You will hand in the XQuery file, the generated web page, any auxiliary files (e.g., CSS) used for display, and a screen shot of the result of each web page display.
You may replace your API key with the phrase "api-key-goes-here" for your submission.

Problems

  1. Setup
    1. Register as a ProPublica developer at projects.propublica.org/ api-docs/congress-api/ This will give you the ability to create API keys to obtain certain information.
    2. Create an API key for the Congress API. You will need to name your application (perhaps ICT4570 HW7?)
    3. You can use the API Console (lower left link) to test the call, using your developer key, as created in the previous step. We will use the Member List query and the Member Vote Positions query in this exercise.
    4. Determine which representative you will use. If you are in the US, you may want to select your local representative. If not, please pick one of interest to you, or use Denver's representative, Diana DeGette.
    5. As of Fall, 2019, the current House is number 118, and Denver's representative is in District 1 of Colorado (CO)
  2. XML Approach (Constructed so each step can be separately tested before moving on to the next step)
    1. Create an XQuery file, and set variables for your developer key, the congress id, the state, and the district you selected above
    2. Construct the URL to request Member List for that congress id, state, and district as an XML document and assign to a variable (test by copying the returned URL and pasting it into a browser).
    3. Execute the query and assign the result to a variable (test by returning the variable)
    4. Create a variable to represent the unique ID of the selected representative. You may wish to consult the browser result from the console API from problem 1 to see how to navigate to the unique ID. This variable will be needed to construct the next query below.
    5. Construct the URL to request the selected Representative's Member Vote Positions as an XML document. You will need to the member's unique ID, as created above, to construct the URL.
    6. Execute the query and assign the result to a variable
    7. Now we begin to play with the return value. Return an HTML container fragment, perhaps a section, and create display elements for the basic member information returned (name, birthday).
    8. Optional: Add the most recent party, chamber, congress, state, and district
    9. Create a table for each Congress the member was in, ordered numerically by congress, showing the congress number, and the percent they voted with their party
    10. Optional: Compute and display the year range for each term
    11. As a stretch goal for the very advanced student, display an SVG graph of these values, with the horizontal axis by election year, and the vertical axis by % (zero to 100).
  3. Extra: JSON Approach
    1. This problem has the same steps as the previous problem except that you will request JSON data from the API instead of XML documents. This would allow JavaScript manipulation of the data, as well as using the XQuery approach.

Notes

Evaluation

Criteria Weight
XQuery for XML data and display 60%
Generated web page for XML data and display 20%
Screenshot for XML data and display 20%
Option parts of problem 2 Extra 10 points for each
XQuery and JavaScript for JSON data and display, resulting web page, and screenshot. Extra 60 points