health_stats 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.md +0 -0
- data/Rakefile +20 -0
- data/VERSION +1 -0
- data/health_stats.gemspec +55 -0
- data/lib/health_stats.rb +15 -0
- data/lib/health_stats/age.rb +35 -0
- data/lib/health_stats/bmi.rb +34 -0
- data/lib/health_stats/cdc_data.rb +8 -0
- data/lib/health_stats/cdc_data/bmi.rb +449 -0
- data/lib/health_stats/statistics.rb +97 -0
- data/pkg/health_stats-0.0.1.gem +0 -0
- data/spec/spec_health_stats.rb +119 -0
- metadata +77 -0
    
        data/LICENSE
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            Copyright (c) 2009 Mark Martin
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 4 | 
            +
            a copy of this software and associated documentation files (the
         | 
| 5 | 
            +
            "Software"), to deal in the Software without restriction, including
         | 
| 6 | 
            +
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 7 | 
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 8 | 
            +
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 9 | 
            +
            the following conditions:
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 12 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 15 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 16 | 
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 17 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 18 | 
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 19 | 
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 20 | 
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    | 
            File without changes
         | 
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            require 'rubygems'
         | 
| 2 | 
            +
            require 'rake'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            begin
         | 
| 5 | 
            +
              require 'jeweler'
         | 
| 6 | 
            +
              Jeweler::Tasks.new do |gemspec|
         | 
| 7 | 
            +
                gemspec.name = "health_stats"
         | 
| 8 | 
            +
                gemspec.summary = "Convenience methods for age, bmi, bmi percentile"
         | 
| 9 | 
            +
                gemspec.email = "assplecake@gmail.com"
         | 
| 10 | 
            +
                gemspec.homepage = "http://github.com/assplecake/healthdata"
         | 
| 11 | 
            +
                gemspec.authors = ["Mark Martin"]
         | 
| 12 | 
            +
                
         | 
| 13 | 
            +
                gemspec.add_development_dependency('activesupport', '>= 2.3')
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
              
         | 
| 16 | 
            +
              Jeweler::GemcutterTasks.new
         | 
| 17 | 
            +
              
         | 
| 18 | 
            +
            rescue LoadError
         | 
| 19 | 
            +
              puts "Jeweler not available. Install it with: sudo gem install jeweler"
         | 
| 20 | 
            +
            end
         | 
    
        data/VERSION
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            0.0.1
         | 
| @@ -0,0 +1,55 @@ | |
| 1 | 
            +
            # Generated by jeweler
         | 
| 2 | 
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
         | 
| 4 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |s|
         | 
| 7 | 
            +
              s.name = %q{health_stats}
         | 
| 8 | 
            +
              s.version = "0.0.1"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            +
              s.authors = ["Mark Martin"]
         | 
| 12 | 
            +
              s.date = %q{2009-12-03}
         | 
| 13 | 
            +
              s.email = %q{assplecake@gmail.com}
         | 
| 14 | 
            +
              s.extra_rdoc_files = [
         | 
| 15 | 
            +
                "LICENSE",
         | 
| 16 | 
            +
                 "README.md"
         | 
| 17 | 
            +
              ]
         | 
| 18 | 
            +
              s.files = [
         | 
| 19 | 
            +
                "LICENSE",
         | 
| 20 | 
            +
                 "README.md",
         | 
| 21 | 
            +
                 "Rakefile",
         | 
| 22 | 
            +
                 "VERSION",
         | 
| 23 | 
            +
                 "health_stats.gemspec",
         | 
| 24 | 
            +
                 "lib/health_stats.rb",
         | 
| 25 | 
            +
                 "lib/health_stats/age.rb",
         | 
| 26 | 
            +
                 "lib/health_stats/bmi.rb",
         | 
| 27 | 
            +
                 "lib/health_stats/cdc_data.rb",
         | 
| 28 | 
            +
                 "lib/health_stats/cdc_data/bmi.rb",
         | 
| 29 | 
            +
                 "lib/health_stats/statistics.rb",
         | 
| 30 | 
            +
                 "pkg/health_stats-0.0.1.gem",
         | 
| 31 | 
            +
                 "spec/spec_health_stats.rb"
         | 
| 32 | 
            +
              ]
         | 
