This is a guest blog post by Jeffrey Shen, a high-school Innovation Intern with LC Labs.
Over the course of my three month internship with the LC Labs team, I developed a website/interactive data visualization which allows users to explore the late 1800s through political cartoons contained in the Cartoon Drawings collection. The main feature of the website is an interactive timeline that displays the number of cartoons in this collection, graphed by year. Users can select specific topics like “Grover Cleveland” or “Caricatures”, then the timeline will update to show how these topics are represented over time.
Underneath the timeline, there is also a slideshow of political cartoons from the Library’s collections. These images, which update alongside the timeline, help the user explore Library content in an interactive and engaging manner.
Through this website, I hope users will develop a better understanding of this particular collection, and will also be motivated to further explore the other digital resources offered by the Library.
To get the metadata for all the political cartoons, I first initiated a “get” request on the LoC API, specifically at the URL (https://www.loc.gov/collections/cartoon-drawings/?fa=online-format:image%7Caccess-restricted:false&fo=json&c=1000) of the images within the Cartoon Drawings collection I want to use. The parameter “fo=json” will give me my data as a JSON object and the parameter “c=1000” will give me all the images at once (given that the total size of the collection is less than 1000) so I can bypass the API’s default pagination.
A major challenge I faced with the project regarded the issue of access rights. Not every resource contained in the Library’s collection is available for public or commercial use, so in order to identify which images in the Cartoon Drawings collection I could use, I contacted the curators of that collection using the Library’s Ask a Librarian service. This tool was as simple as filling out a web form, and I quickly received a response which informed me that the copyright in the Cartoon Drawings collection varied based on each image. Rather than manually figuring out which images were publicly available, I selected only the images I was sure were in the Public Domain (images printed before 1923, as of the time of this blog post). Though this may not be the ideal approach for most projects, it worked for mine, especially as my tool centers around the late 1800s.
I also removed duplicate cartoons, or images with the exact same title, author, and date, in the collection. I then stored this cleaned metadata in a file called “data.json”, which I would later call in the frontend.
With the data fully processed, I began work on the frontend visualization. I programmed everything in standard HTML/CSS/JS, and the graph was created using D3 and the slideshow was created using Slick. Once I already had all the data in place, the main challenge was with presenting the data in a visually compelling and intuitive user interface. One feature of the website that I implemented to improve the user experience, for example, was the placement of “events” over the timeline (see the screenshot below) for certain subjects.
The goal of these events was to contextualize the spikes in the graph, so the user can understand the collection better. I manually entered these events into a JSON file, which is then read and displayed on the website.
Thanks to Jaime Mears, Elaine Kamlley, Jamie Bresner, Chris Thatcher, and everybody else in the Library who helped with this project! You can explore the website yourself via the Library of Congress Labs Experiments page, and can find full source code and documentation on Github. Feel free to add a comment to this blog post!