| 1 | package Convert::Pheno::Pipeline; | ||||||||||||||||||||||||||||
| 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 Exporter 'import'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 136 | ▶ | use Convert::Pheno::ConversionRequest; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 136 | ▶ | use Convert::Pheno::ExecutionContext; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 136 | our @EXPORT_OK = qw(run_conversion_pipeline); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 49 | ▶ | sub run_conversion_pipeline { | ||||||||||||||||||||||||||
|
Subroutine
run_conversion_pipeline: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 49 | my ($converter) = @_; | |||||||||||||||||||||||||||
| 15 | 49 | my $request = Convert::Pheno::ConversionRequest->from_converter($converter); | |||||||||||||||||||||||||||
| 16 | 49 | my $spec = $request->spec; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | die "Conversion <$spec->{name}> is not a compound pipeline\n" | ||||||||||||||||||||||||||||
| 19 | 49 | ▶ | unless $spec->{operation} eq 'pipeline'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | die "Conversion <$spec->{name}> does not support streaming\n" | ||||||||||||||||||||||||||||
| 21 | 49 | ▶ | if $converter->{stream} && !$spec->{streaming}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$converter->{"stream"} and not $spec->{"streaming"}
MC/DC0%0/2
$converter->{"stream"} and not $spec->{"streaming"}
$converter->{"stream"}
not $spec->{"streaming"}
Truth table33%1/3
A and not(B)
A= $converter->{"stream"}B= not $spec->{"streaming"}
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 49 | my $execution = Convert::Pheno::ExecutionContext->new( | |||||||||||||||||||||||||||
| 24 | { request => $request } | ||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||
| 26 | 49 | delete $converter->{_term_audit_review}; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | # OMOP file input is already emitted one participant at a time. Preserve | ||||||||||||||||||||||||||||
| 29 | # that bounded-memory path while applying the downstream BFF-to-PXF stage | ||||||||||||||||||||||||||||
| 30 | # in the output sink rather than materializing the full BFF intermediate. | ||||||||||||||||||||||||||||
| 31 | 49 | ▶ | if ( $spec->{name} eq 'omop2pxf' && !$request->has_data ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$spec->{"name"} eq "omop2pxf" and not $request->has_data
MC/DC100%2/2
$spec->{"name"} eq "omop2pxf" and not $request->has_data
$spec->{"name"} eq "omop2pxf"
not $request->has_data
Truth table100%3/3
A and not(B)
A= $spec->{"name"} eq "omop2pxf"B= not $request->has_data
| |||||||||||||||||||||||||||||
| 32 | 2 | my ( $stage, $arguments ) = $execution->begin_next_stage; | |||||||||||||||||||||||||||
| 33 | 2 | my $stage_converter = Convert::Pheno->new($arguments); | |||||||||||||||||||||||||||
| 34 | 2 | $stage_converter->{method_ori} = $spec->{name}; | |||||||||||||||||||||||||||
| 35 | 2 | my $result = $stage_converter->$stage(); | |||||||||||||||||||||||||||
| 36 | 2 | $converter->{_term_audit_review} = $stage_converter->term_audit_review; | |||||||||||||||||||||||||||
| 37 | 2 | return $execution->complete_stage($result); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 47 | ▶ | while ( $execution->has_next_stage ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 94 | my ( $stage, $arguments ) = $execution->begin_next_stage; | |||||||||||||||||||||||||||
| 42 | 94 | my $stage_converter = Convert::Pheno->new($arguments); | |||||||||||||||||||||||||||
| 43 | 94 | my $result = $stage_converter->$stage(); | |||||||||||||||||||||||||||
| 44 | # Stages own their audit writers; callers need the review associated | ||||||||||||||||||||||||||||
| 45 | # with the last written report, not an intermediate mapping decision. | ||||||||||||||||||||||||||||
| 46 | 94 | ▶ | if (my $review = $stage_converter->term_audit_review) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 2 | $converter->{_term_audit_review} = $review; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | 94 | $execution->complete_stage($result); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 47 | return $execution->result; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 136 | 1; | |||||||||||||||||||||||||||