summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/csv2json15
1 files changed, 15 insertions, 0 deletions
diff --git a/share/csv2json b/share/csv2json
index a91bac9..1cfd3ee 100755
--- a/share/csv2json
+++ b/share/csv2json
@@ -18,6 +18,21 @@ shift @csv_lines;
for my $line (@csv_lines) {
if ( $csv->parse($line) ) {
my ( $name, $ds100, $uic, $lat, $lon ) = $csv->fields;
+
+ if ( not $name ) {
+ say "Station name is mandatory -- skipping this line: $line";
+ next;
+ }
+ if ( not $ds100 ) {
+ say "DS100 is mandatory at the moment -- skipping this line: $line";
+ next;
+ }
+ if ( not $uic or $uic !~ m{ ^ \d+ $ }x ) {
+ say
+"UIC is mandatory and must be numeric -- skipping this line: $line";
+ next;
+ }
+
my $station = {
name => $name,
ds100 => $ds100,