DateRanger – a new tool to share

This is a post by Nat Buckley, of Buckley Williams, our recent collaborators on the new Postal Museum Touch Table project.

As humans we find it easy to quickly read a variety of date formats and almost instantly understand what they represent. We can glance at dates written as “23rd Jan 1894”, “Jan-Mar 1856”, “c. 1960” or “1945-1949” and we know how big the date range is and how accurate it might be. These are just a few examples of dates formats we found in the Postal Museum collections.

To work with those dates effectively in our software we needed to find a way to parse them and represent them in a single format. There are many software libraries designed for translating between standardised date formats (eg. ones used by different countries), but parsing formats commonly used in archives is a slightly less popular problem to solve. Archives tend not to have an enforced, fixed way of writing down dates, so there can be a surprising variety of notations. This isn’t a bad thing — it gives the archivists the flexibility they need to represent their knowledge about the objects under their care. Each collection might have its own quirks.

Some smaller software libraries do take on a challenge of parsing dates from more natural, human-readable formats, but we decided to devise our own way. We had a very specific set of formats and couldn’t find an existing solution that could deal with all of them easily.

I wrote DateRanger, a Ruby library which takes in those formats and translates them into a data structure which represents the start and end of the date range. It makes it straightforward to understand the accuracy of the date — the wider the range, the less accurate or specific the date was to begin with. We’d love to see contributions from anyone interested in expanding how many formats DateRanger can work with.

I used automated tests to build up the code in stages, starting from parsing really simple dates, and culminating at testing even obscure format combinations that we didn’t quite encounter in our data sample. The tests-first approach meant I managed to notice and catch some pretty confusing bugs really early on.

We used DateRanger on the Postal Museum touch table, to help us determine where on the timeline to place the collection records. We did, however, use the original date formats from the archive to display to the viewer. After all, those are already perfectly human-readable.

How big is that?

As part of the work we’ve done on the new Waddesdon Bequest Explorer with the British Museum, we made a widget which depicts the volume of an object (as a cuboid), next to a tennis ball for scale, and thought that other people might be able to use it. So, we’ve extracted it into a public Github repository called dimension-drawer.

This seems like a small thing, but it can be hard to get a sense of how big a museum object is, when looking at its photo online – especially when that photo is artfully shot on a black background.

Luckily for us, ‘dimensions’ of an object are one bit of metadata that museums routinely store across their entire collection. I suspect this is mainly for practical purposes (“how big a box will I need to transport this object in?”), as there would will little point in displaying it on a label in gallery, when you can look at the real thing.

The tool outputs the drawing as SVG (Scalable Vector Graphics), an XML based format which works in most modern browsers (even Internet Explorer). You can even style it using regular ol’ CSS.

The cuboid in the diagram is drawn using the ‘Cabinet Projection’, which is a sort of fake 3D with parallel lines (instead of a vanishing point). This made the Maths easier (I dusted off my school-age memory of Trigonometry), and also seemed like a pleasing throwback to the age of the collection. (Cabinet Projection was traditionally in technical drawing by furniture makers).

Why a tennis ball? The size was right for our purposes (some of the objects are smaller, some bigger), we thought a tennis ball would be universally recognisable, and it’s simple to draw. We’ve already had a request for the option of displaying a rugby ball instead though!

You can see how it looks for a collection of almost 300 objects in the new Waddesdon Bequest collection explorer we made for the British Museum.

We’ve published the Ruby code behind the tool as a gem, so that other people can use it. There are instructions on the GitHub page.

I’m sure there’s lots of ways the code could be improved, or new features added, so if you have any ideas, get in touch.