lib/Convert/Pheno/Execution/Files.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 6 / 6 Conditioncond 92.8% 26 / 28 MC/DCmcdc 75.0% 9 / 12 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 93.1% 82 / 88 CC 14 SCAR 23.1
CC
14
Cov
97%
execute_file_conversion
14.0
BEGIN
1.0
BEGIN
1.0
CRAP 10.1
« lib/Convert/Pheno/CDISC/ODM/Record.pm ↑ Summary lib/Convert/Pheno/ClinicalCDM/Claims.pm »
1 package Convert::Pheno::Execution::Files;
2  
3 101 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 101 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 101 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 101 ▶use Convert::Pheno::IO::Atomic qw(write_atomically);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 101 ▶use Convert::Pheno::Sink::FileSet;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 101 our @EXPORT_OK = qw(execute_file_conversion);
10  
11 # Transport-independent file execution. The caller owns destination selection
12 # and overwrite policy; the existing sinks own serialization and atomic writes.
13 71 ▶sub execute_file_conversion {
Subroutine execute_file_conversion: called CC=14 SCAR=26.4
Pod undocumented
14 71 my ($convert, $request, %callbacks) = @_;
15 71 my $method = $request->{method};
16 71 my $target = $request->{out_file};
17 71 ▶ my $entities = $request->{entities} || [];
Condition100%2/2
$request->{'entities'} || []
l!l
701
MC/DC100%1/1
$request->{'entities'} || []
$request->{'entities'}
Truth table100%2/2
A
A= $request->{'entities'}
Aresult
11
00
18 71 ▶ my $bundle_mode = $method =~ /2bff$/
Condition87%7/8
$method =~ /2bff$/ && (@$entities != 1 || ($entities->[0] || 'individuals') ne 'individuals')
!ll&&!rl&&r
202625
@$entities != 1 or ($entities->[0] || "individuals") ne "individuals"
l!l&&r!l&&!r
20526
$entities->[0] || 'individuals'
l!l
310
MC/DC33%1/3
$method =~ /2bff$/ && (@$entities != 1 || ($entities->[0] || 'individuals') ne 'individuals')
$method =~ /2bff$/ @$entities != 1 $entities->[0]
Truth table75%3/4
A && B or C
A= $method =~ /2bff$/B= @$entities != 1C= $entities->[0]
ABCresult
0XX0
1000
11X1
1011
19 && (@$entities != 1 || ($entities->[0] || 'individuals') ne 'individuals');
20 71 my ($data, $bundle);
21 # OMOP file readers can emit directly. In-memory API inputs return records
22 # instead, and those records must reach the file sink even for OMOP routes.
23 71 my $file_input = !exists $request->{data};
24 71 ▶ if ($file_input && $request->{stream} && $method eq 'omop2bff' && $bundle_mode) {
Branch: 3 branches
BranchTrueFalseTotal
if ($file_input and $request->{'stream'} and $method eq 'omop2bff' and $bundle_mode) { } 1 70 71
elsif ($bundle_mode) { } 24 46 70
elsif ($file_input and $request->{'stream'} || $method eq 'omop2bff' || $method eq 'omop2pxf') { } 6 40 46
Condition88%8/9
$file_input and $request->{"stream"} and $method eq "omop2bff" and $bundle_mode
!ll&&!rl&&r
6821
$file_input and $request->{"stream"} and $method eq "omop2bff"
!ll&&!rl&&r
6803
$file_input and $request->{"stream"}
!ll&&!rl&&r
2663
MC/DC75%3/4
$file_input and $request->{"stream"} and $method eq "omop2bff" and $bundle_mode
$file_input $request->{"stream"} $method eq "omop2bff" $bundle_mode
Truth table80%4/5
A and B and C and D
A= $file_inputB= $request->{"stream"}C= $method eq "omop2bff"D= $bundle_mode
ABCDresult
0XXX0
10XX0
110X0
11100
11111
25 1 $convert->$method;
26 }
27 elsif ($bundle_mode) {
28 24 $bundle = $convert->_run_bundle_view;
29 }
30 ▶ elsif ($file_input && ($request->{stream} || $method eq 'omop2bff' || $method eq 'omop2pxf')) {
Condition100%9/9
$file_input and $request->{"stream"} || $method eq "omop2bff" || $method eq "omop2pxf"
!ll&&!rl&&r
2386
$request->{"stream"} or $method eq "omop2bff" or $method eq "omop2pxf"
l!l&&r!l&&!r
5138
$request->{"stream"} or $method eq "omop2bff"
l!l&&r!l&&!r
2339
MC/DC100%4/4
$file_input and $request->{"stream"} || $method eq "omop2bff" || $method eq "omop2pxf"
$file_input $request->{"stream"} $method eq "omop2bff" $method eq "omop2pxf"
Truth table100%5/5
A and B or C or D
A= $file_inputB= $request->{"stream"}C= $method eq "omop2bff"D= $method eq "omop2pxf"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
31 6 ▶ write_atomically($target, sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 6 my ($staged) = @_;
33 6 local $convert->{out_file} = $staged;
34 6 $convert->$method;
35 6 });
36 }
37 else {
38 40 $data = $convert->$method;
39 }
40 70 Convert::Pheno::Sink::FileSet->new({
41 request => $request, out_file => $target, %callbacks,
42 })->write_result(data => $data, bundle => $bundle);
43 70 return 1;
44 }
45  
46 101 1;
« lib/Convert/Pheno/CDISC/ODM/Record.pm ↑ Summary lib/Convert/Pheno/ClinicalCDM/Claims.pm »