line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
714
|
use 5.010; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
49
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
5
|
1
|
|
|
1
|
|
18
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Medical::Growth::NHANES_2000; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our ($VERSION) = '1.10'; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
472
|
use Moo::Lax; # Vanilla Moo considered harmful |
|
1
|
|
|
|
|
13121
|
|
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
1660
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use Module::Runtime; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
15
|
|
|
|
|
|
|
use Module::Pluggable |
16
|
1
|
|
|
|
|
7
|
require => 1, |
17
|
|
|
|
|
|
|
search_path => 'Medical::Growth::NHANES_2000', |
18
|
1
|
|
|
1
|
|
28
|
except => 'Medical::Growth::NHANES_2000::Base'; |
|
1
|
|
|
|
|
2
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub measure_classes { |
21
|
1
|
|
|
1
|
1
|
13400
|
shift->plugins; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub measure_class_name_for { |
25
|
31
|
|
|
31
|
1
|
6213
|
my ( $self, %criteria ) = @_; |
26
|
31
|
|
|
|
|
38
|
my ( $measure, $norm, $ages, $sex, $class ); |
27
|
|
|
|
|
|
|
|
28
|
31
|
100
|
66
|
|
|
97
|
$criteria{age_group} //= $criteria{age} if exists $criteria{age}; |
29
|
31
|
100
|
100
|
|
|
588
|
croak('Need to specify measure, age_group, and sex') |
|
|
|
100
|
|
|
|
|
30
|
|
|
|
|
|
|
unless exists $criteria{measure} |
31
|
|
|
|
|
|
|
and exists $criteria{age_group} |
32
|
|
|
|
|
|
|
and exists $criteria{sex}; |
33
|
|
|
|
|
|
|
|
34
|
28
|
100
|
100
|
|
|
385
|
if ( $criteria{measure} =~ /^(\w+)(?:\s+|_)(?:for|by)(?:\s+|_)(\w+)/i |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
35
|
|
|
|
|
|
|
or $criteria{measure} =~ |
36
|
|
|
|
|
|
|
/^(Head Circumference)(?:\s+|_)(?:for|by)(?:\s+|_)(Age)/i ) |
37
|
|
|
|
|
|
|
{ |
38
|
9
|
|
|
|
|
32
|
( $measure, $norm ) = ( $1, $2 ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
elsif ( $criteria{measure} =~ /(\w+)\s+(\w+)/i ) { |
41
|
2
|
|
|
|
|
6
|
( $measure, $norm ) = ( $1, $2 ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
elsif ( |
44
|
|
|
|
|
|
|
$criteria{measure} =~ |
45
|
|
|
|
|
|
|
/^(Weight|Wg?t|Height|Hg?t|Stature|Stat|Length|Len|BMI|Head|HC|OFC) |
46
|
|
|
|
|
|
|
(Age|Height|Hg?t|Length|Len)/ix |
47
|
|
|
|
|
|
|
) |
48
|
|
|
|
|
|
|
{ |
49
|
16
|
|
|
|
|
54
|
( $measure, $norm ) = ( $1, $2 ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
1
|
|
|
|
|
214
|
croak "Don't understand measure spec '$criteria{measure}'"; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
27
|
100
|
66
|
|
|
135
|
if ( $criteria{age_group} =~ /^(?:infant|toddler|recumbent|neonat)/i ) { |
|
|
100
|
66
|
|
|
|
|
|
|
100
|
|
|
|
|
|
56
|
14
|
|
|
|
|
24
|
$ages = 'Infant'; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
elsif ( $criteria{age_group} =~ /^(?:child|school|adol)/i ) { |
59
|
10
|
|
|
|
|
12
|
$ages = 'Child'; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
elsif ( $criteria{age_group} =~ /^[0-9.]+$/ |
62
|
|
|
|
|
|
|
and ( $criteria{age_group} eq '0' or $criteria{age_group} > 0 ) ) |
63
|
|
|
|
|
|
|
{ |
64
|
2
|
100
|
|
|
|
8
|
$ages = $criteria{age_group} >= 24 ? 'Child' : 'Infant'; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
else { |
67
|
1
|
|
|
|
|
118
|
croak "Don't understand age group '$criteria{age_group}'"; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Sigh - 5.18 makes this warn |
71
|
1
|
|
|
1
|
|
578
|
no if $] >= 5.017011, warnings => 'experimental::smartmatch'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
72
|
|
|
|
|
|
|
|
73
|
26
|
|
|
|
|
35
|
given ($measure) { |
74
|
26
|
|
|
|
|
53
|
when (/^W/i) { $measure = 'Weight'; } |
|
6
|
|
|
|
|
13
|
|
75
|
20
|
|
|
|
|
49
|
when (/^O|^Hea|^HC/i) { $measure = 'HC'; } |
|
3
|
|
|
|
|
9
|
|
76
|
17
|
100
|
|
|
|
32
|
when (/^[HLS]/i) { $measure = $ages eq 'Infant' ? 'Length' : 'Height'; } |
|
8
|
|
|
|
|
29
|
|
77
|
9
|
|
|
|
|
22
|
when (/^B/i) { $measure = 'BMI'; } |
|
9
|
|
|
|
|
28
|
|
78
|
0
|
|
|
|
|
0
|
default { |
79
|
0
|
|
|
|
|
0
|
croak "Don't understand measure name '$measure' in " |
80
|
|
|
|
|
|
|
. "'$criteria{measure}'"; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
26
|
|
|
|
|
30
|
given ($norm) { |
85
|
26
|
|
|
|
|
42
|
when (/^A/i) { $norm = 'Age'; } |
|
23
|
|
|
|
|
31
|
|
86
|
3
|
100
|
|
|
|
7
|
when (/^[HL]/i) { $norm = $ages eq 'Infant' ? 'Length' : 'Height'; } |
|
2
|
|
|
|
|
6
|
|
87
|
1
|
|
|
|
|
2
|
default { |
88
|
1
|
|
|
|
|
119
|
croak "Don't understand norm name in " . "'$criteria{measure}'"; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
25
|
100
|
|
|
|
75
|
if ( $criteria{sex} =~ /^[MB1]/i ) { |
|
|
100
|
|
|
|
|
|
93
|
15
|
|
|
|
|
19
|
$sex = 'Male'; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
elsif ( $criteria{sex} =~ /^[FG2]/i ) { |
96
|
9
|
|
|
|
|
9
|
$sex = 'Female'; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
else { |
99
|
1
|
|
|
|
|
136
|
croak "Don't understand sex '$criteria{sex}'"; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
24
|
|
|
|
|
57
|
$class = |
103
|
|
|
|
|
|
|
'Medical::Growth::NHANES_2000::' |
104
|
|
|
|
|
|
|
. $measure . '_for_' |
105
|
|
|
|
|
|
|
. $norm . '::' |
106
|
|
|
|
|
|
|
. $ages . '::' |
107
|
|
|
|
|
|
|
. $sex; |
108
|
24
|
|
|
|
|
63
|
return $class; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub have_measure_class_for { |
112
|
2
|
|
|
2
|
1
|
678
|
my $self = shift; |
113
|
2
|
|
|
|
|
7
|
my $class = $self->measure_class_name_for(@_); |
114
|
2
|
50
|
|
|
|
7
|
return unless $class; # Never happens in this class; just kind to subclasses |
115
|
2
|
100
|
|
|
|
3
|
eval { Module::Runtime::use_module($class) } or undef; |
|
2
|
|
|
|
|
9
|
|
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub measure_class_for { |
119
|
19
|
|
|
19
|
1
|
31353
|
my $self = shift; |
120
|
19
|
|
|
|
|
46
|
my $class = $self->measure_class_name_for(@_); |
121
|
19
|
|
|
|
|
52
|
Module::Runtime::use_module($class)->new; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
__END__ |