| 1 | package Convert::Pheno::OMOP::ToBFF; | ||||||||||||||||||||||||||||||
| 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 | 138 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 8 | 138 | ▶ | use Convert::Pheno::Context; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 9 | 138 | ▶ | use Convert::Pheno::Model::Bundle; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 10 | 138 | ▶ | use Convert::Pheno::OMOP::ToBFF::Individuals qw(map_participant); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 11 | 138 | ▶ | use Convert::Pheno::OMOP::ToBFF::Biosamples qw(extract_participant_biosamples); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||
| 13 | 138 | our @EXPORT_OK = qw(do_omop2bff run_omop_to_bundle map_participant extract_participant_biosamples); | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||
| 15 | 6906 | ▶ | sub do_omop2bff { | ||||||||||||||||||||||||||||
|
Subroutine
do_omop2bff: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 16 | 6906 | my ( $self, $participant ) = @_; | |||||||||||||||||||||||||||||
| 17 | 6906 | my $bundle = run_omop_to_bundle( $self, $participant, $self->{conversion_context} ); | |||||||||||||||||||||||||||||
| 18 | 6906 | return $bundle->primary_entity('individuals'); | |||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||
| 21 | 19854 | ▶ | sub run_omop_to_bundle { | ||||||||||||||||||||||||||||
|
Subroutine
run_omop_to_bundle: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 22 | 19854 | my ( $self, $participant, $context ) = @_; | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||
| 24 | $context ||= Convert::Pheno::Context->from_self( | ||||||||||||||||||||||||||||||
| 25 | $self, | ||||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||||
| 27 | source_format => 'omop', | ||||||||||||||||||||||||||||||
| 28 | target_format => 'beacon', | ||||||||||||||||||||||||||||||
| 29 | 19854 | ▶ | entities => $self->{entities} || ['individuals'], | ||||||||||||||||||||||||||||
|
Condition60%3/5
$context ||= "Convert::Pheno::Context"->from_self($self, {"source_format", "omop", "target_format", "beacon", "entities", $self->{"entities"} || ["individuals"]})
$self->{'entities'} || ['individuals']
MC/DC0%0/2
$context ||= "Convert::Pheno::Context"->from_self($self, {"source_format", "omop", "target_format", "beacon", "entities", $self->{"entities"} || ["individuals"]})
$context
"Convert::Pheno::Context"->from_self($self, {"source_format", "omop", "target_format", "beacon", "entities", $self->{"entities"} || ["individuals"]})
MC/DC0%0/1
$self->{'entities'} || ['individuals']
$self->{'entities'}
Truth table66%2/3
A ||= B
A= $contextB= "Convert::Pheno::Context"->from_self($self, {"source_format", "omop", "target_format", "beacon", "entities", $self->{"entities"} || ["individuals"]})
Truth table50%1/2
A
A= $self->{'entities'}
| |||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||
| 33 | 19854 | my $bundle = Convert::Pheno::Model::Bundle->new( | |||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||||
| 35 | context => $context, | ||||||||||||||||||||||||||||||
| 36 | entities => $context->entities, | ||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||
| 40 | 19854 | my $individual = map_participant( $self, $participant ); | |||||||||||||||||||||||||||||
| 41 | 19853 | $bundle->add_entity( individuals => $individual ); | |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||
| 43 | 19853 | ▶ | if ( _context_requests_entity( $context, 'biosamples' ) ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 44 | 1021 | for my $biosample ( @{ extract_participant_biosamples( $self, $participant, $individual ) } ) { | |||||||||||||||||||||||||||||
| 45 | 76 | $bundle->add_entity( biosamples => $biosample ); | |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||
| 49 | 19853 | return $bundle; | |||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||
| 52 | 19853 | ▶ | sub _context_requests_entity { | ||||||||||||||||||||||||||||
|
Subroutine
_context_requests_entity: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 53 | 19853 | my ( $context, $entity ) = @_; | |||||||||||||||||||||||||||||
| 54 | 19853 | return scalar grep { $_ eq $entity } @{ $context->entities }; | |||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||
| 57 | 138 | 1; | |||||||||||||||||||||||||||||