lib/Convert/Pheno/Model/Bundle.pm

filter: Statementstmt 94.7% 36 / 38 Branchbran 90.0% 9 / 10 Conditioncond 82.3% 14 / 17 MC/DCmcdc 71.4% 5 / 7 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 5 totaltotal 83.5% 71 / 85 CC 14 SCAR 16.6
CC
14
Cov
91%
add_entity
9.0
new
4.1
context
2.0
CRAP 5.3
« lib/Convert/Pheno/Pipeline.pm ↑ Summary lib/Convert/Pheno/OMOP/ToBFF/Biosamples.pm »
1 package Convert::Pheno::Model::Bundle;
2  
3 138 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 138 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 138 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 21102 ▶sub new {
Subroutine new: called CC=4 SCAR=14.0
Pod undocumented
8 21102 my ( $class, $args ) = @_;
9 21102 ▶ $args ||= {};
Condition50%1/2
$args ||= {}
l!l
211020
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
10  
11 my $self = {
12 context => $args->{context},
13 21102 };
14  
15 21102 ▶ if ( $args->{entities} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"entities"}) 21102 0 21102
16 21102 for my $entity ( @{ $args->{entities} } ) {
17 23879 $self->{$entity} = [];
18 }
19 }
20  
21 21102 return bless $self, $class;
22 }
23  
24 0 ▶sub context {
Subroutine context: not called CC=1 SCAR=6.9
Pod undocumented
25 0 my ($self) = @_;
26 0 return $self->{context};
27 }
28  
29 26362 ▶sub add_entity {
Subroutine add_entity: called CC=9 SCAR=22.0
Pod undocumented
30 26362 my ( $self, $entity_type, $entity ) = @_;
31 26362 ▶ return unless defined $entity;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $entity 1218 25144 26362
32 25144 my $context = $self->{context};
33 25144 ▶ if ($context && ($context->target_format || '') eq 'beacon'
Branch: 1 branch
BranchTrueFalseTotal
if ($context and ($context->target_format || "") eq "beacon" and $entity_type eq "individuals" || $entity_type eq "biosamples") 25104 40 25144
Condition81%9/11
$context and ($context->target_format || "") eq "beacon" and $entity_type eq "individuals" || $entity_type eq "biosamples"
!ll&&!rl&&r
63425104
$context and ($context->target_format || "") eq "beacon"
!ll&&!rl&&r
6025138
$context->target_format || ''
l!l
251380
$entity_type eq "individuals" or $entity_type eq "biosamples"
l!l&&r!l&&!r
2444565934
MC/DC75%3/4
$context and ($context->target_format || "") eq "beacon" and $entity_type eq "individuals" || $entity_type eq "biosamples"
$context $context->target_format $entity_type eq "individuals" $entity_type eq "biosamples"
Truth table80%4/5
A and B and C or D
A= $contextB= $context->target_formatC= $entity_type eq "individuals"D= $entity_type eq "biosamples"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
34 && ($entity_type eq 'individuals' || $entity_type eq 'biosamples')) {
35 25104 my $id = $context->options->{datasetId};
36 # Some Beacon backends require this non-standard top-level property.
37 # Opt in explicitly; copy the record so caller-owned data stays intact.
38 25104 ▶ $entity = { %{$entity}, datasetId => $id } if defined $id;
Branch: 1 branch
BranchTrueFalseTotal
if defined $id 61 25043 25104
39 }
40 25144 ▶ $self->{$entity_type} ||= [];
Condition100%2/2
$self->{$entity_type} ||= []
l!l
24622522
MC/DC100%1/1
$self->{$entity_type} ||= []
$self->{$entity_type}
Truth table100%2/2
A
A= $self->{$entity_type}
Aresult
11
00
41 25144 push @{ $self->{$entity_type} }, $entity;
42 25144 return 1;
43 }
44  
45 23978 ▶sub entities {
Subroutine entities: called CC=2 SCAR=6.9
Pod undocumented
46 23978 my ( $self, $entity_type ) = @_;
47 23978 ▶ $self->{$entity_type} ||= [];
Condition100%2/2
$self->{$entity_type} ||= []
l!l
2396315
MC/DC100%1/1
$self->{$entity_type} ||= []
$self->{$entity_type}
Truth table100%2/2
A
A= $self->{$entity_type}
Aresult
11
00
48 23978 return $self->{$entity_type};
49 }
50  
51 15170 ▶sub primary_entity {
Subroutine primary_entity: called CC=2 SCAR=6.9
Pod undocumented
52 15170 my ( $self, $entity_type ) = @_;
53 15170 my $entities = $self->entities($entity_type);
54 15170 ▶ return unless @$entities;
Branch: 1 branch
BranchTrueFalseTotal
unless @$entities 520 14650 15170
55 14650 return $entities->[0];
56 }
57  
58 138 1;
« lib/Convert/Pheno/Pipeline.pm ↑ Summary lib/Convert/Pheno/OMOP/ToBFF/Biosamples.pm »