Module: Recon::Type::ReconType::ClassMethods
- Defined in:
- lib/ds/recon/type/recon_type.rb
Instance Method Summary collapse
-
#as_recorded_column ⇒ Symbol
Returns the column in the recon CSV that holds the as-recorded value; e.g., :author_as_recorded.
-
#balanced_columns ⇒ Array<Symbol>
Returns the balanced columns for the current object.
-
#delimiter_map ⇒ Hash<Symbol,String>
Returns the delimiter repalcement map: { ORIGINAL => REPLACEMENT}; e.g., { ‘|’ => ‘;’ }.
-
#get_key_values(row) ⇒ Array<String>
Return the values of the key columns in the given row.
-
#key_columns ⇒ Array<Symbol>
Returns the columns used to make the lookup key for the data dictionary; e.g., [:genre_as_recorded, :vocabulary].
-
#lookup_columns ⇒ Array<Symbol>
Returns lookups should pulls from the data dictionaries; e.g., [:authorized_label, :structured_value, :ds_qid].
- #lookup_values(row) ⇒ Object
-
#method_name ⇒ Array<Symbol>
Returns the name of the DS::Extractor methods; e.g., [:extract_places].
-
#recon_csv_headers ⇒ Array<Symbol>
Returns the recon CSV headers; e.g., [:place_as_recorded, :authorized_label, :structured_value, :ds_qid].
-
#set_name ⇒ Symbol
Returns the set name of the recon set; e.g., :places.
Instance Method Details
#as_recorded_column ⇒ Symbol
Returns the column in the recon CSV that holds the as-recorded value; e.g., :author_as_recorded
84 85 86 |
# File 'lib/ds/recon/type/recon_type.rb', line 84 def as_recorded_column self::AS_RECORDED_COLUMN end |
#balanced_columns ⇒ Array<Symbol>
Returns the balanced columns for the current object.
Balanced columns should have equal numbers of fields and subfields in each row; e.g., if fields are delimited by ‘|’ and subfields by ‘;’, then the following are balanced:
structured_value,authorized_label a|b;c,d|e;f 1|2|3,x|y|z r,s
117 118 119 |
# File 'lib/ds/recon/type/recon_type.rb', line 117 def balanced_columns self::BALANCED_COLUMNS end |
#delimiter_map ⇒ Hash<Symbol,String>
Returns the delimiter repalcement map: { ORIGINAL => REPLACEMENT}; e.g., { ‘|’ => ‘;’ }
91 92 93 |
# File 'lib/ds/recon/type/recon_type.rb', line 91 def delimiter_map self::DELIMITER_MAP end |
#get_key_values(row) ⇒ Array<String>
Return the values of the key columns in the given row.
126 127 128 |
# File 'lib/ds/recon/type/recon_type.rb', line 126 def get_key_values row key_columns.map { |key| row[key] } end |
#key_columns ⇒ Array<Symbol>
Returns the columns used to make the lookup key for the data dictionary; e.g., [:genre_as_recorded, :vocabulary]
77 78 79 |
# File 'lib/ds/recon/type/recon_type.rb', line 77 def key_columns self::KEY_COLUMNS end |
#lookup_columns ⇒ Array<Symbol>
Returns lookups should pulls from the data dictionaries; e.g., [:authorized_label, :structured_value, :ds_qid]
70 71 72 |
# File 'lib/ds/recon/type/recon_type.rb', line 70 def lookup_columns self::LOOKUP_COLUMNS end |
#lookup_values(row) ⇒ Object
130 131 132 |
# File 'lib/ds/recon/type/recon_type.rb', line 130 def lookup_values row lookup_columns.map { |key| row[key] } end |
#method_name ⇒ Array<Symbol>
Returns the name of the DS::Extractor methods; e.g., [:extract_places]
98 99 100 |
# File 'lib/ds/recon/type/recon_type.rb', line 98 def method_name self::METHOD_NAME end |
#recon_csv_headers ⇒ Array<Symbol>
Returns the recon CSV headers; e.g., [:place_as_recorded, :authorized_label, :structured_value, :ds_qid]
63 64 65 |
# File 'lib/ds/recon/type/recon_type.rb', line 63 def recon_csv_headers self::RECON_CSV_HEADERS end |
#set_name ⇒ Symbol
Returns the set name of the recon set; e.g., :places
Used to find a recon type configuration by name; either the ReconType (like Recon::Type::Places) or the path to the recon data dictionary CSV in the ds-data git repo as defined in config/settings.yml:
ds:
recon:
...
sets:
- name: :places
repo_path: terms/reconciled/places.csv
key_column: place_as_recorded
...
56 57 58 |
# File 'lib/ds/recon/type/recon_type.rb', line 56 def set_name self::SET_NAME end |