lib/Convert/Pheno/Tabular/Record.pm

filter: Statementstmt 100% 48 / 48 Branchbran 92.8% 13 / 14 Conditioncond 60.0% 9 / 15 MC/DCmcdc 33.3% 3 / 9 Subroutinesub 100% 14 / 14 Podpod 0.0% 0 / 9 totaltotal 79.8% 87 / 109 CC 14 SCAR 11.2
CC
14
Cov
91%
value
6.0
has_choice_labels
3.5
field_meta
3.0
CRAP 3.1
« lib/Convert/Pheno/Mapping/Metadata.pm ↑ Summary lib/Convert/Pheno/Source/Result.pm »
1 package Convert::Pheno::Tabular::Record;
2  
3 136 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 136 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 136 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 136 ▶use Convert::Pheno::Mapping::Shared qw(dotify_and_coerce_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 136 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 444 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
10 444 my ( $class, $arg ) = @_;
11 444 ▶ my $raw = $arg->{raw} || {};
Condition50%1/2
$arg->{'raw'} || {}
l!l
4440
MC/DC0%0/1
$arg->{'raw'} || {}
$arg->{'raw'}
Truth table50%1/2
A
A= $arg->{'raw'}
Aresult
11
00
12 my $self = {
13 source => $arg->{source},
14 444 raw => { %{$raw} },
15 444 ▶ values => { %{$raw} },
Condition100%2/2
$arg->{'redcap_dict'} || {}
l!l
180264
MC/DC100%1/1
$arg->{'redcap_dict'} || {}
$arg->{'redcap_dict'}
Truth table100%2/2
A
A= $arg->{'redcap_dict'}
Aresult
11
00
16 redcap_dict => $arg->{redcap_dict} || {},
17 444 };
18 444 return bless $self, $class;
19 }
20  
21 22057 ▶sub raw_value {
Subroutine raw_value: called CC=1 SCAR=0.0
Pod undocumented
22 22057 my ( $self, $field ) = @_;
23 22057 return $self->{raw}{$field};
24 }
25  
26 62065 ▶sub value {
Subroutine value: called CC=6 SCAR=17.9
Pod undocumented
27 62065 my ( $self, $field ) = @_;
28 62065 my $value = $self->{values}{$field};
29 62065 ▶ return undef unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 15575 46490 62065
30  
31 46490 ▶ return $value unless lc( $self->{source} // q{} ) eq 'redcap';
Branch: 1 branch
BranchTrueFalseTotal
unless lc($self->{"source"} // "") eq "redcap" 14045 32445 46490
Condition50%1/2
$self->{"source"} // ""
l!l
464900
MC/DC0%0/1
$self->{"source"} // ""
$self->{"source"}
Truth table50%1/2
A
A= $self->{"source"}
Aresult
11
00
32 32445 ▶ return $value unless $self->has_choice_labels($field);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_choice_labels($field) 24980 7465 32445
33  
34 7465 my $mapped = $self->{redcap_dict}->choice_label( $field, $value );
35  
36 7465 ▶ return defined $mapped ? dotify_and_coerce_number($mapped) : $value;
Branch: 1 branch
BranchTrueFalseTotal
defined $mapped ? : 2670 4795 7465
37 }
38  
39 27810 ▶sub working_value {
Subroutine working_value: called CC=1 SCAR=0.0
Pod undocumented
40 27810 my ( $self, $field ) = @_;
41 27810 return $self->{values}{$field};
42 }
43  
44 12437 ▶sub set_value {
Subroutine set_value: called CC=1 SCAR=0.0
Pod undocumented
45 12437 my ( $self, $field, $value ) = @_;
46 12437 $self->{values}{$field} = $value;
47 12437 return 1;
48 }
49  
50 32445 ▶sub has_choice_labels {
Subroutine has_choice_labels: called CC=3 SCAR=12.5
Pod undocumented
51 32445 my ( $self, $field ) = @_;
52 return 0 unless blessed( $self->{redcap_dict} )
53 32445 ▶ && $self->{redcap_dict}->can('has_choice_labels');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("has_choice_labels") 0 32445 32445
Condition33%1/3
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("has_choice_labels")
!ll&&!rl&&r
0032445
MC/DC0%0/2
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("has_choice_labels")
builtin::blessed($self->{"redcap_dict"}) $self->{"redcap_dict"}->can("has_choice_labels")
Truth table33%1/3
A and B
A= builtin::blessed($self->{"redcap_dict"})B= $self->{"redcap_dict"}->can("has_choice_labels")
ABresult
0X0
100
111
54 32445 return $self->{redcap_dict}->has_choice_labels($field);
55 }
56  
57 5925 ▶sub field_meta {
Subroutine field_meta: called CC=3 SCAR=11.0
Pod undocumented
58 5925 my ( $self, $field ) = @_;
59 return unless blessed( $self->{redcap_dict} )
60 5925 ▶ && $self->{redcap_dict}->can('field_meta');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("field_meta") 10 5915 5925
Condition66%2/3
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("field_meta")
!ll&&!rl&&r
1005915
MC/DC50%1/2
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("field_meta")
builtin::blessed($self->{"redcap_dict"}) $self->{"redcap_dict"}->can("field_meta")
Truth table66%2/3
A and B
A= builtin::blessed($self->{"redcap_dict"})B= $self->{"redcap_dict"}->can("field_meta")
ABresult
0X0
100
111
61 5915 return $self->{redcap_dict}->field_meta($field);
62 }
63  
64 3746 ▶sub field_note {
Subroutine field_note: called CC=3 SCAR=11.0
Pod undocumented
65 3746 my ( $self, $field ) = @_;
66 return unless blessed( $self->{redcap_dict} )
67 3746 ▶ && $self->{redcap_dict}->can('field_note');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("field_note") 961 2785 3746
Condition66%2/3
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("field_note")
!ll&&!rl&&r
96102785
MC/DC50%1/2
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("field_note")
builtin::blessed($self->{"redcap_dict"}) $self->{"redcap_dict"}->can("field_note")
Truth table66%2/3
A and B
A= builtin::blessed($self->{"redcap_dict"})B= $self->{"redcap_dict"}->can("field_note")
ABresult
0X0
100
111
68 2785 return $self->{redcap_dict}->field_note($field);
69 }
70  
71 424 ▶sub columns_snapshot {
Subroutine columns_snapshot: called CC=1 SCAR=0.0
Pod undocumented
72 424 my ($self) = @_;
73 424 return { %{ $self->{raw} } };
74 }
75  
76 136 1;
« lib/Convert/Pheno/Mapping/Metadata.pm ↑ Summary lib/Convert/Pheno/Source/Result.pm »