CSVW Validation
+Check your CSV file and CSV Schema
+diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..639e088 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'csvlint', github: 'ONS-OpenData/csvlint.rb' +gem 'sinatra' \ No newline at end of file diff --git a/app.rb b/app.rb new file mode 100644 index 0000000..bae6777 --- /dev/null +++ b/app.rb @@ -0,0 +1,20 @@ +require 'rubygems' +require 'bundler/setup' +require 'sinatra' +require 'csvlint' + +get '/' do + erb :index +end + +post '/validate' do + tidy_file = params[:tidyDataFile][:tempfile] + schema_file = params[:schemaFile][:tempfile] + schema_string = schema_file.read + csvw_schema = Csvlint::Schema.load_from_string(params[:schemaFile][:filename], + schema_string, + true) + @validator = Csvlint::Validator.new(tidy_file, {}, csvw_schema) +# @validator.validate + erb :results +end diff --git a/public/cogs.svg b/public/cogs.svg new file mode 100644 index 0000000..e612f72 --- /dev/null +++ b/public/cogs.svg @@ -0,0 +1,105 @@ + + + + diff --git a/views/index.erb b/views/index.erb new file mode 100644 index 0000000..0ee1f11 --- /dev/null +++ b/views/index.erb @@ -0,0 +1,45 @@ + + +
+ + + +Check your CSV file and CSV Schema
+