Auto Docs¶
the constants used in looking up fields for marc field extraction to proper IIIF fields
DESCRIPTION_LOOKUPS is a list MARC fields that could be classified as description fields
TITLE_LOOKUPS is a list of MARC fields that could be classified as giving title information
LABEL_LOOKUPS is a a dictionary where the key is the MARC field and the value is the human interpretable string explaining what that field is
utility functions for marc2iiif library
-
marc2iiif.utils.
combine_subfields_into_one_value
(list_of_dicts)¶ a function to merge a list of dicts into a single string
:rtype str :returns the complete value to be printed in the metadata field
-
marc2iiif.utils.
default_identifier_extraction
(value)¶ a function to take a pi.lib URL and return the unique identifier
It splits the URL from the scheme and host name. WARNING: assumes that the scheme is https which is hard-coded into the string
Parameters: value (str) – a pi.lib.uchicago.edu URL string :rtype str :returns the actual url without domain implementation details
-
marc2iiif.utils.
match_single_file
(src, pot_match=None)¶ a function to determine if a file matches with another file
:rtype Boolean :returns whether the file is a match or not
-
marc2iiif.utils.
search_for_marc_file
(src, pot_match=None)¶ a function to determine if a file in a directory tree is a MARC record
Parameters: src (str) – an absolute filepath to a file that may be a MARC record :rtype Boolean :returns whether or not the file is a MARC record
-
class
marc2iiif.classes.
IIIFDataExtractionFromMarc
(metadata)¶ a class to be used for retrieving and packaging metadata from MARC records for conversion to IIIF
-
add_metadata
(a_dict)¶ a method to add a new metadata field to a particular instance
Parameters: a_dict (dict) – a dictionary with the key as the field value found in constants.LABEL_LOOOKUPS and value as the particular value that needs to be added
-
change_description
(value)¶ a method to modify the description of the particular IIIF record instance
Parameters: value (str) – the new description to add to the IIIF record
-
change_title
(value)¶ a method to modify the label of the particular IIIF record instance
Parameters: value (str) – the new title to add to the IIIF record
-
del_metadata
()¶ deletes the metadata property from the instance
-
classmethod
from_dict
(dictified_marc_record)¶ a method to create an instance of IIIFDataExtractionFromMarc from a dictionary of a MARC record
Parameters: dictified_marc_record (dict) – a dictionary containing a complete MARC record
-
get_metadata
()¶ gets the value of the metadata property
-
metadata
¶ gets the value of the metadata property
-
modify_metadata
(field_to_change, new_value)¶ a method to change a particular metadata field
Parameters: - field_to_change (str) – the name of the field to change
- new_value (str) – the value to replace the current value of named field with
-
remove_metadata
(a_dict)¶ a method to remove a particular metadata field from the fields
Parameters: a_dict (dict) – a key:value pair where key=field name to delete, and value=the value of the named field to remove
-
set_metadata
(value)¶ sets the metadata property
:param :instance:`IIIFMetadataBoxFromMarc`: an instance of IIIFMetadataBoxMarc
-
show_description
()¶ a method to show the description of the IIIF record
:rtype str :returns the IIIF description for the instance’s Cultural Heritage Object
-
show_metadata
()¶ a method to show the metadata fields available for the particular instance
:rtype list :returns a list of strings with field name and field value in each string separated with a ‘:’ such that a single field looks like “field:value”
-
show_title
()¶ a method to show the title of the IIIF record
It retrieves the label from the metadata information that the instance delegates metadata collection to
:rtype str :returns the IIIF label for the instance’s Cultural Heritage Object
-
to_dict
()¶ a method to output the contents of the instance as a IIIF valid dictionary
:rtype dict :returns the data in the instance as a IIIF valid dict that can be exported to json
-
-
class
marc2iiif.classes.
IIIFMetadataBoxFromMarc
(label, description, identifier, fields)¶ a class to be used for extracting IIIF metadata from a Marc record
-
add_field
(a_field)¶ a method to add a new field instance to the fields list
:param :instance:`IIIFMetadataField`: a field to add to the list of fields
-
classmethod
from_dict
(a_dict)¶ a classmethod to create an instance of the class from a dictionary
Parameter must have a key ‘fields’ that has a value that is a list of dictionaries. Each of those dictionaries must have a key found in any of the LOOKUP lists and a value that is a list of dictionaries that contain a subfield key and a str value.
Parameters: a_dict (dict) – a dictionary containing a MARC record
-
-
class
marc2iiif.classes.
IIIFMetadataField
(name, value)¶ a class to be used for extracting IIIF metadata from a Marc record
-
del_label
()¶ deletes the label property
-
del_value
()¶ delete the value property
-
get_label
()¶ gets the value of the label property
-
get_value
()¶ gets teh value of the value property
-
label
¶ gets the value of the label property
-
set_label
(value)¶ sets the value of the label property
Parameters: value (str) – the value to set on the property
-
set_value
(value)¶ sets the value of the value property
Parameters: value (str) – the value of the value to set
-
value
¶ gets teh value of the value property
-