Skip to content

Commit

Permalink
Merge pull request #3668 from mlibrary/HELIO-4695/scholarlyiq_tsv_esc…
Browse files Browse the repository at this point in the history
…aping

HELIO-4695 - quote all fields in Scholarly iQ TSV files
  • Loading branch information
conorom authored Jul 18, 2024
2 parents ed5cb1e + c2d395d commit 77041ae
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace :heliotrope do
CounterReport.where("created_at >= CURDATE() - INTERVAL 1 DAY AND created_at < CURDATE()").find_each
end

CSV.open(output_file, "w", col_sep: "\t", write_headers: true) do |tsv|
CSV.open(output_file, "w", col_sep: "\t", force_quotes: true, write_headers: true) do |tsv|
rows.with_index do |row, index|
if index.zero?
tsv << row.attributes.map { |key, _value| key }
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/scholarlyiq/scholarlyiq_upload_institutions.rake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace :heliotrope do
# For now let's assume these will be tidied up manually, or by a separate cron
output_file = File.join(args.output_directory, "institutions-#{Time.now.getlocal.strftime("%Y-%m-%d")}.tsv")

CSV.open(output_file, "w", col_sep: "\t", write_headers: true) do |tsv|
CSV.open(output_file, "w", col_sep: "\t", force_quotes: true, write_headers: true) do |tsv|
tsv << %w[identifier name display_name entity_id]
Greensub::Institution.all.each do |institution|
tsv << [institution.identifier, institution.name, institution.display_name, institution.entity_id]
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/scholarlyiq/scholarlyiq_upload_items.rake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace :heliotrope do
'identifier_tesim',
'resource_type_tesim'], rows: 100_000)

CSV.open(output_file, "w", col_sep: "\t", write_headers: true) do |tsv|
CSV.open(output_file, "w", col_sep: "\t", force_quotes: true, write_headers: true) do |tsv|
tsv << %w[id title creator date_created doi identifier resource_type]
docs.each do |doc|
tsv << [doc.id, doc['title_tesim']&.first,
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/scholarlyiq/scholarlyiq_upload_presses.rake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace :heliotrope do
# For now let's assume these will be tidied up manually, or by a separate cron
output_file = File.join(args.output_directory, "presses-#{Time.now.getlocal.strftime("%Y-%m-%d")}.tsv")

CSV.open(output_file, "w", col_sep: "\t", write_headers: true) do |tsv|
CSV.open(output_file, "w", col_sep: "\t", force_quotes: true, write_headers: true) do |tsv|
tsv << %w[press_id subdomain name child_press_ids]
Press.all.each do |press|
tsv << [
Expand Down

0 comments on commit 77041ae

Please sign in to comment.