Adding records to Islandora: Difference between revisions

(Created page with "<big>'''This page is under construction'''</big> __TOC__ =Generating records= <pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script"> import requests import xml.etree.ElementTree as ET import csv from relatorDict import relatorDictionary from ShxQuartosList import ShxQuartos from holdingsTestDict import holdingsToBibDictionary headers = {'Authorization': "Token cd639621-cb39-4805-80fa-82734155d9fd"} pa...")
 
 
(19 intermediate revisions by the same user not shown)
Line 4: Line 4:


=Generating records=
=Generating records=
* Use bib hldgs pairs to generate records. Use script to generate bib hldgs pairs from call numbers if needed.
* Extend the records to have the correct number of child records for each parent.
* If imaging has generated rootfiles, add them to the child records.
** Otherwise, send the records to imaging for rootfiling
** Rename image files with rootfile names in IrfanView thumbnails
=Importing records=
* Upload images to S3
* Add S3 links to records
* Upload spreadsheet to Islandora
** After upload has processed, generate thumbnail for parent record
=Useful scripts=
==Script to generate Islandora records from given holdings-bib pairs==
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
import requests
import requests
Line 13: Line 27:




headers = {'Authorization': "Token cd639621-cb39-4805-80fa-82734155d9fd"}
headers = {'Authorization': "Token APIKeyGoesHere"}
params = {"of":"xm"}
params = {"of":"xm"}
csvF=open("islandoraRecord.csv","w",newline='', encoding='utf-8')
csvF=open("islandoraRecord.csv","w",newline='', encoding='utf-8')
Line 826: Line 840:
writer.writerow({"title":"","id":i,"parent_id":"1","field_resource_type":"still image","field_model":"page","field_member_of":"","field_weight":"","field_identifier":"","field_linked_agent":"","field_creator":"","field_edtf_date":"","field_place_published":"","field_extent":"","field_rights":rights,"field_subject":"","field_note":"","field_classification":callNums[holdingsID],"field_page_opening":"","field_contents":"","field_catalog_link":"","field_finding_aid_link":"","field_created_published":"","field_genre":"","field_iconclass_headings":"","field_bindings_features":"","field_bindings_terms":"","field_digital_image_type":digitalImageType,"field_microfilm_call_number":"","field_microfilm_reduction_ratio":"","field_microfilm_length":"","field_credit":"","field_sponsored_by":"","field_bib_id":"","field_holdings_id":"","field_display_hints":"Mirador","file":"","url_alias":"/img"})
writer.writerow({"title":"","id":i,"parent_id":"1","field_resource_type":"still image","field_model":"page","field_member_of":"","field_weight":"","field_identifier":"","field_linked_agent":"","field_creator":"","field_edtf_date":"","field_place_published":"","field_extent":"","field_rights":rights,"field_subject":"","field_note":"","field_classification":callNums[holdingsID],"field_page_opening":"","field_contents":"","field_catalog_link":"","field_finding_aid_link":"","field_created_published":"","field_genre":"","field_iconclass_headings":"","field_bindings_features":"","field_bindings_terms":"","field_digital_image_type":digitalImageType,"field_microfilm_call_number":"","field_microfilm_reduction_ratio":"","field_microfilm_length":"","field_credit":"","field_sponsored_by":"","field_bib_id":"","field_holdings_id":"","field_display_hints":"Mirador","file":"","url_alias":"/img"})
</pre>
</pre>
==Script to generate bib-holdings pairs from a list of call numbers==
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
import requests
from lxml import etree
from lxml.etree import fromstring
import csv
import json
from searchList import searchList
headers = {'Authorization': "Token APIKeyGoesHere"}
url1 = "https://catalog.folger.edu/api/v1/search"
url2 = ""
params2 = {"of":"xm"}
csvF=open("record.csv","w",newline='', encoding='utf-8')
fieldnames=["search string","callNum","bib id", "holdings id"]
writer=csv.DictWriter(csvF,fieldnames=fieldnames)
writer.writeheader()
i=1
for searchString in searchList:
callNum=""
bibID=""
hldgID=""
params1 = {"format":"id", "f": "callnumber", "p": searchString}
response = requests.request("GET", url1, headers=headers, params=params1)
jsonResponse = response.json()
if jsonResponse["total"]==1:
bib=jsonResponse["hits"][0]
bibID=str(bib)
url2="https://catalog.folger.edu/api/v1/record/"+bibID
r = requests.request("GET", url2, headers=headers, params=params2)
root = etree.fromstring(r.content)
#get hldg ID and call num--this only works for records with single holdings (for now)
for datafield in root.findall("datafield[@tag='852']"):
dict852={}
for subfield in datafield.findall("subfield"):
sfCode=subfield.attrib['code']#
sfValue=subfield.text
dict852[sfCode]=sfValue
sfCode=""
sfValue=""
callNum=""
hldgID=""
if "7" in dict852:
hldgID=dict852["7"]
if "k" in dict852:
callNum=dict852["k"]
if "h" in dict852:
callNum=callNum+" "+dict852["h"]
if "i" in dict852:
callNum=callNum+" "+(dict852["i"])
callNum=callNum.replace("  "," ")
callNum=callNum.rstrip("., ")
callNum=callNum.lstrip(" ")
print(callNum)
print(bibID)
print(hldgID)
writer.writerow({"search string":searchString,"callNum":callNum,"bib id":bibID,"holdings id":hldgID})
else:
numOfResponses=str(jsonResponse["total"])
writer.writerow({"search string":searchString,"callNum":"total record response "+numOfResponses,"bib id":"","holdings id":""})
</pre>
==Dictionary of relator terms==
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
relatorDictionary={
"abridger": "relators:abr",
"actor": "relators:act",
"adapter": "relators:adp",
"addressee": "relators:rcp",
"analyst": "relators:anl",
"animator": "relators:anm",
"annotator": "relators:ann",
"appellant": "relators:apl",
"appellee": "relators:ape",
"applicant": "relators:app",
"architect": "relators:arc",
"arranger": "relators:arr",
"art copyist": "relators:acp",
"art director": "relators:adi",
"artist": "relators:art",
"artistic director": "relators:ard",
"assignee": "relators:asg",
"associated name": "relators:asn",
"attributed name": "relators:att",
"auctioneer": "relators:auc",
"author": "relators:aut",
"author in quotations or text abstracts": "relators:aqt",
"author of afterword, colophon, etc.": "relators:aft",
"author of dialog": "relators:aud",
"author of introduction, etc.": "relators:aui",
"autographer": "relators:ato",
"bibliographic antecedent": "relators:ant",
"binder": "relators:bnd",
"binding designer": "relators:bdd",
"blurb writer": "relators:blw",
"book designer": "relators:bkd",
"book producer": "relators:bkp",
"bookjacket designer": "relators:bjd",
"bookplate designer": "relators:bpd",
"bookseller": "relators:bsl",
"braille embosser": "relators:brl",
"broadcaster": "relators:brd",
"calligrapher": "relators:cll",
"cartographer": "relators:ctg",
"caster": "relators:cas",
"censor": "relators:cns",
"choreographer": "relators:chr",
"collaborator": "relators:clb",
"cinematographer": "relators:cng",
"client": "relators:cli",
"collection registrar": "relators:cor",
"collector": "relators:col",
"collotyper": "relators:clt",
"colorist": "relators:clr",
"commentator": "relators:cmm",
"commentator for written text": "relators:cwt",
"compiler": "relators:com",
"complainant": "relators:cpl",
"complainant-appellant": "relators:cpt",
"complainant-appellee": "relators:cpe",
"composer": "relators:cmp",
"compositor": "relators:cmt",
"conceptor": "relators:ccp",
"conductor": "relators:cnd",
"conservator": "relators:con",
"consultant": "relators:csl",
"consultant to a project": "relators:csp",
"contestant": "relators:cos",
"contestant-appellant": "relators:cot",
"contestant-appellee": "relators:coe",
"contestee": "relators:cts",
"contestee-appellant": "relators:ctt",
"contestee-appellee": "relators:cte",
"contractor": "relators:ctr",
"contributor": "relators:ctb",
"copyright claimant": "relators:cpc",
"copyright holder": "relators:cph",
"corrector": "relators:crr",
"correspondent": "relators:crp",
"costume designer": "relators:cst",
"court governed": "relators:cou",
"court reporter": "relators:crt",
"cover designer": "relators:cov",
"creator": "relators:cre",
"curator": "relators:cur",
"dancer": "relators:dnc",
"data contributor": "relators:dtc",
"data manager": "relators:dtm",
"dedicatee": "relators:dte",
"dedicator": "relators:dto",
"defendant": "relators:dfd",
"defendant-appellant": "relators:dft",
"defendant-appellee": "relators:dfe",
"degree granting institution": "relators:dgg",
"degree supervisor": "relators:dgs",
"delineator": "relators:dln",
"depicted": "relators:dpc",
"depositor": "relators:dpt",
"designer": "relators:dsr",
"director": "relators:drt",
"dissertant": "relators:dis",
"distribution place": "relators:dbp",
"distributor": "relators:dst",
"donor": "relators:dnr",
"draftsman": "relators:drm",
"dubious author": "relators:dub",
"editor": "relators:edt",
"editor of compilation": "relators:edc",
"editor of moving image work": "relators:edm",
"electrician": "relators:elg",
"electrotyper": "relators:elt",
"enacting jurisdiction": "relators:enj",
"engineer": "relators:eng",
"engraver": "relators:egr",
"etcher": "relators:etr",
"event place": "relators:evp",
"expert": "relators:exp",
"facsimilist": "relators:fac",
"field director": "relators:fld",
"film director": "relators:fmd",
"film distributor": "relators:fds",
"film editor": "relators:flm",
"film producer": "relators:fmp",
"filmmaker": "relators:fmk",
"first party": "relators:fpy",
"forger": "relators:frg",
"former owner": "relators:fmo",
"funder": "relators:fnd",
"geographic information specialist": "relators:gis",
"graphic technician": "relators:grt",
"honoree": "relators:hnr",
"honouree": "relators:hnr",
"host": "relators:hst",
"host institution": "relators:his",
"illuminator": "relators:ilu",
"illustrator": "relators:ill",
"inscriber": "relators:ins",
"instrumentalist": "relators:itr",
"interviewee": "relators:ive",
"interviewer": "relators:ivr",
"inventor": "relators:inv",
"issuing body": "relators:isb",
"judge": "relators:jud",
"jurisdiction governed": "relators:jug",
"laboratory": "relators:lbr",
"laboratory director": "relators:ldr",
"landscape architect": "relators:lsa",
"lead": "relators:led",
"lender": "relators:len",
"libelant": "relators:lil",
"libelant-appellant": "relators:lit",
"libelant-appellee": "relators:lie",
"libelee": "relators:lel",
"libelee-appellant": "relators:let",
"libelee-appellee": "relators:lee",
"librettist": "relators:lbt",
"licensee": "relators:lse",
"licensor": "relators:lso",
"lighting designer": "relators:lgd",
"lithographer": "relators:ltg",
"lyricist": "relators:lyr",
"manufacture place": "relators:mfp",
"manufacturer": "relators:mfr",
"marbler": "relators:mrb",
"markup editor": "relators:mrk",
"medium": "relators:med",
"metadata contact": "relators:mdc",
"metal-engraver": "relators:mte",
"minute taker": "relators:mtk",
"moderator": "relators:mod",
"monitor": "relators:mon",
"music copyist": "relators:mcp",
"musical director": "relators:msd",
"musician": "relators:mus",
"narrator": "relators:nrt",
"onscreen presenter": "relators:osp",
"opponent": "relators:opn",
"organizer": "relators:orm",
"originator": "relators:org",
"other": "relators:oth",
"owner": "relators:own",
"panelist": "relators:pan",
"papermaker": "relators:ppm",
"patent applicant": "relators:pta",
"patent holder": "relators:pth",
"patron": "relators:pat",
"performer": "relators:prf",
"permitting agency": "relators:pma",
"photographer": "relators:pht",
"plaintiff": "relators:ptf",
"plaintiff-appellant": "relators:ptt",
"plaintiff-appellee": "relators:pte",
"platemaker": "relators:plt",
"praeses": "relators:pra",
"presenter": "relators:pre",
"previous owner": "relators:fmo",
"printer": "relators:prt",
"printer of plates": "relators:pop",
"printmaker": "relators:prm",
"process contact": "relators:prc",
"producer": "relators:pro",
"production company": "relators:prn",
"production designer": "relators:prs",
"production manager": "relators:pmn",
"production personnel": "relators:prd",
"production place": "relators:prp",
"programmer": "relators:prg",
"project director": "relators:pdr",
"proofreader": "relators:pfr",
"provider": "relators:prv",
"publication place": "relators:pup",
"publisher": "relators:pbl",
"publishing director": "relators:pbd",
"puppeteer": "relators:ppt",
"radio director": "relators:rdd",
"radio producer": "relators:rpc",
"recording engineer": "relators:rce",
"recordist": "relators:rcd",
"redaktor": "relators:red",
"renderer": "relators:ren",
"reporter": "relators:rpt",
"repository": "relators:rps",
"research team head": "relators:rth",
"research team member": "relators:rtm",
"researcher": "relators:res",
"respondent": "relators:rsp",
"respondent-appellant": "relators:rst",
"respondent-appellee": "relators:rse",
"responsible party": "relators:rpy",
"restager": "relators:rsg",
"restorationist": "relators:rsr",
"reviewer": "relators:rev",
"rubricator": "relators:rbr",
"scenarist": "relators:sce",
"scientific advisor": "relators:sad",
"screenwriter": "relators:aus",
"scribe": "relators:scr",
"sculptor": "relators:scl",
"second party": "relators:spy",
"secretary": "relators:sec",
"seller": "relators:sll",
"set designer": "relators:std",
"setting": "relators:stg",
"signer": "relators:sgn",
"singer": "relators:sng",
"sound designer": "relators:sds",
"speaker": "relators:spk",
"sponsor": "relators:spn",
"sponsoring body": "relators:spn",
"stage director": "relators:sgd",
"stage manager": "relators:stm",
"standards body": "relators:stn",
"stereotyper": "relators:str",
"storyteller": "relators:stl",
"supporting host": "relators:sht",
"surveyor": "relators:srv",
"teacher": "relators:tch",
"technical director": "relators:tcd",
"television director": "relators:tld",
"television producer": "relators:tlp",
"thesis advisor": "relators:ths",
"transcriber": "relators:trc",
"translator": "relators:trl",
"type designer": "relators:tyd",
"typographer": "relators:tyg",
"university place": "relators:uvp",
"videographer": "relators:vdg",
"vocalist": "relators:voc",
"voice actor": "relators:vac",
"witness": "relators:wit",
"wood engraver": "relators:wde",
"woodcutter": "relators:wdc",
"writer of accompanying material": "relators:wam",
"writer of added commentary": "relators:wac",
"writer of added lyrics": "relators:wal",
"writer of added text": "relators:wat",
"writer of introduction": "relators:win",
"writer of preface": "relators:wpr",
"writer of supplementary textual content": "relators:wst",
}
</pre>
==List of Shakespeare quarto call numbers==
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
ShxQuartos=[
"STC 22275",
"STC 22276",
"STC 22276a",
"STC 22277",
"STC 22278",
"STC 22279",
"STC 22279a",
"STC 22280",
"STC 22281",
"STC 22282",
"STC 22283",
"STC 22284",
"STC 22285",
"STC 22286",
"STC 22287",
"STC 22288",
"STC 22288a",
"STC 22289",
"STC 22290",
"STC 22291",
"STC 22292",
"STC 22293",
"STC 22294",
"STC 22295",
"STC 22296",
"STC 22297",
"STC 22298",
"STC 22299",
"STC 22300",
"STC 22301",
"STC 22302",
"STC 22303",
"STC 22304",
"STC 22305",
"STC 22306",
"STC 22307",
"STC 22308",
"STC 22309",
"STC 22310",
"STC 22311",
"STC 22312",
"STC 22313",
"STC 22314",
"STC 22315",
"STC 22316",
"STC 22317",
"STC 22318",
"STC 22319",
"STC 22320",
"STC 22321",
"STC 22322",
"STC 22323",
"STC 22324",
"STC 22325",
"STC 22325a",
"STC 22326",
"STC 22327",
"STC 22328",
"STC 22329",
"STC 22330",
"STC 22331",
"STC 22332",
"STC 22334",
"STC 22335",
"STC 22336",
"STC 26101",
"STC 22337",
"STC 22338",
"STC 22339",
"STC 26099",
"STC 26100",
"STC 21006",
"STC 21006a",
"STC 11075"
]
</pre>
==Sample dictionary of holdings-bib ID pairs==
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
holdingsToBibDictionary={
"158300": "164478",
"230236":"128729"
}
</pre>
==Script to generate Islandora records from finding aid xml==
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
from lxml import etree
from collections import OrderedDict
import codecs
import copy
import io
import json
import re
import sys
import csv
csvF=open("islandoraRecord.csv","w",newline='')
fieldnames=["title","id","parent_id","field_resource_type","field_model","field_member_of","field_weight","field_identifier","field_linked_agent","field_creator","field_edtf_date","field_place_published","field_extent","field_rights","field_subject","field_note","field_classification","field_page_opening","field_contents","field_catalog_link","field_finding_aid_link","field_created_published","field_genre","field_iconclass_headings","field_bindings_features","field_bindings_terms","field_transcription","field_digital_image_type","field_microfilm_call_number","field_microfilm_reduction_ratio","field_microfilm_length","field_credit","field_sponsored_by","field_bib_id","field_holdings_id","field_display_hints","file","url_alias"]
writer=csv.DictWriter(csvF,fieldnames=fieldnames)
writer.writeheader()
filename="findingAid"
tree = etree.parse(filename+'.xml')
for elem in tree.getiterator():
    if not (
        isinstance(elem, etree._Comment)
        or isinstance(elem, etree._ProcessingInstruction)
    ):
        elem.tag = etree.QName(elem).localname
etree.cleanup_namespaces(tree)
   
nodeList = tree.xpath('//c[@level="item"]')
for node in nodeList:
    callNumber = ""
    accessionNumber = ""
    displayTitle = ""
    titleCreator = ""
    titleAgents = []
    titleLocationCreated = ""
    titleLocationReceived = ""
    locationCreated = {}
    agentCreator = ""
    agentRecipient = ""
    displayDate = ""
    scopecontent = ""
    bioghist = ""
    physfacet = ""
    oddp = ""
    notes = ""
    #date
    dateSearch = node.xpath('did/unitdate')
    for date in dateSearch:
        displayDate = date.text
    #identifier
    identifierSearch = node.xpath('did/unitid')
    for identifier in identifierSearch:
        callNumber = identifier.text
        print(callNumber)
    #title
    titleSearch = node.xpath('did/unittitle')
    for title in titleSearch:
        displayTitle += "".join(title.itertext())
    #notes
    abstractSearch = node.xpath('scopecontent/p')
    for abstract in abstractSearch:
        scopecontent += " ".join(abstract.itertext())
        scopecontent = scopecontent.replace("\n"," ")
    #notes
    noteSearch = node.xpath('bioghist/p')
    for note in noteSearch:
        bioghist += "".join(note.itertext())
        bioghist = bioghist.replace("\n"," ")
    generalNoteSearch = node.xpath('did/physdesc/physfacet')
    for generalNote in generalNoteSearch:
        physfacet += "".join(generalNote.itertext())
    oddNoteSearch = node.xpath('odd/p')
    for oddNote in oddNoteSearch:
        oddp += "".join(oddNote.itertext())
        oddp = oddp.replace(" \n"," ")
    notes='{0} {1} {2} {3}'.format(scopecontent,bioghist,physfacet,oddp)
    notes.replace("  "," ")
    writer.writerow({"title":displayTitle,"id":"","parent_id":"","field_resource_type":"","field_model":"","field_member_of":"","field_weight":"","field_identifier":"","field_linked_agent":"","field_creator":"","field_edtf_date":"","field_place_published":"","field_extent":"","field_rights":"","field_subject":"","field_note":notes,"field_classification":callNumber,"field_page_opening":"","field_contents":"","field_catalog_link":"","field_finding_aid_link":"","field_created_published":displayDate,"field_genre":"","field_iconclass_headings":"","field_bindings_features":"","field_bindings_terms":"","field_transcription":"","field_digital_image_type":"","field_microfilm_call_number":"","field_microfilm_reduction_ratio":"","field_microfilm_length":"","field_credit":"","field_sponsored_by":"","field_bib_id":"","field_holdings_id":"","field_display_hints":"","file":"","url_alias":""})
</pre>
=Adding images to S3=
=Adding images to S3=
=Importing records to Islandora=
=Importing records to Islandora=
=Adding links to the catalog=
==Export Islandora record metadata==
Following this guide: https://mjordan.github.io/islandora_workbench_docs/generating_csv_files/#using-a-drupal-view-to-identify-content-to-export-as-csv
Open Workbench in an FTP client (like WinSCP). If not already there, add "get_data_from_view.yml" to the Workbench folder (/mnt/ingest/islandora_workbench). It should read as follows, with the username and password needing to belong to an account with admin privileges:
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see yml">
task: get_data_from_view
host: "https://digitalcollections.folger.edu"
view_path: '/content_links'
username: userNameGoesHere
password: userPasswordGoesHere
export_csv_file_path: /mnt/ingest/content_links.csv
</pre>
Run a check, and then run the whole process in a screen session. This will take some time. It may be faster to limit the view by date, but that's not set up and may or may not be possible/helpful.
When complete, the csv will be saved as "content_links.csv" in the ingest folder (or wherever you instruct the yml file to save it). Add the date to the end of the filename in this format: "_yyyymmdd", and transfer to your local Islandora folder.
==Creating a CSV of link text and record IDs==
Open the newest content_links csv as well as the second-newest content links csv in LibreOffice Calc or Excel. Look at the latest node ID in the second newest spreadsheet--this is the most recent Islandora record that already is linked from Tind. Remove all lines from that item up in the newest CSV, leaving the headings. This leaves only the items in Islandora that have not yet been linked from Tind.
Resizing all columns and freezing the first row (the headers) will make the spreadsheet more manageable. Delete all columns except for:
*node_id
*field_resource_type
*field_model
*field_member_of
*field_identifier
*field_holdings_id
*field_finding_aid_link
*field_digital_image_type
*field_classification
*field_catalog_link
*field_bib_id
Save. This will be your second-newest content_links csv the next time you run this export, and is an important record. Copy everything to a new working spreadsheet, and close out the csv-of-record.
Create a new column with heading '''856 $u'''. In the second row, paste in the formula <code>="https://digitalcollections.folger.edu/bib"&K2&"-"&F2</code> K should be the column with bib IDs and F with holdings IDs; adjust formula if necessary. Drag down for all rows.
Look at the member_of column.
: If it contains the id "97", this is a bindings record. (This is unlikely, as all bindings records have already been ingested and linked, and we are not adding new material to the collection.) Add "bindings_" to the URL, like <code>="https://digitalcollections.folger.edu/bindings_bib"&K2&"-"&F2</code>
: If it contains the id "101", this is a microfilm record. Add "mf_" to the URL, like <code>="https://digitalcollections.folger.edu/mf_bib"&K2&"-"&F2</code>
Check the identifier column for rootfiles. This indicates that the record for the item only has one available image. Alternately, check the model column for id "[look this up]", which is the model type image.
: This URL should be based on the rootfile rather than the bib and holdings ids. Change the formula to <code>="https://digitalcollections.folger.edu/img"&E2</code>, with E being the column for identifier, and 2 being the row of the record. Adjust the formula if necessary.
: The only exception to this rule is bindings records with only one available image. (This is unlikely, as all bindings records have already been ingested and linked, and we are not adding new material to the collection.) Bindings images don't have rootfiles, so we use the default node ID URL. The formula would be <code>="https://digitalcollections.folger.edu/node/"&A2</code>, with A being the column for node id and 2 being the row of the record. Adjust the formula if necessary.
: Items without bib and holdings IDs are not in the catalog, so we cannot add links to them from Tind. If the item is in a finding aid, construct the URL using the node id. The formula would be <code>="https://digitalcollections.folger.edu/node/"&A2</code>, with A being the column for node id and 2 being the row of the record. Adjust the formula if necessary. Do not include this row in the Tind CSV, since there's no catalog record to add this link to.
Create a new column with heading '''856 $z'''. In the second row, paste the formula <code>="Digital image(s) of Folger Shakespeare Library "&I2</code>, with I being the column for classification. Adjust formula if necessary. Drag down for all rows. For any microfilm links, change the formula to <code>Microfilm image(s) of Folger Shakespeare Library "&I2</code>, with I being the column for classification and 2 being the row of the record; adjust formula if necessary.
Open a fresh spreadsheet in Excel--this cannot be in LibreOffice. Copy-paste in the bib and holdings ID columns, followed by the 856 $u and 856 $z columns (using special paste-values). Sort by bib ID.
Do a visual scan for items with duplicate holdings records. Highlight them (changing the box or font color to make them easier to find). These are links to collection-level records; the URLs are correct, but the $z is item-level, and the duplicates need to be removed.
: Remove duplicates by hand, or using Excel's de-dupe tool: Highlight the holdings ID column, and select "Remove duplicates". When prompted, expand the selection and click "Remove duplicates...", then uncheck all columns except for holdings ID and select OK.
: To adjust the link text, append the bib ID to the URL <code>https://catalog.folger.edu/record/</code>, follow that link to the catalog record, and copy-paste in the call number range to $z (over the item-level call number) for remaining highlighted cells.
Note: check for any catalog records that already have links. Generally, this will be because an item that only had a small number of images has now been fully digitized, or an item that only had reference photos now has high-resolution images. Some of these links may be fine as-is, and should be removed from the csv. Others may be moving from an image link to an item link (if there was previously only one image available); these should be left in the csv, but the old link should be removed. Going forward, it may be possible to check for 856s using the record API while adding the links, and removing/replacing links as needed. For now, this needs to be done by hand.
Remove the headings column. The spreadsheet should contain no formulas, and the headers should read, in order, <code>bib id,856 $u,856 $z</code>. Save as a catalogLinks.csv in your Python folder.
Run the following script to add all links from this CSV. Best practice is to run this after work hours. Cataloging staff must be informed that this process is running so that they aren't trying to edit records at the same time.
Note: It may be possible to not include the subfield z text in the csv, and instead to pull in the call number via the record API as the links are being added. (The holdings ID would need to be included in the csv so that the correct call number is identified.) This may simplify the process to set up the links, but would complicate the process to add them. It has not yet been set up, and at this point may not be worth it.
==Script to add links to the catalog using a CSV of link text and record IDs==
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
import requests
import csv
headers = {'Authorization': "Token APIKeyGoesHere",'Content-Type': "application/xml"}
params = {"callback_email": "email@goeshere.com","mode": "append"}
with open('catalogLinks.csv') as links_file:
links_reader = csv.DictReader(links_file) 
for row in links_reader:
bib=row["bib id"]
subU=row["856 $u"]
subZ=row["856 $z"]
URL="https://catalog.folger.edu/api/v1/record/"
payload = r"""<record><controlfield tag="001">{0}</controlfield><datafield tag="856" ind1="4" ind2="1">
<subfield code="u">{1}</subfield>
<subfield code="z">{2}</subfield>
</datafield></record>""".format(bib,subU,subZ)
response = requests.request("POST", URL, data=payload, headers=headers, params=params)
</pre>
==Sample CSV file with link text and record IDs==
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">
bib id,856 $u,856 $z
255835,https://digitalcollections.folger.edu/img35779,Digital image(s) of Folger Shakespeare Library ART Box B924 no.2
255836,https://digitalcollections.folger.edu/img35817,Digital image(s) of Folger Shakespeare Library ART Box C875.6 no.1
255837,https://digitalcollections.folger.edu/img35770,Digital image(s) of Folger Shakespeare Library ART Box B919 no.17
</pre>

Latest revision as of 13:22, 9 April 2025

This page is under construction

Generating records

  • Use bib hldgs pairs to generate records. Use script to generate bib hldgs pairs from call numbers if needed.
  • Extend the records to have the correct number of child records for each parent.
  • If imaging has generated rootfiles, add them to the child records.
    • Otherwise, send the records to imaging for rootfiling
    • Rename image files with rootfile names in IrfanView thumbnails

Importing records

  • Upload images to S3
  • Add S3 links to records
  • Upload spreadsheet to Islandora
    • After upload has processed, generate thumbnail for parent record

Useful scripts

Script to generate Islandora records from given holdings-bib pairs

Script to generate bib-holdings pairs from a list of call numbers

Dictionary of relator terms

List of Shakespeare quarto call numbers

Sample dictionary of holdings-bib ID pairs

Script to generate Islandora records from finding aid xml

Adding images to S3

Importing records to Islandora

Adding links to the catalog

Export Islandora record metadata

Following this guide: https://mjordan.github.io/islandora_workbench_docs/generating_csv_files/#using-a-drupal-view-to-identify-content-to-export-as-csv

Open Workbench in an FTP client (like WinSCP). If not already there, add "get_data_from_view.yml" to the Workbench folder (/mnt/ingest/islandora_workbench). It should read as follows, with the username and password needing to belong to an account with admin privileges:

Run a check, and then run the whole process in a screen session. This will take some time. It may be faster to limit the view by date, but that's not set up and may or may not be possible/helpful.

When complete, the csv will be saved as "content_links.csv" in the ingest folder (or wherever you instruct the yml file to save it). Add the date to the end of the filename in this format: "_yyyymmdd", and transfer to your local Islandora folder.

Creating a CSV of link text and record IDs

Open the newest content_links csv as well as the second-newest content links csv in LibreOffice Calc or Excel. Look at the latest node ID in the second newest spreadsheet--this is the most recent Islandora record that already is linked from Tind. Remove all lines from that item up in the newest CSV, leaving the headings. This leaves only the items in Islandora that have not yet been linked from Tind.

Resizing all columns and freezing the first row (the headers) will make the spreadsheet more manageable. Delete all columns except for:

  • node_id
  • field_resource_type
  • field_model
  • field_member_of
  • field_identifier
  • field_holdings_id
  • field_finding_aid_link
  • field_digital_image_type
  • field_classification
  • field_catalog_link
  • field_bib_id

Save. This will be your second-newest content_links csv the next time you run this export, and is an important record. Copy everything to a new working spreadsheet, and close out the csv-of-record.

Create a new column with heading 856 $u. In the second row, paste in the formula ="https://digitalcollections.folger.edu/bib"&K2&"-"&F2 K should be the column with bib IDs and F with holdings IDs; adjust formula if necessary. Drag down for all rows.

Look at the member_of column.

If it contains the id "97", this is a bindings record. (This is unlikely, as all bindings records have already been ingested and linked, and we are not adding new material to the collection.) Add "bindings_" to the URL, like ="https://digitalcollections.folger.edu/bindings_bib"&K2&"-"&F2
If it contains the id "101", this is a microfilm record. Add "mf_" to the URL, like ="https://digitalcollections.folger.edu/mf_bib"&K2&"-"&F2

Check the identifier column for rootfiles. This indicates that the record for the item only has one available image. Alternately, check the model column for id "[look this up]", which is the model type image.

This URL should be based on the rootfile rather than the bib and holdings ids. Change the formula to ="https://digitalcollections.folger.edu/img"&E2, with E being the column for identifier, and 2 being the row of the record. Adjust the formula if necessary.
The only exception to this rule is bindings records with only one available image. (This is unlikely, as all bindings records have already been ingested and linked, and we are not adding new material to the collection.) Bindings images don't have rootfiles, so we use the default node ID URL. The formula would be ="https://digitalcollections.folger.edu/node/"&A2, with A being the column for node id and 2 being the row of the record. Adjust the formula if necessary.
Items without bib and holdings IDs are not in the catalog, so we cannot add links to them from Tind. If the item is in a finding aid, construct the URL using the node id. The formula would be ="https://digitalcollections.folger.edu/node/"&A2, with A being the column for node id and 2 being the row of the record. Adjust the formula if necessary. Do not include this row in the Tind CSV, since there's no catalog record to add this link to.

Create a new column with heading 856 $z. In the second row, paste the formula ="Digital image(s) of Folger Shakespeare Library "&I2, with I being the column for classification. Adjust formula if necessary. Drag down for all rows. For any microfilm links, change the formula to Microfilm image(s) of Folger Shakespeare Library "&I2, with I being the column for classification and 2 being the row of the record; adjust formula if necessary.

Open a fresh spreadsheet in Excel--this cannot be in LibreOffice. Copy-paste in the bib and holdings ID columns, followed by the 856 $u and 856 $z columns (using special paste-values). Sort by bib ID.

Do a visual scan for items with duplicate holdings records. Highlight them (changing the box or font color to make them easier to find). These are links to collection-level records; the URLs are correct, but the $z is item-level, and the duplicates need to be removed.

Remove duplicates by hand, or using Excel's de-dupe tool: Highlight the holdings ID column, and select "Remove duplicates". When prompted, expand the selection and click "Remove duplicates...", then uncheck all columns except for holdings ID and select OK.
To adjust the link text, append the bib ID to the URL https://catalog.folger.edu/record/, follow that link to the catalog record, and copy-paste in the call number range to $z (over the item-level call number) for remaining highlighted cells.

Note: check for any catalog records that already have links. Generally, this will be because an item that only had a small number of images has now been fully digitized, or an item that only had reference photos now has high-resolution images. Some of these links may be fine as-is, and should be removed from the csv. Others may be moving from an image link to an item link (if there was previously only one image available); these should be left in the csv, but the old link should be removed. Going forward, it may be possible to check for 856s using the record API while adding the links, and removing/replacing links as needed. For now, this needs to be done by hand.

Remove the headings column. The spreadsheet should contain no formulas, and the headers should read, in order, bib id,856 $u,856 $z. Save as a catalogLinks.csv in your Python folder.

Run the following script to add all links from this CSV. Best practice is to run this after work hours. Cataloging staff must be informed that this process is running so that they aren't trying to edit records at the same time.

Note: It may be possible to not include the subfield z text in the csv, and instead to pull in the call number via the record API as the links are being added. (The holdings ID would need to be included in the csv so that the correct call number is identified.) This may simplify the process to set up the links, but would complicate the process to add them. It has not yet been set up, and at this point may not be worth it.

Script to add links to the catalog using a CSV of link text and record IDs

Sample CSV file with link text and record IDs