| 1 | package Convert::Pheno::Source::CDISC::DatasetXML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 JSON::PP (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 136 | ▶ | use Path::Tiny qw(path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 136 | ▶ | use Scalar::Util qw(looks_like_number); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 136 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 136 | ▶ | use XML::Fast qw(xml2hash); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 136 | ▶ | use Convert::Pheno::CDISC::DefineXML qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | load_define_catalog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | resolve_define_group | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 136 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 136 | ▶ | use Convert::Pheno::CDISC::ODM::Detector qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | attribute_by_namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | detect_odm_document | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 136 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 136 | ▶ | use Convert::Pheno::CDISC::ODM::Util qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | attr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | children | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 136 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 136 | ▶ | use Convert::Pheno::CDISC::SDTM::Normalizer qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | derive_sdtm_entity_overrides | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | normalize_sdtm_datasets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 136 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 136 | ▶ | use Convert::Pheno::CDISC::SDTM::Terminology qw(prepare_sdtm_terminology); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 136 | ▶ | use Convert::Pheno::Mapping::Shared qw(get_info); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 136 | ▶ | use Convert::Pheno::Source::Result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 136 | my $DATASET_XML_NAMESPACE = 'http://www.cdisc.org/ns/Dataset-XML/v1.0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 15 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 15 | my ( $class, $converter ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 15 | return bless { converter => $converter }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 15 | ▶ | sub load { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=17 SCAR=30.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 15 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 15 | my $converter = $self->{converter}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 15 | my ( $define_input, @dataset_documents, @labels ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 15 | ▶ | if ( exists $converter->{data} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 5 | my $input = $converter->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | die "In-memory Dataset-XML input must contain <define> and <datasets>\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | unless ref($input) eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | && exists $input->{define} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 5 | ▶ | && ref( $input->{datasets} ) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $input eq "HASH" and exists $input->{"define"} and ref $input->{"datasets"} eq "ARRAY"
ref $input eq "HASH" and exists $input->{"define"}
MC/DC0%0/3
ref $input eq "HASH" and exists $input->{"define"} and ref $input->{"datasets"} eq "ARRAY"
ref $input eq "HASH"
exists $input->{"define"}
ref $input->{"datasets"} eq "ARRAY"
Truth table25%1/4
A and B and C
A= ref $input eq "HASH"B= exists $input->{"define"}C= ref $input->{"datasets"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 5 | $define_input = _clone_input( $input->{define} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | @dataset_documents = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 20 | _xml_document( _clone_input($_), 'in-memory Dataset-XML' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 5 | } @{ $input->{datasets} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 5 | @labels = map { 'in-memory Dataset-XML dataset ' . ( $_ + 1 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 .. $#dataset_documents; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 10 | my $define_file = $converter->{define_xml}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 10 | ▶ | die "Dataset-XML input requires --define-xml <file>\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $define_file and length $define_file
MC/DC0%0/2
defined $define_file and length $define_file
defined $define_file
length $define_file
Truth table33%1/3
A and B
A= defined $define_fileB= length $define_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | unless defined $define_file && length $define_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 10 | ▶ | die "Dataset-XML Define-XML file <$define_file> does not exist\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | unless -f $define_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 10 | ▶ | 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'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | push @files, $converter->{in_file} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 10 | ▶ | if !@files && defined $converter->{in_file}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not @files and defined $converter->{"in_file"}
MC/DC0%0/2
not @files and defined $converter->{"in_file"}
not @files
defined $converter->{"in_file"}
Truth table33%1/3
not(A) and B
A= not @filesB= defined $converter->{"in_file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 10 | ▶ | die "Dataset-XML input requires at least one XML dataset file\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | unless @files; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 10 | $define_input = $define_file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 10 | for my $file (@files) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 34 | ▶ | die "Dataset-XML file <$file> does not exist\n" unless -f $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 34 | push @dataset_documents, _read_xml_file($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 34 | push @labels, $file; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 15 | my $catalog = load_define_catalog( $define_input, 'Define-XML' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 15 | my @datasets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | my $metadata_version_oid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 15 | for my $index ( 0 .. $#dataset_documents ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 48 | my $dataset = _dataset_document( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | $dataset_documents[$index], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | $labels[$index], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | $catalog, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 46 | ▶ | $metadata_version_oid //= $dataset->{metaDataVersionOID}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$metadata_version_oid //= $dataset->{"metaDataVersionOID"}
MC/DC0%0/2
$metadata_version_oid //= $dataset->{"metaDataVersionOID"}
$metadata_version_oid
$dataset->{"metaDataVersionOID"}
Truth table66%2/3
A //= B
A= $metadata_version_oidB= $dataset->{"metaDataVersionOID"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | die "Dataset-XML files contain inconsistent MetaDataVersionOID values <$metadata_version_oid> and <$dataset->{metaDataVersionOID}>\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 46 | ▶ | if $dataset->{metaDataVersionOID} ne $metadata_version_oid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 46 | push @datasets, $dataset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 13 | my $normalized = normalize_sdtm_datasets( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | \@datasets, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | \@labels, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | format_name => 'Dataset-XML', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | source_format => 'dataset-xml', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | version_key => 'datasetXMLVersion', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | subject_metadata_fields => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | qw(defineXMLVersion metaDataVersionOID metaDataRef originator sourceSystem) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | my $terminology = prepare_sdtm_terminology( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | $converter, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | $normalized->{metadata}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 13 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | return Convert::Pheno::Source::Result->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | data => $normalized->{subjects}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | owned => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | artifacts => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | dataset_metadata => $normalized->{metadata}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | subject_independent_domains => $normalized->{subject_independent}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | terminology_mapping => $terminology->{mapping}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | source_terminology => $terminology->{source_terms}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | terminology_requires_sqlite => $terminology->{requires_sqlite}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | derived_entity_overrides => derive_sdtm_entity_overrides( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | $converter, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | $normalized->{metadata}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | $normalized->{subject_independent}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 13 | format_label => 'Dataset-XML', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | provenance_key => 'datasetXml', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 25 | ▶ | sub _clone_input { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clone_input: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 25 | my ($input) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 25 | ▶ | return ref($input) ? dclone($input) : $input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 34 | ▶ | sub _read_xml_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_xml_file: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 34 | my ($file) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 34 | return _xml_document( path($file)->slurp_utf8, $file ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 54 | ▶ | sub _xml_document { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_xml_document: called CC=5 SCAR=17.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 54 | my ( $input, $label ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 54 | ▶ | return $input if ref($input) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 54 | ▶ | die "XML input <$label> must contain an XML string or parsed object\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $input or not defined $input
MC/DC0%0/2
ref $input or not defined $input
ref $input
not defined $input
Truth table33%1/3
A or not(B)
A= ref $inputB= not defined $input
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | if ref($input) || !defined $input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 54 | my $document = eval { xml2hash $input, attr => '-', text => '~' }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 54 | ▶ | die "Could not parse XML input <$label>: $@" if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 54 | return $document; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 48 | ▶ | sub _dataset_document { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dataset_document: called CC=34 SCAR=41.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 48 | my ( $document, $label, $catalog ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 48 | my $descriptor = detect_odm_document($document); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | die "Dataset-XML input <$label> must use the ODM 1.3 namespace\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 48 | ▶ | unless $descriptor->{adapter} eq 'v1'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 48 | my %seen_namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | my @dataset_namespaces = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 96 | ▶ | $_ eq $DATASET_XML_NAMESPACE && !$seen_namespace{$_}++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_ eq $DATASET_XML_NAMESPACE && !$seen_namespace{$_}++
MC/DC50%1/2
$_ eq $DATASET_XML_NAMESPACE && !$seen_namespace{$_}++
$_ eq $DATASET_XML_NAMESPACE
!$seen_namespace{$_}++
Truth table66%2/3
A && not(B)
A= $_ eq $DATASET_XML_NAMESPACEB= !$seen_namespace{$_}++
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 48 | } values %{ $descriptor->{namespaces} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 48 | ▶ | die "Dataset-XML input <$label> is missing the Dataset-XML v1.0 namespace\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | unless @dataset_namespaces == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | my $dataset_version = attribute_by_namespace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | $descriptor->{root}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | $descriptor->{namespaces}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 48 | $DATASET_XML_NAMESPACE, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 'DatasetXMLVersion', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 48 | ▶ | die "Dataset-XML input <$label> is missing DatasetXMLVersion\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $dataset_version and length $dataset_version
MC/DC0%0/2
defined $dataset_version and length $dataset_version
defined $dataset_version
length $dataset_version
Truth table33%1/3
A and B
A= defined $dataset_versionB= length $dataset_version
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | unless defined $dataset_version && length $dataset_version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 48 | ▶ | die "Unsupported Dataset-XML version <$dataset_version> in <$label>; expected 1.0.0\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | unless $dataset_version eq '1.0.0'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | my @containers = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 48 | @{ children( $descriptor->{root}, 'ClinicalData' ) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 48 | @{ children( $descriptor->{root}, 'ReferenceData' ) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 48 | ▶ | die "Dataset-XML input <$label> must contain exactly one ClinicalData or ReferenceData element\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | unless @containers == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 48 | my $container = $containers[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 48 | my $study_oid = attr( $container, 'StudyOID' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 48 | my $version_oid = attr( $container, 'MetaDataVersionOID' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 48 | ▶ | die "Dataset-XML input <$label> is missing StudyOID or MetaDataVersionOID\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $study_oid and length $study_oid and defined $version_oid and length $version_oid
defined $study_oid and length $study_oid and defined $version_oid
defined $study_oid and length $study_oid
MC/DC0%0/4
defined $study_oid and length $study_oid and defined $version_oid and length $version_oid
defined $study_oid
length $study_oid
defined $version_oid
length $version_oid
Truth table20%1/5
A and B and C and D
A= defined $study_oidB= length $study_oidC= defined $version_oidD= length $version_oid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | unless defined $study_oid && length $study_oid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | && defined $version_oid && length $version_oid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 48 | my @groups = @{ children( $container, 'ItemGroupData' ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 48 | ▶ | die "Dataset-XML input <$label> does not contain any ItemGroupData rows\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | unless @groups; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 48 | my $group_oid = attr( $groups[0], 'ItemGroupOID' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 48 | ▶ | die "Dataset-XML input <$label> contains an ItemGroupData row without ItemGroupOID\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $group_oid and length $group_oid
MC/DC0%0/2
defined $group_oid and length $group_oid
defined $group_oid
length $group_oid
Truth table33%1/3
A and B
A= defined $group_oidB= length $group_oid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | unless defined $group_oid && length $group_oid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 48 | my ( $provider, $group ) = resolve_define_group( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | $catalog, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | $study_oid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | $version_oid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | $group_oid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | "Dataset-XML input <$label>", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 47 | my %column_by_oid = map { $_->{itemOID} => $_ } @{ $group->{columns} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 47 | my ( @rows, %sequence ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 47 | for my $row_index ( 0 .. $#groups ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 94 | my $row = $groups[$row_index]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 94 | my $current_group_oid = attr( $row, 'ItemGroupOID' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 94 | ▶ | die "Dataset-XML input <$label> contains multiple ItemGroupOID values <$group_oid> and <$current_group_oid>\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $current_group_oid and $current_group_oid eq $group_oid
MC/DC0%0/2
defined $current_group_oid and $current_group_oid eq $group_oid
defined $current_group_oid
$current_group_oid eq $group_oid
Truth table33%1/3
A and B
A= defined $current_group_oidB= $current_group_oid eq $group_oid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | unless defined $current_group_oid && $current_group_oid eq $group_oid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | my $sequence = attribute_by_namespace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | $row, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | $descriptor->{namespaces}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 94 | $DATASET_XML_NAMESPACE, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 'ItemGroupDataSeq', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 94 | ▶ | die "Dataset-XML input <$label> row " . ( $row_index + 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $sequence and length $sequence
MC/DC0%0/2
defined $sequence and length $sequence
defined $sequence
length $sequence
Truth table33%1/3
A and B
A= defined $sequenceB= length $sequence
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | . " is missing ItemGroupDataSeq\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | unless defined $sequence && length $sequence; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | die "Dataset-XML input <$label> contains duplicate ItemGroupDataSeq <$sequence>\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 94 | ▶ | if $sequence{$sequence}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 94 | my %values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 94 | for my $item ( @{ children( $row, 'ItemData' ) } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 612 | my $item_oid = attr( $item, 'ItemOID' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 612 | ▶ | die "Dataset-XML input <$label> row $sequence contains ItemData without ItemOID\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $item_oid and length $item_oid
MC/DC0%0/2
defined $item_oid and length $item_oid
defined $item_oid
length $item_oid
Truth table33%1/3
A and B
A= defined $item_oidB= length $item_oid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | unless defined $item_oid && length $item_oid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | die "Dataset-XML input <$label> row $sequence contains ItemOID <$item_oid> outside ItemGroupDef <$group_oid>\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 612 | ▶ | unless exists $column_by_oid{$item_oid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | die "Dataset-XML input <$label> row $sequence contains duplicate ItemOID <$item_oid>\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 612 | ▶ | if exists $values{$item_oid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 612 | my $value = attr( $item, 'Value' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 612 | ▶ | die "Dataset-XML input <$label> row $sequence ItemOID <$item_oid> is missing Value; omit ItemData for a missing value\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | unless defined $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | $values{$item_oid} = _coerce_value( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | $value, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | $column_by_oid{$item_oid}{dataType}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 612 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | push @rows, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | exists $values{ $_->{itemOID} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | ? $values{ $_->{itemOID} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | : undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 94 | ▶ | } @{ $group->{columns} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 47 | my $root = $descriptor->{root}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 47 | my $prior_file_oid = attr( $root, 'PriorFileOID' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | die "Dataset-XML input <$label> links to Define-XML <$prior_file_oid>, but the supplied Define-XML FileOID is <$catalog->{fileOID}>\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | if defined $prior_file_oid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | && defined $catalog->{fileOID} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 47 | ▶ | && $prior_file_oid ne $catalog->{fileOID}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $prior_file_oid and defined $catalog->{"fileOID"} and $prior_file_oid ne $catalog->{"fileOID"}
defined $prior_file_oid and defined $catalog->{"fileOID"}
MC/DC33%1/3
defined $prior_file_oid and defined $catalog->{"fileOID"} and $prior_file_oid ne $catalog->{"fileOID"}
defined $prior_file_oid
defined $catalog->{"fileOID"}
$prior_file_oid ne $catalog->{"fileOID"}
Truth table50%2/4
A and B and C
A= defined $prior_file_oidB= defined $catalog->{"fileOID"}C= $prior_file_oid ne $catalog->{"fileOID"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | my $dataset = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | datasetXMLVersion => $dataset_version, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | defineXMLVersion => $provider->{defineXMLVersion}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | studyOID => $study_oid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | metaDataVersionOID => $version_oid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | name => $group->{name}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | label => $group->{label}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | itemGroupOID => $group_oid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | records => scalar(@rows), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 46 | columns => dclone( $group->{columns} ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | rows => \@rows, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 46 | ▶ | $dataset->{originator} = attr( $root, 'Originator' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | if defined attr( $root, 'Originator' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 46 | ▶ | $dataset->{sourceSystem} = attr( $root, 'SourceSystem' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | if defined attr( $root, 'SourceSystem' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 46 | ▶ | $dataset->{metaDataRef} = $prior_file_oid if defined $prior_file_oid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 46 | return $dataset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 612 | ▶ | sub _coerce_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_coerce_value: called CC=8 SCAR=23.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 612 | my ( $value, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 612 | ▶ | $type = lc( $type // q{} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$type // ""
MC/DC0%0/1
$type // ""
$type
Truth table50%1/2
A
A= $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 612 | ▶ | return 0 + $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type =~ /\A(?:integer|float|double|decimal)\z/ and &looks_like_number($value)
MC/DC50%1/2
$type =~ /\A(?:integer|float|double|decimal)\z/ and &looks_like_number($value)
$type =~ /\A(?:integer|float|double|decimal)\z/
&looks_like_number($value)
Truth table66%2/3
A and B
A= $type =~ /\A(?:integer|float|double|decimal)\z/B= &looks_like_number($value)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | if $type =~ /\A(?:integer|float|double|decimal)\z/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | && looks_like_number($value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 524 | ▶ | return JSON::PP::true() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$type eq "boolean" and $value =~ /\A(?:true|1)\z/i
MC/DC0%0/2
$type eq "boolean" and $value =~ /\A(?:true|1)\z/i
$type eq "boolean"
$value =~ /\A(?:true|1)\z/i
Truth table33%1/3
A and B
A= $type eq "boolean"B= $value =~ /\A(?:true|1)\z/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | if $type eq 'boolean' && $value =~ /\A(?:true|1)\z/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 524 | ▶ | return JSON::PP::false() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$type eq "boolean" and $value =~ /\A(?:false|0)\z/i
MC/DC0%0/2
$type eq "boolean" and $value =~ /\A(?:false|0)\z/i
$type eq "boolean"
$value =~ /\A(?:false|0)\z/i
Truth table33%1/3
A and B
A= $type eq "boolean"B= $value =~ /\A(?:false|0)\z/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | if $type eq 'boolean' && $value =~ /\A(?:false|0)\z/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 524 | return $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 13 | ▶ | sub prepare { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare: called CC=12 SCAR=25.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 13 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 13 | my $converter = $self->{converter}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | return 1 if $converter->{dataset_xml_input_prepared} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 13 | ▶ | && exists $converter->{data}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$converter->{"dataset_xml_input_prepared"} and exists $converter->{"data"}
MC/DC0%0/2
$converter->{"dataset_xml_input_prepared"} and exists $converter->{"data"}
$converter->{"dataset_xml_input_prepared"}
exists $converter->{"data"}
Truth table66%2/3
A and B
A= $converter->{"dataset_xml_input_prepared"}B= exists $converter->{"data"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | $converter->{_dataset_xml_source_data} = $converter->{data} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | if exists $converter->{data} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 13 | ▶ | && !exists $converter->{_dataset_xml_source_data}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $converter->{"data"} and not exists $converter->{"_dataset_xml_source_data"}
MC/DC50%1/2
exists $converter->{"data"} and not exists $converter->{"_dataset_xml_source_data"}
exists $converter->{"data"}
not exists $converter->{"_dataset_xml_source_data"}
Truth table66%2/3
A and not(B)
A= exists $converter->{"data"}B= not exists $converter->{"_dataset_xml_source_data"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | $converter->{data} = $converter->{_dataset_xml_source_data} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | if !exists $converter->{data} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 13 | ▶ | && exists $converter->{_dataset_xml_source_data}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not exists $converter->{"data"} and exists $converter->{"_dataset_xml_source_data"}
MC/DC100%2/2
not exists $converter->{"data"} and exists $converter->{"_dataset_xml_source_data"}
not exists $converter->{"data"}
exists $converter->{"_dataset_xml_source_data"}
Truth table100%3/3
not(A) and B
A= not exists $converter->{"data"}B= exists $converter->{"_dataset_xml_source_data"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 13 | my $source = $self->load; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 11 | $source->apply_to($converter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | $converter->{dataset_xml_metadata} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 11 | $source->artifact('dataset_metadata'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | $converter->{dataset_xml_subject_independent_domains} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 11 | $source->artifact('subject_independent_domains'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | $converter->{source_derived_entity_overrides} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 11 | ▶ | $source->artifact('derived_entity_overrides') || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$source->artifact('derived_entity_overrides') || {}
MC/DC0%0/1
$source->artifact('derived_entity_overrides') || {}
$source->artifact('derived_entity_overrides')
Truth table50%1/2
A
A= $source->artifact('derived_entity_overrides')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | $converter->{sdtm_terminology_mapping} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 11 | ▶ | $source->artifact('terminology_mapping') || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$source->artifact('terminology_mapping') || {}
MC/DC0%0/1
$source->artifact('terminology_mapping') || {}
$source->artifact('terminology_mapping')
Truth table50%1/2
A
A= $source->artifact('terminology_mapping')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | $converter->{sdtm_source_terms} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 11 | ▶ | $source->artifact('source_terminology') || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$source->artifact('source_terminology') || {}
MC/DC0%0/1
$source->artifact('source_terminology') || {}
$source->artifact('source_terminology')
Truth table50%1/2
A
A= $source->artifact('source_terminology')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | $converter->{terminology_lookup_required} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 11 | ▶ | $source->artifact('terminology_requires_sqlite') ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 11 | ▶ | $converter->{convertPheno} ||= get_info($converter); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$converter->{"convertPheno"} ||= get_info($converter)
MC/DC0%0/2
$converter->{"convertPheno"} ||= get_info($converter)
$converter->{"convertPheno"}
get_info($converter)
Truth table66%2/3
A ||= B
A= $converter->{"convertPheno"}B= get_info($converter)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 11 | $converter->{dataset_xml_input_prepared} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 11 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 136 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||