| 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'} || {}
MC/DC0%0/1
$arg->{'raw'} || {}
$arg->{'raw'}
Truth table50%1/2
A
A= $arg->{'raw'}
| |||||||||||||||||||||||||||||
| 12 | my $self = { | ||||||||||||||||||||||||||||
| 13 | source => $arg->{source}, | ||||||||||||||||||||||||||||
| 14 | 444 | raw => { %{$raw} }, | |||||||||||||||||||||||||||
| 15 | 444 | ▶ | values => { %{$raw} }, | ||||||||||||||||||||||||||
|
Condition100%2/2
$arg->{'redcap_dict'} || {}
MC/DC100%1/1
$arg->{'redcap_dict'} || {}
$arg->{'redcap_dict'}
Truth table100%2/2
A
A= $arg->{'redcap_dict'}
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 46490 | ▶ | return $value unless lc( $self->{source} // q{} ) eq 'redcap'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->{"source"} // ""
MC/DC0%0/1
$self->{"source"} // ""
$self->{"source"}
Truth table50%1/2
A
A= $self->{"source"}
| |||||||||||||||||||||||||||||
| 32 | 32445 | ▶ | return $value unless $self->has_choice_labels($field); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("has_choice_labels")
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")
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("field_meta")
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")
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
builtin::blessed($self->{"redcap_dict"}) and $self->{"redcap_dict"}->can("field_note")
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")
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||