Sha256: 38cbaa4f07b196dabc165c3657b456747da44c1f46723f8d799c983dcbdb9573
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
require 'pathname' require 'fileutils' namespace :hqmf do desc 'Convert a HQMF file to JavaScript' task :convert, [:hqmf,:hqmf_version] do |t, args| raise "The path to the the hqmf xml must be specified" unless args.hqmf FileUtils.mkdir_p File.join(".","tmp",'js') file = File.expand_path(args.hqmf) version = args.hqmf_version || HQMF::Parser::HQMF_VERSION_1 filename = Pathname.new(file).basename doc = HQMF::Parser.parse(File.open(file).read, version) gen = HQMF2JS::Generator::JS.new(doc) out_file = File.join(".","tmp",'js',"#{filename}.js") File.open(out_file, 'w') do |f| f.write("// #########################\n") f.write("// ##### DATA CRITERIA #####\n") f.write("// #########################\n\n") f.write(gen.js_for_data_criteria()) f.write("// #########################\n") f.write("// ##### POPULATION CRITERIA #####\n") f.write("// #########################\n\n") f.write("// INITIAL PATIENT POPULATION\n") f.write(gen.js_for(HQMF::PopulationCriteria::IPP)) f.write("\n// DENOMINATOR\n") f.write(gen.js_for(HQMF::PopulationCriteria::DENOM)) f.write("\n// NUMERATOR\n") f.write(gen.js_for(HQMF::PopulationCriteria::NUMER)) f.write("\n// EXCLUSIONS\n") f.write(gen.js_for(HQMF::PopulationCriteria::DENEX)) f.write("\n// DENOMINATOR EXCEPTIONS\n") f.write(gen.js_for(HQMF::PopulationCriteria::DENEXCEP)) f.write("\n// MSRPOPL\n") f.write(gen.js_for(HQMF::PopulationCriteria::MSRPOPL)) f.write("\n// OBSERV\n") f.write(gen.js_for(HQMF::PopulationCriteria::OBSERV)) end puts "wrote javascript to: #{out_file}" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hqmf2js-1.3.0 | lib/tasks/convert.rake |
hqmf2js-1.2.1 | lib/tasks/convert.rake |
hqmf2js-1.2.0 | lib/tasks/convert.rake |