| 1 | package Convert::Pheno::CDISC::SDTM::Terminology; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 | 136 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 136 | ▶ | use Convert::Pheno::CDISC::SDTM::Normalizer qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | collect_sdtm_source_terms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | sdtm_source_fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 136 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 136 | ▶ | use Convert::Pheno::IO::CSVHandler qw(read_mapping_file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 136 | ▶ | use Convert::Pheno::Mapping::Compiler qw(compile_mapping); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 136 | ▶ | use Convert::Pheno::Mapping::Shared qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | map_ontology_term | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | record_term_audit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 136 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 136 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | prepare_sdtm_terminology | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | resolve_sdtm_term | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 136 | my %SUPPORTED_FIELD = map { $_ => 1 } qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | DM.ETHNIC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | DM.COUNTRY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | MH.MHDECOD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | MH.MHTERM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | AE.AEDECOD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | AE.AETERM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | AE.AESEV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | LB.LBTESTCD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | LB.LBTEST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | LB.LBSTRESC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | LB.LBSTRESU | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | VS.VSTESTCD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | VS.VSTEST | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | VS.VSSTRESC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | VS.VSSTRESU | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | CM.CMDECOD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | CM.CMTRT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | CM.CMROUTE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | EX.EXTRT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | EX.EXROUTE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | PR.PRDECOD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | PR.PRTRT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | PR.PRLOC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 31 | ▶ | sub prepare_sdtm_terminology { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_sdtm_terminology: called CC=12 SCAR=25.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 31 | my ( $converter, $metadata ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 31 | my $source_terms = collect_sdtm_source_terms($metadata); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 31 | my $mapping; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 31 | ▶ | if ( defined $converter->{mapping_file} && 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"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | my $schema_file = $converter->{schema_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 3 | ▶ | // 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")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | my $loaded = read_mapping_file( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | mapping_file => $converter->{mapping_file}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | self_validate_schema => $converter->{self_validate_schema}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 3 | schema_file => $schema_file, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 3 | $mapping = compile_mapping( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $loaded, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | source_profile => 'sdtm', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | headers => sdtm_source_fields($metadata), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 12 | my @unsupported = sort grep { !$SUPPORTED_FIELD{$_} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 3 | ▶ | keys %{ $mapping->{terminology} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$mapping->{'terminology'} || {}
MC/DC0%0/1
$mapping->{'terminology'} || {}
$mapping->{'terminology'}
Truth table50%1/2
A
A= $mapping->{'terminology'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 3 | ▶ | die "SDTM terminology mapping references fields that do not produce BFF ontology terms: <" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | . join( '>, <', @unsupported ) . ">.\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | if @unsupported; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | my $requires_sqlite = scalar grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 6 | my $term = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ref($term) eq 'HASH' && defined $term->{id} && length $term->{id} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 31 | ▶ | } map { values %{$_} } values %{$source_terms}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
ref $term eq 'HASH' && defined $term->{'id'} && length $term->{'id'}
ref $term eq "HASH" and defined $term->{"id"}
MC/DC33%1/3
ref $term eq 'HASH' && defined $term->{'id'} && length $term->{'id'}
ref $term eq "HASH"
defined $term->{"id"}
length $term->{'id'}
Truth table50%2/4
A and B && C
A= ref $term eq "HASH"B= defined $term->{"id"}C= length $term->{'id'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 31 | ▶ | if ($mapping) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | $requires_sqlite ||= scalar grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | exists $mapping->{terminology}{$_}{query} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 3 | ▶ | } keys %{ $mapping->{terminology} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$requires_sqlite ||= scalar grep({exists $mapping->{"terminology"}{$_}{"query"};} keys %{$mapping->{"terminology"} or {};})
$mapping->{'terminology'} || {}
MC/DC0%0/1
$requires_sqlite ||= scalar grep({exists $mapping->{"terminology"}{$_}{"query"};} keys %{$mapping->{"terminology"} or {};})
$requires_sqlite
MC/DC0%0/1
$mapping->{'terminology'} || {}
$mapping->{'terminology'}
Truth table50%1/2
A
A= $requires_sqlite
Truth table50%1/2
A
A= $mapping->{'terminology'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 31 | ▶ | mapping => $mapping, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | source_terms => $source_terms, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | requires_sqlite => $requires_sqlite ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 481 | ▶ | sub resolve_sdtm_term { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_sdtm_term: called CC=32 SCAR=42.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 481 | my ($arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 481 | my $self = $arg->{self}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 481 | ▶ | my $domain = uc( $arg->{domain} // q{} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg->{"domain"} // ""
MC/DC0%0/1
$arg->{"domain"} // ""
$arg->{"domain"}
Truth table50%1/2
A
A= $arg->{"domain"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 481 | ▶ | my $field = uc( $arg->{field} // q{} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$arg->{"field"} // ""
MC/DC0%0/1
$arg->{"field"} // ""
$arg->{"field"}
Truth table50%1/2
A
A= $arg->{"field"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 481 | my $source_field = "$domain.$field"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 481 | my $source_value = $arg->{value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 481 | my $fallback = dclone( $arg->{fallback} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 481 | my $source_metadata = $self->{sdtm_source_terms}{$source_field}{$source_value}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | my $source_label = ref($source_metadata) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ? ( $source_metadata->{label} // $arg->{label} // $source_value ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 481 | ▶ | : ( $arg->{label} // $source_value ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
($source_metadata->{"label"} // $arg->{"label"}) // $source_value
$source_metadata->{"label"} // $arg->{"label"}
$arg->{"label"} // $source_value
MC/DC0%0/3
($source_metadata->{"label"} // $arg->{"label"}) // $source_value
$source_metadata->{"label"}
$arg->{"label"}
$source_value
MC/DC0%0/2
$arg->{"label"} // $source_value
$arg->{"label"}
$source_value
Truth table25%1/4
A // B // C
A= $source_metadata->{"label"}B= $arg->{"label"}C= $source_value
Truth table33%1/3
A // B
A= $arg->{"label"}B= $source_value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 481 | ▶ | $fallback->{label} = $source_label | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $fallback eq "HASH" and defined $source_label and length $source_label
ref $fallback eq "HASH" and defined $source_label
MC/DC0%0/3
ref $fallback eq "HASH" and defined $source_label and length $source_label
ref $fallback eq "HASH"
defined $source_label
length $source_label
Truth table25%1/4
A and B and C
A= ref $fallback eq "HASH"B= defined $source_labelC= length $source_label
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | if ref($fallback) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | && defined $source_label | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | && length $source_label; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 481 | my $rule = $self->{sdtm_terminology_mapping}{terminology}{$source_field}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 481 | ▶ | if ( ref($rule) eq 'HASH' && exists $rule->{term} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $rule eq "HASH" and exists $rule->{"term"}
MC/DC0%0/2
ref $rule eq "HASH" and exists $rule->{"term"}
ref $rule eq "HASH"
exists $rule->{"term"}
Truth table66%2/3
A and B
A= ref $rule eq "HASH"B= exists $rule->{"term"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | return _configured_term( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | $rule->{term}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | $source_field, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | $source_value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | $source_label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | $arg->{source_record}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | $rule->{ontology} // $self->{sdtm_terminology_mapping}{defaults}{ontology}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$rule->{"ontology"} // $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
MC/DC0%0/2
$rule->{"ontology"} // $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
$rule->{"ontology"}
$self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
Truth table0%0/3
A // B
A= $rule->{"ontology"}B= $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 481 | ▶ | if ( ref($rule) eq 'HASH' && ref( $rule->{terms} ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $rule eq "HASH" and ref $rule->{"terms"} eq "HASH"
MC/DC100%2/2
ref $rule eq "HASH" and ref $rule->{"terms"} eq "HASH"
ref $rule eq "HASH"
ref $rule->{"terms"} eq "HASH"
Truth table100%3/3
A and B
A= ref $rule eq "HASH"B= ref $rule->{"terms"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 12 | ▶ | my $term_key = exists $rule->{terms}{$source_label} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | ? $source_label | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | : $source_value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 12 | ▶ | if ( exists $rule->{terms}{$term_key} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | return _configured_term( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | $rule->{terms}{$term_key}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | $source_field, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | $source_value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | $source_label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | $arg->{source_record}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | $rule->{ontology} // $self->{sdtm_terminology_mapping}{defaults}{ontology}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 9 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$rule->{"ontology"} // $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
MC/DC0%0/2
$rule->{"ontology"} // $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
$rule->{"ontology"}
$self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
Truth table33%1/3
A // B
A= $rule->{"ontology"}B= $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 472 | ▶ | if ( ref($source_metadata) eq 'HASH' && defined $source_metadata->{id} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $source_metadata eq "HASH" and defined $source_metadata->{"id"}
MC/DC100%2/2
ref $source_metadata eq "HASH" and defined $source_metadata->{"id"}
ref $source_metadata eq "HASH"
defined $source_metadata->{"id"}
Truth table100%3/3
A and B
A= ref $source_metadata eq "HASH"B= defined $source_metadata->{"id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3 | my $id = $source_metadata->{id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 3 | $id =~ s/^NCIT://i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | return _lookup_or_fallback( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | self => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ontology => 'ncit', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | query => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | column => 'id', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | source_field => $source_field, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | source_value => $source_value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | source_label => $source_label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | source_record => $arg->{source_record}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3 | match_source => 'define_xml', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | fallback => $fallback, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 469 | ▶ | if ( ref($rule) eq 'HASH' && ref( $rule->{query} ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $rule eq "HASH" and ref $rule->{"query"} eq "HASH"
MC/DC50%1/2
ref $rule eq "HASH" and ref $rule->{"query"} eq "HASH"
ref $rule eq "HASH"
ref $rule->{"query"} eq "HASH"
Truth table66%2/3
A and B
A= ref $rule eq "HASH"B= ref $rule->{"query"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 15 | my $query_rule = $rule->{query}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 15 | my $query; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 15 | ▶ | if ( exists $query_rule->{literal} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $query = $query_rule->{literal}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | ▶ | elsif ( ( $query_rule->{from} // q{} ) eq 'field' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$query_rule->{"from"} // ""
MC/DC0%0/1
$query_rule->{"from"} // ""
$query_rule->{"from"}
Truth table50%1/2
A
A= $query_rule->{"from"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $query = $field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | ▶ | elsif ( ( $query_rule->{from} // q{} ) eq 'fieldNote' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$query_rule->{"from"} // ""
MC/DC0%0/1
$query_rule->{"from"} // ""
$query_rule->{"from"}
Truth table50%1/2
A
A= $query_rule->{"from"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | $query = $arg->{field_label} // $field; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$arg->{"field_label"} // $field
MC/DC0%0/2
$arg->{"field_label"} // $field
$arg->{"field_label"}
$field
Truth table0%0/3
A // B
A= $arg->{"field_label"}B= $field
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 15 | $query = $source_label; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 15 | ▶ | if ( ref( $query_rule->{aliases} ) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 12 | ▶ | my $alias_key = exists $query_rule->{aliases}{$source_label} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | ? $source_label | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | : $source_value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | $query = $query_rule->{aliases}{$alias_key} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 12 | ▶ | if exists $query_rule->{aliases}{$alias_key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | return _lookup_or_fallback( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | self => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ontology => $rule->{ontology} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | // $self->{sdtm_terminology_mapping}{defaults}{ontology}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | query => $query, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | column => 'label', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | source_field => $source_field, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | source_value => $source_value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | source_label => $source_label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | source_record => $arg->{source_record}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 15 | ▶ | match_source => 'db', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$rule->{"ontology"} // $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
MC/DC0%0/2
$rule->{"ontology"} // $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
$rule->{"ontology"}
$self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
Truth table33%1/3
A // B
A= $rule->{"ontology"}B= $self->{"sdtm_terminology_mapping"}{"defaults"}{"ontology"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | fallback => $fallback, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | record_term_audit( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | self => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | source_record => $arg->{source_record}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 454 | source_field => $source_field, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | source_value => $source_value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | source_label => $source_label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | ontology => 'cdisc', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | term => $fallback, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | match_status => 'not_searched', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | match_source => 'source_fallback', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | lookup_resolution => 'fallback_source', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | fallback_action => 'source_term', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 454 | return $fallback; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 9 | ▶ | sub _configured_term { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_configured_term: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 9 | my ( $self, $term, $source_field, $source_value, $source_label, $source_record, $ontology ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 9 | my $resolved = dclone($term); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 9 | record_term_audit( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | self => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | source_record => $source_record, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | source_field => $source_field, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | source_value => $source_value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | source_label => $source_label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ontology => $ontology, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | term => $resolved, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | match_status => 'configured', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | match_source => 'mapping', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | lookup_resolution => 'direct_term', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | fallback_action => 'none', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 9 | return $resolved; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 18 | ▶ | sub _lookup_or_fallback { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_lookup_or_fallback: called CC=16 SCAR=30.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 18 | my (%arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | my $result = map_ontology_term( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | self => $arg{self}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | ontology => $arg{ontology}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | query => $arg{query}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | column => $arg{column}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 18 | audit => 0, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | return_metadata => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 18 | my $match_source = $arg{match_source}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 18 | my $source_search_evidence = $result->{search_evidence}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 18 | ▶ | if ( !_not_found($result) && $arg{ontology} eq 'cdisc' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not _not_found($result) and $arg{"ontology"} eq "cdisc"
MC/DC0%0/2
not _not_found($result) and $arg{"ontology"} eq "cdisc"
not _not_found($result)
$arg{"ontology"} eq "cdisc"
Truth table66%2/3
not(A) and B
A= not _not_found($result)B= $arg{"ontology"} eq "cdisc"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | my $nci_id = $result->{id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $nci_id =~ s/^NCIT://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | $result = map_ontology_term( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | self => $arg{self}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ontology => 'ncit', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | query => $nci_id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | column => 'id', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | audit => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | return_metadata => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | $result->{search_evidence} = $source_search_evidence | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | if defined $source_search_evidence; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $match_source = 'cdisc_to_ncit'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 18 | my $matched = !_not_found($result); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | my $term = $matched | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | ? { id => $result->{id}, label => $result->{label} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 18 | ▶ | : dclone( $arg{fallback} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | my $audit_term = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 18 | %{$term}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | search_evidence => $result->{search_evidence}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 18 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 18 | my $reported_match_source = $match_source; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 18 | ▶ | if ( $matched | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$matched and $match_source ne "define_xml" and $match_source ne "cdisc_to_ncit"
$matched and $match_source ne "define_xml"
MC/DC66%2/3
$matched and $match_source ne "define_xml" and $match_source ne "cdisc_to_ncit"
$matched
$match_source ne "define_xml"
$match_source ne "cdisc_to_ncit"
Truth table75%3/4
A and B and C
A= $matchedB= $match_source ne "define_xml"C= $match_source ne "cdisc_to_ncit"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | && $match_source ne 'define_xml' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | && $match_source ne 'cdisc_to_ncit' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 12 | ▶ | $reported_match_source = $result->{match_source} // $match_source; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$result->{"match_source"} // $match_source
MC/DC0%0/2
$result->{"match_source"} // $match_source
$result->{"match_source"}
$match_source
Truth table33%1/3
A // B
A= $result->{"match_source"}B= $match_source
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | record_term_audit( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | self => $arg{self}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | source_record => $arg{source_record}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | source_field => $arg{source_field}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | source_value => $arg{source_value}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | source_label => $arg{source_label}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | lookup_query => $arg{query}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | lookup_column => $arg{column}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | ontology => $matched && $arg{ontology} eq 'cdisc' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | ? 'ncit' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | : $arg{ontology}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | term => $audit_term, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | effective_search_mode => $arg{column} eq 'id' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ? 'exact' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | : $arg{self}{search}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | match_status => $matched ? 'matched' : 'not_found', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | match_source => $reported_match_source, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | lookup_resolution => $matched | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 18 | ▶ | ? ( $result->{search_resolution} // 'exact' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition60%3/5
$matched and $arg{"ontology"} eq "cdisc"
$result->{"search_resolution"} // "exact"
MC/DC0%0/2
$matched and $arg{"ontology"} eq "cdisc"
$matched
$arg{"ontology"} eq "cdisc"
MC/DC0%0/1
$result->{"search_resolution"} // "exact"
$result->{"search_resolution"}
Truth table66%2/3
A and B
A= $matchedB= $arg{"ontology"} eq "cdisc"
Truth table50%1/2
A
A= $result->{"search_resolution"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | : 'fallback_source', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | fallback_action => $matched ? 'none' : 'source_term', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 18 | return $term; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 36 | ▶ | sub _not_found { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_not_found: called CC=4 SCAR=14.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 36 | my ($term) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 36 | ▶ | return 1 unless ref($term) eq 'HASH' && defined $term->{id}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $term eq "HASH" and defined $term->{"id"}
MC/DC0%0/2
ref $term eq "HASH" and defined $term->{"id"}
ref $term eq "HASH"
defined $term->{"id"}
Truth table33%1/3
A and B
A= ref $term eq "HASH"B= defined $term->{"id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 36 | ▶ | return $term->{id} =~ /:NA0000\z/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 136 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||