| 1 | package Convert::Pheno::Mapping::Metadata; | ||||||||||||||||||||||||||||
| 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 | 136 | ▶ | use File::ShareDir::ProjectDistDir qw(dist_dir); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 136 | ▶ | use File::Spec::Functions qw(catfile); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 136 | ▶ | use Convert::Pheno::BFF::DerivedEntities qw(mapping_entity_overrides); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 136 | ▶ | use Convert::Pheno::IO::CSVHandler qw(read_mapping_file); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 136 | ▶ | use Convert::Pheno::Mapping::Compiler qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | compile_mapping | ||||||||||||||||||||||||||||
| 14 | is_metadata_profile | ||||||||||||||||||||||||||||
| 15 | 136 | ); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 136 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||
| 18 | apply_metadata_mapping | ||||||||||||||||||||||||||||
| 19 | load_metadata_mapping | ||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 211 | ▶ | sub load_metadata_mapping { | ||||||||||||||||||||||||||
|
Subroutine
load_metadata_mapping: called CC=6 SCAR=18.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | 211 | my ( $converter, $profile ) = @_; | |||||||||||||||||||||||||||
| 24 | 211 | ▶ | return unless is_metadata_profile($profile); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | return | ||||||||||||||||||||||||||||
| 26 | unless defined $converter->{mapping_file} | ||||||||||||||||||||||||||||
| 27 | 142 | ▶ | && length $converter->{mapping_file}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $converter->{"mapping_file"} and length $converter->{"mapping_file"}
MC/DC50%1/2
defined $converter->{"mapping_file"} and length $converter->{"mapping_file"}
defined $converter->{"mapping_file"}
length $converter->{"mapping_file"}
Truth table66%2/3
A and B
A= defined $converter->{"mapping_file"}B= length $converter->{"mapping_file"}
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | my $schema_file = $converter->{schema_file} | ||||||||||||||||||||||||||||
| 30 | 11 | ▶ | // catfile( dist_dir('Convert-Pheno'), 'schema', 'mapping-v2.json' ); | ||||||||||||||||||||||||||
|
Condition33%1/3
$converter->{"schema_file"} // catfile(dist_dir("Convert-Pheno"), "schema", "mapping-v2.json")
MC/DC0%0/2
$converter->{"schema_file"} // catfile(dist_dir("Convert-Pheno"), "schema", "mapping-v2.json")
$converter->{"schema_file"}
catfile(dist_dir("Convert-Pheno"), "schema", "mapping-v2.json")
Truth table33%1/3
A // B
A= $converter->{"schema_file"}B= catfile(dist_dir("Convert-Pheno"), "schema", "mapping-v2.json")
| |||||||||||||||||||||||||||||
| 31 | my $mapping = read_mapping_file( | ||||||||||||||||||||||||||||
| 32 | { | ||||||||||||||||||||||||||||
| 33 | mapping_file => $converter->{mapping_file}, | ||||||||||||||||||||||||||||
| 34 | 11 | ▶ | self_validate_schema => $converter->{self_validate_schema} || 0, | ||||||||||||||||||||||||||
|
Condition50%1/2
$converter->{'self_validate_schema'} || 0
MC/DC0%0/1
$converter->{'self_validate_schema'} || 0
$converter->{'self_validate_schema'}
Truth table50%1/2
A
A= $converter->{'self_validate_schema'}
| |||||||||||||||||||||||||||||
| 35 | schema_file => $schema_file, | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | 11 | my $compiled = compile_mapping( | |||||||||||||||||||||||||||
| 39 | $mapping, | ||||||||||||||||||||||||||||
| 40 | source_profile => $profile, | ||||||||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 11 | return mapping_entity_overrides($compiled); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 197 | ▶ | sub apply_metadata_mapping { | ||||||||||||||||||||||||||
|
Subroutine
apply_metadata_mapping: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 197 | my ( $converter, $profile, $overrides ) = @_; | |||||||||||||||||||||||||||
| 48 | 197 | ▶ | return 1 unless is_metadata_profile($profile); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | # Source adapters may be reused by more than one route. Reset only the | ||||||||||||||||||||||||||||
| 51 | # mapping-derived layer; source-derived and explicit programmatic overrides | ||||||||||||||||||||||||||||
| 52 | # have their own precedence in DerivedEntities. | ||||||||||||||||||||||||||||
| 53 | 134 | delete $converter->{mapping_file_derived_entity_overrides}; | |||||||||||||||||||||||||||
| 54 | 134 | ▶ | $converter->{mapping_file_derived_entity_overrides} = $overrides | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | if defined $overrides; | ||||||||||||||||||||||||||||
| 56 | 134 | return 1; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 136 | 1; | |||||||||||||||||||||||||||