Sha256: 9182aaf67e38120e01d0b7b9e6066170933a14add96dac2b27bf5874b97bdde4
Contents?: true
Size: 1.19 KB
Versions: 23
Compression:
Stored size: 1.19 KB
Contents
module HQMF1 class Expression include HQMF1::Utilities attr_reader :text, :value, :type def initialize(entry) @entry = entry @text = @entry.xpath('./*/cda:derivationExpr').text.strip type = attr_val('./*/cda:value/@xsi:type') case type when 'IVL_PQ' @value = Range.new(@entry.xpath('./*/cda:value')) when 'PQ' @value = Value.new(@entry.xpath('./*/cda:value')) when 'ANYNonNull' @value = HQMF::AnyValue.new else raise "Unknown expression value type #{type}" end @type = match_type end def match_type case @text when /^COUNT(.*)$/ "COUNT" when /^MIN(.*)$/ "MIN" when /^MAX(.*)$/ "MAX" when /^DATEDIFF(.*)$/ "DATEDIFF" when /^TIMEDIFF(.*)$/ "TIMEDIFF" when /^MEDIAN(.*)$/ "MEDIAN" when /^AVG(.*)$/ "MEAN" else raise "unknown expression type: #{@text}" end end def to_json json = build_hash(self, [:text,:type]) json[:value] = self.value.to_json if self.value json end end end
Version data entries
23 entries across 23 versions & 2 rubygems
Version | Path |
---|---|
health-data-standards-3.0.4 | lib/hqmf-parser/1.0/expression.rb |
health-data-standards-3.0.3 | lib/hqmf-parser/1.0/expression.rb |
hqmf-parser-1.1.0 | lib/hqmf-parser/1.0/expression.rb |