MarcusBarnes / mik

The Move to Islandora Kit is an extensible PHP command-line tool for converting source content and metadata into packages suitable for importing into Islandora (or other digital repository and preservations systems).
GNU General Public License v3.0
34 stars 11 forks source link

Allow CSV input files to contain commented out rows #388

Closed mjordan closed 7 years ago

mjordan commented 7 years ago

It would be useful to be able to comment out a row in a CSV input file, during troubleshooting, for example. A # would make a suitable comment marker, e.g.,

#"I am","a commented","row"

mjordan commented 7 years ago

Because our CSV parser creates an object for each row, we can't use simple beginning-of-line pattern matching to allow commenting out of records. Instead, we need to add the commenting character (e.g. # to the beginning of the column configured to be the record_key of the row:

"#postcard_100","Waterfront and Shipping Vancouver, B.C.","1907","Vancouver, BC","Waterfronts; Vessels; Shipping","A waterfront and shipping scene in Vancouver, B.C. Several vessels are shown along the waterfront.","postcard_20.jpg"

The record key is not necessarily the first column in the CSV file:

"Waterfront and Shipping Vancouver, B.C.","#postcard_100","1907","Vancouver, BC","Waterfronts; Vessels; Shipping","A waterfront and shipping scene in Vancouver, B.C. Several vessels are shown along the waterfront.","postcard_20.jpg"

This "feature" will need to be documented.

MarcusBarnes commented 7 years ago

This has been addressed in pull-request https://github.com/MarcusBarnes/mik/pull/390 (merged with commit https://github.com/MarcusBarnes/mik/commit/f2cbdec527fe8a15e6488503f09f2496a8deb725). Thank you @mjordan.