| 1 | package Convert::Pheno::Source::OpenEHR; | ||||||||||||||||||||||||||||||||||||||||||
| 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 Convert::Pheno::IO::FileIO qw(io_yaml_or_json); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 136 | ▶ | use Convert::Pheno::Mapping::Shared qw(get_info); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 136 | ▶ | use Convert::Pheno::OpenEHR::ToBFF qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | extract_openehr_compositions | ||||||||||||||||||||||||||||||||||||||||||
| 10 | resolve_openehr_embedded_patient_id | ||||||||||||||||||||||||||||||||||||||||||
| 11 | resolve_openehr_patient_id | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 136 | ); | |||||||||||||||||||||||||||||||||||||||||
| 13 | 136 | ▶ | use Convert::Pheno::Source::Result; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 19 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 19 | my ( $class, $converter ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 19 | return bless { converter => $converter }, $class; | |||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 19 | ▶ | sub load { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 19 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 19 | my $converter = $self->{converter}; | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 19 | ▶ | if ( exists $converter->{data} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | return Convert::Pheno::Source::Result->new( | ||||||||||||||||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 17 | data => [ _normalize_documents( $converter->{data} ) ], | |||||||||||||||||||||||||||||||||||||||||
| 28 | # Normalization creates a new top-level document buffer. Its | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # nested values may still reference caller-owned structures. | ||||||||||||||||||||||||||||||||||||||||||
| 30 | owned => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||
| 32 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | ▶ | my @files = @{ $converter->{in_files} || [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$converter->{'in_files'} || []
MC/DC0%0/1
$converter->{'in_files'} || []
$converter->{'in_files'}
Truth table50%1/2
A
A= $converter->{'in_files'}
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | push @files, $converter->{in_file} | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | ▶ | if !@files && defined $converter->{in_file}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not @files and defined $converter->{"in_file"}
MC/DC50%1/2
not @files and defined $converter->{"in_file"}
not @files
defined $converter->{"in_file"}
Truth table66%2/3
not(A) and B
A= not @filesB= defined $converter->{"in_file"}
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | my @documents; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | for my $file (@files) { | |||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | my $loaded = io_yaml_or_json( | |||||||||||||||||||||||||||||||||||||||||
| 42 | { | ||||||||||||||||||||||||||||||||||||||||||
| 43 | filepath => $file, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | mode => 'read', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | push @documents, _normalize_documents($loaded); | |||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | return Convert::Pheno::Source::Result->new( | |||||||||||||||||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||||||||||||||||
| 52 | data => \@documents, | ||||||||||||||||||||||||||||||||||||||||||
| 53 | owned => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 17 | ▶ | sub prepare { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare: called CC=5 SCAR=16.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 17 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 17 | my $converter = $self->{converter}; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 17 | ▶ | return 1 if $converter->{openehr_input_prepared}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 17 | my $source = $self->load; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 17 | my @documents = @{ $source->data }; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 17 | my $grouped = _group_documents_by_patient( $converter, \@documents ); | |||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 16 | ▶ | $converter->{data} = @{$grouped} == 1 ? $grouped->[0] : $grouped; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 16 | ▶ | $converter->{_owns_prepared_data} = 1 if $source->owned; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 16 | delete $converter->{mapping_file_derived_entity_overrides}; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 16 | ▶ | $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)
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 16 | $converter->{openehr_input_prepared} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 16 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 17 | ▶ | sub _group_documents_by_patient { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_group_documents_by_patient: called CC=6 SCAR=18.0
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 17 | my ( $converter, $documents ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 17 | my ( %by_patient, @order ); | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 17 | for my $document ( @{$documents} ) { | |||||||||||||||||||||||||||||||||||||||||
| 80 | 19 | for my $patient_document ( | |||||||||||||||||||||||||||||||||||||||||
| 81 | _split_document_by_patient( $converter, $document ) | ||||||||||||||||||||||||||||||||||||||||||
| 82 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | { | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 21 | my $patient_id = | |||||||||||||||||||||||||||||||||||||||||
| 85 | resolve_openehr_patient_id( $converter, $patient_document ); | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 21 | ▶ | die "The input <openEHR> data could not be resolved to a patient id; please provide one composition set with a stable patient identifier in the payload or envelope\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $patient_id and length $patient_id
MC/DC50%1/2
defined $patient_id and length $patient_id
defined $patient_id
length $patient_id
Truth table66%2/3
A and B
A= defined $patient_idB= length $patient_id
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | unless defined $patient_id && length $patient_id; | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 20 | ▶ | if ( !exists $by_patient{$patient_id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 20 | $by_patient{$patient_id} = { | |||||||||||||||||||||||||||||||||||||||||
| 91 | patient => { id => $patient_id }, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | compositions => [], | ||||||||||||||||||||||||||||||||||||||||||
| 93 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 20 | push @order, $patient_id; | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 20 | push @{ $by_patient{$patient_id}{compositions} }, | |||||||||||||||||||||||||||||||||||||||||
| 97 | 20 | @{ extract_openehr_compositions($patient_document) }; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 16 | return [ map { $by_patient{$_} } @order ]; | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 19 | ▶ | sub _split_document_by_patient { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_split_document_by_patient: called CC=10 SCAR=23.5
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 19 | my ( $converter, $document ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 19 | ▶ | return ($document) if _document_has_patient_context($document); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 12 | my $compositions = extract_openehr_compositions($document); | |||||||||||||||||||||||||||||||||||||||||
| 109 | return ($document) | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 12 | ▶ | unless ref($compositions) eq 'ARRAY' && @{$compositions} > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $compositions eq "ARRAY" and @{$compositions;} > 1
MC/DC50%1/2
ref $compositions eq "ARRAY" and @{$compositions;} > 1
ref $compositions eq "ARRAY"
@{$compositions;} > 1
Truth table66%2/3
A and B
A= ref $compositions eq "ARRAY"B= @{$compositions;} > 1
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 3 | my ( %by_patient, @order ); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 3 | my $missing = 0; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 3 | for my $composition ( @{$compositions} ) { | |||||||||||||||||||||||||||||||||||||||||
| 115 | 6 | my $patient_id = resolve_openehr_embedded_patient_id( | |||||||||||||||||||||||||||||||||||||||||
| 116 | $composition, | ||||||||||||||||||||||||||||||||||||||||||
| 117 | [$composition], | ||||||||||||||||||||||||||||||||||||||||||
| 118 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 6 | ▶ | if ( !defined $patient_id || !length $patient_id ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $patient_id and length $patient_id
MC/DC0%0/2
defined $patient_id and length $patient_id
defined $patient_id
length $patient_id
Truth table33%1/3
A and B
A= defined $patient_idB= length $patient_id
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $missing = 1; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 6 | ▶ | if ( !exists $by_patient{$patient_id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 5 | $by_patient{$patient_id} = []; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 5 | push @order, $patient_id; | |||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 6 | push @{ $by_patient{$patient_id} }, $composition; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 3 | ▶ | return ($document) unless @order > 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 2 | ▶ | die "The input <openEHR> data mixes patient-identified and unidentified compositions; please provide patient-bearing envelopes or per-patient composition sets\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | if $missing; | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | return map { | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 2 | { | |||||||||||||||||||||||||||||||||||||||||
| 136 | patient => { id => $_ }, | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 4 | compositions => $by_patient{$_}, | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | } @order; | ||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 19 | ▶ | sub _document_has_patient_context { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_document_has_patient_context: called CC=7 SCAR=20.0
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 19 | my ($document) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 19 | ▶ | return 0 unless ref($document) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | return 1 | ||||||||||||||||||||||||||||||||||||||||||
| 147 | if ref( $document->{patient} ) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||
| 148 | && defined $document->{patient}{id} | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 19 | ▶ | && length $document->{patient}{id}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
ref $document->{"patient"} eq "HASH" and defined $document->{"patient"}{"id"} and length $document->{"patient"}{"id"}
ref $document->{"patient"} eq "HASH" and defined $document->{"patient"}{"id"}
MC/DC33%1/3
ref $document->{"patient"} eq "HASH" and defined $document->{"patient"}{"id"} and length $document->{"patient"}{"id"}
ref $document->{"patient"} eq "HASH"
defined $document->{"patient"}{"id"}
length $document->{"patient"}{"id"}
Truth table50%2/4
A and B and C
A= ref $document->{"patient"} eq "HASH"B= defined $document->{"patient"}{"id"}C= length $document->{"patient"}{"id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | return 1 | ||||||||||||||||||||||||||||||||||||||||||
| 152 | if ref( $document->{ehr_status} ) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 13 | ▶ | && exists $document->{ehr_status}{subject}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $document->{"ehr_status"} eq "HASH" and exists $document->{"ehr_status"}{"subject"}
MC/DC50%1/2
ref $document->{"ehr_status"} eq "HASH" and exists $document->{"ehr_status"}{"subject"}
ref $document->{"ehr_status"} eq "HASH"
exists $document->{"ehr_status"}{"subject"}
Truth table66%2/3
A and B
A= ref $document->{"ehr_status"} eq "HASH"B= exists $document->{"ehr_status"}{"subject"}
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 12 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 19 | ▶ | sub _normalize_documents { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_normalize_documents: called CC=8 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 19 | my ($data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 19 | ▶ | return () unless defined $data; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 19 | ▶ | if ( ref($data) eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 4 | my $all_envelopes = 1; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 4 | for my $item ( @{$data} ) { | |||||||||||||||||||||||||||||||||||||||||
| 165 | 6 | ▶ | if ( ref($item) ne 'HASH' || !exists $item->{compositions} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $item ne "HASH" or not exists $item->{"compositions"}
MC/DC50%1/2
ref $item ne "HASH" or not exists $item->{"compositions"}
ref $item ne "HASH"
not exists $item->{"compositions"}
Truth table66%2/3
A or not(B)
A= ref $item ne "HASH"B= not exists $item->{"compositions"}
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 2 | $all_envelopes = 0; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | last; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 4 | return map { _normalize_document($_) } @{$data} | |||||||||||||||||||||||||||||||||||||||||
| 172 | 4 | ▶ | if @{$data} && $all_envelopes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@{$data;} and $all_envelopes
MC/DC50%1/2
@{$data;} and $all_envelopes
@{$data;}
$all_envelopes
Truth table66%2/3
A and B
A= @{$data;}B= $all_envelopes
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | return ( _normalize_document($data) ); | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 15 | return ( _normalize_document($data) ); | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 21 | ▶ | sub _normalize_document { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_normalize_document: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 21 | my ($document) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 181 | return $document | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 21 | ▶ | if ref($document) eq 'HASH' && exists $document->{compositions}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $document eq "HASH" and exists $document->{"compositions"}
MC/DC100%2/2
ref $document eq "HASH" and exists $document->{"compositions"}
ref $document eq "HASH"
exists $document->{"compositions"}
Truth table100%3/3
A and B
A= ref $document eq "HASH"B= exists $document->{"compositions"}
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 5 | ▶ | return { compositions => $document } if ref($document) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 3 | return { compositions => [$document] }; | |||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 136 | 1; | |||||||||||||||||||||||||||||||||||||||||