Week Beginning 30th May 2022

It was a three-day week as Thursday and Friday were bank holidays for the Queen’s Platinum Jubilee.  I spent most of the available time working on the Books and Borrowers project.  I had a chat with RA Alex Deans about the data for the Chambers Library sub-project that we’re hoping to launch in July.  Although this data is already in the system it needs additional latitude and longitude data so we can position borrowers on an interactive map.  We decided to add this data and some other data using the ‘additional fields’ system in the CMS and Alex is hopefully going to get this done by next week.

I’d made a start on the API for the project last week, and this week I completed the endpoint that displays all of the data that will be needed for the ‘Browse Libraries’ page, which can be accessed as JSON or CSV data.  This includes counts of registers, borrowing records, books and borrowers plus a breakdown of the number of borrowings per year at each library that will be used for the stacked column chart.  The systems reside on servers at Stirling University, and their setup has the database on a different server to the code.  This means there is an overhead when sending queries to the database as each one needs to be sent as an HTTP request rather than dealt with locally.  This has led me to be a bit more efficient when constructing queries.  For example, rather than running individual ‘count’ queries for each library after running an initial query to retrieve all library details I’ve instead used subqueries as part of the initial query so all the data including the counts gets processed and returned by the database via one HTTP request.

With the data retrieval aspects of the ‘browse libraries’ page completed I then moved on to developing the page itself.  It has an introductory section (with placeholder text for now) then a map showing the locations of the libraries.  Any libraries that currently have lat/lng data appear on this map.  The markers are clustered when zoomed out, with the number referring to the number of libraries in the cluster.  I selected a map design that I thought fitted in with the site, but this might change, and I used an open book icon for the library map marker on a red background (to match the site’s header text colour) and again this may change.  You can hover over a marker to see the library name and press on a marker to open a popup containing a link to the library, the library name and alternative names, location, foundation date, type and statistics about registers, books, borrowers and records.

Beneath the map is a tabular view of the data.  This is the exact same data as is found on the map.  Library names are buttons leading to the library’s page.  You can change the order of the table by pressing on a heading (e.g. to see which library has the most books).  Pressing a second time reverses the order.  Below is a screenshot showing the map and the table, with the table ordered by number of borrowing records:

Beneath the table is a stacked column chart showing borrowings at the libraries over time that I created using the extremely useful HighCharts JavaScript library (See https://www.highcharts.com/demo).  At the moment the borrowing records start somewhere between 1700 and 1710 and end somewhere between 1890 and 1899.  Actually, there are some borrowing records beyond even this but are presumably mistakes (e.g. one had a year of ‘179’ or something like that).  As generating a graph with a bar for each year would result in about 200 bars I decided this wasn’t feasible and instead grouped borrowings into decades.  This sort of works, but we still have many decades at the start and end that only have a few records, but we may limit the decades we focus on.  We’re also visualising the data from 18 libraries in the chart, which is a lot.  This takes up a lot of space under the chart (where you can hover over a name to highlight the data in the bars).  However, you can open the menu to view the chart full screen, which makes it more legible.  You can also view the year data in a table by selecting the ‘data table’ option.  Below is a screenshot of the bar chart:

There are a couple of things I could do to make this more legible if required.  Firstly, we could use a stacked bar chart instead (https://www.highcharts.com/demo/bar-stacked).  The years would then be on the y-axis and we could have a very long chart with all of the years in place rather than aggregating to decades.  This would make it more difficult to view the legend and the x-axis tick marks, as you would need to scroll down to see them.  Secondly, we could stick with the decade view but then give the user the option of selecting a decade to view a new chart featuring the individual years in that decade.  This would make it harder for users to get the big picture all at once, although I guess the decade view would give that.

Also this week I checked up on the Speak For Yersel website, as we had sent the URL out to people with an interest in the Scots language at the end of last week.  When I checked on Wednesday we’d had 168 registered users.  These users had submitted 8,110 answers for the main questions plus 85 for the ‘drag onto map’ and 85 for the transcript.  606 of those main answers are from people who have chosen ‘outside Scotland’.  I also realised that I’d set the markers to be smaller if there were more than 100 answers on a map but the markers looked too small so I’ve updated things to make them the same size no matter how many answers there are.

My other main task for the week was to finalise the transfer of the Uist Saints website.  We managed to get the domain name ownership transferred over to Glasgow and paid the subscription fee for the next nine years and the version of the site hosted at Glasgow can now be found here: https://uistsaints.co.uk/