1085Loading govtrack data into Filemaker
- Nov 13, 2012I wanted to offer some lessons I learned in putting this data up in Filemaker, as I would think others probably use that platform. (Hopefully this is the appropriate forum for this).
1. It might be helpful to people to describe the general transformation that needs to take place to load the data into Filemaker:
a. The bulk data comes from govtrack as field/value pairs. To load into Filemaker, it needs to get translated into a list of field declarations (at the beginning), followed by all the data values (without field labels) in the same order. The data values are delimited by Filemaker-specific XML code. (See http://www.filemaker.com/help/html/import_export.16.30.html, or Google FMPXMLRESULT).
b. There is some Filemaker specific static text that has to go into the file; it's documented in the link above.
c. The Role data is presented by govtrack as if there could be multiple roles per person (because in the full history file there are). But as there is just one role per person in the Session-specific file (people.112), I
flattened the role data into the same record as the person fields. There needs to be some extra XSLT code to accomplish this which you will see in my XSLT file.
d. The following article, from a Filemaker book (QUE CORPORATION - Using Filemaker pro X, 2003, p.193), helped me understand the basics of what I needed to do, although the code I needed to write differed in important ways:
The key difference is this example accesses data in XML elements. govtrack data is placed in XML attributes, which you access differently. See my XSLT file.
e. Working with XSLT is massively easier if you use a test bench site to test the code. This one, unlike all the others I tried, works well for this application because it displays the resulting XML rather than trying to execute it as web display code:
That way you can compare it to what Filemaker says you need.
2. I'll post my XSLT file separately. I'm sure it could be massively improved upon but it works.
I'd welcome any comments or suggestions. Next I want to figure out how to update a joined table of current and historical data with the full historical people file.
- Next post in topic >>