Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get valid CSV headers directly from CurateMapper #508

Merged
merged 1 commit into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/importers/curate_mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def initialize(attributes = {})

# What columns are allowed in the CSV
def self.allowed_headers
CURATE_TERMS_MAP.values
CURATE_TERMS_MAP.values + ['filename']
end

def fields
Expand Down
45 changes: 1 addition & 44 deletions app/uploaders/zizia/csv_manifest_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,50 +53,6 @@ def default_delimiter
Zizia::HyraxBasicMetadataMapper.new.delimiter
end

def valid_headers
%w[
abstract
administrative_unit
content_genre
contact_information
content_type
copyright_date
creator
data_classification
date_created
date_digitized
date_issued
extent
holding_repository
institution
internal_rights_note
keywords
legacy_ark
legacy_identifier
legacy_rights
local_call_number
note
place_of_production
primary_language
publisher
rights_holder
rights_statement
rights_statement_text
sensitive_material
sensitive_material_note
subject_geo
subject_names
subject_topics
sublocation
table_of_contents
title
transfer_engineer
uniform_title
visibility
filename
]
end

def parse_csv
@rows = CSV.read(csv_file.path)
@headers = @rows.first || []
Expand Down Expand Up @@ -129,6 +85,7 @@ def duplicate_headers

# Warn the user if we find any unexpected headers.
def unrecognized_headers
valid_headers = Zizia.config.metadata_mapper_class.allowed_headers
normalized_valid_headers = valid_headers.map { |a| a.downcase.strip }
extra_headers = @transformed_headers - normalized_valid_headers
extra_headers.each do |header|
Expand Down
2 changes: 2 additions & 0 deletions spec/support/capybara.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Webdrivers.cache_time = 3

# Setup chrome headless driver
Capybara.server = :puma, { Silent: true }

Expand Down