| 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'} || []
MC/DC100%1/1
$request->{'entities'} || []
$request->{'entities'}
Truth table100%2/2
A
A= $request->{'entities'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 71 | ▶ | my $bundle_mode = $method =~ /2bff$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition87%7/8
$method =~ /2bff$/ && (@$entities != 1 || ($entities->[0] || 'individuals') ne 'individuals')
@$entities != 1 or ($entities->[0] || "individuals") ne "individuals"
$entities->[0] || 'individuals'
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]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Condition88%8/9
$file_input and $request->{"stream"} and $method eq "omop2bff" and $bundle_mode
$file_input and $request->{"stream"} and $method eq "omop2bff"
$file_input and $request->{"stream"}
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
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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"
$request->{"stream"} or $method eq "omop2bff" or $method eq "omop2pxf"
$request->{"stream"} or $method eq "omop2bff"
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"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||