Class: DS::Manifest::Entry

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/ds/manifest/entry.rb

Overview

The manifest Entry provides information to validate delivered data and to drive the data extraction process. Specifically, each line of the manifest:

  1. Provides information often not present in standard a location in the source record, like shelfmark, source type (MARC XML, TEI XML, etc.), link to a IIIF manifest, and link to the institution's record in an OPAC or on the institution's website

  2. Gives the file name for the record present in the delivered set of records

  3. Provides information needed to validate the source record: its presence in the delivered data, correspondence of the source file(s) to identifying information, etc.)

Constant Summary

Constants included from Constants

Constants::CALL_NUMBER, Constants::DATED, Constants::DATE_TIME_COLUMNS, Constants::DS_ID, Constants::FILENAME, Constants::IIIF_MANIFEST_URL, Constants::INSTITUTIONAL_ID, Constants::INSTITUTIONAL_ID_LOCATION_IN_SOURCE, Constants::INSTITUTION_DS_QID, Constants::INSTITUTION_WIKIDATA_LABEL, Constants::LINK_TO_INSTITUTIONAL_RECORD, Constants::MANIFEST_COLUMNS, Constants::MANIFEST_GENERATED_AT, Constants::QID_COLUMNS, Constants::RECORD_LAST_UPDATED, Constants::REQUIRED_VALUES, Constants::SOURCE_TYPE, Constants::TITLE, Constants::URI_COLUMNS

Constants included from DS

VERSION

Constants included from Constants

Constants::DS_CSV, Constants::DS_METS, Constants::HEADINGS, Constants::INSTITUTIONS, Constants::INSTITUTION_DS_IDS, Constants::MARC_XML, Constants::MAX_WIKIBASE_FIELD_LENGTH, Constants::NESTED_COLUMNS, Constants::TEI_XML, Constants::TRAILING_PUNCTUATION_RE, Constants::VALID_SOURCE_TYPES, Constants::XML_NAMESPACES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DS

configure!, data_dir, env, env=, normalize_key, root

Methods included from ClassMethods

#adjust_for_century, #calculate_century, #configure_logger_for, #logger, #logger_for, #lookup_century, #mark_long, #timestamp, #transform_centuries_to_aat, #transform_dates_to_centuries

Constructor Details

#initialize(row, manifest) ⇒ Entry

Returns a new instance of Entry.

Parameters:



33
34
35
36
# File 'lib/ds/manifest/entry.rb', line 33

def initialize row, manifest
  @row = row
  @manifest = manifest
end

Instance Attribute Details

#manifest ⇒ Object (readonly)

Returns the value of attribute manifest.



29
30
31
# File 'lib/ds/manifest/entry.rb', line 29

def manifest
  @manifest
end

#row ⇒ Object (readonly)

Returns the value of attribute row.



28
29
30
# File 'lib/ds/manifest/entry.rb', line 28

def row
  @row
end

Instance Method Details

#[](key) ⇒ Object



38
39
40
# File 'lib/ds/manifest/entry.rb', line 38

def [] key
  row[key]
end

#call_number ⇒ Object

CALL_NUMBER = 'call_number'



82
83
84
# File 'lib/ds/manifest/entry.rb', line 82

def call_number
  row[CALL_NUMBER]
end

#dated ⇒ Object

DATED = 'dated'



64
65
66
# File 'lib/ds/manifest/entry.rb', line 64

def dated
  row[DATED]
end

#dated? ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/ds/manifest/entry.rb', line 109

def dated?
  dated.to_s.strip.downcase == 'true'
end

#ds_id ⇒ Object

DS_ID = 'ds_id'



59
60
61
# File 'lib/ds/manifest/entry.rb', line 59

def ds_id
  row[DS_ID]
end

#filename ⇒ Object

FILENAME = 'filename'



47
48
49
# File 'lib/ds/manifest/entry.rb', line 47

def filename
  row[FILENAME]
end

#iiif_manifest_url ⇒ Object

IIIF_MANIFEST_URL = 'iiif_manifest_url'



91
92
93
94
95
# File 'lib/ds/manifest/entry.rb', line 91

def iiif_manifest_url
  return '' unless row[IIIF_MANIFEST_URL]
  # there may be multiple manifests; split & join with pipes
  row[IIIF_MANIFEST_URL].split(/[ ;|]+/).join('|')
end

#institution_ds_qid ⇒ Object



42
43
44
# File 'lib/ds/manifest/entry.rb', line 42

def institution_ds_qid
  row[INSTITUTION_DS_QID]
end

#institution_wikidata_label ⇒ Object



51
52
53
# File 'lib/ds/manifest/entry.rb', line 51

def institution_wikidata_label
  row[INSTITUTION_WIKIDATA_LABEL]
end

#institutional_id ⇒ Object

INSTITUTIONAL_ID = 'holding_institution_institutional_id'



68
69
70
# File 'lib/ds/manifest/entry.rb', line 68

def institutional_id
  row[INSTITUTIONAL_ID]
end

#institutional_id_location_in_source ⇒ Object

INSTITUTIONAL_ID_LOCATION_IN_SOURCE = 'institutional_id_location_in_source'



73
74
75
# File 'lib/ds/manifest/entry.rb', line 73

def institutional_id_location_in_source
  row[INSTITUTIONAL_ID_LOCATION_IN_SOURCE]
end

LINK_TO_INSTITUTIONAL_RECORD = 'link_to_institutional_record'



97
98
99
# File 'lib/ds/manifest/entry.rb', line 97

def link_to_institutional_record
  row[LINK_TO_INSTITUTIONAL_RECORD]
end

#manifest_generated_at ⇒ Object

MANIFEST_GENERATED_AT = 'manifest_generated_at'



101
102
103
# File 'lib/ds/manifest/entry.rb', line 101

def manifest_generated_at
  row[MANIFEST_GENERATED_AT]
end

#manifest_path ⇒ Object



105
106
107
# File 'lib/ds/manifest/entry.rb', line 105

def manifest_path
  manifest.present? && manifest.path
end

#record_last_updated ⇒ Object

RECORD_LAST_UPDATED = 'record_last_updated'



77
78
79
# File 'lib/ds/manifest/entry.rb', line 77

def record_last_updated
  row[RECORD_LAST_UPDATED]
end

#source_type ⇒ Object



55
56
57
# File 'lib/ds/manifest/entry.rb', line 55

def source_type
  row[SOURCE_TYPE]
end

#title ⇒ Object

TITLE = 'title'



86
87
88
# File 'lib/ds/manifest/entry.rb', line 86

def title
  row[TITLE]
end

#to_h ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/ds/manifest/entry.rb', line 113

def to_h
  {
    institution_ds_qid:           institution_ds_qid,
    institution_wikidata_label:   institution_wikidata_label,
    ds_id:                        ds_id,
    call_number:                  call_number,
    institutional_id:             institutional_id,
    title:                        title,
    link_to_institutional_record: link_to_institutional_record,
    iiif_manifest_url:            iiif_manifest_url,
    record_last_updated:          record_last_updated,
    source_type:                  source_type,
    filename:                     filename,
    dated:                        dated?,
    manifest_generated_at:        manifest_generated_at,
  }
end