Sha256: bb7e3c96831b575e17819628060f11bd4a06a1159d8c3977387f74093eb058f4

Contents?: true

Size: 1.62 KB

Versions: 8

Compression:

Stored size: 1.62 KB

Contents

module Tnql #:nodoc: all
  module Nodes
    module AgeNode
      def to_limits
        age.to_limits
      end
    end

    module ExactAgeNode
      def to_exact
        text_value.to_i
      end

      def to_limits
        i = to_exact
        [i, i]
      end
    end

    module FuzzyAgeNode
      def to_limits
        [start.to_exact, finish.to_exact]
      end
    end

    module AgeAtDiagnosisNode
      def meta_data_item
        { 'patient.age' => { Tnql::LIMITS => age.to_limits } }
      end
    end

    module DeathDateNode
      def meta_data_item
        range = fuzzy_date.to_daterange
        {
          'patient.deathdate' => {
            Tnql::LIMITS => [
              range.date1.try(:to_date).try(:iso8601), range.date2.try(:to_date).try(:iso8601)
            ]
          }
        }
      end
    end

    module BirthDateNode
      def meta_data_item
        range = fuzzy_date.to_daterange
        {
          'patient.birthdate' => {
            Tnql::LIMITS => [
              range.date1.try(:to_date).try(:iso8601), range.date2.try(:to_date).try(:iso8601)
            ]
          }
        }
      end
    end

    module CtyaNode
      def meta_data_item
        { 'patient.age' => { Tnql::LIMITS => [0, 24] } }
      end
    end

    module PaediatricNode
      def meta_data_item
        { 'patient.age' => { Tnql::LIMITS => [0, 15] } }
      end
    end

    module TeenageNode
      def meta_data_item
        { 'patient.age' => { Tnql::LIMITS => [16, 18] } }
      end
    end

    module YoungAdultNode
      def meta_data_item
        { 'patient.age' => { Tnql::LIMITS => [19, 24] } }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tnql-1.1.2 lib/tnql/nodes/age.rb
tnql-1.1.1 lib/tnql/nodes/age.rb
tnql-1.1.0 lib/tnql/nodes/age.rb
tnql-1.0.4 lib/tnql/nodes/age.rb
tnql-1.0.3 lib/tnql/nodes/age.rb
tnql-1.0.2 lib/tnql/nodes/age.rb
tnql-1.0.1 lib/tnql/nodes/age.rb
tnql-1.0.0 lib/tnql/nodes/age.rb