| 1 | package Convert::Pheno::CDISC::ODM::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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 136 | ▶ | use JSON::PP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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 | 136 | ▶ | use Convert::Pheno::Mapping::Shared qw(dotify_and_coerce_number); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 136 | my $JSON = JSON::PP->new->canonical; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 221 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=21 SCAR=31.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 221 | my ( $class, $arg ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 221 | ▶ | $arg ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg ||= {}
MC/DC0%0/1
$arg ||= {}
$arg
Truth table50%1/2
A
A= $arg
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | my $self = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 221 | ▶ | context => { %{ $arg->{context} || {} } }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg->{'context'} || {}
MC/DC0%0/1
$arg->{'context'} || {}
$arg->{'context'}
Truth table50%1/2
A
A= $arg->{'context'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 221 | ▶ | context_order => [ @{ $arg->{context_order} || [] } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$arg->{'context_order'} || []
MC/DC100%1/1
$arg->{'context_order'} || []
$arg->{'context_order'}
Truth table100%2/2
A
A= $arg->{'context_order'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 221 | ▶ | descriptor => { %{ $arg->{descriptor} || {} } }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$arg->{'descriptor'} || {}
$arg->{'record_profile'} || 'cdisc-odm'
MC/DC100%1/1
$arg->{'descriptor'} || {}
$arg->{'descriptor'}
MC/DC100%1/1
$arg->{'record_profile'} || 'cdisc-odm'
$arg->{'record_profile'}
Truth table100%2/2
A
A= $arg->{'descriptor'}
Truth table100%2/2
A
A= $arg->{'record_profile'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | entries => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | field_order => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | groups => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | metadata => $arg->{metadata}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | overrides => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 221 | recordProfile => $arg->{record_profile} || 'cdisc-odm', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | sourceFormat => 'cdisc-odm', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 221 | my ( %seen_field, %seen_group ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 221 | ▶ | for my $group ( @{ $arg->{groups} || [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg->{'groups'} || []
MC/DC0%0/1
$arg->{'groups'} || []
$arg->{'groups'}
Truth table50%1/2
A
A= $arg->{'groups'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 9985 | ▶ | my $context = { %{ $group->{context} || {} } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$group->{'context'} || {}
MC/DC0%0/1
$group->{'context'} || {}
$group->{'context'}
Truth table50%1/2
A
A= $group->{'context'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 9985 | my $identity = $JSON->encode($context); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | die "Duplicate CDISC-ODM item-group occurrence " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | . _format_context($context) . "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 9985 | ▶ | if $seen_group{$identity}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 9985 | my $group_index = @{ $self->{groups} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 9985 | push @{ $self->{groups} }, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | context => $context, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | itemOrder => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 9985 | ▶ | scopePath => [ @{ $group->{scopePath} || [] } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$group->{'scopePath'} || []
MC/DC0%0/1
$group->{'scopePath'} || []
$group->{'scopePath'}
Truth table50%1/2
A
A= $group->{'scopePath'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 9985 | my %seen_item; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 9985 | ▶ | for my $item ( @{ $group->{items} || [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$group->{'items'} || []
MC/DC0%0/1
$group->{'items'} || []
$group->{'items'}
Truth table50%1/2
A
A= $group->{'items'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 70325 | my $field = $item->{itemOID}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 70325 | ▶ | die "CDISC-ODM ItemData is missing ItemOID " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $field and length $field
MC/DC0%0/2
defined $field and length $field
defined $field
length $field
Truth table33%1/3
A and B
A= defined $fieldB= length $field
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | . _format_context($context) . "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | unless defined $field && length $field; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | die "Duplicate CDISC-ODM ItemOID <$field> in item-group occurrence " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | . _format_context($context) . "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 70325 | ▶ | if $seen_item{$field}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 70324 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$self->{"recordProfile"} eq "cdisc-odm" and builtin::blessed($self->{"metadata"}) and $self->{"metadata"}->can("field_meta") and not defined $self->{"metadata"}->field_meta($field)
$self->{"recordProfile"} eq "cdisc-odm" and builtin::blessed($self->{"metadata"}) and $self->{"metadata"}->can("field_meta")
$self->{"recordProfile"} eq "cdisc-odm" and builtin::blessed($self->{"metadata"})
MC/DC75%3/4
$self->{"recordProfile"} eq "cdisc-odm" and builtin::blessed($self->{"metadata"}) and $self->{"metadata"}->can("field_meta") and not defined $self->{"metadata"}->field_meta($field)
$self->{"recordProfile"} eq "cdisc-odm"
builtin::blessed($self->{"metadata"})
$self->{"metadata"}->can("field_meta")
not defined $self->{"metadata"}->field_meta($field)
Truth table80%4/5
A and B and C and not(D)
A= $self->{"recordProfile"} eq "cdisc-odm"B= builtin::blessed($self->{"metadata"})C= $self->{"metadata"}->can("field_meta")D= not defined $self->{"metadata"}->field_meta($field)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | $self->{recordProfile} eq 'cdisc-odm' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | && blessed( $self->{metadata} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | && $self->{metadata}->can('field_meta') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | && !defined $self->{metadata}->field_meta($field) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | die "CDISC-ODM ItemData <ItemOID=$field> references no ItemDef in the active MetaDataVersion " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | . _format_context($context) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 70323 | my $raw = _coerce_value( $self, $field, $item->{value} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | my $entry = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | groupIndex => $group_index, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | raw => $raw, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | sourceValue => $item->{value}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 70323 | working => $raw, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 70323 | push @{ $self->{entries}{$field} }, $entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 70323 | push @{ $self->{groups}[$group_index]{itemOrder} }, $field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 70323 | ▶ | push @{ $self->{field_order} }, $field unless $seen_field{$field}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 219 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub source_format { return 'cdisc-odm' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
source_format: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub record_profile { return _root( $_[0] )->{recordProfile} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
record_profile: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 221 | ▶ | sub headers { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
headers: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 221 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 221 | my $root = _root($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 221 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 71220 | grep { !$seen{$_}++ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 221 | @{ $root->{context_order} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 221 | sort( keys %{ $root->{context} } ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 221 | @{ $root->{field_order} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 16099 | ▶ | sub raw_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raw_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 16099 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 16099 | return _resolved_value( $self, $field, 'raw' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 19802 | ▶ | sub working_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
working_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 19802 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 19802 | return _resolved_value( $self, $field, 'working' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 46593 | ▶ | sub value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 46593 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 46593 | my $value = _resolved_value( $self, $field, 'working' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 46591 | return _mapped_value( _root($self), $field, $value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1998 | ▶ | sub info_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info_value: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1998 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 1998 | my $root = _root($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1998 | ▶ | return $self->value($field) if exists $self->{boundGroup}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 1998 | my $entries = $root->{entries}{$field}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1998 | ▶ | return $self->value($field) unless $entries && @{$entries} > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$entries and @{$entries;} > 1
MC/DC100%2/2
$entries and @{$entries;} > 1
$entries
@{$entries;} > 1
Truth table100%3/3
A and B
A= $entriesB= @{$entries;} > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | my @values = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | context => _public_group_context( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | $root->{groups}[ $_->{groupIndex} ]{context} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 11 | value => _mapped_value( $root, $field, $_->{working} ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 3 | } @{$entries}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 3 | my %distinct; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 3 | for my $item (@values) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 11 | my $comparison = $item->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 11 | ▶ | my $key = defined $comparison ? "$comparison" : "\x00undef"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 11 | $distinct{$key} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 3 | ▶ | return $values[0]{value} if keys(%distinct) == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | return \@values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 11260 | ▶ | sub set_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_value: called CC=5 SCAR=24.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 11260 | my ( $self, $field, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 11260 | my $root = _root($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 11260 | ▶ | if ( exists $self->{boundGroup} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my @exact = grep { $_->{groupIndex} == $self->{boundGroup} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | @{ $root->{entries}{$field} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$root->{'entries'}{$field} || []
MC/DC0%0/1
$root->{'entries'}{$field} || []
$root->{'entries'}{$field}
Truth table0%0/2
A
A= $root->{'entries'}{$field}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if (@exact) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $_->{working} = $value for @exact; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 11260 | $root->{overrides}{$field} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 11260 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | sub has_choice_labels { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_choice_labels: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $metadata = _root($self)->{metadata}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | return 0 unless blessed($metadata) && $metadata->can('has_choice_labels'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($metadata) and $metadata->can("has_choice_labels")
MC/DC0%0/2
builtin::blessed($metadata) and $metadata->can("has_choice_labels")
builtin::blessed($metadata)
$metadata->can("has_choice_labels")
Truth table0%0/3
A and B
A= builtin::blessed($metadata)B= $metadata->can("has_choice_labels")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return $metadata->has_choice_labels($field); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 5918 | ▶ | sub field_meta { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
field_meta: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 5918 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 5918 | my $metadata = _root($self)->{metadata}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 5918 | ▶ | return unless blessed($metadata) && $metadata->can('field_meta'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($metadata) and $metadata->can("field_meta")
MC/DC0%0/2
builtin::blessed($metadata) and $metadata->can("field_meta")
builtin::blessed($metadata)
$metadata->can("field_meta")
Truth table33%1/3
A and B
A= builtin::blessed($metadata)B= $metadata->can("field_meta")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 5918 | return $metadata->field_meta($field); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2785 | ▶ | sub field_note { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
field_note: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2785 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 2785 | my $metadata = _root($self)->{metadata}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 2785 | ▶ | return unless blessed($metadata) && $metadata->can('field_note'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($metadata) and $metadata->can("field_note")
MC/DC0%0/2
builtin::blessed($metadata) and $metadata->can("field_note")
builtin::blessed($metadata)
$metadata->can("field_note")
Truth table33%1/3
A and B
A= builtin::blessed($metadata)B= $metadata->can("field_note")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 2785 | return $metadata->field_note($field); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 12065 | ▶ | sub views_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
views_for: called CC=9 SCAR=30.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 12065 | my ( $self, $field ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 12065 | my $root = _root($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 12065 | ▶ | my $entries = $root->{entries}{$field} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$root->{'entries'}{$field} || []
MC/DC100%1/1
$root->{'entries'}{$field} || []
$root->{'entries'}{$field}
Truth table100%2/2
A
A= $root->{'entries'}{$field}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 12065 | ▶ | return [$self] if exists $root->{overrides}{$field}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 8960 | ▶ | if ( exists $self->{boundGroup} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | my $bound = $root->{groups}[ $self->{boundGroup} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my @exact = grep { $_->{groupIndex} == $self->{boundGroup} } @{$entries}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | return [ map { _bound_view( $root, $_->{groupIndex} ) } @exact ] if @exact; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | my @descendants = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | _path_is_prefix( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | $bound->{scopePath}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | $root->{groups}[ $_->{groupIndex} ]{scopePath}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | } @{$entries}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | return [ map { _bound_view( $root, $_->{groupIndex} ) } @descendants ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | if @descendants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | return [$self] if defined $self->working_value($field); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 6750 | return [ map { _bound_view( $root, $_->{groupIndex} ) } @{$entries} ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 8960 | ▶ | if @{$entries}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 2215 | ▶ | return [$self] if exists $root->{context}{$field}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 2215 | return []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 182 | ▶ | sub columns_snapshot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
columns_snapshot: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 182 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 182 | my $root = _root($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 182 | my %snapshot = %{ $root->{context} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 182 | for my $field ( @{ $root->{field_order} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | my ( $value, $ambiguous ) = _collapse_entries( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | $root, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | $field, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 58588 | $root->{entries}{$field}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 'raw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 58588 | ▶ | $snapshot{$field} = $value unless $ambiguous; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 182 | return \%snapshot; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 180 | ▶ | sub has_repeated_fields { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_repeated_fields: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 180 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 180 | my $root = _root($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 58580 | return scalar grep { @{ $root->{entries}{$_} } > 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 180 | keys %{ $root->{entries} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | ▶ | sub odm_provenance { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
odm_provenance: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 3 | my $root = _root($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 3 | my @groups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | for my $group_index ( 0 .. $#{ $root->{groups} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 11 | my $group = $root->{groups}[$group_index]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 11 | my @items; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 11 | for my $field ( @{ $group->{itemOrder} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 26 | ▶ | for my $entry ( @{ $root->{entries}{$field} || [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$root->{'entries'}{$field} || []
MC/DC0%0/1
$root->{'entries'}{$field} || []
$root->{'entries'}{$field}
Truth table50%1/2
A
A= $root->{'entries'}{$field}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 68 | ▶ | next unless $entry->{groupIndex} == $group_index; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | push @items, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | itemOID => $field, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | value => $entry->{sourceValue}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 26 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | push @groups, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 11 | %{ _public_group_context( $group->{context} ) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | items => \@items, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 3 | %{ $root->{descriptor} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 3 | %{ $root->{context} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | itemGroups => \@groups, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 82494 | ▶ | sub _resolved_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_resolved_value: called CC=9 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 82494 | my ( $self, $field, $kind ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 82494 | my $root = _root($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 82494 | ▶ | return $root->{overrides}{$field} if exists $root->{overrides}{$field}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 62669 | ▶ | my $entries = $root->{entries}{$field} || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$root->{'entries'}{$field} || []
MC/DC100%1/1
$root->{'entries'}{$field} || []
$root->{'entries'}{$field}
Truth table100%2/2
A
A= $root->{'entries'}{$field}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 62669 | ▶ | if ( exists $self->{boundGroup} && @{$entries} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
exists $self->{"boundGroup"} and @{$entries;}
MC/DC100%2/2
exists $self->{"boundGroup"} and @{$entries;}
exists $self->{"boundGroup"}
@{$entries;}
Truth table100%3/3
A and B
A= exists $self->{"boundGroup"}B= @{$entries;}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 34897 | my @exact = grep { $_->{groupIndex} == $self->{boundGroup} } @{$entries}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 34897 | ▶ | return $exact[0]{$kind} if @exact; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 40 | my $bound_path = $root->{groups}[ $self->{boundGroup} ]{scopePath}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | my @ancestors = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | @{ $root->{groups}[ $b->{groupIndex} ]{scopePath} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | <=> @{ $root->{groups}[ $a->{groupIndex} ]{scopePath} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | _path_is_prefix( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | $root->{groups}[ $_->{groupIndex} ]{scopePath}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 40 | $bound_path, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 40 | } @{$entries}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 40 | ▶ | return $ancestors[0]{$kind} if @ancestors; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 27812 | ▶ | if ( @{$entries} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 5826 | my ($value) = _collapse_entries( $root, $field, $entries, $kind, 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 5824 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 21986 | ▶ | return $root->{context}{$field} if exists $root->{context}{$field}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 13660 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 64414 | ▶ | sub _collapse_entries { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_collapse_entries: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 64414 | my ( $root, $field, $entries, $kind, $fatal ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 64414 | my %distinct; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 64414 | for my $entry ( @{$entries} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # Compare through a copy. Stringifying the hash value directly changes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # Perl's scalar flags and makes JSON::XS serialize numbers as strings. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 64438 | my $comparison = $entry->{$kind}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 64438 | ▶ | my $key = defined $comparison ? "$comparison" : "\x00undef"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 64438 | push @{ $distinct{$key} }, $entry; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 64414 | ▶ | return ( $entries->[0]{$kind}, 0 ) if keys(%distinct) <= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 6 | ▶ | return ( undef, 1 ) unless $fatal; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | my @occurrences = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 4 | ▶ | my $value = defined $_->{$kind} ? $_->{$kind} : 'null'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | $value . ' at ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | . _format_context( $root->{groups}[ $_->{groupIndex} ]{context} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | } @{$entries}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 2 | die "Ambiguous CDISC-ODM scalar field <$field> has differing occurrence values: " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | . join( '; ', @occurrences ) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 46602 | ▶ | sub _mapped_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mapped_value: called CC=6 SCAR=18.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 46602 | my ( $root, $field, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 46602 | ▶ | return unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 32492 | my $metadata = $root->{metadata}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 32492 | ▶ | return $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
builtin::blessed($metadata) and $metadata->can("has_choice_labels") and $metadata->has_choice_labels($field)
builtin::blessed($metadata) and $metadata->can("has_choice_labels")
MC/DC33%1/3
builtin::blessed($metadata) and $metadata->can("has_choice_labels") and $metadata->has_choice_labels($field)
builtin::blessed($metadata)
$metadata->can("has_choice_labels")
$metadata->has_choice_labels($field)
Truth table50%2/4
A and B and C
A= builtin::blessed($metadata)B= $metadata->can("has_choice_labels")C= $metadata->has_choice_labels($field)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | unless blessed($metadata) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | && $metadata->can('has_choice_labels') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | && $metadata->has_choice_labels($field); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 7483 | my $mapped = $metadata->choice_label( $field, $value ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 7483 | ▶ | return defined $mapped ? dotify_and_coerce_number($mapped) : $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 70323 | ▶ | sub _coerce_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_coerce_value: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 70323 | my ( $self, $field, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | return dotify_and_coerce_number($value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 70323 | ▶ | if $self->{recordProfile} eq 'redcap'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 27 | my $metadata = $self->{metadata}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 27 | ▶ | return $metadata->coerce_value( $field, $value ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($metadata) and $metadata->can("coerce_value")
MC/DC50%1/2
builtin::blessed($metadata) and $metadata->can("coerce_value")
builtin::blessed($metadata)
$metadata->can("coerce_value")
Truth table66%2/3
A and B
A= builtin::blessed($metadata)B= $metadata->can("coerce_value")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | if blessed($metadata) && $metadata->can('coerce_value'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 6750 | ▶ | sub _bound_view { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bound_view: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 6750 | my ( $root, $group_index ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 6750 | return bless { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | parent => $root, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | boundGroup => $group_index, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | }, __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 163697 | ▶ | sub _root { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_root: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 163697 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 163697 | ▶ | return $self->{parent} || $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{'parent'} || $self
MC/DC0%0/2
$self->{'parent'} || $self
$self->{'parent'}
$self
Truth table66%2/3
A || B
A= $self->{'parent'}B= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 40 | ▶ | sub _path_is_prefix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_path_is_prefix: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 40 | my ( $candidate, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 40 | ▶ | return 0 if @{$candidate} > @{$path}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 40 | for my $index ( 0 .. $#{$candidate} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 40 | ▶ | return 0 if $candidate->[$index] ne $path->[$index]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 22 | ▶ | sub _public_group_context { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_public_group_context: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 22 | my ($context) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 22 | my %public = %{$context}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 22 | delete $public{scopePath}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 22 | return \%public; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 6 | ▶ | sub _format_context { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format_context: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 6 | my ($context) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | my @parts = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 40 | ▶ | defined $context->{$_} && length "$context->{$_}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $context->{$_} and length "$context->{$_}"
MC/DC50%1/2
defined $context->{$_} and length "$context->{$_}"
defined $context->{$_}
length "$context->{$_}"
Truth table66%2/3
A and B
A= defined $context->{$_}B= length "$context->{$_}"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | ? "$_=$context->{$_}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 6 | } sort keys %{$context}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 6 | return '<' . join( ', ', @parts ) . '>'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 136 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||