Weel Beginning 23rd September 2024

I spent the majority of this week continuing to work on the interactive map of Burns correspondence, most of it working on implementing the filter options.  I started developing the filters form within the map menu, but I came to the conclusion that the menu was just too small for the large number of filter options that we want to offer.  The following screenshot shows my initial attempt, with hardly any of the filter form visible in the menu.

Instead I decided to set the filters tab of the menu to display a summary of the currently selected filters and a count of the matching correspondence.  I then added in a button that opens up the filter options in a popup similar to the one used to display the biographical information about correspondents, as the following screenshot demonstrates:

The filter options are split into two columns, with the right column containing the categories in a scrollable area.  Both hierarchical levels are represented, and you can select / deselect all, or select / deselect an entire category group by pressing on the checkbox next to its parent.  On the left there are filters for correspondent and correspondence.  For correspondent you can search for an individual person.  This is an ‘autocomplete’ and if you start typing (e.g. ‘rob’) then a list of possible matches appear, from which you can select one.  I figured it wasn’t really necessary to allow users to search for multiple people as this would increase the complexity and correspondence only ever involve two people anyway.  In addition to selecting a person you can choose to filter by gender (e.g. all correspondence involving women).  You can also specify the role of the correspondent, e.g. limiting the map to showing correspondence that were sent by women, or received by ‘Clarinda’.  Leaving this option blank means the filter matches both sender and recipient.

For correspondence you can limit to a single date or a range.  I’ve added tooltips to give information about what exactly is possible, but you can search for a year, a year and a month or an exact day in each field.  You can also limit by location.  This isn’t an autocomplete but instead matches whatever you enter against the full location field.  I figured this would be more useful as (for example) you can enter ‘Edinburgh’ and find all locations in Edinburgh, or you can enter a specific place in Edinburgh.

Any combination of these filters can be chosen, although not all combinations will make sense or give results.  Pressing on the ‘Filter’ button at the bottom of the popup closes the popup and performs the search, limiting the data on the map accordingly.  When you press on a map marker the correspondence listed are similarly filtered.  After performing a search and closing the filter popup a summary of your filters is displayed in the tab (as mentioned earlier).  If you re-open the filter popup your selected filters remain in the form and you can either edit your selection or press the ‘Reset filters’ at the top of the popup to start afresh.

I had to do a lot of behind the scenes work to get all of this operational – lots of updates to the API to process the filter selection for both the map data and the list of correspondence.  I think it’s working pretty well and it’s much nicer to use the map when it’s filtered rather than showing all of the data.  Next week I’ll continue with the outstanding tasks mentioned last week:  the timeline, citation and bookmarking etc.

Other than working on the correspondence map I spent some further time on the article for the Books and Borrowers project, adding in new sections on the four-tier book structure, authors, genre and borrower occupations.  I also spotted an issue with the online resource’s advanced search, whereby the library registers were not getting added to the multi-select area.  I realised this was an unintended consequence of an update to the API I’d made a couple of weeks back to cut down on complex queries.  The call to return registers was running several subqueries to work out counts of things like associated borrowers and borrowings.  I had thought the call was only ever used when viewing registers for a specific library, and in this use case the query was pretty rapid as only a few registers at a time were ever involved.  I therefore blocked a call to the API that didn’t specify a library, not realising this call was actually used to generate the list of registers for the advanced search form.

Once I realised that the call was actually needed I decided to create static cached fields in the register table for the counts, rather than conducting the counts on the fly in subqueries.  With the new fields in place I then created a script that would populate the fields and updated the API to reference these fields rather than perform the additional queries.  This resulted in a significantly faster query time and the advanced search form now includes registers again.

Also this week I had an email conversation with Matthew Creasy about an interactive map we would like me to build.  I can’t say much more about it at this stage, but we’ve arranged to meet the week after next to talk about it in more detail.  I also spoke to Thomas Clancy about a possible funding application and made a few minor tweaks to the Speak For Yersel region resources, which will hopefully be going live fairly soon.