Adding records to Islandora: Difference between revisions

(4 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==
==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">
Line 826: Line 839:
writer.writerow({"title":title,"id":i,"parent_id":"","field_resource_type":"collection","field_model":"paged content","field_member_of":fullCollections,"field_weight":"","field_identifier":"","field_linked_agent":fullAssociatedNames,"field_creator":creator,"field_edtf_date":edtfDate,"field_place_published":hierarchicalPlaceName,"field_extent":extent,"field_rights":rights,"field_subject":fullSubjects,"field_note":fullNotes,"field_classification":callNums[holdingsID],"field_page_opening":"","field_contents":"","field_catalog_link":catalogLink,"field_finding_aid_link":"","field_created_published":createdPublished,"field_genre":fullGenresForms,"field_iconclass_headings":"","field_bindings_features":"","field_bindings_terms":"","field_digital_image_type":"","field_microfilm_call_number":"","field_microfilm_reduction_ratio":"","field_microfilm_length":"","field_credit":"","field_sponsored_by":"","field_bib_id":bibID,"field_holdings_id":holdingsID,"field_display_hints":"Mirador","file":"","url_alias":"/bib"+bibID+"-"+holdingsID})
writer.writerow({"title":title,"id":i,"parent_id":"","field_resource_type":"collection","field_model":"paged content","field_member_of":fullCollections,"field_weight":"","field_identifier":"","field_linked_agent":fullAssociatedNames,"field_creator":creator,"field_edtf_date":edtfDate,"field_place_published":hierarchicalPlaceName,"field_extent":extent,"field_rights":rights,"field_subject":fullSubjects,"field_note":fullNotes,"field_classification":callNums[holdingsID],"field_page_opening":"","field_contents":"","field_catalog_link":catalogLink,"field_finding_aid_link":"","field_created_published":createdPublished,"field_genre":fullGenresForms,"field_iconclass_headings":"","field_bindings_features":"","field_bindings_terms":"","field_digital_image_type":"","field_microfilm_call_number":"","field_microfilm_reduction_ratio":"","field_microfilm_length":"","field_credit":"","field_sponsored_by":"","field_bib_id":bibID,"field_holdings_id":holdingsID,"field_display_hints":"Mirador","file":"","url_alias":"/bib"+bibID+"-"+holdingsID})
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>
==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>
</pre>


Line 1,290: Line 1,376:
=Importing records to Islandora=
=Importing records to Islandora=
=Adding links to the catalog=
=Adding links to the catalog=
https://mjordan.github.io/islandora_workbench_docs/generating_csv_files/#using-a-drupal-view-to-identify-content-to-export-as-csv
==Script to add links to the catalog using a CSV of link text and record IDs==
==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">
<pre style="min-height:38px; margin-left:2em" class="mw-collapsible mw-collapsed" data-expandtext="Expand to see script">

Revision as of 12:39, 26 March 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

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

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