\n", "TimelineJS is an open-source tool that enables anyone to build visually rich, interactive timelines. Beginners can create a timeline using nothing more than a Google spreadsheet, like the one we used for the Timeline above. Experts can use their JSON skills to create custom installations, while keeping TimelineJS's core functionality.\n", "\n", "\n", "The method for creating a visualisation is a simple one:\n", "- use a script to transform Linked Art JSON-LD files to a CSV format as defined by KnightLab\n", " - [Google spreadsheet template for a timeline](https://docs.google.com/spreadsheets/d/1pHBvXN7nmGkiG8uQSUB82eNlnL8xHu6kydzH_-eguHQ/copy)\n", "\n", "The method then differs depending on use of a Google spreadsheet vs local CSV file.\n", "\n", "#### Further Reading\n", "- [KnightLab visualisation service](https://knightlab.northwestern.edu/projects/)\n", "- [Google docs](https://doc.google.com)\n", "\n", "Detailed requirements and instructions are available at:\n", "- [http://timeline.knightlab.com/](http://timeline.knightlab.com/)\n" ] }, { "cell_type": "markdown", "id": "e5c72a9a", "metadata": {}, "source": [ "## Read in Linked Art files and transform to CSV timeline template" ] }, { "cell_type": "code", "execution_count": 8, "id": "25c066fb", "metadata": {}, "outputs": [], "source": [ "ruskin_la_files = \"./data/ruskin/output/json/\"" ] }, { "cell_type": "code", "execution_count": 9, "id": "bd985534", "metadata": {}, "outputs": [], "source": [ "import os\n", "try:\n", " import json\n", "except:\n", " !pip install json\n", " import json \n", "\n", "import csv\n", "\n", " \n", "sources = {}\n", "sources[\"https://www.nga.gov/collection/\"] = {\"name\":\"National Gallery of Art\",\"colour\": \"#E8A798\"}\n", "sources[\"https://clevelandart.org/art/\"] = {\"name\":\"Cleveland Museum of Art\", \"colour\":\"#EDD59E\"}\n", "sources[\"https://www.philamuseum.org/collection/object/\"] = {\"name\":\"Philadelphia Museum of Art\",\"colour\":\"#6B5876\"}\n", "sources[\"https://www.tate.org.uk/art/artworks/\"] = {\"name\":\"Tate Museum\",\"colour\":\"#A09998\"}\n", "sources[\"https://www.harvardartmuseums.org/collections/object/\"] = {\"name\":\"Harvard Art Museum\",\"colour\":\"#00758F\"}\n", "sources[\"ashmolean\"] = {\"name\":\"Ashmolean Museum\",\"colour\":\"#3f83e8\"}\n", "sources[\"rijk\"] = {\"name\":\"Rijksmuseum\",\"colour\":\"#94b7c3\"}\n", "\n", " \n", "json_all = {}\n", "\n", "# get list of Linked Art JSON-LD files for John Ruskin, created with 01-06-Transform-John-Ruskin.ipynb and 02-01-Reconcile-John-Ruskin-Place-Names.ipynb\n", "file_list=os.listdir(r\"./data/ruskin/output/json/\")\n", " \n", " \n", "for file in file_list:\n", " with open( ruskin_la_files + file) as json_file:\n", " json_text = json.load(json_file)\n", " json_all.update({file : json_text})\n", " \n", "my_dict = []\n", "\n", "title_rows = [\n", " {\n", " \"Year\": \"\",\n", " \"Month\" : \"\",\n", " \"Day\" : \"\",\n", " \"Time\" : \"\",\n", " \"End Year\": \"\",\n", " \"End Month\" : \"\",\n", " \"End Day\" : \"\",\n", " \"End Time\" : \"\",\n", " \"Display Date\": \"\",\n", " \"Headline\" : \"John Ruskin\" ,\n", " \"Text\": \"
This timeline visualisation shows artworks created by John Ruskin.
It demonstrates how the Linked Art data model can be used to transform, reconcile and visualise collections data for artworks.
See https://linked.art for more information.
\",\n", " \"Media\": \"https://upload.wikimedia.org/wikipedia/commons/0/0a/John_Ruskin_1863.jpg\",\n", " \"Media Credit\": \"Wikipedia\",\n", " \"Media Caption\": \"John Ruskin\",\n", " \"Media Thumbnail\" : \"\",\n", " \"Type\": \"title\",\n", " \"Group\" :\"\",\n", " \"Background\": \"\" },\n", " \n", " {\n", " \"Year\": \"1819\",\n", " \"Month\" : 2,\n", " \"Day\" : 8,\n", " \"Time\" : \"\",\n", " \"End Year\": \"1900\",\n", " \"End Month\" : 1,\n", " \"End Day\" : 20,\n", " \"End Time\" : \"\",\n", " \"Display Date\": \"\",\n", " \"Headline\" : \"John Ruskin's lifetime\" ,\n", " \"Text\": \"\",\n", " \"Media\": \"https://en.wikipedia.org/wiki/John_Ruskin#/media/File:John_Ruskin_1863.jpg\",\n", " \"Media Credit\": \"Wikipedia\",\n", " \"Media Caption\": \"John Ruskin\",\n", " \"Media Thumbnail\" : \"\",\n", " \"Type\": \"era\",\n", " \"Group\" :\"\",\n", " \"Background\": \"\"},\n", " \n", "]\n", "\n", "my_dict = title_rows\n", "\n", "for file in json_all:\n", " artwork = json_all[file]\n", " \n", " id = artwork[\"id\"]\n", " \n", " if \"_label\" not in artwork:\n", " continue\n", " \n", " if \"produced_by\" not in artwork:\n", " continue\n", " \n", " if \"begin_of_the_begin\" not in artwork[\"produced_by\"][\"timespan\"]:\n", " continue\n", " \n", " if artwork[\"produced_by\"][\"timespan\"][\"begin_of_the_begin\"] == 1819:\n", " continue\n", " \n", " credit = \"\"\n", " for source in list(sources.keys()):\n", " if source in id:\n", " credit = sources[source][\"name\"]\n", " bgcolour = sources[source][\"colour\"]\n", " \n", " text = \"\"\n", " imageurl = \"\"\n", " homepage = \"\"\n", " \n", " if \"referred_to_by\" in artwork and len(artwork[\"referred_to_by\"]) > 0 and \"content\" in artwork[\"referred_to_by\"][0]: \n", " text = artwork[\"referred_to_by\"][0][\"content\"]\n", " \n", " \n", " if artwork[\"subject_of\"][0][\"classified_as\"][1][\"id\"] == \"http://vocab.getty.edu/aat/300266277\":\n", " homepage = artwork[\"subject_of\"][0][\"id\"]\n", " text = text + \"\n", " | Year | \n", "Month | \n", "Day | \n", "Time | \n", "End Year | \n", "End Month | \n", "End Day | \n", "End Time | \n", "Display Date | \n", "Headline | \n", "Text | \n", "Media | \n", "Media Credit | \n", "Media Caption | \n", "Media Thumbnail | \n", "Type | \n", "Group | \n", "Background | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "John Ruskin | \n", "<p>This timeline visualisation shows artworks ... | \n", "https://upload.wikimedia.org/wikipedia/commons... | \n", "Wikipedia | \n", "John Ruskin | \n", "NaN | \n", "title | \n", "NaN | \n", "NaN | \n", "
1 | \n", "1819.0 | \n", "2.0 | \n", "8.0 | \n", "NaN | \n", "1900.0 | \n", "1.0 | \n", "20.0 | \n", "NaN | \n", "NaN | \n", "John Ruskin's lifetime | \n", "NaN | \n", "https://en.wikipedia.org/wiki/John_Ruskin#/med... | \n", "Wikipedia | \n", "John Ruskin | \n", "NaN | \n", "era | \n", "NaN | \n", "NaN | \n", "
2 | \n", "1870.0 | \n", "1.0 | \n", "1.0 | \n", "NaN | \n", "1870.0 | \n", "12.0 | \n", "31.0 | \n", "NaN | \n", "before 1870 | \n", "Engraving of Ruskin's Drawing of the Petal Vau... | \n", "<br/><br/><a target='_new' href='https://colle... | \n", "https://collections.ashmolean.org/media/ashmol... | \n", "Ashmolean Museum | \n", "NaN | \n", "https://collections.ashmolean.org/media/ashmol... | \n", "title | \n", "NaN | \n", "#3f83e8 | \n", "
3 | \n", "1869.0 | \n", "1.0 | \n", "1.0 | \n", "NaN | \n", "1869.0 | \n", "12.0 | \n", "31.0 | \n", "NaN | \n", "early November 1869 | \n", "Enlarged Study of a Prawn's Rostrum | \n", "<br/><br/><a target='_new' href='https://colle... | \n", "https://collections.ashmolean.org/media/ashmol... | \n", "Ashmolean Museum | \n", "NaN | \n", "https://collections.ashmolean.org/media/ashmol... | \n", "title | \n", "NaN | \n", "#3f83e8 | \n", "
4 | \n", "1852.0 | \n", "1.0 | \n", "1.0 | \n", "NaN | \n", "1852.0 | \n", "12.0 | \n", "31.0 | \n", "NaN | \n", "1852(?) | \n", "Study of a Venetian Capital | \n", "Fine Arts Department, Harvard University, Camb... | \n", "https://nrs.harvard.edu/urn-3:HUAM:VRS48802_dynmc | \n", "Harvard Art Museum | \n", "NaN | \n", "https://nrs.harvard.edu/urn-3:HUAM:VRS48802_dynmc | \n", "title | \n", "NaN | \n", "#00758F | \n", "
This timeline visualisation shows artworks ... \n",
"1 NaN \n",
"2
Timeline visualisation"
],
"text/plain": [
"