app/models/record_formats/dif10_record.rb
# There are currently only scripts for DIF10 collections.
There are currently only scripts for DIF10 collections.
There are currently only scripts for DIF10 collections .
def evaluate_script(raw_data = nil)
      if raw_data.nil?
        raw_data = get_raw_data
      end
      remove_quotes_from_all_values!(raw_data)
      record_json = raw_data.to_json
      script_results = ''
      if collection?
        Tempfile.create do |file|
          file << record_json
          file.flush
          script_results = `python2 -W ignore lib/CollectionCheckerDIF.py #{file.path}`
        end
      end
      unless script_results.to_s.empty?
        comment_hash = JSON.parse(script_results)
        value_keys = self.record_datas.map { |data| data.column_name }
        comment_hash = Record.format_script_comments(comment_hash, value_keys)
        comment_hash
      else
        raise Errors::PythonError, "Python error occurred DIF10 (#{short_name})"
      end
    end
def evaluate_script ( raw_data = nil ) if raw_data . nil? raw_data = get_raw_data end remove_quotes_from_all_values! ( raw_data ) record_json = raw_data . to_json script_results = '' if collection? Tempfile . create do | file | file << record_json file . flush script_results = ` python2 -W ignore lib/CollectionCheckerDIF.py  #{ file . path } ` end end unless script_results . to_s . empty? comment_hash = JSON . parse ( script_results ) value_keys = self . record_datas . map { | data | data . column_name } comment_hash = Record . format_script_comments ( comment_hash , value_keys ) comment_hash else raise Errors :: PythonError , "Python error occurred DIF10 (#{short_name})" end end
There are currently only scripts for DIF10 collections.
There are currently only scripts for DIF10 collections .
#running collection script in python #W option to silence warnings
raw_data
<not_specific>