| 1 | package Convert::Pheno::Source::ClinicalCDM; | ||||||||||||||||||||||||||||
| 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 Storable qw(dclone); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 136 | ▶ | use Convert::Pheno::Mapping::Shared qw(get_info); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 136 | ▶ | use Convert::Pheno::Source::Result; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 136 | ▶ | use Convert::Pheno::Source::TablePackage qw(load_table_package); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 136 | my %PROFILE = ( | |||||||||||||||||||||||||||
| 13 | i2b2 => { | ||||||||||||||||||||||||||||
| 14 | label => 'i2b2', | ||||||||||||||||||||||||||||
| 15 | person_table => 'PATIENT_DIMENSION', | ||||||||||||||||||||||||||||
| 16 | person_keys => [qw(PATIENT_NUM PATID PATIENT_ID)], | ||||||||||||||||||||||||||||
| 17 | required => [qw(PATIENT_DIMENSION OBSERVATION_FACT)], | ||||||||||||||||||||||||||||
| 18 | concept_table => 'CONCEPT_DIMENSION', | ||||||||||||||||||||||||||||
| 19 | concept_key => 'CONCEPT_CD', | ||||||||||||||||||||||||||||
| 20 | visit_table => 'VISIT_DIMENSION', | ||||||||||||||||||||||||||||
| 21 | visit_keys => [qw(ENCOUNTER_NUM ENCOUNTERID VISIT_ID)], | ||||||||||||||||||||||||||||
| 22 | patient_tables => [qw(OBSERVATION_FACT VISIT_DIMENSION)], | ||||||||||||||||||||||||||||
| 23 | }, | ||||||||||||||||||||||||||||
| 24 | sentinel => { | ||||||||||||||||||||||||||||
| 25 | label => 'Sentinel CDM', | ||||||||||||||||||||||||||||
| 26 | person_table => 'DEMOGRAPHIC', | ||||||||||||||||||||||||||||
| 27 | person_keys => [qw(PATID PATIENT_ID PATIENT_NUM)], | ||||||||||||||||||||||||||||
| 28 | required => ['DEMOGRAPHIC'], | ||||||||||||||||||||||||||||
| 29 | visit_table => 'ENCOUNTER', | ||||||||||||||||||||||||||||
| 30 | visit_keys => [qw(ENCOUNTERID ENCOUNTER_NUM VISIT_ID)], | ||||||||||||||||||||||||||||
| 31 | patient_tables => [qw(DEATH DIAGNOSIS DISPENSING ENCOUNTER INPATIENT_PHARMACY LAB_RESULT PRESCRIBING PROCEDURE VITAL_SIGNS)], | ||||||||||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||||||||||
| 33 | pcornet => { | ||||||||||||||||||||||||||||
| 34 | label => 'PCORnet CDM', | ||||||||||||||||||||||||||||
| 35 | person_table => 'DEMOGRAPHIC', | ||||||||||||||||||||||||||||
| 36 | person_keys => [qw(PATID PATIENT_ID PATIENT_NUM)], | ||||||||||||||||||||||||||||
| 37 | required => ['DEMOGRAPHIC'], | ||||||||||||||||||||||||||||
| 38 | visit_table => 'ENCOUNTER', | ||||||||||||||||||||||||||||
| 39 | visit_keys => [qw(ENCOUNTERID ENCOUNTER_NUM VISIT_ID)], | ||||||||||||||||||||||||||||
| 40 | patient_tables => [qw(CONDITION DEATH DIAGNOSIS DISPENSING ENCOUNTER EXTERNAL_MEDS IMMUNIZATION LAB_RESULT_CM MED_ADMIN OBS_CLIN OBS_GEN PRESCRIBING PROCEDURES VITAL)], | ||||||||||||||||||||||||||||
| 41 | }, | ||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 21 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | 21 | my ( $class, $converter, %arg ) = @_; | |||||||||||||||||||||||||||
| 46 | 21 | ▶ | my $profile = lc( $arg{profile} // q{} ); | ||||||||||||||||||||||||||
|
Condition50%1/2
$arg{"profile"} // ""
MC/DC0%0/1
$arg{"profile"} // ""
$arg{"profile"}
Truth table50%1/2
A
A= $arg{"profile"}
| |||||||||||||||||||||||||||||
| 47 | die "Unknown clinical CDM source profile <$profile>\n" | ||||||||||||||||||||||||||||
| 48 | 21 | ▶ | unless exists $PROFILE{$profile}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 21 | return bless { | |||||||||||||||||||||||||||
| 50 | converter => $converter, | ||||||||||||||||||||||||||||
| 51 | profile => $profile, | ||||||||||||||||||||||||||||
| 52 | }, $class; | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 21 | ▶ | sub load { | ||||||||||||||||||||||||||
|
Subroutine
load: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 21 | my ($self) = @_; | |||||||||||||||||||||||||||
| 57 | 21 | my $profile = $self->{profile}; | |||||||||||||||||||||||||||
| 58 | 21 | my $config = $PROFILE{$profile}; | |||||||||||||||||||||||||||
| 59 | 21 | my $package = load_table_package( $self->{converter}, $profile ); | |||||||||||||||||||||||||||
| 60 | 21 | my $tables = $package->{tables}; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 21 | for my $required ( @{ $config->{required} } ) { | |||||||||||||||||||||||||||
| 63 | die "$config->{label} input requires table <$required>\n" | ||||||||||||||||||||||||||||
| 64 | 29 | ▶ | unless exists $tables->{$required}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 21 | my $records = _group_patients( $tables, $profile, $config ); | |||||||||||||||||||||||||||
| 68 | 19 | my %counts = map { $_ => scalar @{ $tables->{$_} } } sort keys %{$tables}; | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | return Convert::Pheno::Source::Result->new( | ||||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||
| 72 | data => $records, | ||||||||||||||||||||||||||||
| 73 | owned => 1, | ||||||||||||||||||||||||||||
| 74 | artifacts => { | ||||||||||||||||||||||||||||
| 75 | profile => $profile, | ||||||||||||||||||||||||||||
| 76 | table_counts => \%counts, | ||||||||||||||||||||||||||||
| 77 | table_sources => dclone( $package->{sources} ), | ||||||||||||||||||||||||||||
| 78 | source_kind => $package->{kind}, | ||||||||||||||||||||||||||||
| 79 | }, | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | 19 | ); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 21 | ▶ | sub prepare { | ||||||||||||||||||||||||||
|
Subroutine
prepare: called CC=8 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 85 | 21 | my ($self) = @_; | |||||||||||||||||||||||||||
| 86 | 21 | my $converter = $self->{converter}; | |||||||||||||||||||||||||||
| 87 | 21 | my $profile = $self->{profile}; | |||||||||||||||||||||||||||
| 88 | 21 | my $prepared_key = $profile . '_input_prepared'; | |||||||||||||||||||||||||||
| 89 | 21 | my $source_key = '_' . $profile . '_source_data'; | |||||||||||||||||||||||||||
| 90 | 21 | ▶ | return 1 if $converter->{$prepared_key} && exists $converter->{data}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$converter->{$prepared_key} and exists $converter->{"data"}
MC/DC0%0/2
$converter->{$prepared_key} and exists $converter->{"data"}
$converter->{$prepared_key}
exists $converter->{"data"}
Truth table33%1/3
A and B
A= $converter->{$prepared_key}B= exists $converter->{"data"}
| |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | $converter->{$source_key} = $converter->{data} | ||||||||||||||||||||||||||||
| 93 | 21 | ▶ | if exists $converter->{data} && !exists $converter->{$source_key}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $converter->{"data"} and not exists $converter->{$source_key}
MC/DC50%1/2
exists $converter->{"data"} and not exists $converter->{$source_key}
exists $converter->{"data"}
not exists $converter->{$source_key}
Truth table66%2/3
A and not(B)
A= exists $converter->{"data"}B= not exists $converter->{$source_key}
| |||||||||||||||||||||||||||||
| 94 | $converter->{data} = $converter->{$source_key} | ||||||||||||||||||||||||||||
| 95 | 21 | ▶ | if !exists $converter->{data} && exists $converter->{$source_key}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not exists $converter->{"data"} and exists $converter->{$source_key}
MC/DC0%0/2
not exists $converter->{"data"} and exists $converter->{$source_key}
not exists $converter->{"data"}
exists $converter->{$source_key}
Truth table66%2/3
not(A) and B
A= not exists $converter->{"data"}B= exists $converter->{$source_key}
| |||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 21 | my $source = $self->load; | |||||||||||||||||||||||||||
| 98 | 19 | $source->apply_to($converter); | |||||||||||||||||||||||||||
| 99 | 19 | $converter->{clinical_cdm_metadata}{$profile} = { | |||||||||||||||||||||||||||
| 100 | table_counts => $source->artifact('table_counts'), | ||||||||||||||||||||||||||||
| 101 | table_sources => $source->artifact('table_sources'), | ||||||||||||||||||||||||||||
| 102 | source_kind => $source->artifact('source_kind'), | ||||||||||||||||||||||||||||
| 103 | }; | ||||||||||||||||||||||||||||
| 104 | 19 | ▶ | $converter->{convertPheno} ||= get_info($converter); | ||||||||||||||||||||||||||
|
Condition33%1/3
$converter->{"convertPheno"} ||= get_info($converter)
MC/DC0%0/2
$converter->{"convertPheno"} ||= get_info($converter)
$converter->{"convertPheno"}
get_info($converter)
Truth table33%1/3
A ||= B
A= $converter->{"convertPheno"}B= get_info($converter)
| |||||||||||||||||||||||||||||
| 105 | 19 | $converter->{$prepared_key} = 1; | |||||||||||||||||||||||||||
| 106 | 19 | return 1; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 21 | ▶ | sub _group_patients { | ||||||||||||||||||||||||||
|
Subroutine
_group_patients: called CC=25 SCAR=32.7
| |||||||||||||||||||||||||||||
| 110 | 21 | my ( $tables, $profile, $config ) = @_; | |||||||||||||||||||||||||||
| 111 | 21 | my $person_table = $config->{person_table}; | |||||||||||||||||||||||||||
| 112 | 21 | my ( %record_for, @order, %concepts ); | |||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 21 | ▶ | if ( $config->{concept_table} && exists $tables->{ $config->{concept_table} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$config->{"concept_table"} and exists $$tables{$config->{"concept_table"}}
MC/DC100%2/2
$config->{"concept_table"} and exists $$tables{$config->{"concept_table"}}
$config->{"concept_table"}
exists $$tables{$config->{"concept_table"}}
Truth table100%3/3
A and B
A= $config->{"concept_table"}B= exists $$tables{$config->{"concept_table"}}
| |||||||||||||||||||||||||||||
| 115 | 5 | for my $row ( @{ $tables->{ $config->{concept_table} } } ) { | |||||||||||||||||||||||||||
| 116 | 25 | my $code = _first_value( $row, $config->{concept_key} ); | |||||||||||||||||||||||||||
| 117 | 25 | ▶ | next unless defined $code; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | die "$config->{label} table <$config->{concept_table}> contains duplicate concept <$code>\n" | ||||||||||||||||||||||||||||
| 119 | 25 | ▶ | if exists $concepts{$code}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 25 | ▶ | $concepts{$code} = $row if defined $code; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 21 | for my $row ( @{ $tables->{$person_table} } ) { | |||||||||||||||||||||||||||
| 125 | my $person_id = _required_identifier( | ||||||||||||||||||||||||||||
| 126 | $row, | ||||||||||||||||||||||||||||
| 127 | $config->{person_keys}, | ||||||||||||||||||||||||||||
| 128 | 38 | "$config->{label} $person_table", | |||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||
| 130 | die "$config->{label} table <$person_table> contains duplicate patient <$person_id>\n" | ||||||||||||||||||||||||||||
| 131 | 38 | ▶ | if exists $record_for{$person_id}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | 38 | my $record = { | |||||||||||||||||||||||||||
| 133 | model => $profile, | ||||||||||||||||||||||||||||
| 134 | personId => $person_id, | ||||||||||||||||||||||||||||
| 135 | patient => $row, | ||||||||||||||||||||||||||||
| 136 | tables => {}, | ||||||||||||||||||||||||||||
| 137 | visits => {}, | ||||||||||||||||||||||||||||
| 138 | # Concept metadata is read-only and can be very large in i2b2. | ||||||||||||||||||||||||||||
| 139 | # Share one index rather than cloning it once per patient. | ||||||||||||||||||||||||||||
| 140 | concepts => \%concepts, | ||||||||||||||||||||||||||||
| 141 | }; | ||||||||||||||||||||||||||||
| 142 | 38 | $record_for{$person_id} = $record; | |||||||||||||||||||||||||||
| 143 | 38 | push @order, $person_id; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | 21 | ▶ | die "$config->{label} table <$person_table> contains no patients\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | unless @order; | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 21 | ▶ | if ( exists $tables->{ $config->{visit_table} } ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 14 | for my $row ( @{ $tables->{ $config->{visit_table} } } ) { | |||||||||||||||||||||||||||
| 150 | 28 | my $person_id = _row_person_id( $row, $config->{person_keys} ); | |||||||||||||||||||||||||||
| 151 | 28 | ▶ | die "$config->{label} table <$config->{visit_table}> row is missing a patient identifier\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | unless defined $person_id; | ||||||||||||||||||||||||||||
| 153 | 28 | _require_known_patient( $profile, $config, $person_id, $config->{visit_table}, \%record_for ); | |||||||||||||||||||||||||||
| 154 | 28 | my $visit_id = _first_value( $row, @{ $config->{visit_keys} } ); | |||||||||||||||||||||||||||
| 155 | 28 | ▶ | next unless defined $visit_id; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | die "$config->{label} table <$config->{visit_table}> contains duplicate encounter <$visit_id> for patient <$person_id>\n" | ||||||||||||||||||||||||||||
| 157 | 28 | ▶ | if exists $record_for{$person_id}{visits}{$visit_id}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | 28 | $record_for{$person_id}{visits}{$visit_id} = $row; | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 21 | ▶ | my %patient_scoped = map { $_ => 1 } @{ $config->{patient_tables} || [] }; | ||||||||||||||||||||||||||
|
Condition50%1/2
$config->{'patient_tables'} || []
MC/DC0%0/1
$config->{'patient_tables'} || []
$config->{'patient_tables'}
Truth table50%1/2
A
A= $config->{'patient_tables'}
| |||||||||||||||||||||||||||||
| 163 | 21 | for my $table ( sort keys %{$tables} ) { | |||||||||||||||||||||||||||
| 164 | 106 | ▶ | next if $table eq $person_table; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 85 | ▶ | next if $config->{concept_table} && $table eq $config->{concept_table}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$config->{"concept_table"} and $table eq $config->{"concept_table"}
MC/DC100%2/2
$config->{"concept_table"} and $table eq $config->{"concept_table"}
$config->{"concept_table"}
$table eq $config->{"concept_table"}
Truth table100%3/3
A and B
A= $config->{"concept_table"}B= $table eq $config->{"concept_table"}
| |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 80 | for my $row ( @{ $tables->{$table} } ) { | |||||||||||||||||||||||||||
| 168 | 128 | my $person_id = _row_person_id( $row, $config->{person_keys} ); | |||||||||||||||||||||||||||
| 169 | 128 | ▶ | if ( !defined $person_id ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | die "$config->{label} table <$table> row is missing a patient identifier\n" | ||||||||||||||||||||||||||||
| 171 | 1 | ▶ | if $patient_scoped{$table}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 0 | next; | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | 127 | _require_known_patient( $profile, $config, $person_id, $table, \%record_for ); | |||||||||||||||||||||||||||
| 175 | 126 | push @{ $record_for{$person_id}{tables}{$table} }, $row; | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 19 | my @records = map { $record_for{$_} } @order; | |||||||||||||||||||||||||||
| 180 | 19 | for my $index ( 0 .. $#records ) { | |||||||||||||||||||||||||||
| 181 | 36 | ▶ | $records[$index]{isFirst} = $index == 0 ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | 19 | return \@records; | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 155 | ▶ | sub _require_known_patient { | ||||||||||||||||||||||||||
|
Subroutine
_require_known_patient: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 187 | 155 | my ( $profile, $config, $person_id, $table, $records ) = @_; | |||||||||||||||||||||||||||
| 188 | die "$config->{label} table <$table> references unknown patient <$person_id>\n" | ||||||||||||||||||||||||||||
| 189 | 155 | ▶ | unless exists $records->{$person_id}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | 154 | return 1; | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 38 | ▶ | sub _required_identifier { | ||||||||||||||||||||||||||
|
Subroutine
_required_identifier: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 194 | 38 | my ( $row, $keys, $context ) = @_; | |||||||||||||||||||||||||||
| 195 | 38 | my $value = _first_value( $row, @{$keys} ); | |||||||||||||||||||||||||||
| 196 | 38 | ▶ | die "$context row is missing a patient identifier\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | unless defined $value; | ||||||||||||||||||||||||||||
| 198 | 38 | return $value; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 156 | ▶ | sub _row_person_id { | ||||||||||||||||||||||||||
|
Subroutine
_row_person_id: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 202 | 156 | my ( $row, $keys ) = @_; | |||||||||||||||||||||||||||
| 203 | 156 | return _first_value( $row, @{$keys} ); | |||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 247 | ▶ | sub _first_value { | ||||||||||||||||||||||||||
|
Subroutine
_first_value: called CC=7 SCAR=20.4
| |||||||||||||||||||||||||||||
| 207 | 247 | my ( $row, @keys ) = @_; | |||||||||||||||||||||||||||
| 208 | 247 | for my $key (@keys) { | |||||||||||||||||||||||||||
| 209 | 249 | ▶ | next unless exists $row->{$key}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | 246 | my $value = $row->{$key}; | |||||||||||||||||||||||||||
| 211 | 246 | ▶ | next unless defined $value && !ref($value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $value and not ref $value
MC/DC0%0/2
defined $value and not ref $value
defined $value
not ref $value
Truth table33%1/3
A and not(B)
A= defined $valueB= not ref $value
| |||||||||||||||||||||||||||||
| 212 | 246 | $value =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||
| 213 | 246 | ▶ | next unless length $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 246 | ▶ | next if $value =~ /\A(?:NULL|\\N|\.)\z/i; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | 246 | return $value; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | 1 | return; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 136 | 1; | |||||||||||||||||||||||||||