The Exhibitionist

[posted by Gavin Robinson, 4:50 pm, 3 February 2007]

I was going to write some more about theories of text today, but I started playing with Exhibit instead (I found out about it from Public Historian). It’s a simple web API which gives you some of the features of a database driven site without having to use a database or any PHP/MySQL code (or the Microsoft equivalent). All you need is one HTML file for the page, and one Javascript file to store the data. It sounds too good to be true doesn’t it?

There are some obvious limitations. The developers only recommend it for small sets of data because it won’t scale up to more than a couple of hundred records. As all the processing is done on the client side, the browser has to download the whole data file before it can do anything with it. So far there doesn’t seem to be any way of getting a permalink to a particular view of the data. If you reload the page it resets to its default state.

Today I’ve been finding out what Exhibit can do, and how to do it. I made a test site showing cavalry and dragoon officers who served in the New Model Army during the First Civil War. It’s quite basic, but it was pretty much done in half an hour (plus a lot longer trying to work out why it sometimes crashes — still not sure if it’s a bug in the API or a problem with my data!). The data came from an Excel spreadsheet which I’d extracted from an Access database that I made for my PhD research. I originally needed a table of troops and regiments so that I could link deliveries of horses and saddles to them. It’s a convenient dataset to use for this experiment as it’s just the right size, and the data might even be useful for someone else. Most of the names came from Firth and Davies’s Regimental History of Cromwell’s Army, with a few missing ones supplied from Sprigge’s Anglia Rediviva. It’s probably still not a complete list, as I came across other names during my research who couldn’t be identified. Looking back now, the structure of the data is a bit strange, but it was only intended for use within my own databases. Fields in the table are:

ID: unique ID number, primary key in Access (converted to “label” by Exhibit)

RegtID: ID of regiment. Regiments were not numbered during the 17th century and were only known by Colonel’s surname. It was useful to add a number for sorting purposes, and I think I took them from Firth’s numbering scheme, except that Firth made the lifeguard troop regiment 1, whereas I made them part of Fairfax’s regiment (2).

Colonel: Surname of regiment’s colonel. Where the colonel changed during the war, this is both names separated by a slash (eg Vermuyden/Cromwell)

TrID: ID number of troop. Made up of regiment number, then a single digit identifying the troop (1 to 6 for cavalry or 1 to 10 for dragoons). Where the captain changed during the war and succession is known, both share the same ID but there is a separate record for each captain

Troop: Surname of captain of troop

Captain: the troop leader’s full name in the form firstname surname. Where the leader holds a rank higher than captain this comes before firstname.

Details: Any other notes.

Converting Excel files to the JSON format required by Exhibit is easy using the Babel tool provided by the developers. This tool can also convert between other formats, including XML and RDF, so could be useful even if you’re not using Exhibit. JSON is basically a Javascript file which contains the data in the form of an array, but you don’t need to know that to be able to use it. In fact you won’t normally need to look at the JSON file at all.

Once you have your data file, you just need to point your HTML file to it, and also point it to the remote script which provides the API. Setting up the HTML file can be done mostly by copying and pasting the examples provided in the tutorial and changing the names of the fields to match your data, so you don’t necessarily need to understand what’s going on in order to make a basic page that works. To get finer control you’ll need to know something about hand coding HTML and CSS, but you don’t need any knowledge of Javascript.

That’s pretty much all there is to it. Once you upload the HTML file and its associated JSON file, users will be able to sort and filter the data in various ways. You can limit or allow different sorts or filters just by changing a few values in the HTML file. In my example the default view is all records visible, sorted by Colonel’s name, Troop ID, and then label/primary key. By clicking on the links at the top of the column you can change the sort order. The box on the right shows a list of all the colonels’ names. By clicking on a name you can filter the records to show only troops in that regiment. This is where the bug kicks in: if you filter by one colonel, and if that regiment has two or more troops with the same TrID, it throws an exception [Edit: whatever the problem was they fixed it quite soon]. But if you select two or more colonels it won’t crash however many troops share the same ID. I’ll have to try it with some different data and see if it still happens.

This is just a quick example of how quickly you can get a basic site up and running. There are links to some more advanced examples on the Exhibit site. It’s possible to include links and pictures in the records, and to switch between tile and table views.

Exhibit doesn’t claim to be a true alternative to PHP/MySQL, or even to XML/XSLT, but it fills its niche very well. If you have a small amount of data which you want to present more flexibly than static HTML allows, but you don’t have the skills, time, or server resources to use databases or XML, then this is for you. In order to get the most out of it you’ll need to know something about HTML and CSS, but if you can design a Wordpress theme then you’ll have no problems. Although you can get reasonable results out of the box with any old data, once you’ve got the hang of how it works it’s probably a good idea to think about how your data will fit into the Exhibit templates and adjust it before exporting to JSON if necessary. Above all, make sure that Exhibit is capable of giving you what you want, and that your dataset is small enough to make it useable.

So far Exhibit looks like a useful tool (and could also be a lot of fun to play with). I hope SIMILE continue to develop it and add more features. It would be particularly nice if someone could put together a front end which would allow users to put together a page without having to deal directly with the HTML, and to edit the JSON files. I’d definitely recommend it to people who have data they want to share but aren’t able to use more sophisticated methods.

Bibliography

  1. Charles Harding Firth and Godfrey Davies, A Regimental History of Cromwell’s Army (Clarendon Press: Oxford, 1940).
  2. Joshua Sprigg, Anglia Rediviva (1647).

1 Comment

Comments are closed.