| 33 | 
            +
              s.homepage = %q{http://github.com/assplecake/healthdata}
         | 
| 34 | 
            +
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| 35 | 
            +
              s.require_paths = ["lib"]
         | 
| 36 | 
            +
              s.rubygems_version = %q{1.3.5}
         | 
| 37 | 
            +
              s.summary = %q{Convenience methods for age, bmi, bmi percentile}
         | 
| 38 | 
            +
              s.test_files = [
         | 
| 39 | 
            +
                "spec/spec_health_stats.rb"
         | 
| 40 | 
            +
              ]
         | 
| 41 | 
            +
             | 
| 42 | 
            +
              if s.respond_to? :specification_version then
         | 
| 43 | 
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 44 | 
            +
                s.specification_version = 3
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
         | 
| 47 | 
            +
                  s.add_development_dependency(%q<activesupport>, [">= 2.3"])
         | 
| 48 | 
            +
                else
         | 
| 49 | 
            +
                  s.add_dependency(%q<activesupport>, [">= 2.3"])
         | 
| 50 | 
            +
                end
         | 
| 51 | 
            +
              else
         | 
| 52 | 
            +
                s.add_dependency(%q<activesupport>, [">= 2.3"])
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
            end
         | 
| 55 | 
            +
             | 
    
        data/lib/health_stats.rb
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            module HealthStats
         | 
| 2 | 
            +
              AttributeError = Class.new(StandardError)
         | 
| 3 | 
            +
              RequiredAttributes = [:dob, :weight, :height, :gender]
         | 
| 4 | 
            +
              
         | 
| 5 | 
            +
              RequiredAttributes.each do |attribute|
         | 
| 6 | 
            +
                define_method(attribute) do
         | 
| 7 | 
            +
                  message = "#{attribute} is not implemented"
         | 
| 8 | 
            +
                  raise HealthStats::AttributeError, message
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
            end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            require 'health_stats/age'
         | 
| 14 | 
            +
            require 'health_stats/statistics'
         | 
| 15 | 
            +
            require 'health_stats/bmi'
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            module HealthStats
         | 
| 2 | 
            +
              module Age
         | 
| 3 | 
            +
                def age_in_months
         | 
| 4 | 
            +
                  return if dob.nil?
         | 
| 5 | 
            +
                  today = Date.today
         | 
| 6 | 
            +
                  months = age_in_years * 12
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  if today.month > dob.month
         | 
| 9 | 
            +
                    months += (today.month - dob.month)
         | 
| 10 | 
            +
                  else
         | 
| 11 | 
            +
                    months += today.month
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  if today.day >= dob.day
         | 
| 15 | 
            +
                    months += 1 + (today.day - dob.day > 15 ? 0.5 : 0.0)
         | 
| 16 | 
            +
                  else
         | 
| 17 | 
            +
                    months += (today.day - dob.day + 30) > 15 ? -0.5 : -1.0
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                def age_in_years
         | 
| 22 | 
            +
                  return if dob.nil?
         | 
| 23 | 
            +
                  today = Date.today
         | 
| 24 | 
            +
                  
         | 
| 25 | 
            +
                  if today.month > dob.month || (today.month == dob.month && today.day >= dob.day)
         | 
| 26 | 
            +
                    today.year - dob.year
         | 
| 27 | 
            +
                  else
         | 
| 28 | 
            +
                    today.year - dob.year - 1
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
                alias_method :age, :age_in_years
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
              
         | 
| 34 | 
            +
              include Age
         | 
| 35 | 
            +
            end
         | 
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            module HealthStats
         | 
| 2 | 
            +
              autoload :CDCData, File.dirname(__FILE__) + '/cdc_data'
         | 
| 3 | 
            +
              
         | 
| 4 | 
            +
              module BMI
         | 
| 5 | 
            +
                include Statistics
         | 
| 6 | 
            +
                
         | 
| 7 | 
            +
                def bmi    
         | 
| 8 | 
            +
                  if weight && height
         | 
| 9 | 
            +
                    (((weight * 703) * 100) / (height ** 2)) / 100.0
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                def bmi_percentile
         | 
| 14 | 
            +
                  bmi_score = bmi
         | 
| 15 | 
            +
                  month_age = age_in_months
         | 
| 16 | 
            +
                  lms_value = nil
         | 
| 17 | 
            +
                  
         | 
| 18 | 
            +
                  return unless bmi_score && month_age && gender
         | 
| 19 | 
            +
                  return if month_age < 24.0 || month_age > 241.0
         | 
| 20 | 
            +
                  
         | 
| 21 | 
            +
                  chart = gender == 'f' ? CDCData::BMI::Female : CDCData::BMI::Male
         | 
| 22 | 
            +
                  
         | 
| 23 | 
            +
                  while lms_value.nil?
         | 
| 24 | 
            +
                    lms_value = chart[month_age]
         | 
| 25 | 
            +
                    month_age -= 0.5
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
                  
         | 
| 28 | 
            +
                  # I feel dirty.
         | 
| 29 | 
            +
                  ((poz(lms(bmi_score, *lms_value)) * 1000000).to_i / 100.0).round / 100.0 
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
              
         | 
| 33 | 
            +
              include BMI
         | 
| 34 | 
            +
            end
         | 
| @@ -0,0 +1,449 @@ | |
| 1 | 
            +
            module HealthStats
         | 
| 2 | 
            +
              module CDCData
         | 
| 3 | 
            +
                module BMI
         | 
| 4 | 
            +
                  Male = {
         | 
| 5 | 
            +
                    24.0 => [-2.01118107, 16.575027675, 0.080592465],
         | 
| 6 | 
            +
                    24.5 => [-1.982373595, 16.547774867, 0.0801274288],
         | 
| 7 | 
            +
                    25.5 => [-1.924100169, 16.494427632, 0.0792339937],
         | 
| 8 | 
            +
                    26.5 => [-1.86549793, 16.442595522, 0.0783893561],
         | 
| 9 | 
            +
                    27.5 => [-1.807261899, 16.392243398, 0.0775935012],
         | 
| 10 | 
            +
                    28.5 => [-1.750118905, 16.343336543, 0.0768464622],
         | 
| 11 | 
            +
                    29.5 => [-1.69481584, 16.295840971, 0.0761483079],
         | 
| 12 | 
            +
                    30.5 => [-1.642106779, 16.249723714, 0.0754991255],
         | 
| 13 | 
            +
                    31.5 => [-1.592744414, 16.204952678, 0.0748989935],
         | 
| 14 | 
            +
                    32.5 => [-1.547442391, 16.161498714, 0.0743479966],
         | 
| 15 | 
            +
                    33.5 => [-1.506902601, 16.119332582, 0.0738461386],
         | 
| 16 | 
            +
                    34.5 => [-1.471770047, 16.078427579, 0.0733933698],
         | 
| 17 | 
            +
                    35.5 => [-1.442628957, 16.038758958, 0.0729895508],
         | 
| 18 | 
            +
                    36.5 => [-1.419991255, 16.000304012, 0.0726344323],
         | 
| 19 | 
            +
                    37.5 => [-1.404277619, 15.963042771, 0.072327649],
         | 
| 20 | 
            +
                    38.5 => [-1.39586317, 15.926954175, 0.0720686401],
         | 
| 21 | 
            +
                    39.5 => [-1.394935252, 15.892025816, 0.0718568052],
         | 
| 22 | 
            +
                    40.5 => [-1.401671596, 15.858240929, 0.071691278],
         | 
| 23 | 
            +
                    41.5 => [-1.416100312, 15.825588223, 0.0715710933],
         | 
| 24 | 
            +
                    42.5 => [-1.438164899, 15.794057282, 0.0714951131],
         | 
| 25 | 
            +
                    43.5 => [-1.467669032, 15.763642549, 0.0714621062],
         | 
| 26 | 
            +
                    44.5 => [-1.504376347, 15.734336684, 0.0714706462],
         | 
| 27 | 
            +
                    45.5 => [-1.547942838, 15.706135657, 0.0715192177],
         | 
| 28 | 
            +
                    46.5 => [-1.597896397, 15.679040623, 0.0716062769],
         | 
| 29 | 
            +
                    47.5 => [-1.653732283, 15.653051916, 0.071730167],
         | 
| 30 | 
            +
                    48.5 => [-1.714869347, 15.628172692, 0.0718892136],
         | 
| 31 | 
            +
                    49.5 => [-1.780673181, 15.604407997, 0.0720817373],
         | 
| 32 | 
            +
                    50.5 => [-1.850468473, 15.58176458, 0.0723060813],
         | 
| 33 | 
            +
                    51.5 => [-1.923551865, 15.560250666, 0.0725606369],
         | 
| 34 | 
            +
                    52.5 => [-1.999220429, 15.539874597, 0.0728438397],
         | 
| 35 | 
            +
                    53.5 => [-2.076707178, 15.520649927, 0.0731543235],
         | 
| 36 | 
            +
                    54.5 => [-2.155348017, 15.502584267, 0.0734906668],
         | 
| 37 | 
            +
                    55.5 => [-2.234438552, 15.485689732, 0.0738516716],
         | 
| 38 | 
            +
                    56.5 => [-2.313321723, 15.469977177, 0.0742362346],
         | 
| 39 | 
            +
                    57.5 => [-2.391381273, 15.455456916, 0.0746433738],
         | 
| 40 | 
            +
                    58.5 => [-2.468032491, 15.442139608, 0.0750722636],
         | 
| 41 | 
            +
                    59.5 => [-2.542781541, 15.430032072, 0.0755221037],
         | 
| 42 | 
            +
                    60.5 => [-2.61516595, 15.419141631, 0.0759922501],
         | 
| 43 | 
            +
                    61.5 => [-2.684789516, 15.409473561, 0.0764821284],
         | 
| 44 | 
            +
                    62.5 => [-2.751316949, 15.401031388, 0.0769912324],
         | 
| 45 | 
            +
                    63.5 => [-2.81445945, 15.393817852, 0.0775191487],
         | 
| 46 | 
            +
                    64.5 => [-2.87402476, 15.387830936, 0.0780653898],
         | 
| 47 | 
            +
                    65.5 => [-2.92984048, 15.383069448, 0.0786295919],
         | 
| 48 | 
            +
                    66.5 => [-2.981796828, 15.37952958, 0.0792113694],
         | 
| 49 | 
            +
                    67.5 => [-3.029831343, 15.37720582, 0.0798103341],
         | 
| 50 | 
            +
                    68.5 => [-3.073924224, 15.376091068, 0.0804260861],
         | 
| 51 | 
            +
                    69.5 => [-3.114093476, 15.376176765, 0.0810582059],
         | 
| 52 | 
            +
                    70.5 => [-3.15039004, 15.37745304, 0.0817062489],
         | 
| 53 | 
            +
                    71.5 => [-3.182893018, 15.379908859, 0.0823697413],
         | 
| 54 | 
            +
                    72.5 => [-3.21170511, 15.383532169, 0.0830481778],
         | 
| 55 | 
            +
                    73.5 => [-3.23694834, 15.388310046, 0.0837410207],
         | 
| 56 | 
            +
                    74.5 => [-3.25876011, 15.39422883, 0.0844476998],
         | 
| 57 | 
            +
                    75.5 => [-3.277281546, 15.40127496, 0.0851676514],
         | 
| 58 | 
            +
                    76.5 => [-3.292683774, 15.40943252, 0.0859001836],
         | 
| 59 | 
            +
                    77.5 => [-3.305124073, 15.418686911, 0.0866446671],
         | 
| 60 | 
            +
                    78.5 => [-3.314768951, 15.429022732, 0.0874004212],
         | 
| 61 | 
            +
                    79.5 => [-3.321785992, 15.440424387, 0.0881667444],
         | 
| 62 | 
            +
                    80.5 => [-3.326345795, 15.452875806, 0.088942897],
         | 
| 63 | 
            +
                    81.5 => [-3.328602731, 15.466362178, 0.0897282019],
         | 
| 64 | 
            +
                    82.5 => [-3.328725277, 15.480867041, 0.0905218748],
         | 
| 65 | 
            +
                    83.5 => [-3.32687018, 15.496374654, 0.0913231621],
         | 
| 66 | 
            +
                    84.5 => [-3.323188896, 15.512869363, 0.0921313054],
         | 
| 67 | 
            +
                    85.5 => [-3.317827016, 15.530335632, 0.0929455443],
         | 
| 68 | 
            +
                    86.5 => [-3.310923871, 15.548758065, 0.0937651184],
         | 
| 69 | 
            +
                    87.5 => [-3.302612272, 15.568121426, 0.0945892702],
         | 
| 70 | 
            +
                    88.5 => [-3.293018361, 15.588410651, 0.0954172465],
         | 
| 71 | 
            +
                    89.5 => [-3.282260813, 15.60961101, 0.0962483005],
         | 
| 72 | 
            +
                    90.5 => [-3.270454609, 15.63170735, 0.0970816941],
         | 
| 73 | 
            +
                    91.5 => [-3.257703616, 15.654685628, 0.0979166976],
         | 
| 74 | 
            +
                    92.5 => [-3.244108214, 15.678531387, 0.0987525931],
         | 
| 75 | 
            +
                    93.5 => [-3.229761713, 15.703230518, 0.0995886749],
         | 
| 76 | 
            +
                    94.5 => [-3.214751287, 15.728769113, 0.1004242507],
         | 
| 77 | 
            +
                    95.5 => [-3.199158184, 15.755133465, 0.1012586429],
         | 
| 78 | 
            +
                    96.5 => [-3.18305795, 15.782310065, 0.1020911894],
         | 
| 79 | 
            +
                    97.5 => [-3.166520664, 15.810285603, 0.1029212448],
         | 
| 80 | 
            +
                    98.5 => [-3.1496103, 15.839047084, 0.1037481885],
         | 
| 81 | 
            +
                    99.5 => [-3.132389637, 15.868581229, 0.1045713862],
         | 
| 82 | 
            +
                    100.5 => [-3.114911153, 15.898875618, 0.1053902685],
         | 
| 83 | 
            +
                    101.5 => [-3.097226399, 15.929917651, 0.1062042575],
         | 
| 84 | 
            +
                    102.5 => [-3.079383079, 15.961694805, 0.1070127883],
         | 
| 85 | 
            +
                    103.5 => [-3.061423765, 15.994194894, 0.1078153274],
         | 
| 86 | 
            +
                    104.5 => [-3.043386071, 16.027406071, 0.1086113736],
         | 
| 87 | 
            +
                    105.5 => [-3.025310003, 16.061315897, 0.1094003876],
         | 
| 88 | 
            +
                    106.5 => [-3.007225737, 16.095912922, 0.1101819146],
         | 
| 89 | 
            +
                    107.5 => [-2.989164598, 16.131185315, 0.1109554781],
         | 
| 90 | 
            +
                    108.5 => [-2.971148225, 16.167122344, 0.1117206908],
         | 
| 91 | 
            +
                    109.5 => [-2.953208047, 16.203711677, 0.1124770587],
         | 
| 92 | 
            +
                    110.5 => [-2.935363951, 16.240942388, 0.1132241995],
         | 
| 93 | 
            +
                    111.5 => [-2.917635157, 16.278803458, 0.1139617339],
         | 
| 94 | 
            +
                    112.5 => [-2.900039803, 16.317283847, 0.1146892914],
         | 
| 95 | 
            +
                    113.5 => [-2.882593796, 16.356372672, 0.1154065227],
         | 
| 96 | 
            +
                    114.5 => [-2.865311266, 16.396059161, 0.1161130971],
         | 
| 97 | 
            +
                    115.5 => [-2.848204697, 16.436332645, 0.1168087018],
         | 
| 98 | 
            +
                    116.5 => [-2.831285052, 16.477182556, 0.1174930418],
         | 
| 99 | 
            +
                    117.5 => [-2.81456189, 16.518598425, 0.1181658396],
         | 
| 100 | 
            +
                    118.5 => [-2.79804347, 16.560569873, 0.1188268351],
         | 
| 101 | 
            +
                    119.5 => [-2.781736856, 16.603086612, 0.1194757852],
         | 
| 102 | 
            +
                    120.5 => [-2.765648008, 16.646138439, 0.1201124636],
         | 
| 103 | 
            +
                    121.5 => [-2.749782197, 16.689715178, 0.1207366562],
         | 
| 104 | 
            +
                    122.5 => [-2.734142443, 16.733806953, 0.1213481813],
         | 
| 105 | 
            +
                    123.5 => [-2.718732873, 16.778403632, 0.121946849],
         | 
| 106 | 
            +
                    124.5 => [-2.703555506, 16.82349538, 0.1225325012],
         | 
| 107 | 
            +
                    125.5 => [-2.688611957, 16.869072375, 0.1231049908],
         | 
| 108 | 
            +
                    126.5 => [-2.673903164, 16.915124866, 0.1236641859],
         | 
| 109 | 
            +
                    127.5 => [-2.659429443, 16.961643168, 0.1242099694],
         | 
| 110 | 
            +
                    128.5 => [-2.645190534, 17.00861766, 0.1247422387],
         | 
| 111 | 
            +
                    129.5 => [-2.631185649, 17.056038787, 0.1252609054],
         | 
| 112 | 
            +
                    130.5 => [-2.617413511, 17.103897052, 0.125765895],
         | 
| 113 | 
            +
                    131.5 => [-2.603872392, 17.152183022, 0.1262571467],
         | 
| 114 | 
            +
                    132.5 => [-2.590560148, 17.200887318, 0.1267346133],
         | 
| 115 | 
            +
                    133.5 => [-2.577474253, 17.250000623, 0.1271982604],
         | 
| 116 | 
            +
                    134.5 => [-2.564611831, 17.299513673, 0.1276480666],
         | 
| 117 | 
            +
                    135.5 => [-2.551969684, 17.349417258, 0.128084023],
         | 
| 118 | 
            +
                    136.5 => [-2.539539972, 17.399703081, 0.1285061919],
         | 
| 119 | 
            +
                    137.5 => [-2.527325681, 17.450360715, 0.1289144974],
         | 
| 120 | 
            +
                    138.5 => [-2.515320235, 17.501381606, 0.1293090012],
         | 
| 121 | 
            +
                    139.5 => [-2.503519447, 17.552756739, 0.1296897408],
         | 
| 122 | 
            +
                    140.5 => [-2.491918934, 17.604477144, 0.1300567649],
         | 
| 123 | 
            +
                    141.5 => [-2.480514136, 17.656533895, 0.1304101325],
         | 
| 124 | 
            +
                    142.5 => [-2.469300331, 17.708918107, 0.1307499132],
         | 
| 125 | 
            +
                    143.5 => [-2.458272656, 17.761620938, 0.1310761867],
         | 
| 126 | 
            +
                    144.5 => [-2.447426113, 17.814633586, 0.1313890423],
         | 
| 127 | 
            +
                    145.5 => [-2.436755595, 17.867947289, 0.1316885791],
         | 
| 128 | 
            +
                    146.5 => [-2.426255887, 17.92155332, 0.1319749052],
         | 
| 129 | 
            +
                    147.5 => [-2.415921689, 17.975442992, 0.1322481377],
         | 
| 130 | 
            +
                    148.5 => [-2.405747619, 18.029607653, 0.1325084026],
         | 
| 131 | 
            +
                    149.5 => [-2.395728233, 18.084038684, 0.1327558343],
         | 
| 132 | 
            +
                    150.5 => [-2.385858029, 18.138727501, 0.1329905752],
         | 
| 133 | 
            +
                    151.5 => [-2.376131459, 18.193665552, 0.133212776],
         | 
| 134 | 
            +
                    152.5 => [-2.366542942, 18.248844314, 0.1334225948],
         | 
| 135 | 
            +
                    153.5 => [-2.357086871, 18.304255296, 0.1336201973],
         | 
| 136 | 
            +
                    154.5 => [-2.347757625, 18.359890034, 0.1338057563],
         | 
| 137 | 
            +
                    155.5 => [-2.338549576, 18.415740092, 0.1339794518],
         | 
| 138 | 
            +
                    156.5 => [-2.3294571, 18.471797059, 0.1341414703],
         | 
| 139 | 
            +
                    157.5 => [-2.320474586, 18.528052549, 0.1342920051],
         | 
| 140 | 
            +
                    158.5 => [-2.311596446, 18.584498199, 0.1344312555],
         | 
| 141 | 
            +
                    159.5 => [-2.302817124, 18.641125665, 0.134559427],
         | 
| 142 | 
            +
                    160.5 => [-2.294131107, 18.697926627, 0.1346767311],
         | 
| 143 | 
            +
                    161.5 => [-2.285532933, 18.754892781, 0.1347833849],
         | 
| 144 | 
            +
                    162.5 => [-2.277017201, 18.812015839, 0.1348796107],
         | 
| 145 | 
            +
                    163.5 => [-2.268578584, 18.869287528, 0.1349656365],
         | 
| 146 | 
            +
                    164.5 => [-2.260211837, 18.92669959, 0.1350416951],
         | 
| 147 | 
            +
                    165.5 => [-2.251911809, 18.984243775, 0.1351080243],
         | 
| 148 | 
            +
                    166.5 => [-2.243673453, 19.041911845, 0.1351648666],
         | 
| 149 | 
            +
                    167.5 => [-2.235491842, 19.099695568, 0.1352124688],
         | 
| 150 | 
            +
                    168.5 => [-2.227362173, 19.157586716, 0.1352510825],
         | 
| 151 | 
            +
                    169.5 => [-2.21927979, 19.215577065, 0.1352809633],
         | 
| 152 | 
            +
                    170.5 => [-2.211240187, 19.27365839, 0.1353023707],
         | 
| 153 | 
            +
                    171.5 => [-2.203239029, 19.331822466, 0.1353155684],
         | 
| 154 | 
            +
                    172.5 => [-2.195272161, 19.390061061, 0.1353208237],
         | 
| 155 | 
            +
                    173.5 => [-2.187335625, 19.448365938, 0.1353184074],
         | 
| 156 | 
            +
                    174.5 => [-2.179425674, 19.506728848, 0.1353085942],
         | 
| 157 | 
            +
                    175.5 => [-2.171538789, 19.565141532, 0.1352916617],
         | 
| 158 | 
            +
                    176.5 => [-2.163671689, 19.623595714, 0.1352678911],
         | 
| 159 | 
            +
                    177.5 => [-2.155821357, 19.682083101, 0.1352375667],
         | 
| 160 | 
            +
                    178.5 => [-2.147985046, 19.740595376, 0.1352009759],
         | 
| 161 | 
            +
                    179.5 => [-2.140160305, 19.799124201, 0.1351584088],
         | 
| 162 | 
            +
                    180.5 => [-2.132344989, 19.857661209, 0.1351101588],
         | 
| 163 | 
            +
                    181.5 => [-2.124537282, 19.916198004, 0.1350565219],
         | 
| 164 | 
            +
                    182.5 => [-2.116735712, 19.974726154, 0.1349977968],
         | 
| 165 | 
            +
                    183.5 => [-2.108939167, 20.033237194, 0.134934285],
         | 
| 166 | 
            +
                    184.5 => [-2.10114692, 20.091722615, 0.1348662908],
         | 
| 167 | 
            +
                    185.5 => [-2.093358637, 20.15017387, 0.1347941208],
         | 
| 168 | 
            +
                    186.5 => [-2.085574403, 20.208582361, 0.1347180845],
         | 
| 169 | 
            +
                    187.5 => [-2.077794735, 20.266939444, 0.1346384938],
         | 
| 170 | 
            +
                    188.5 => [-2.070020599, 20.325236424, 0.1345556632],
         | 
| 171 | 
            +
                    189.5 => [-2.062253431, 20.383464548, 0.1344699098],
         | 
| 172 | 
            +
                    190.5 => [-2.054495145, 20.441615008, 0.1343815533],
         | 
| 173 | 
            +
                    191.5 => [-2.046748156, 20.499678935, 0.1342909159],
         | 
| 174 | 
            +
                    192.5 => [-2.039015385, 20.557647399, 0.1341983225],
         | 
| 175 | 
            +
                    193.5 => [-2.031300282, 20.615511404, 0.1341041006],
         | 
| 176 | 
            +
                    194.5 => [-2.023606828, 20.673261889, 0.1340085806],
         | 
| 177 | 
            +
                    195.5 => [-2.015942013, 20.730889051, 0.1339120657],
         | 
| 178 | 
            +
                    196.5 => [-2.008305745, 20.788385102, 0.1338149542],
         | 
| 179 | 
            +
                    197.5 => [-2.000706389, 20.845740029, 0.1337175518],
         | 
| 180 | 
            +
                    198.5 => [-1.993150137, 20.902944494, 0.1336202002],
         | 
| 181 | 
            +
                    199.5 => [-1.985643741, 20.959989088, 0.1335232441],
         | 
| 182 | 
            +
                    200.5 => [-1.97819451, 21.01686433, 0.1334270316],
         | 
| 183 | 
            +
                    201.5 => [-1.970810308, 21.073560674, 0.1333319137],
         | 
| 184 | 
            +
                    202.5 => [-1.96349954, 21.130068501, 0.1332382449],
         | 
| 185 | 
            +
                    203.5 => [-1.956271141, 21.186378131, 0.1331463832],
         | 
| 186 | 
            +
                    204.5 => [-1.949134561, 21.242479819, 0.1330566901],
         | 
| 187 | 
            +
                    205.5 => [-1.942099744, 21.298363759, 0.1329695305],
         | 
| 188 | 
            +
                    206.5 => [-1.935177101, 21.354020094, 0.1328852735],
         | 
| 189 | 
            +
                    207.5 => [-1.92837748, 21.409438911, 0.1328042916],
         | 
| 190 | 
            +
                    208.5 => [-1.921712136, 21.464610257, 0.1327269615],
         | 
| 191 | 
            +
                    209.5 => [-1.915192685, 21.519524136, 0.1326536641],
         | 
| 192 | 
            +
                    210.5 => [-1.908831065, 21.574170525, 0.1325847841],
         | 
| 193 | 
            +
                    211.5 => [-1.902639482, 21.628539373, 0.1325207109],
         | 
| 194 | 
            +
                    212.5 => [-1.896630358, 21.682620618, 0.1324618378],
         | 
| 195 | 
            +
                    213.5 => [-1.890816268, 21.736404191, 0.1324085629],
         | 
| 196 | 
            +
                    214.5 => [-1.885209876, 21.789880029, 0.1323612888],
         | 
| 197 | 
            +
                    215.5 => [-1.879823505, 21.843038191, 0.1323204265],
         | 
| 198 | 
            +
                    216.5 => [-1.874670324, 21.895868501, 0.1322863818],
         | 
| 199 | 
            +
                    217.5 => [-1.869760299, 21.948361684, 0.1322595999],
         | 
| 200 | 
            +
                    218.5 => [-1.865113245, 22.00050569, 0.1322404176],
         | 
| 201 | 
            +
                    219.5 => [-1.860734944, 22.052292423, 0.1322293301],
         | 
| 202 | 
            +
                    220.5 => [-1.85663384, 22.103713048, 0.132226801],
         | 
| 203 | 
            +
                    221.5 => [-1.852827186, 22.154756029, 0.1322332005],
         | 
| 204 | 
            +
                    222.5 => [-1.849323204, 22.205412485, 0.1322489931],
         | 
| 205 | 
            +
                    223.5 => [-1.846131607, 22.255673, 0.1322746254],
         | 
| 206 | 
            +
                    224.5 => [-1.843261294, 22.305528306, 0.132310549],
         | 
| 207 | 
            +
                    225.5 => [-1.840720248, 22.354969299, 0.1323572208],
         | 
| 208 | 
            +
                    226.5 => [-1.83851544, 22.403987057, 0.132415103],
         | 
| 209 | 
            +
                    227.5 => [-1.83665586, 22.452571818, 0.132484631],
         | 
| 210 | 
            +
                    228.5 => [-1.835138046, 22.500717781, 0.1325663592],
         | 
| 211 | 
            +
                    229.5 => [-1.833972004, 22.548414372, 0.132660699],
         | 
| 212 | 
            +
                    230.5 => [-1.833157751, 22.595654215, 0.1327681527],
         | 
| 213 | 
            +
                    231.5 => [-1.83269562, 22.642429557, 0.1328892105],
         | 
| 214 | 
            +
                    232.5 => [-1.832584342, 22.688732921, 0.1330243684],
         | 
| 215 | 
            +
                    233.5 => [-1.832820974, 22.734557126, 0.1331741285],
         | 
| 216 | 
            +
                    234.5 => [-1.833400825, 22.779895295, 0.1333389994],
         | 
| 217 | 
            +
                    235.5 => [-1.834317405, 22.824740868, 0.1335194959],
         | 
| 218 | 
            +
                    236.5 => [-1.83555752, 22.869089116, 0.1337161923],
         | 
| 219 | 
            +
                    237.5 => [-1.837119466, 22.912931508, 0.1339295249],
         | 
| 220 | 
            +
                    238.5 => [-1.838987063, 22.956263733, 0.1341600729],
         | 
| 221 | 
            +
                    239.5 => [-1.841146139, 22.999080616, 0.1344083809],
         | 
| 222 | 
            +
                    240.0 => [-1.84233016, 23.020294238, 0.134539365],
         | 
| 223 | 
            +
                    240.5 => [-1.843580575, 23.041377338, 0.1346750014]
         | 
| 224 | 
            +
                  }
         | 
| 225 | 
            +
             | 
| 226 | 
            +
                  Female = {
         | 
| 227 | 
            +
                  	24.0 => [-0.98660853, 16.423396643, 0.085451785],
         | 
| 228 | 
            +
                    24.5 => [-1.024496827, 16.388040561, 0.085025838],
         | 
| 229 | 
            +
                    25.5 => [-1.102698353, 16.318971901, 0.0842140522],
         | 
| 230 | 
            +
                    26.5 => [-1.18396635, 16.252079845, 0.083455124],
         | 
| 231 | 
            +
                    27.5 => [-1.268071036, 16.187346686, 0.0827482842],
         | 
| 232 | 
            +
                    28.5 => [-1.354751525, 16.124754481, 0.0820927371],
         | 
| 233 | 
            +
                    29.5 => [-1.443689692, 16.064287623, 0.0814877172],
         | 
| 234 | 
            +
                    30.5 => [-1.53454192, 16.005930007, 0.0809324482],
         | 
| 235 | 
            +
                    31.5 => [-1.626928093, 15.94966631, 0.0804261754],
         | 
| 236 | 
            +
                    32.5 => [-1.720434829, 15.895481969, 0.0799681758],
         | 
| 237 | 
            +
                    33.5 => [-1.814635262, 15.843361791, 0.0795577348],
         | 
| 238 | 
            +
                    34.5 => [-1.909076262, 15.793291456, 0.0791941867],
         | 
| 239 | 
            +
                    35.5 => [-2.003296102, 15.7452564, 0.0788768946],
         | 
| 240 | 
            +
                    36.5 => [-2.096828937, 15.699241878, 0.0786052551],
         | 
| 241 | 
            +
                    37.5 => [-2.189211877, 15.655232823, 0.0783786964],
         | 
| 242 | 
            +
                    38.5 => [-2.279991982, 15.613213709, 0.0781966743],
         | 
| 243 | 
            +
                    39.5 => [-2.368732949, 15.573168427, 0.078058667],
         | 
| 244 | 
            +
                    40.5 => [-2.455021314, 15.53508019, 0.077964169],
         | 
| 245 | 
            +
                    41.5 => [-2.538471972, 15.498931449, 0.0779126837],
         | 
| 246 | 
            +
                    42.5 => [-2.618732901, 15.464703844, 0.0779037156],
         | 
| 247 | 
            +
                    43.5 => [-2.695488973, 15.432378168, 0.0779367628],
         | 
| 248 | 
            +
                    44.5 => [-2.768464816, 15.401934364, 0.078011309],
         | 
| 249 | 
            +
                    45.5 => [-2.837426693, 15.373351541, 0.0781268172],
         | 
| 250 | 
            +
                    46.5 => [-2.902178205, 15.346608415, 0.0782827393],
         | 
| 251 | 
            +
                    47.5 => [-2.962580386, 15.321681814, 0.0784784485],
         | 
| 252 | 
            +
                    48.5 => [-3.018521987, 15.298548972, 0.0787133246],
         | 
| 253 | 
            +
                    49.5 => [-3.069936555, 15.277186179, 0.0789866938],
         | 
| 254 | 
            +
                    50.5 => [-3.116795864, 15.257569204, 0.0792978405],
         | 
| 255 | 
            +
                    51.5 => [-3.159107331, 15.239673384, 0.079646006],
         | 
| 256 | 
            +
                    52.5 => [-3.196911083, 15.22347371, 0.0800303887],
         | 
| 257 | 
            +
                    53.5 => [-3.230276759, 15.208944907, 0.0804501449],
         | 
| 258 | 
            +
                    54.5 => [-3.259300182, 15.19606152, 0.0809043905],
         | 
| 259 | 
            +
                    55.5 => [-3.284099963, 15.184797987, 0.0813922027],
         | 
| 260 | 
            +
                    56.5 => [-3.30481415, 15.175128708, 0.0819126232],
         | 
| 261 | 
            +
                    57.5 => [-3.321596954, 15.167028107, 0.0824646608],
         | 
| 262 | 
            +
                    58.5 => [-3.334615646, 15.160470684, 0.0830472946],
         | 
| 263 | 
            +
                    59.5 => [-3.344047622, 15.155431067, 0.0836594775],
         | 
| 264 | 
            +
                    60.5 => [-3.35007771, 15.15188405, 0.0843001394],
         | 
| 265 | 
            +
                    61.5 => [-3.352893805, 15.149804788, 0.0849681996],
         | 
| 266 | 
            +
                    62.5 => [-3.352691376, 15.14916825, 0.085662539],
         | 
| 267 | 
            +
                    63.5 => [-3.34966438, 15.149949835, 0.086382035],
         | 
| 268 | 
            +
                    64.5 => [-3.343998803, 15.152125852, 0.0871255909],
         | 
| 269 | 
            +
                    65.5 => [-3.335889574, 15.155671862, 0.0878920466],
         | 
| 270 | 
            +
                    66.5 => [-3.325522491, 15.160564192, 0.0886802643],
         | 
| 271 | 
            +
                    67.5 => [-3.31307846, 15.166779473, 0.0894891056],
         | 
| 272 | 
            +
                    68.5 => [-3.298732648, 15.174294641, 0.090317434],
         | 
| 273 | 
            +
                    69.5 => [-3.282653831, 15.183086936, 0.0911641168],
         | 
| 274 | 
            +
                    70.5 => [-3.265003896, 15.193133896, 0.0920280276],
         | 
| 275 | 
            +
                    71.5 => [-3.245937506, 15.204413348, 0.0929080476],
         | 
| 276 | 
            +
                    72.5 => [-3.225606516, 15.216902957, 0.0938030328],
         | 
| 277 | 
            +
                    73.5 => [-3.204146115, 15.230581504, 0.0947119161],
         | 
| 278 | 
            +
                    74.5 => [-3.181690237, 15.245427448, 0.0956335947],
         | 
| 279 | 
            +
                    75.5 => [-3.158363475, 15.261419664, 0.096566992],
         | 
| 280 | 
            +
                    76.5 => [-3.134282833, 15.278537278, 0.0975110459],
         | 
| 281 | 
            +
                    77.5 => [-3.109557879, 15.296759667, 0.0984647101],
         | 
| 282 | 
            +
                    78.5 => [-3.084290931, 15.316066442, 0.0994269552],
         | 
| 283 | 
            +
                    79.5 => [-3.058577292, 15.336437447, 0.1003967693],
         | 
| 284 | 
            +
                    80.5 => [-3.032505499, 15.357852744, 0.1013731591],
         | 
| 285 | 
            +
                    81.5 => [-3.0061576, 15.380292613, 0.1023551503],
         | 
| 286 | 
            +
                    82.5 => [-2.979609448, 15.403737535, 0.1033417884],
         | 
| 287 | 
            +
                    83.5 => [-2.952930993, 15.428168191, 0.1043321392],
         | 
| 288 | 
            +
                    84.5 => [-2.926186592, 15.453565452, 0.1053252892],
         | 
| 289 | 
            +
                    85.5 => [-2.899435307, 15.479910374, 0.1063203463],
         | 
| 290 | 
            +
                    86.5 => [-2.872731211, 15.507184187, 0.1073164399],
         | 
| 291 | 
            +
                    87.5 => [-2.846123683, 15.535368293, 0.1083127212],
         | 
| 292 | 
            +
                    88.5 => [-2.819657704, 15.564444257, 0.1093083637],
         | 
| 293 | 
            +
                    89.5 => [-2.793374145, 15.594393802, 0.1103025629],
         | 
| 294 | 
            +
                    90.5 => [-2.767310047, 15.625198798, 0.111294537],
         | 
| 295 | 
            +
                    91.5 => [-2.741498897, 15.656841259, 0.1122835261],
         | 
| 296 | 
            +
                    92.5 => [-2.715970894, 15.689303334, 0.113268793],
         | 
| 297 | 
            +
                    93.5 => [-2.690753197, 15.722567299, 0.1142496222],
         | 
| 298 | 
            +
                    94.5 => [-2.665870146, 15.756615553, 0.1152253207],
         | 
| 299 | 
            +
                    95.5 => [-2.641343436, 15.791430622, 0.1161952181],
         | 
| 300 | 
            +
                    96.5 => [-2.617192204, 15.826995169, 0.1171586674],
         | 
| 301 | 
            +
                    97.5 => [-2.593430614, 15.863292407, 0.1181150731],
         | 
| 302 | 
            +
                    98.5 => [-2.570076037, 15.900304841, 0.1190638073],
         | 
| 303 | 
            +
                    99.5 => [-2.547141473, 15.938015446, 0.1200042898],
         | 
| 304 | 
            +
                    100.5 => [-2.524635245, 15.976407871, 0.1209359936],
         | 
| 305 | 
            +
                    101.5 => [-2.502569666, 16.015464834, 0.1218583548],
         | 
| 306 | 
            +
                    102.5 => [-2.48095189, 16.055169844, 0.1227708703],
         | 
| 307 | 
            +
                    103.5 => [-2.459785573, 16.09550688, 0.1236730846],
         | 
| 308 | 
            +
                    104.5 => [-2.439080117, 16.136458809, 0.1245644841],
         | 
| 309 | 
            +
                    105.5 => [-2.418838304, 16.178009551, 0.125444639],
         | 
| 310 | 
            +
                    106.5 => [-2.399063683, 16.220142813, 0.1263131206],
         | 
| 311 | 
            +
                    107.5 => [-2.379756861, 16.262842771, 0.1271695453],
         | 
| 312 | 
            +
                    108.5 => [-2.360920527, 16.306093162, 0.1280135154],
         | 
| 313 | 
            +
                    109.5 => [-2.342557728, 16.349877586, 0.1288446388],
         | 
| 314 | 
            +
                    110.5 => [-2.324663326, 16.39418118, 0.1296626372],
         | 
| 315 | 
            +
                    111.5 => [-2.307240716, 16.438987413, 0.1304671382],
         | 
| 316 | 
            +
                    112.5 => [-2.290287663, 16.484280823, 0.1312578524],
         | 
| 317 | 
            +
                    113.5 => [-2.273803847, 16.530045538, 0.1320344789],
         | 
| 318 | 
            +
                    114.5 => [-2.257782149, 16.57626713, 0.132796819],
         | 
| 319 | 
            +
                    115.5 => [-2.242227723, 16.62292864, 0.1335445247],
         | 
| 320 | 
            +
                    116.5 => [-2.227132805, 16.670015716, 0.1342774356],
         | 
| 321 | 
            +
                    117.5 => [-2.212495585, 16.717512877, 0.1349953236],
         | 
| 322 | 
            +
                    118.5 => [-2.19831275, 16.765404961, 0.1356979956],
         | 
| 323 | 
            +
                    119.5 => [-2.184580762, 16.813676886, 0.1363852755],
         | 
| 324 | 
            +
                    120.5 => [-2.171295888, 16.862313656, 0.1370570042],
         | 
| 325 | 
            +
                    121.5 => [-2.158454232, 16.911300357, 0.1377130391],
         | 
| 326 | 
            +
                    122.5 => [-2.146051754, 16.960622156, 0.1383532537],
         | 
| 327 | 
            +
                    123.5 => [-2.134084303, 17.010264304, 0.1389775374],
         | 
| 328 | 
            +
                    124.5 => [-2.122547629, 17.060212133, 0.1395857952],
         | 
| 329 | 
            +
                    125.5 => [-2.111437411, 17.110451055, 0.1401779469],
         | 
| 330 | 
            +
                    126.5 => [-2.100749266, 17.160966564, 0.1407539274],
         | 
| 331 | 
            +
                    127.5 => [-2.090478774, 17.211744236, 0.1413136859],
         | 
| 332 | 
            +
                    128.5 => [-2.080621484, 17.262769728, 0.1418571858],
         | 
| 333 | 
            +
                    129.5 => [-2.071172932, 17.314028776, 0.1423844043],
         | 
| 334 | 
            +
                    130.5 => [-2.062128649, 17.365507199, 0.1428953318],
         | 
| 335 | 
            +
                    131.5 => [-2.053484173, 17.417190895, 0.143389972],
         | 
| 336 | 
            +
                    132.5 => [-2.045235058, 17.469065845, 0.1438683412],
         | 
| 337 | 
            +
                    133.5 => [-2.03737688, 17.52111811, 0.1443304685],
         | 
| 338 | 
            +
                    134.5 => [-2.029906684, 17.573333469, 0.1447763715],
         | 
| 339 | 
            +
                    135.5 => [-2.022817914, 17.625698688, 0.1452061381],
         | 
| 340 | 
            +
                    136.5 => [-2.016107084, 17.678199868, 0.1456198193],
         | 
| 341 | 
            +
                    137.5 => [-2.009769905, 17.730823397, 0.1460174906],
         | 
| 342 | 
            +
                    138.5 => [-2.003802134, 17.783555746, 0.1463992386],
         | 
| 343 | 
            +
                    139.5 => [-1.998199572, 17.836383471, 0.1467651605],
         | 
| 344 | 
            +
                    140.5 => [-1.992958064, 17.889293209, 0.1471153639],
         | 
| 345 | 
            +
                    141.5 => [-1.988073505, 17.942271684, 0.1474499668],
         | 
| 346 | 
            +
                    142.5 => [-1.983541835, 17.995305704, 0.1477690965],
         | 
| 347 | 
            +
                    143.5 => [-1.979359041, 18.048382162, 0.1480728906],
         | 
| 348 | 
            +
                    144.5 => [-1.975521156, 18.101488036, 0.1483614954],
         | 
| 349 | 
            +
                    145.5 => [-1.972024258, 18.154610394, 0.1486350668],
         | 
| 350 | 
            +
                    146.5 => [-1.968864465, 18.207736386, 0.1488937694],
         | 
| 351 | 
            +
                    147.5 => [-1.966037938, 18.260853253, 0.1491377764],
         | 
| 352 | 
            +
                    148.5 => [-1.963540872, 18.313948324, 0.1493672695],
         | 
| 353 | 
            +
                    149.5 => [-1.961369499, 18.367009017, 0.1495824386],
         | 
| 354 | 
            +
                    150.5 => [-1.959520079, 18.420022839, 0.1497834816],
         | 
| 355 | 
            +
                    151.5 => [-1.9579889, 18.472977388, 0.1499706043],
         | 
| 356 | 
            +
                    152.5 => [-1.956772271, 18.525860352, 0.1501440201],
         | 
| 357 | 
            +
                    153.5 => [-1.95586652, 18.578659513, 0.1503039498],
         | 
| 358 | 
            +
                    154.5 => [-1.955267984, 18.631362745, 0.1504506214],
         | 
| 359 | 
            +
                    155.5 => [-1.954973011, 18.683958013, 0.1505842702],
         | 
| 360 | 
            +
                    156.5 => [-1.954977947, 18.736433381, 0.1507051384],
         | 
| 361 | 
            +
                    157.5 => [-1.955279136, 18.788777004, 0.1508134748],
         | 
| 362 | 
            +
                    158.5 => [-1.955872909, 18.840977134, 0.1509095352],
         | 
| 363 | 
            +
                    159.5 => [-1.956755579, 18.893022121, 0.1509935818],
         | 
| 364 | 
            +
                    160.5 => [-1.957923436, 18.944900411, 0.1510658829],
         | 
| 365 | 
            +
                    161.5 => [-1.959372737, 18.996600549, 0.1511267136],
         | 
| 366 | 
            +
                    162.5 => [-1.9610997, 19.048111179, 0.1511763547],
         | 
| 367 | 
            +
                    163.5 => [-1.963100496, 19.099421046, 0.1512150935],
         | 
| 368 | 
            +
                    164.5 => [-1.96537124, 19.150518994, 0.1512432229],
         | 
| 369 | 
            +
                    165.5 => [-1.967907983, 19.201393971, 0.1512610419],
         | 
| 370 | 
            +
                    166.5 => [-1.970706706, 19.252035026, 0.1512688553],
         | 
| 371 | 
            +
                    167.5 => [-1.973763307, 19.302431312, 0.1512669735],
         | 
| 372 | 
            +
                    168.5 => [-1.977073595, 19.352572085, 0.1512557127],
         | 
| 373 | 
            +
                    169.5 => [-1.980633277, 19.402446707, 0.1512353947],
         | 
| 374 | 
            +
                    170.5 => [-1.984437954, 19.452044646, 0.1512063468],
         | 
| 375 | 
            +
                    171.5 => [-1.988483106, 19.501355476, 0.1511689019],
         | 
| 376 | 
            +
                    172.5 => [-1.992764085, 19.550368876, 0.1511233983],
         | 
| 377 | 
            +
                    173.5 => [-1.997276103, 19.599074637, 0.1510701797],
         | 
| 378 | 
            +
                    174.5 => [-2.002014224, 19.647462655, 0.1510095954],
         | 
| 379 | 
            +
                    175.5 => [-2.00697335, 19.695522937, 0.1509419999],
         | 
| 380 | 
            +
                    176.5 => [-2.012148213, 19.743245597, 0.1508677534],
         | 
| 381 | 
            +
                    177.5 => [-2.017533363, 19.790620862, 0.1507872211],
         | 
| 382 | 
            +
                    178.5 => [-2.023123159, 19.837639068, 0.1507007738],
         | 
| 383 | 
            +
                    179.5 => [-2.028911755, 19.884290662, 0.1506087878],
         | 
| 384 | 
            +
                    180.5 => [-2.034893091, 19.930566203, 0.1505116446],
         | 
| 385 | 
            +
                    181.5 => [-2.041060881, 19.976456361, 0.1504097312],
         | 
| 386 | 
            +
                    182.5 => [-2.047408604, 20.021951917, 0.1503034402],
         | 
| 387 | 
            +
                    183.5 => [-2.05392949, 20.067043765, 0.1501931693],
         | 
| 388 | 
            +
                    184.5 => [-2.060616513, 20.11172291, 0.1500793222],
         | 
| 389 | 
            +
                    185.5 => [-2.067462375, 20.155980469, 0.1499623077],
         | 
| 390 | 
            +
                    186.5 => [-2.074459502, 20.199807672, 0.1498425404],
         | 
| 391 | 
            +
                    187.5 => [-2.081600029, 20.243195857, 0.1497204407],
         | 
| 392 | 
            +
                    188.5 => [-2.088875793, 20.286136477, 0.1495964342],
         | 
| 393 | 
            +
                    189.5 => [-2.096278323, 20.328621093, 0.1494709526],
         | 
| 394 | 
            +
                    190.5 => [-2.103798828, 20.370641376, 0.1493444333],
         | 
| 395 | 
            +
                    191.5 => [-2.111428194, 20.412189106, 0.1492173194],
         | 
| 396 | 
            +
                    192.5 => [-2.119156972, 20.453256172, 0.14909006],
         | 
| 397 | 
            +
                    193.5 => [-2.126975375, 20.49383457, 0.1489631101],
         | 
| 398 | 
            +
                    194.5 => [-2.134873266, 20.5339164, 0.1488369306],
         | 
| 399 | 
            +
                    195.5 => [-2.142840157, 20.573493869, 0.1487119885],
         | 
| 400 | 
            +
                    196.5 => [-2.150865204, 20.612559285, 0.1485887569],
         | 
| 401 | 
            +
                    197.5 => [-2.158937201, 20.651105058, 0.1484677151],
         | 
| 402 | 
            +
                    198.5 => [-2.167044578, 20.689123698, 0.1483493484],
         | 
| 403 | 
            +
                    199.5 => [-2.175176987, 20.726607282, 0.1482341202],
         | 
| 404 | 
            +
                    200.5 => [-2.183317362, 20.763550105, 0.148122614],
         | 
| 405 | 
            +
                    201.5 => [-2.191457792, 20.799943374, 0.1480152488],
         | 
| 406 | 
            +
                    202.5 => [-2.199583649, 20.83578051, 0.1479125643],
         | 
| 407 | 
            +
                    203.5 => [-2.207681525, 20.871054493, 0.1478150781],
         | 
| 408 | 
            +
                    204.5 => [-2.215737645, 20.905758394, 0.1477233147],
         | 
| 409 | 
            +
                    205.5 => [-2.223739902, 20.939884769, 0.1476377678],
         | 
| 410 | 
            +
                    206.5 => [-2.231667995, 20.973428578, 0.1475590832],
         | 
| 411 | 
            +
                    207.5 => [-2.239511942, 21.006381705, 0.1474877162],
         | 
| 412 | 
            +
                    208.5 => [-2.247257081, 21.038737402, 0.1474242097],
         | 
| 413 | 
            +
                    209.5 => [-2.254885145, 21.070489959, 0.1473691743],
         | 
| 414 | 
            +
                    210.5 => [-2.26238209, 21.101632407, 0.147323144],
         | 
| 415 | 
            +
                    211.5 => [-2.269731517, 21.132158447, 0.1472866982],
         | 
| 416 | 
            +
                    212.5 => [-2.276917229, 21.162061708, 0.1472604146],
         | 
| 417 | 
            +
                    213.5 => [-2.283925442, 21.191335097, 0.1472448281],
         | 
| 418 | 
            +
                    214.5 => [-2.290731442, 21.219974716, 0.1472406828],
         | 
| 419 | 
            +
                    215.5 => [-2.29732427, 21.247972623, 0.147248467],
         | 
| 420 | 
            +
                    216.5 => [-2.303687802, 21.275322389, 0.1472687698],
         | 
| 421 | 
            +
                    217.5 => [-2.309799971, 21.302019325, 0.1473022986],
         | 
| 422 | 
            +
                    218.5 => [-2.315651874, 21.328054894, 0.1473495144],
         | 
| 423 | 
            +
                    219.5 => [-2.32121731, 21.353425629, 0.1474112153],
         | 
| 424 | 
            +
                    220.5 => [-2.326481911, 21.378124616, 0.1474879793],
         | 
| 425 | 
            +
                    221.5 => [-2.331428139, 21.402145892, 0.1475804525],
         | 
| 426 | 
            +
                    222.5 => [-2.336038473, 21.425483514, 0.1476892889],
         | 
| 427 | 
            +
                    223.5 => [-2.34029545, 21.448131558, 0.1478151501],
         | 
| 428 | 
            +
                    224.5 => [-2.344181703, 21.470084116, 0.1479587057],
         | 
| 429 | 
            +
                    225.5 => [-2.34768, 21.491335286, 0.1481206332],
         | 
| 430 | 
            +
                    226.5 => [-2.350773286, 21.511879176, 0.1483016185],
         | 
| 431 | 
            +
                    227.5 => [-2.353444725, 21.531709894, 0.1485023554],
         | 
| 432 | 
            +
                    228.5 => [-2.355677743, 21.550821547, 0.1487235462],
         | 
| 433 | 
            +
                    229.5 => [-2.35745607, 21.569208237, 0.1489659018],
         | 
| 434 | 
            +
                    230.5 => [-2.358763788, 21.586864057, 0.1492301415],
         | 
| 435 | 
            +
                    231.5 => [-2.359585369, 21.603783087, 0.1495169936],
         | 
| 436 | 
            +
                    232.5 => [-2.359905726, 21.619959388, 0.1498271951],
         | 
| 437 | 
            +
                    233.5 => [-2.359710258, 21.635387002, 0.1501614923],
         | 
| 438 | 
            +
                    234.5 => [-2.358980464, 21.650061262, 0.150520734],
         | 
| 439 | 
            +
                    235.5 => [-2.357714508, 21.663972695, 0.1509054394],
         | 
| 440 | 
            +
                    236.5 => [-2.355892424, 21.677117355, 0.1513165313],
         | 
| 441 | 
            +
                    237.5 => [-2.353501353, 21.689489352, 0.1517548077],
         | 
| 442 | 
            +
                    238.5 => [-2.350528726, 21.701082884, 0.1522210861],
         | 
| 443 | 
            +
                    239.5 => [-2.346962247, 21.711892252, 0.1527162055],
         | 
| 444 | 
            +
                    240.0 => [-2.34495843, 21.716999342, 0.152974718],
         | 
| 445 | 
            +
                    240.5 => [-2.342796948, 21.721909734, 0.1532408716]
         | 
| 446 | 
            +
                  }
         | 
| 447 | 
            +
                end
         | 
| 448 | 
            +
              end
         | 
| 449 | 
            +
            end
         | 
| @@ -0,0 +1,97 @@ | |
| 1 | 
            +
            # The following were adapted from 
         | 
| 2 | 
            +
            # http://www.fourmilab.ch/rpkp/experiments/analysis/zCalc.html?
         | 
| 3 | 
            +
            # Original comments below:
         | 
| 4 | 
            +
            #
         | 
| 5 | 
            +
            #     The following functions for calculating normal and
         | 
| 6 | 
            +
            #     chi-square probabilities and critical values were adapted by
         | 
| 7 | 
            +
            #     John Walker from C implementations
         | 
| 8 | 
            +
            #     written by Gary Perlman of Wang Institute, Tyngsboro, MA
         | 
| 9 | 
            +
            #     01879.  Both the original C code and this edition
         | 
| 10 | 
            +
            #     are in the public domain.  */
         | 
| 11 | 
            +
            # 
         | 
| 12 | 
            +
            #     POZ  --  probability of normal z value
         | 
| 13 | 
            +
            # 
         | 
| 14 | 
            +
            #     Adapted from a polynomial approximation in:
         | 
| 15 | 
            +
            #             Ibbetson D, Algorithm 209
         | 
| 16 | 
            +
            #             Collected Algorithms of the CACM 1963 p. 616
         | 
| 17 | 
            +
            #     Note:
         | 
| 18 | 
            +
            #             This routine has six digit accuracy, so it is only useful for absolute
         | 
| 19 | 
            +
            #             z values <= 6.  For z values > to 6.0, poz() returns 0.0.
         | 
| 20 | 
            +
            #
         | 
| 21 | 
            +
            module HealthStats
         | 
| 22 | 
            +
              module Statistics
         | 
| 23 | 
            +
                extend self
         | 
| 24 | 
            +
              
         | 
| 25 | 
            +
                Z_MAX = 6
         | 
| 26 | 
            +
                Z_EPSILON = 0.000001
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                def poz(z)
         | 
| 29 | 
            +
                  if z == 0.0
         | 
| 30 | 
            +
                    x = 0.0
         | 
| 31 | 
            +
                  else
         | 
| 32 | 
            +
                    y = 0.5 * z.abs
         | 
| 33 | 
            +
                
         | 
| 34 | 
            +
                    if y > (Z_MAX * 0.5)
         | 
| 35 | 
            +
                      x = 1.0
         | 
| 36 | 
            +
                    elsif y < 1.0
         | 
| 37 | 
            +
                      w = y ** 2
         | 
| 38 | 
            +
                      x = ((((((((0.000124818987 * w -
         | 
| 39 | 
            +
                                  0.001075204047) * w + 0.005198775019) * w -
         | 
| 40 | 
            +
                                  0.019198292004) * w + 0.059054035642) * w -
         | 
| 41 | 
            +
                                  0.151968751364) * w + 0.319152932694) * w -
         | 
| 42 | 
            +
                                  0.531923007300) * w + 0.797884560593) * y * 2.0
         | 
| 43 | 
            +
                    else
         | 
| 44 | 
            +
                      y -= 2.0
         | 
| 45 | 
            +
                      x = (((((((((((((-0.000045255659 * y +
         | 
| 46 | 
            +
                                        0.000152529290) * y - 0.000019538132) * y -
         | 
| 47 | 
            +
                                        0.000676904986) * y + 0.001390604284) * y -
         | 
| 48 | 
            +
                                        0.000794620820) * y - 0.002034254874) * y +
         | 
| 49 | 
            +
                                        0.006549791214) * y - 0.010557625006) * y +
         | 
| 50 | 
            +
                                        0.011630447319) * y - 0.009279453341) * y +
         | 
| 51 | 
            +
                                        0.005353579108) * y - 0.002141268741) * y +
         | 
| 52 | 
            +
                                        0.000535310849) * y + 0.999936657524
         | 
| 53 | 
            +
                    end
         | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
              
         | 
| 56 | 
            +
                  z > 0.0 ? ((x + 1.0) * 0.5) : ((1.0 - x) * 0.5)
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                def critz(p)
         | 
| 60 | 
            +
                  minz = -Z_MAX
         | 
| 61 | 
            +
                  maxz = Z_MAX
         | 
| 62 | 
            +
                  zval = 0.0
         | 
| 63 | 
            +
              
         | 
| 64 | 
            +
                  return -1 if p < 0.0 || p > 1.0
         | 
| 65 | 
            +
              
         | 
| 66 | 
            +
                  while maxz - minz > Z_EPSILON
         | 
| 67 | 
            +
                    pval = poz(zval)
         | 
| 68 | 
            +
                
         | 
| 69 | 
            +
                    if pval > p
         | 
| 70 | 
            +
                      maxz = zval
         | 
| 71 | 
            +
                    else
         | 
| 72 | 
            +
                      minz = zval
         | 
| 73 | 
            +
                    end
         | 
| 74 | 
            +
                
         | 
| 75 | 
            +
                    zval = (maxz + minz) * 0.5
         | 
| 76 | 
            +
                  end
         | 
| 77 | 
            +
              
         | 
| 78 | 
            +
                  zval
         | 
| 79 | 
            +
                end
         | 
| 80 | 
            +
                
         | 
| 81 | 
            +
                 # LMS method
         | 
| 82 | 
            +
                 # Box GE, Cox DR. An analysis of transformations. J Roy Stat Soc, Series 
         | 
| 83 | 
            +
                 #      B. 26:211-252, 1964.
         | 
| 84 | 
            +
                 # Cole TJ. The LMS method for constructing normalized growth standards. 
         | 
| 85 | 
            +
                 #      Eur J Clin Nutr. 44: 45-60, 1990
         | 
| 86 | 
            +
                 # Cole TJ. Fitting smoothed centile curves to reference data. 
         | 
| 87 | 
            +
                 #      Royal Stat Soc. 151:385-418, 1988
         | 
| 88 | 
            +
                 
         | 
| 89 | 
            +
                def lms(x, l, m, s)
         | 
| 90 | 
            +
                  (((x / m) ** l) - 1) / (l * s)
         | 
| 91 | 
            +
                end
         | 
| 92 | 
            +
                
         | 
| 93 | 
            +
                # puts poz(lms(17.08, -1.924100169, 16.494427632, 0.0792339937)) * 100
         | 
| 94 | 
            +
              end
         | 
| 95 | 
            +
            end
         | 
| 96 | 
            +
              # puts critz(0.85)
         | 
| 97 | 
            +
              # 
         | 
| Binary file | 
| @@ -0,0 +1,119 @@ | |
| 1 | 
            +
            $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
         | 
| 2 | 
            +
            require 'health_stats'
         | 
| 3 | 
            +
            require 'activesupport'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            REQUIRED_ATTRIBUTES = [:height, :weight, :gender, :dob]
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            describe 'HealthStats' do
         | 
| 8 | 
            +
              describe 'required attributes' do
         | 
| 9 | 
            +
                before do
         | 
| 10 | 
            +
                  @klass = Class.new do
         | 
| 11 | 
            +
                    include HealthStats
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
                
         | 
| 15 | 
            +
                REQUIRED_ATTRIBUTES.each do |attribute|
         | 
| 16 | 
            +
                  it "should include #{attribute}" do
         | 
| 17 | 
            +
                    person = @klass.new
         | 
| 18 | 
            +
                    lambda { person.send(attribute) }.should.raise(HealthStats::AttributeError)
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
              
         | 
| 23 | 
            +
              describe 'included methods' do
         | 
| 24 | 
            +
                before do
         | 
| 25 | 
            +
                  @klass = Class.new do
         | 
| 26 | 
            +
                    include HealthStats
         | 
| 27 | 
            +
                    attr_accessor *REQUIRED_ATTRIBUTES
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
                  
         | 
| 30 | 
            +
                  @person = @klass.new
         | 
| 31 | 
            +
                  @person.height = 53
         | 
| 32 | 
            +
                  @person.weight = 100
         | 
| 33 | 
            +
                  @person.gender = 'f'
         | 
| 34 | 
            +
                  @person.dob = 14.years.ago - 5.days
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
                
         | 
| 37 | 
            +
                describe '#age_methods' do
         | 
| 38 | 
            +
                  it "should return nil if dob is nil" do
         | 
| 39 | 
            +
                    @person.dob = nil
         | 
| 40 | 
            +
                    @person.age.should.be.nil
         | 
| 41 | 
            +
                    @person.age_in_years.should.be.nil
         | 
| 42 | 
            +
                    @person.age_in_months.should.be.nil
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
                  
         | 
| 45 | 
            +
                  it "should return years as integer" do
         | 
| 46 | 
            +
                    @person.age_in_years.should == 14
         | 
| 47 | 
            +
                    @person.age.should == 14
         | 
| 48 | 
            +
                    
         | 
| 49 | 
            +
                    @person.dob = 1.month.ago
         | 
| 50 | 
            +
                    @person.age_in_years.should == 0
         | 
| 51 | 
            +
                    @person.age.should == 0
         | 
| 52 | 
            +
                    
         | 
| 53 | 
            +
                    @person.dob = 14.months.ago
         | 
| 54 | 
            +
                    @person.age_in_years.should == 1
         | 
| 55 | 
            +
                    @person.age.should == 1
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
                  
         | 
| 58 | 
            +
                  it "should include age in months as a float in .5 increments" do
         | 
| 59 | 
            +
                    @person.age_in_months.should == 168.0
         | 
| 60 | 
            +
                    
         | 
| 61 | 
            +
                    @person.dob = 1.month.ago + 2.days
         | 
| 62 | 
            +
                    @person.age_in_months.should == 0.5
         | 
| 63 | 
            +
                    
         | 
| 64 | 
            +
                    @person.dob = 1.month.ago - 3.days
         | 
| 65 | 
            +
                    @person.age_in_months.should == 1.0
         | 
| 66 | 
            +
                    
         | 
| 67 | 
            +
                    @person.dob = 1.year.ago - 5.days
         | 
| 68 | 
            +
                    @person.age_in_months.should == 12.0
         | 
| 69 | 
            +
                    
         | 
| 70 | 
            +
                    @person.dob = 1.year.ago + 5.days
         | 
| 71 | 
            +
                    @person.age_in_months.should == 11.5
         | 
| 72 | 
            +
                    
         | 
| 73 | 
            +
                    @person.dob = 2.years.ago - 1.month - 18.days
         | 
| 74 | 
            +
                    @person.age_in_months.should. == 25.5
         | 
| 75 | 
            +
                  end
         | 
| 76 | 
            +
                  
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
                
         | 
| 79 | 
            +
                describe '#bmi' do
         | 
| 80 | 
            +
                  [:height, :weight].each do |attribute|
         | 
| 81 | 
            +
                    it "should return nil if #{attribute} is nil" do
         | 
| 82 | 
            +
                      @person.send("#{attribute}=", nil)
         | 
| 83 | 
            +
                      @person.bmi.should.be.nil
         | 
| 84 | 
            +
                    end
         | 
| 85 | 
            +
                  end
         | 
| 86 | 
            +
                
         | 
| 87 | 
            +
                  it 'should return the correct bmi (precision 2)' do
         | 
| 88 | 
            +
                    @person.bmi.should == 25.02
         | 
| 89 | 
            +
                  end
         | 
| 90 | 
            +
                end
         | 
| 91 | 
            +
              
         | 
| 92 | 
            +
                describe '#bmi_percentile' do    
         | 
| 93 | 
            +
                  [:dob, :gender].each do |attribute|
         | 
| 94 | 
            +
                    it "should return nil if #{attribute} is nil" do
         | 
| 95 | 
            +
                      @person.send("#{attribute}=", nil)
         | 
| 96 | 
            +
                      @person.bmi_percentile.should.be.nil
         | 
| 97 | 
            +
                    end
         | 
| 98 | 
            +
                  end
         | 
| 99 | 
            +
                  
         | 
| 100 | 
            +
                  it "should return nil if outside cdc date range" do
         | 
| 101 | 
            +
                    @person.dob = 1.month.ago
         | 
| 102 | 
            +
                    @person.bmi_percentile.should.be.nil
         | 
| 103 | 
            +
                    
         | 
| 104 | 
            +
                    @person.dob == 20.years.ago - 10.days - 2.months
         | 
| 105 | 
            +
                    @person.bmi_percentile.should.be.nil
         | 
| 106 | 
            +
                  end
         | 
| 107 | 
            +
                  
         | 
| 108 | 
            +
                  it "should return percentile (precision 2)" do
         | 
| 109 | 
            +
                    @person.bmi_percentile.should == 91.02
         | 
| 110 | 
            +
                    
         | 
| 111 | 
            +
                    @person.gender = 'm'
         | 
| 112 | 
            +
                    @person.dob = 2.years.ago - 1.month - 18.days
         | 
| 113 | 
            +
                    @person.weight = 14
         | 
| 114 | 
            +
                    @person.height = 24
         | 
| 115 | 
            +
                    @person.bmi_percentile.should == 66.49
         | 
| 116 | 
            +
                  end
         | 
| 117 | 
            +
                end
         | 
| 118 | 
            +
              end
         | 
| 119 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,77 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification 
         | 
| 2 | 
            +
            name: health_stats
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            +
              version: 0.0.1
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors: 
         | 
| 7 | 
            +
            - Mark Martin
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            date: 2009-12-03 00:00:00 -08:00
         | 
| 13 | 
            +
            default_executable: 
         | 
| 14 | 
            +
            dependencies: 
         | 
| 15 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 16 | 
            +
              name: activesupport
         | 
| 17 | 
            +
              type: :development
         | 
| 18 | 
            +
              version_requirement: 
         | 
| 19 | 
            +
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 20 | 
            +
                requirements: 
         | 
| 21 | 
            +
                - - ">="
         | 
| 22 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 23 | 
            +
                    version: "2.3"
         | 
| 24 | 
            +
                version: 
         | 
| 25 | 
            +
            description: 
         | 
| 26 | 
            +
            email: assplecake@gmail.com
         | 
| 27 | 
            +
            executables: []
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            extensions: []
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            extra_rdoc_files: 
         | 
| 32 | 
            +
            - LICENSE
         | 
| 33 | 
            +
            - README.md
         | 
| 34 | 
            +
            files: 
         | 
| 35 | 
            +
            - LICENSE
         | 
| 36 | 
            +
            - README.md
         | 
| 37 | 
            +
            - Rakefile
         | 
| 38 | 
            +
            - VERSION
         | 
| 39 | 
            +
            - health_stats.gemspec
         | 
| 40 | 
            +
            - lib/health_stats.rb
         | 
| 41 | 
            +
            - lib/health_stats/age.rb
         | 
| 42 | 
            +
            - lib/health_stats/bmi.rb
         | 
| 43 | 
            +
            - lib/health_stats/cdc_data.rb
         | 
| 44 | 
            +
            - lib/health_stats/cdc_data/bmi.rb
         | 
| 45 | 
            +
            - lib/health_stats/statistics.rb
         | 
| 46 | 
            +
            - pkg/health_stats-0.0.1.gem
         | 
| 47 | 
            +
            - spec/spec_health_stats.rb
         | 
| 48 | 
            +
            has_rdoc: true
         | 
| 49 | 
            +
            homepage: http://github.com/assplecake/healthdata
         | 
| 50 | 
            +
            licenses: []
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            post_install_message: 
         | 
| 53 | 
            +
            rdoc_options: 
         | 
| 54 | 
            +
            - --charset=UTF-8
         | 
| 55 | 
            +
            require_paths: 
         | 
| 56 | 
            +
            - lib
         | 
| 57 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 58 | 
            +
              requirements: 
         | 
| 59 | 
            +
              - - ">="
         | 
| 60 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 61 | 
            +
                  version: "0"
         | 
| 62 | 
            +
              version: 
         | 
| 63 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 64 | 
            +
              requirements: 
         | 
| 65 | 
            +
              - - ">="
         | 
| 66 | 
            +
                - !ruby/object:Gem::Version 
         | 
| 67 | 
            +
                  version: "0"
         | 
| 68 | 
            +
              version: 
         | 
| 69 | 
            +
            requirements: []
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            rubyforge_project: 
         | 
| 72 | 
            +
            rubygems_version: 1.3.5
         | 
| 73 | 
            +
            signing_key: 
         | 
| 74 | 
            +
            specification_version: 3
         | 
| 75 | 
            +
            summary: Convenience methods for age, bmi, bmi percentile
         | 
| 76 | 
            +
            test_files: 
         | 
| 77 | 
            +
            - spec/spec_health_stats.rb
         |