lib/Convert/Pheno/CLI/Args.pm

filter: Statementstmt 91.2% 291 / 319 Branchbran 84.8% 331 / 390 Conditioncond 76.0% 216 / 284 MC/DCmcdc 36.1% 47 / 130 Subroutinesub 97.4% 38 / 39 Podpod 0.0% 0 / 1 totaltotal 79.3% 923 / 1163 CC 290 SCAR 55.0
CC
290
Cov
84%
build_cli_request
375.5
__ANON__
32.0
_valid_table_package_input
10.8
CRAP 245.2
↑ Summary lib/Convert/Pheno/CDISC/DefineXML.pm »
1 package Convert::Pheno::CLI::Args;
2  
3 62 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 62 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 62 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 62 ▶use Getopt::Long qw(GetOptionsFromArray :config no_ignore_case);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 62 ▶use File::Spec::Functions qw(catfile file_name_is_absolute);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 62 ▶use Convert::Pheno::OMOP::Definitions qw(@omop_supported_tables);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 62 ▶use Convert::Pheno::Operations qw(conversion_spec is_public_conversion);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 62 our @EXPORT_OK = qw(build_cli_request);
13  
14 246 ▶sub _normalize_cli_type {
Subroutine _normalize_cli_type: called CC=2 SCAR=6.9
15 246 my ($type) = @_;
16 246 ▶ return undef unless defined $type;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 188 58 246
17 58 my $norm = lc $type;
18 58 $norm =~ s/^\s+|\s+$//g;
19 58 $norm =~ s/[-_\s]+//g;
20 58 my %map = (
21 bff => 'bff',
22 beacon => 'bff',
23 pxf => 'pxf',
24 phenopackets => 'pxf',
25 omop => 'omop',
26 omopcdm => 'omop',
27 openehr => 'openehr',
28 ehrbase => 'openehr',
29 redcap => 'redcap',
30 cbioportal => 'cbioportal',
31 cdiscodm => 'cdiscodm',
32 datasetjson => 'datasetjson',
33 datasetxml => 'datasetxml',
34 fhir => 'fhir',
35 i2b2 => 'i2b2',
36 sentinel => 'sentinel',
37 sentinelcdm => 'sentinel',
38 pcornet => 'pcornet',
39 pcornetcdm => 'pcornet',
40 csv => 'csv',
41 jsonf => 'jsonf',
42 jsonld => 'jsonld',
43 );
44 58 return $map{$norm};
45 }
46  
47 53 ▶sub _count_defined {
Subroutine _count_defined: called CC=1 SCAR=0.0
48 53 return scalar grep { defined $_ } @_;
49 }
50  
51 14 ▶sub _valid_table_package_input {
Subroutine _valid_table_package_input: called CC=5 SCAR=23.8
52 14 my ($path) = @_;
53 14 ▶ return 0 unless defined $path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 14 14
54 14 ▶ return 1 if -d $path;
Branch: 1 branch
BranchTrueFalseTotal
if -d $path 14 0 14
55 0 ▶ return 0 unless -f $path;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $path 0 0 0
56 0 ▶ return $path =~ m/\.(?:zip|csv|tsv|txt)(?:\.gz)?\z/i ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$path =~ /\.(?:zip|csv|tsv|txt)(?:\.gz)?\z/i ? : 0 0 0
57 }
58  
59 41 ▶sub _valid_omop_input {
Subroutine _valid_omop_input: called CC=5 SCAR=16.7
60 41 my ($path) = @_;
61 41 ▶ return 0 unless defined $path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 41 41
62 41 ▶ return 1 if -d $path;
Branch: 1 branch
BranchTrueFalseTotal
if -d $path 2 39 41
63 39 ▶ return 0 unless -f $path;
Branch: 1 branch
BranchTrueFalseTotal
unless -f $path 0 39 39
64 39 ▶ return $path =~ m/\.(?:zip|csv|tsv|sql)(?:\.gz)?\z/i ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$path =~ /\.(?:zip|csv|tsv|sql)(?:\.gz)?\z/i ? : 39 0 39
65 }
66  
67 76 ▶sub _resolve_output_path {
Subroutine _resolve_output_path: called CC=3 SCAR=11.0
68 76 my ( $dir, $path ) = @_;
69 76 ▶ return undef unless defined $path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 76 76
70 76 ▶ return $path if file_name_is_absolute($path);
Branch: 1 branch
BranchTrueFalseTotal
if file_name_is_absolute($path) 40 36 76
71 36 return catfile( $dir, $path );
72 }
73  
74 129 ▶sub build_cli_request {
Subroutine build_cli_request: called CC=211 SCAR=59.3
Pod undocumented
75 129 my (%arg) = @_;
76 129 ▶ my $argv = $arg{argv} || [];
Condition50%1/2
$arg{'argv'} || []
l!l
1290
MC/DC0%0/1
$arg{'argv'} || []
$arg{'argv'}
Truth table50%1/2
A
A= $arg{'argv'}
Aresult
11
00
77 0 ▶ my $usage_error = $arg{usage_error} || sub { die @_ };
Subroutine __ANON__: not called CC=1 SCAR=2.0
Condition33%1/3
$arg{'usage_error'} || sub { die @_; }
l!l&&r!l&&!r
12900
MC/DC0%0/2
$arg{'usage_error'} || sub { die @_; }
$arg{'usage_error'} sub { die @_; }
Truth table33%1/3
A || B
A= $arg{'usage_error'}B= sub { die @_; }
ABresult
1X1
011
000
78 129 my $schema_default = $arg{schema_file};
79 129 ▶ my $out_dir = exists $arg{out_dir} ? $arg{out_dir} : '.';
Branch: 1 branch
BranchTrueFalseTotal
exists $arg{'out_dir'} ? : 129 0 129
80 129 ▶ my $color = exists $arg{color} ? $arg{color} : 1;
Branch: 1 branch
BranchTrueFalseTotal
exists $arg{'color'} ? : 128 1 129
81 129 ▶ my $stream = exists $arg{stream} ? $arg{stream} : 0;
Branch: 1 branch
BranchTrueFalseTotal
exists $arg{'stream'} ? : 59 70 129
82 129 ▶ my $ohdsi_db = exists $arg{ohdsi_db} ? $arg{ohdsi_db} : 0;
Branch: 1 branch
BranchTrueFalseTotal
exists $arg{'ohdsi_db'} ? : 59 70 129
83  
84 129 my ( $in_type_arg, $out_type_arg );
85 129 my ( $in_pxf, $in_bff, $in_cbioportal, $in_redcap, $in_cdiscodm, $in_csv );
86 129 my @datasetjson_files;
87 129 my @datasetxml_files;
88 129 my @fhir_files;
89 129 my @i2b2_files;
90 129 my @sentinel_files;
91 129 my @pcornet_files;
92 129 my @openehr_files;
93 129 my @omop_files;
94 129 my ( $out_bff, $out_pxf, $out_csv, $out_jsonf, $out_jsonld );
95 129 my $out_omop_selected = 0;
96 129 my $out_bff_selected = 0;
97 129 my @entities_args;
98 my @out_name_specs;
99 129 my ( $help, $man, $mapping_file, $define_xml, $max_lines_sql, $search );
100 129 my ( $text_similarity_method, $min_text_similarity_score, $levenshtein_weight );
101 129 my ( $debug, $verbose, $sep, $exposures_file, $sql2csv, $test, $term_audit );
102 129 my ( @omop_tables, $redcap_dictionary, $path_to_ohdsi_db );
103 129 my ( $self_validate_schema, $overwrite, $username, $log, $version );
104 129 my $default_vital_status;
105 129 my $schema_file = $schema_default;
106 129 my $source_info = 1;
107 129 my $include_dataset_id = 0;
108  
109 GetOptionsFromArray(
110 $argv,
111 'i=s' => \$in_type_arg,
112 'o=s' => \$out_type_arg,
113 'ipxf=s' => \$in_pxf,
114 'ibff=s' => \$in_bff,
115 'icbioportal=s' => \$in_cbioportal,
116 'iredcap=s' => \$in_redcap,
117 'icdisc-odm=s' => \$in_cdiscodm,
118 'idataset-json=s{1,}' => \@datasetjson_files,
119 'idataset-xml=s{1,}' => \@datasetxml_files,
120 'ifhir=s{1,}' => \@fhir_files,
121 'ii2b2=s{1,}' => \@i2b2_files,
122 'isentinel=s{1,}' => \@sentinel_files,
123 'ipcornet=s{1,}' => \@pcornet_files,
124 'iomop=s{1,}' => \@omop_files,
125 'iopenehr=s{1,}' => \@openehr_files,
126 'icsv=s' => \$in_csv,
127 61 ▶ 'obff:s' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.1
128 61 my ( $opt_name, $opt_value ) = @_;
129 61 $out_bff_selected = 1;
130 61 ▶ $out_bff = $opt_value if defined $opt_value;
Branch: 1 branch
BranchTrueFalseTotal
if defined $opt_value 61 0 61
131 },
132 129 ▶ 'opxf=s' => \$out_pxf,
Branch: 1 branch
BranchTrueFalseTotal
&GetOptionsFromArray($argv, "i=s", \$in_type_arg, "o=s", \$out_type_arg, "ipxf=s", \$in_pxf, "ibff=s", \$in_bff, "icbioportal=s", \$in_cbioportal, "iredcap=s", \$in_redcap, "icdisc-odm=s", \$in_cdiscodm, "idataset-json=s{1,}", \@datasetjson_files, "idataset-xml=s{1,}", \@datasetxml_files, "ifhir=s{1,}", \@fhir_files, "ii2b2=s{1,}", \@i2b2_files, "isentinel=s{1,}", \@sentinel_files, "ipcornet=s{1,}", \@pcornet_files, "iomop=s{1,}", \@omop_files, "iopenehr=s{1,}", \@openehr_files, "icsv=s", \$in_csv, "obff:s", sub { my($opt_name, $opt_value) = @_; $out_bff_selected = 1; $out_bff = $opt_value if defined $opt_value; } , "opxf=s", \$out_pxf, "ocsv=s", \$out_csv, "ojsonf=s", \$out_jsonf, "ojsonld=s", \$out_jsonld, "oomop", \$out_omop_selected, "out-dir=s", \$out_dir, "entities=s{1,}", \@entities_args, "out-name=s", \@out_name_specs, "help|?", \$help, "man", \$man, "mapping-file=s", \$mapping_file, "define-xml=s", \$define_xml, "max-lines-sql=i", \$max_lines_sql, "search=s", \$search, "text-similarity-method=s", \$text_similarity_method, "min-text-similarity-score=f", \$min_text_similarity_score, "levenshtein-weight=f", \$levenshtein_weight, "debug=i", \$debug, "verbose|v", \$verbose, "color!", \$color, "separator|sep=s", \$sep, "schema-file=s", \$schema_file, "exposures-file=s", \$exposures_file, "stream!", \$stream, "sql2csv", \$sql2csv, "test", \$test, "term-audit=s", \$term_audit, "source-info!", \$source_info, "include-dataset-id!", \$include_dataset_id, "ohdsi-db", \$ohdsi_db, "omop-tables=s{1,}", \@omop_tables, "redcap-dictionary|rcd=s", \$redcap_dictionary, "path-to-ohdsi-db=s", \$path_to_ohdsi_db, "self-validate-schema|svs", \$self_validate_schema, "default-vital-status=s", \$default_vital_status, "O", \$overwrite, "username|u=s", \$username, "log:s", \$log, "version|V", \$version) or &$usage_error("Invalid command-line arguments") 127 2 129
133 'ocsv=s' => \$out_csv,
134 'ojsonf=s' => \$out_jsonf,
135 'ojsonld=s' => \$out_jsonld,
136 'oomop' => \$out_omop_selected,
137 'out-dir=s' => \$out_dir,
138 'entities=s{1,}' => \@entities_args,
139 'out-name=s' => \@out_name_specs,
140 'help|?' => \$help,
141 'man' => \$man,
142 'mapping-file=s' => \$mapping_file,
143 'define-xml=s' => \$define_xml,
144 'max-lines-sql=i' => \$max_lines_sql,
145 'search=s' => \$search,
146 'text-similarity-method=s' => \$text_similarity_method,
147 'min-text-similarity-score=f' => \$min_text_similarity_score,
148 'levenshtein-weight=f' => \$levenshtein_weight,
149 'debug=i' => \$debug,
150 'verbose|v' => \$verbose,
151 'color!' => \$color,
152 'separator|sep=s' => \$sep,
153 'schema-file=s' => \$schema_file,
154 'exposures-file=s' => \$exposures_file,
155 'stream!' => \$stream,
156 'sql2csv' => \$sql2csv,
157 'test' => \$test,
158 'term-audit=s' => \$term_audit,
159 'source-info!' => \$source_info,
160 'include-dataset-id!' => \$include_dataset_id,
161 'ohdsi-db' => \$ohdsi_db,
162 'omop-tables=s{1,}' => \@omop_tables,
163 'redcap-dictionary|rcd=s' => \$redcap_dictionary,
164 'path-to-ohdsi-db=s' => \$path_to_ohdsi_db,
165 'self-validate-schema|svs' => \$self_validate_schema,
166 'default-vital-status=s' => \$default_vital_status,
167 'O' => \$overwrite,
168 'username|u=s' => \$username,
169 'log:s' => \$log,
170 'version|V' => \$version,
171 ) or $usage_error->('Invalid command-line arguments');
172  
173 return {
174 127 ▶ action => 'help',
Branch: 1 branch
BranchTrueFalseTotal
if $help 2 125 127
175 color => $color,
176 } if $help;
177  
178 return {
179 125 ▶ action => 'man',
Branch: 1 branch
BranchTrueFalseTotal
if $man 1 124 125
180 color => $color,
181 } if $man;
182  
183 return {
184 124 ▶ action => 'version',
Branch: 1 branch
BranchTrueFalseTotal
if $version 1 123 124
185 color => $color,
186 } if $version;
187  
188 123 my $normalized_in_type = _normalize_cli_type($in_type_arg);
189 123 my $normalized_out_type = _normalize_cli_type($out_type_arg);
190  
191 123 ▶ $usage_error->("Unsupported input type <$in_type_arg> for -i")
Branch: 1 branch
BranchTrueFalseTotal
if defined $in_type_arg and not defined $normalized_in_type 1 122 123
Condition100%3/3
defined $in_type_arg and not defined $normalized_in_type
!ll&&!rl&&r
92301
MC/DC100%2/2
defined $in_type_arg and not defined $normalized_in_type
defined $in_type_arg not defined $normalized_in_type
Truth table100%3/3
A and not(B)
A= defined $in_type_argB= not defined $normalized_in_type
ABresult
0X0
100
111
192 if defined $in_type_arg && !defined $normalized_in_type;
193 122 ▶ $usage_error->("Unsupported output type <$out_type_arg> for -o")
Branch: 1 branch
BranchTrueFalseTotal
if defined $out_type_arg and not defined $normalized_out_type 1 121 122
Condition100%3/3
defined $out_type_arg and not defined $normalized_out_type
!ll&&!rl&&r
96251
MC/DC100%2/2
defined $out_type_arg and not defined $normalized_out_type
defined $out_type_arg not defined $normalized_out_type
Truth table100%3/3
A and not(B)
A= defined $out_type_argB= not defined $normalized_out_type
ABresult
0X0
100
111
194 if defined $out_type_arg && !defined $normalized_out_type;
195  
196 121 ▶ $usage_error->("Please use either the generic <-i/-o> syntax or the compact <-ixxx/-oxxx> flags for each side, not both")
Branch: 11 branches
BranchTrueFalseTotal
if defined $normalized_in_type and _count_defined($in_pxf, $in_bff, $in_cbioportal, $in_redcap, $in_cdiscodm, $in_csv, @datasetjson_files ? 1 : undef, @datasetxml_files ? 1 : undef, @fhir_files ? 1 : undef, @i2b2_files ? 1 : undef, @sentinel_files ? 1 : undef, @pcornet_files ? 1 : undef, @omop_files ? 1 : undef, @openehr_files ? 1 : undef) or defined $normalized_out_type and _count_defined($out_bff_selected ? 1 : undef, $out_pxf, $out_csv, $out_jsonf, $out_jsonld, $out_omop_selected ? 1 : undef) 1 120 121
@datasetjson_files ? : 0 29 29
@datasetxml_files ? : 0 29 29
@fhir_files ? : 0 29 29
@i2b2_files ? : 0 29 29
@sentinel_files ? : 0 29 29
@pcornet_files ? : 0 29 29
@omop_files ? : 0 29 29
@openehr_files ? : 0 29 29
$out_bff_selected ? : 0 24 24
$out_omop_selected ? : 0 24 24
Condition77%7/9
defined $normalized_in_type and _count_defined($in_pxf, $in_bff, $in_cbioportal, $in_redcap, $in_cdiscodm, $in_csv, @datasetjson_files ? 1 : undef, @datasetxml_files ? 1 : undef, @fhir_files ? 1 : undef, @i2b2_files ? 1 : undef, @sentinel_files ? 1 : undef, @pcornet_files ? 1 : undef, @omop_files ? 1 : undef, @openehr_files ? 1 : undef) or defined $normalized_out_type and _count_defined($out_bff_selected ? 1 : undef, $out_pxf, $out_csv, $out_jsonf, $out_jsonld, $out_omop_selected ? 1 : undef)
l!l&&r!l&&!r
10120
defined $normalized_in_type and _count_defined($in_pxf, $in_bff, $in_cbioportal, $in_redcap, $in_cdiscodm, $in_csv, @datasetjson_files ? 1 : undef, @datasetxml_files ? 1 : undef, @fhir_files ? 1 : undef, @i2b2_files ? 1 : undef, @sentinel_files ? 1 : undef, @pcornet_files ? 1 : undef, @omop_files ? 1 : undef, @openehr_files ? 1 : undef)
!ll&&!rl&&r
92281
defined $normalized_out_type and _count_defined($out_bff_selected ? 1 : undef, $out_pxf, $out_csv, $out_jsonf, $out_jsonld, $out_omop_selected ? 1 : undef)
!ll&&!rl&&r
96240
MC/DC50%2/4
defined $normalized_in_type and _count_defined($in_pxf, $in_bff, $in_cbioportal, $in_redcap, $in_cdiscodm, $in_csv, @datasetjson_files ? 1 : undef, @datasetxml_files ? 1 : undef, @fhir_files ? 1 : undef, @i2b2_files ? 1 : undef, @sentinel_files ? 1 : undef, @pcornet_files ? 1 : undef, @omop_files ? 1 : undef, @openehr_files ? 1 : undef) or defined $normalized_out_type and _count_defined($out_bff_selected ? 1 : undef, $out_pxf, $out_csv, $out_jsonf, $out_jsonld, $out_omop_selected ? 1 : undef)
defined $normalized_in_type _count_defined($in_pxf, $in_bff, $in_cbioportal, $in_redcap, $in_cdiscodm, $in_csv, @datasetjson_files ? 1 : undef, @datasetxml_files ? 1 : undef, @fhir_files ? 1 : undef, @i2b2_files ? 1 : undef, @sentinel_files ? 1 : undef, @pcornet_files ? 1 : undef, @omop_files ? 1 : undef, @openehr_files ? 1 : undef) defined $normalized_out_type _count_defined($out_bff_selected ? 1 : undef, $out_pxf, $out_csv, $out_jsonf, $out_jsonld, $out_omop_selected ? 1 : undef)
Truth table71%5/7
A and B or C and D
A= defined $normalized_in_typeB= _count_defined($in_pxf, $in_bff, $in_cbioportal, $in_redcap, $in_cdiscodm, $in_csv, @datasetjson_files ? 1 : undef, @datasetxml_files ? 1 : undef, @fhir_files ? 1 : undef, @i2b2_files ? 1 : undef, @sentinel_files ? 1 : undef, @pcornet_files ? 1 : undef, @omop_files ? 1 : undef, @openehr_files ? 1 : undef)C= defined $normalized_out_typeD= _count_defined($out_bff_selected ? 1 : undef, $out_pxf, $out_csv, $out_jsonf, $out_jsonld, $out_omop_selected ? 1 : undef)
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
197 if ( defined $normalized_in_type
198 && _count_defined( $in_pxf, $in_bff, $in_cbioportal, $in_redcap, $in_cdiscodm, $in_csv, @datasetjson_files ? 1 : undef, @datasetxml_files ? 1 : undef, @fhir_files ? 1 : undef, @i2b2_files ? 1 : undef, @sentinel_files ? 1 : undef, @pcornet_files ? 1 : undef, @omop_files ? 1 : undef, @openehr_files ? 1 : undef ) )
199 || ( defined $normalized_out_type
200 && _count_defined( $out_bff_selected ? 1 : undef, $out_pxf, $out_csv, $out_jsonf, $out_jsonld, $out_omop_selected ? 1 : undef ) );
201  
202 120 ▶ if ( defined $normalized_in_type ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $normalized_in_type) 28 92 120
203 28 ▶ if ( $normalized_in_type eq 'omop'
Branch: 1 branch
BranchTrueFalseTotal
if ($normalized_in_type eq 'omop' or $normalized_in_type eq 'openehr' or $normalized_in_type eq 'datasetjson' or $normalized_in_type eq 'datasetxml' or $normalized_in_type eq 'fhir' or $normalized_in_type eq 'i2b2' or $normalized_in_type eq 'sentinel' or $normalized_in_type eq 'pcornet') { } 18 10 28
Condition90%19/21
$normalized_in_type eq "omop" or $normalized_in_type eq "openehr" or $normalized_in_type eq "datasetjson" or $normalized_in_type eq "datasetxml" or $normalized_in_type eq "fhir" or $normalized_in_type eq "i2b2" or $normalized_in_type eq "sentinel" or $normalized_in_type eq "pcornet"
l!l&&r!l&&!r
17110
$normalized_in_type eq "omop" or $normalized_in_type eq "openehr" or $normalized_in_type eq "datasetjson" or $normalized_in_type eq "datasetxml" or $normalized_in_type eq "fhir" or $normalized_in_type eq "i2b2" or $normalized_in_type eq "sentinel"
l!l&&r!l&&!r
17011
$normalized_in_type eq "omop" or $normalized_in_type eq "openehr" or $normalized_in_type eq "datasetjson" or $normalized_in_type eq "datasetxml" or $normalized_in_type eq "fhir" or $normalized_in_type eq "i2b2"
l!l&&r!l&&!r
17011
$normalized_in_type eq "omop" or $normalized_in_type eq "openehr" or $normalized_in_type eq "datasetjson" or $normalized_in_type eq "datasetxml" or $normalized_in_type eq "fhir"
l!l&&r!l&&!r
13411
$normalized_in_type eq "omop" or $normalized_in_type eq "openehr" or $normalized_in_type eq "datasetjson" or $normalized_in_type eq "datasetxml"
l!l&&r!l&&!r
10315
$normalized_in_type eq "omop" or $normalized_in_type eq "openehr" or $normalized_in_type eq "datasetjson"
l!l&&r!l&&!r
6418
$normalized_in_type eq "omop" or $normalized_in_type eq "openehr"
l!l&&r!l&&!r
3322
MC/DC75%6/8
$normalized_in_type eq "omop" or $normalized_in_type eq "openehr" or $normalized_in_type eq "datasetjson" or $normalized_in_type eq "datasetxml" or $normalized_in_type eq "fhir" or $normalized_in_type eq "i2b2" or $normalized_in_type eq "sentinel" or $normalized_in_type eq "pcornet"
$normalized_in_type eq "omop" $normalized_in_type eq "openehr" $normalized_in_type eq "datasetjson" $normalized_in_type eq "datasetxml" $normalized_in_type eq "fhir" $normalized_in_type eq "i2b2" $normalized_in_type eq "sentinel" $normalized_in_type eq "pcornet"
Truth table77%7/9
A or B or C or D or E or F or G or H
A= $normalized_in_type eq "omop"B= $normalized_in_type eq "openehr"C= $normalized_in_type eq "datasetjson"D= $normalized_in_type eq "datasetxml"E= $normalized_in_type eq "fhir"F= $normalized_in_type eq "i2b2"G= $normalized_in_type eq "sentinel"H= $normalized_in_type eq "pcornet"
ABCDEFGHresult
1XXXXXXX1
01XXXXXX1
001XXXXX1
0001XXXX1
00001XXX1
000001XX1
0000001X1
000000011
000000000
204 || $normalized_in_type eq 'openehr'
205 || $normalized_in_type eq 'datasetjson'
206 || $normalized_in_type eq 'datasetxml'
207 || $normalized_in_type eq 'fhir'
208 || $normalized_in_type eq 'i2b2'
209 || $normalized_in_type eq 'sentinel'
210 || $normalized_in_type eq 'pcornet' )
211 {
212 18 ▶ $usage_error->("Please provide $in_type_arg input file(s) after <-i $in_type_arg>") unless @{$argv};
Branch: 1 branch
BranchTrueFalseTotal
unless @{$argv;} 0 18 18
213 18 ▶ if ( defined $normalized_out_type ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $normalized_out_type) { } 13 5 18
214 13 ▶ if ( $normalized_out_type eq 'omop' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($normalized_out_type eq 'omop') { } 4 9 13
215 4 ▶ if ( $normalized_in_type eq 'omop' ) {
Branch: 7 branches
BranchTrueFalseTotal
if ($normalized_in_type eq 'omop') { } 0 4 4
elsif ($normalized_in_type eq 'fhir') { } 1 3 4
elsif ($normalized_in_type eq 'openehr') { } 1 2 3
elsif ($normalized_in_type eq 'datasetxml') { } 1 1 2
elsif ($normalized_in_type eq 'i2b2') { } 0 1 1
elsif ($normalized_in_type eq 'sentinel') { } 0 1 1
elsif ($normalized_in_type eq 'pcornet') { } 0 1 1
216 0 @omop_files = @{$argv};
217 }
218 elsif ( $normalized_in_type eq 'fhir' ) {
219 1 @fhir_files = @{$argv};
220 }
221 elsif ( $normalized_in_type eq 'openehr' ) {
222 1 @openehr_files = @{$argv};
223 }
224 elsif ( $normalized_in_type eq 'datasetxml' ) {
225 1 @datasetxml_files = @{$argv};
226 }
227 elsif ( $normalized_in_type eq 'i2b2' ) {
228 0 @i2b2_files = @{$argv};
229 }
230 elsif ( $normalized_in_type eq 'sentinel' ) {
231 0 @sentinel_files = @{$argv};
232 }
233 elsif ( $normalized_in_type eq 'pcornet' ) {
234 0 @pcornet_files = @{$argv};
235 }
236 else {
237 1 @datasetjson_files = @{$argv};
238 }
239 4 $out_omop_selected = 1;
240 }
241 else {
242 $usage_error->("Please provide $in_type_arg input file(s) followed by one output path")
243 9 ▶ unless @{$argv} >= 2;
Branch: 1 branch
BranchTrueFalseTotal
unless @{$argv;} >= 2 0 9 9
244 9 ▶ if ( $normalized_in_type eq 'omop' ) {
Branch: 7 branches
BranchTrueFalseTotal
if ($normalized_in_type eq 'omop') { } 2 7 9
elsif ($normalized_in_type eq 'fhir') { } 2 5 7
elsif ($normalized_in_type eq 'openehr') { } 1 4 5
elsif ($normalized_in_type eq 'datasetxml') { } 1 3 4
elsif ($normalized_in_type eq 'i2b2') { } 0 3 3
elsif ($normalized_in_type eq 'sentinel') { } 0 3 3
elsif ($normalized_in_type eq 'pcornet') { } 1 2 3
245 2 @omop_files = @{$argv}[ 0 .. $#{$argv} - 1 ];
246 }
247 elsif ( $normalized_in_type eq 'fhir' ) {
248 2 @fhir_files = @{$argv}[ 0 .. $#{$argv} - 1 ];
249 }
250 elsif ( $normalized_in_type eq 'openehr' ) {
251 1 @openehr_files = @{$argv}[ 0 .. $#{$argv} - 1 ];
252 }
253 elsif ( $normalized_in_type eq 'datasetxml' ) {
254 1 @datasetxml_files = @{$argv}[ 0 .. $#{$argv} - 1 ];
255 }
256 elsif ( $normalized_in_type eq 'i2b2' ) {
257 0 @i2b2_files = @{$argv}[ 0 .. $#{$argv} - 1 ];
258 }
259 elsif ( $normalized_in_type eq 'sentinel' ) {
260 0 @sentinel_files = @{$argv}[ 0 .. $#{$argv} - 1 ];
261 }
262 elsif ( $normalized_in_type eq 'pcornet' ) {
263 1 @pcornet_files = @{$argv}[ 0 .. $#{$argv} - 1 ];
264 }
265 else {
266 2 @datasetjson_files = @{$argv}[ 0 .. $#{$argv} - 1 ];
267 }
268 9 my $generic_outfile = $argv->[-1];
269 9 ▶ if ( $normalized_out_type eq 'bff' ) { $out_bff_selected = 1; $out_bff = $generic_outfile }
Branch: 5 branches
BranchTrueFalseTotal
if ($normalized_out_type eq 'bff') { } 5 4 9
elsif ($normalized_out_type eq 'pxf') { } 4 0 4
elsif ($normalized_out_type eq 'csv') { } 0 0 0
elsif ($normalized_out_type eq 'jsonf') { } 0 0 0
elsif ($normalized_out_type eq 'jsonld') { } 0 0 0
270 4 elsif ( $normalized_out_type eq 'pxf' ) { $out_pxf = $generic_outfile }
271 0 elsif ( $normalized_out_type eq 'csv' ) { $out_csv = $generic_outfile }
272 0 elsif ( $normalized_out_type eq 'jsonf' ) { $out_jsonf = $generic_outfile }
273 0 elsif ( $normalized_out_type eq 'jsonld' ) { $out_jsonld = $generic_outfile }
274 }
275 }
276 else {
277 5 ▶ if ( $normalized_in_type eq 'omop' ) {
Branch: 7 branches
BranchTrueFalseTotal
if ($normalized_in_type eq 'omop') { } 1 4 5
elsif ($normalized_in_type eq 'fhir') { } 1 3 4
elsif ($normalized_in_type eq 'openehr') { } 1 2 3
elsif ($normalized_in_type eq 'datasetxml') { } 1 1 2
elsif ($normalized_in_type eq 'i2b2') { } 0 1 1
elsif ($normalized_in_type eq 'sentinel') { } 0 1 1
elsif ($normalized_in_type eq 'pcornet') { } 0 1 1
278 1 @omop_files = @{$argv};
279 }
280 elsif ( $normalized_in_type eq 'fhir' ) {
281 1 @fhir_files = @{$argv};
282 }
283 elsif ( $normalized_in_type eq 'openehr' ) {
284 1 @openehr_files = @{$argv};
285 }
286 elsif ( $normalized_in_type eq 'datasetxml' ) {
287 1 @datasetxml_files = @{$argv};
288 }
289 elsif ( $normalized_in_type eq 'i2b2' ) {
290 0 @i2b2_files = @{$argv};
291 }
292 elsif ( $normalized_in_type eq 'sentinel' ) {
293 0 @sentinel_files = @{$argv};
294 }
295 elsif ( $normalized_in_type eq 'pcornet' ) {
296 0 @pcornet_files = @{$argv};
297 }
298 else {
299 1 @datasetjson_files = @{$argv};
300 }
301 }
302 18 @{$argv} = ();
303 }
304 else {
305 $usage_error->("Please provide an input file after <-i $in_type_arg>")
306 10 ▶ unless @{$argv};
Branch: 1 branch
BranchTrueFalseTotal
unless @{$argv;} 0 10 10
307 10 my $generic_infile = shift @{$argv};
308 10 ▶ if ( $normalized_in_type eq 'pxf' ) { $in_pxf = $generic_infile }
Branch: 6 branches
BranchTrueFalseTotal
if ($normalized_in_type eq 'pxf') { } 5 5 10
elsif ($normalized_in_type eq 'bff') { } 1 4 5
elsif ($normalized_in_type eq 'cbioportal') { } 1 3 4
elsif ($normalized_in_type eq 'redcap') { } 1 2 3
elsif ($normalized_in_type eq 'cdiscodm') { } 1 1 2
elsif ($normalized_in_type eq 'csv') { } 1 0 1
309 1 elsif ( $normalized_in_type eq 'bff' ) { $in_bff = $generic_infile }
310 1 elsif ( $normalized_in_type eq 'cbioportal' ) { $in_cbioportal = $generic_infile }
311 1 elsif ( $normalized_in_type eq 'redcap' ) { $in_redcap = $generic_infile }
312 1 elsif ( $normalized_in_type eq 'cdiscodm' ) { $in_cdiscodm = $generic_infile }
313 1 elsif ( $normalized_in_type eq 'csv' ) { $in_csv = $generic_infile }
314  
315 10 ▶ if ( defined $normalized_out_type ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $normalized_out_type) 10 0 10
316 10 ▶ if ( $normalized_out_type eq 'omop' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($normalized_out_type eq 'omop') { } 1 9 10
317 1 $out_omop_selected = 1;
318 }
319 else {
320 $usage_error->("Please provide an output file after <-o $out_type_arg>")
321 9 ▶ unless @{$argv};
Branch: 1 branch
BranchTrueFalseTotal
unless @{$argv;} 0 9 9
322 9 my $generic_outfile = shift @{$argv};
323 9 ▶ if ( $normalized_out_type eq 'bff' ) { $out_bff_selected = 1; $out_bff = $generic_outfile }
Branch: 5 branches
BranchTrueFalseTotal
if ($normalized_out_type eq 'bff') { } 5 4 9
elsif ($normalized_out_type eq 'pxf') { } 1 3 4
elsif ($normalized_out_type eq 'csv') { } 1 2 3
elsif ($normalized_out_type eq 'jsonf') { } 1 1 2
elsif ($normalized_out_type eq 'jsonld') { } 1 0 1
324 1 elsif ( $normalized_out_type eq 'pxf' ) { $out_pxf = $generic_outfile }
325 1 elsif ( $normalized_out_type eq 'csv' ) { $out_csv = $generic_outfile }
326 1 elsif ( $normalized_out_type eq 'jsonf' ) { $out_jsonf = $generic_outfile }
327 1 elsif ( $normalized_out_type eq 'jsonld' ) { $out_jsonld = $generic_outfile }
328 }
329 }
330 }
331 }
332  
333 120 ▶ $usage_error->("The flag <-o> requires <-i> when using the generic syntax")
Branch: 1 branch
BranchTrueFalseTotal
if defined $normalized_out_type and not defined $normalized_in_type 1 119 120
Condition100%3/3
defined $normalized_out_type and not defined $normalized_in_type
!ll&&!rl&&r
96231
MC/DC100%2/2
defined $normalized_out_type and not defined $normalized_in_type
defined $normalized_out_type not defined $normalized_in_type
Truth table100%3/3
A and not(B)
A= defined $normalized_out_typeB= not defined $normalized_in_type
ABresult
0X0
100
111
334 if defined $normalized_out_type && !defined $normalized_in_type;
335  
336 119 ▶ if ( @entities_args && @{$argv} == 1 && !$out_bff_selected && $argv->[0] eq $out_dir ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@entities_args and @{$argv;} == 1 and not $out_bff_selected and $argv->[0] eq $out_dir) 0 119 119
Condition44%4/9
@entities_args and @{$argv;} == 1 and not $out_bff_selected and $argv->[0] eq $out_dir
!ll&&!rl&&r
11900
@entities_args and @{$argv;} == 1 and not $out_bff_selected
!ll&&!rl&&r
11900
@entities_args and @{$argv;} == 1
!ll&&!rl&&r
96230
MC/DC0%0/4
@entities_args and @{$argv;} == 1 and not $out_bff_selected and $argv->[0] eq $out_dir
@entities_args @{$argv;} == 1 not $out_bff_selected $argv->[0] eq $out_dir
Truth table40%2/5
A and B and not(C) and D
A= @entities_argsB= @{$argv;} == 1C= not $out_bff_selectedD= $argv->[0] eq $out_dir
ABCDresult
0XXX0
10XX0
110X0
11100
11111
337 0 $usage_error->("When using <--entities>, please also select BFF output with <-obff> and keep <--out-dir> as the directory target");
338 }
339  
340 $usage_error->("The flag <-oomop> no longer accepts a prefix. Use <-oomop --out-dir DIR> and optional <--out-name TABLE=file> overrides instead")
341 119 ▶ if $out_omop_selected && @{$argv};
Branch: 1 branch
BranchTrueFalseTotal
if $out_omop_selected and @{$argv;} 1 118 119
Condition100%3/3
$out_omop_selected and @{$argv;}
!ll&&!rl&&r
107111
MC/DC100%2/2
$out_omop_selected and @{$argv;}
$out_omop_selected @{$argv;}
Truth table100%3/3
A and B
A= $out_omop_selectedB= @{$argv;}
ABresult
0X0
100
111
342  
343 0 ▶ $usage_error->("Unexpected extra positional arguments: @{$argv}") if @{$argv};
Branch: 1 branch
BranchTrueFalseTotal
if @{$argv;} 0 118 118
344  
345 my @validation_checks = (
346 {
347 118 ▶ condition => sub {
Subroutine __ANON__: called CC=27 SCAR=34.7
348 118 ▶ !( ( defined $in_pxf && -f $in_pxf )
Condition80%63/78
defined $in_pxf && -f $in_pxf || defined $in_bff && -f $in_bff || defined $in_cbioportal || defined $in_redcap && -f $in_redcap || defined $in_cdiscodm && -f $in_cdiscodm || defined $in_csv && -f $in_csv || @datasetjson_files && -f $datasetjson_files[0] || @datasetxml_files && -f $datasetxml_files[0] || @fhir_files && -f $fhir_files[0] || @i2b2_files && _valid_table_package_input($i2b2_files[0]) || @sentinel_files && _valid_table_package_input($sentinel_files[0]) || @pcornet_files && _valid_table_package_input($pcornet_files[0]) || @omop_files && _valid_omop_input($omop_files[0]) || @openehr_files && -f $openehr_files[0]
l!l&&r!l&&!r
11440
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm or defined $in_csv and -f $in_csv or @datasetjson_files and -f $datasetjson_files[0] or @datasetxml_files and -f $datasetxml_files[0] or @fhir_files and -f $fhir_files[0] or @i2b2_files and _valid_table_package_input($i2b2_files[0]) or @sentinel_files and _valid_table_package_input($sentinel_files[0]) or @pcornet_files and _valid_table_package_input($pcornet_files[0]) or @omop_files and _valid_omop_input($omop_files[0])
l!l&&r!l&&!r
100144
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm or defined $in_csv and -f $in_csv or @datasetjson_files and -f $datasetjson_files[0] or @datasetxml_files and -f $datasetxml_files[0] or @fhir_files and -f $fhir_files[0] or @i2b2_files and _valid_table_package_input($i2b2_files[0]) or @sentinel_files and _valid_table_package_input($sentinel_files[0]) or @pcornet_files and _valid_table_package_input($pcornet_files[0])
l!l&&r!l&&!r
97318
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm or defined $in_csv and -f $in_csv or @datasetjson_files and -f $datasetjson_files[0] or @datasetxml_files and -f $datasetxml_files[0] or @fhir_files and -f $fhir_files[0] or @i2b2_files and _valid_table_package_input($i2b2_files[0]) or @sentinel_files and _valid_table_package_input($sentinel_files[0])
l!l&&r!l&&!r
95221
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm or defined $in_csv and -f $in_csv or @datasetjson_files and -f $datasetjson_files[0] or @datasetxml_files and -f $datasetxml_files[0] or @fhir_files and -f $fhir_files[0] or @i2b2_files and _valid_table_package_input($i2b2_files[0])
l!l&&r!l&&!r
93223
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm or defined $in_csv and -f $in_csv or @datasetjson_files and -f $datasetjson_files[0] or @datasetxml_files and -f $datasetxml_files[0] or @fhir_files and -f $fhir_files[0]
l!l&&r!l&&!r
85825
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm or defined $in_csv and -f $in_csv or @datasetjson_files and -f $datasetjson_files[0] or @datasetxml_files and -f $datasetxml_files[0]
l!l&&r!l&&!r
79633
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm or defined $in_csv and -f $in_csv or @datasetjson_files and -f $datasetjson_files[0]
l!l&&r!l&&!r
71839
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm or defined $in_csv and -f $in_csv
l!l&&r!l&&!r
601147
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap or defined $in_cdiscodm and -f $in_cdiscodm
l!l&&r!l&&!r
55558
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal or defined $in_redcap and -f $in_redcap
l!l&&r!l&&!r
50563
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff or defined $in_cbioportal
l!l&&r!l&&!r
45568
defined $in_pxf and -f $in_pxf or defined $in_bff and -f $in_bff
l!l&&r!l&&!r
331273
defined $in_pxf and -f $in_pxf
!ll&&!rl&&r
85033
defined $in_bff and -f $in_bff
!ll&&!rl&&r
73012
defined $in_redcap and -f $in_redcap
!ll&&!rl&&r
6305
defined $in_cdiscodm and -f $in_cdiscodm
!ll&&!rl&&r
5805
defined $in_csv and -f $in_csv
!ll&&!rl&&r
47011
@datasetjson_files and -f $datasetjson_files[0]
!ll&&!rl&&r
3908
@datasetxml_files and -f $datasetxml_files[0]
!ll&&!rl&&r
3306
@fhir_files and -f $fhir_files[0]
!ll&&!rl&&r
2508
@i2b2_files and _valid_table_package_input($i2b2_files[0])
!ll&&!rl&&r
2302
@sentinel_files and _valid_table_package_input($sentinel_files[0])
!ll&&!rl&&r
2102
@pcornet_files and _valid_table_package_input($pcornet_files[0])
!ll&&!rl&&r
1803
@omop_files and _valid_omop_input($omop_files[0])
!ll&&!rl&&r
4014
@openehr_files and -f $openehr_files[0]
!ll&&!rl&&r
004
MC/DC0%0/27
defined $in_pxf && -f $in_pxf || defined $in_bff && -f $in_bff || defined $in_cbioportal || defined $in_redcap && -f $in_redcap || defined $in_cdiscodm && -f $in_cdiscodm || defined $in_csv && -f $in_csv || @datasetjson_files && -f $datasetjson_files[0] || @datasetxml_files && -f $datasetxml_files[0] || @fhir_files && -f $fhir_files[0] || @i2b2_files && _valid_table_package_input($i2b2_files[0]) || @sentinel_files && _valid_table_package_input($sentinel_files[0]) || @pcornet_files && _valid_table_package_input($pcornet_files[0]) || @omop_files && _valid_omop_input($omop_files[0]) || @openehr_files && -f $openehr_files[0]
too many conditions
349 || ( defined $in_bff && -f $in_bff )
350 || defined $in_cbioportal
351 || ( defined $in_redcap && -f $in_redcap )
352 || ( defined $in_cdiscodm && -f $in_cdiscodm )
353 || ( defined $in_csv && -f $in_csv )
354 || ( @datasetjson_files && -f $datasetjson_files[0] )
355 || ( @datasetxml_files && -f $datasetxml_files[0] )
356 || ( @fhir_files && -f $fhir_files[0] )
357 || ( @i2b2_files && _valid_table_package_input( $i2b2_files[0] ) )
358 || ( @sentinel_files && _valid_table_package_input( $sentinel_files[0] ) )
359 || ( @pcornet_files && _valid_table_package_input( $pcornet_files[0] ) )
360 || ( @omop_files && _valid_omop_input( $omop_files[0] ) )
361 || ( @openehr_files && -f $openehr_files[0] ) );
362 },
363 message => "Please specify a valid input [-i input-type] <infile>\n",
364 },
365 118 ▶ { condition => sub { !-d $out_dir }, message => "Please specify a valid directory for --out-dir\n", },
Subroutine __ANON__: called CC=1 SCAR=0.0
366 {
367 118 ▶ condition => sub {
Subroutine __ANON__: called CC=4 SCAR=14.5
368 118 ▶ defined $in_cbioportal
Branch: 1 branch
BranchTrueFalseTotal
defined $in_cbioportal and not -d $in_cbioportal and not -f $in_cbioportal && $in_cbioportal =~ /\.zip\z/i 1 117 118
Condition66%6/9
defined $in_cbioportal && !(-d $in_cbioportal) && !(-f $in_cbioportal && $in_cbioportal =~ /\.zip\z/i)
!ll&&!rl&&r
11701
defined $in_cbioportal and not -d $in_cbioportal
!ll&&!rl&&r
11341
-f $in_cbioportal && $in_cbioportal =~ /\.zip\z/i
!ll&&!rl&&r
100
MC/DC50%2/4
defined $in_cbioportal && !(-d $in_cbioportal) && !(-f $in_cbioportal && $in_cbioportal =~ /\.zip\z/i)
defined $in_cbioportal not -d $in_cbioportal -f $in_cbioportal $in_cbioportal =~ /\.zip\z/i
Truth table60%3/5
A and not(B) && not(C && D)
A= defined $in_cbioportalB= not -d $in_cbioportalC= -f $in_cbioportalD= $in_cbioportal =~ /\.zip\z/i
ABCDresult
0XXX0
10XX0
11110
110X1
11101
369 && !-d $in_cbioportal
370 && !( -f $in_cbioportal && $in_cbioportal =~ /\.zip\z/i );
371 },
372 message => "Please specify a valid cBioPortal study directory or ZIP file\n",
373 },
374 {
375 117 ▶ condition => sub { $in_redcap && !$redcap_dictionary },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$in_redcap and not $redcap_dictionary 5 112 117
376 message => "Please specify a valid REDCap data dictionary --rcd <file>\n",
377 },
378 {
379 116 ▶ condition => sub { ( $in_redcap || $in_cdiscodm || $in_csv ) && !$mapping_file },
Subroutine __ANON__: called CC=4 SCAR=13.9
Branch: 1 branch
BranchTrueFalseTotal
$in_redcap || $in_cdiscodm || $in_csv and not $mapping_file 20 96 116
Condition100%6/6
$in_redcap or $in_cdiscodm or $in_csv
l!l&&r!l&&!r
91196
$in_redcap or $in_cdiscodm
l!l&&r!l&&!r
45107
MC/DC100%3/3
$in_redcap or $in_cdiscodm or $in_csv
$in_redcap $in_cdiscodm $in_csv
Truth table100%4/4
A or B or C
A= $in_redcapB= $in_cdiscodmC= $in_csv
ABCresult
1XX1
01X1
0011
0000
380 message => "Please specify a valid mapping file --mapping-file <file>\n",
381 },
382 {
383 115 ▶ condition => sub { defined $mapping_file && !-f $mapping_file },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
defined $mapping_file and not -f $mapping_file 21 94 115
384 message => "Please specify an existing mapping file --mapping-file <file>\n",
385 },
386 {
387 115 ▶ condition => sub {
Subroutine __ANON__: called CC=3 SCAR=11.7
388 @datasetjson_files
389 115 ▶ && grep { !-f $_ || $_ !~ m/\.json(?:\.gz)?$/i }
Branch: 1 branch
BranchTrueFalseTotal
@datasetjson_files and grep {not -f $_ && $_ =~ /\.json(?:\.gz)?$/i;} @datasetjson_files 8 107 115
Condition33%1/3
-f $_ && $_ =~ /\.json(?:\.gz)?$/i
!ll&&!rl&&r
0080
MC/DC0%0/2
-f $_ && $_ =~ /\.json(?:\.gz)?$/i
-f $_ $_ =~ /\.json(?:\.gz)?$/i
Truth table33%1/3
A && B
A= -f $_B= $_ =~ /\.json(?:\.gz)?$/i
ABresult
0X0
100
111
390 @datasetjson_files;
391 },
392 message => "Please specify valid CDISC Dataset-JSON file(s) (.json or .json.gz)\n",
393 },
394 {
395 115 ▶ condition => sub {
Subroutine __ANON__: called CC=3 SCAR=11.7
396 @datasetxml_files
397 115 ▶ && grep { !-f $_ || $_ !~ m/\.xml$/i }
Branch: 1 branch
BranchTrueFalseTotal
@datasetxml_files and grep {not -f $_ && $_ =~ /\.xml$/i;} @datasetxml_files 6 109 115
Condition33%1/3
-f $_ && $_ =~ /\.xml$/i
!ll&&!rl&&r
0021
MC/DC0%0/2
-f $_ && $_ =~ /\.xml$/i
-f $_ $_ =~ /\.xml$/i
Truth table33%1/3
A && B
A= -f $_B= $_ =~ /\.xml$/i
ABresult
0X0
100
111
398 @datasetxml_files;
399 },
400 message => "Please specify valid CDISC Dataset-XML file(s) (.xml)\n",
401 },
402 {
403 115 ▶ condition => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
404 115 ▶ @datasetxml_files && ( !defined $define_xml || !-f $define_xml );
Branch: 1 branch
BranchTrueFalseTotal
@datasetxml_files and not defined $define_xml && -f $define_xml 6 109 115
Condition83%5/6
@datasetxml_files && !(defined $define_xml && -f $define_xml)
!ll&&!rl&&r
10951
defined $define_xml && -f $define_xml
!ll&&!rl&&r
105
MC/DC66%2/3
@datasetxml_files && !(defined $define_xml && -f $define_xml)
@datasetxml_files defined $define_xml -f $define_xml
Truth table75%3/4
A && not(B && C)
A= @datasetxml_filesB= defined $define_xmlC= -f $define_xml
ABCresult
0XX0
1110
10X1
1101
405 },
406 message => "Please specify the accompanying Define-XML file with --define-xml <file>\n",
407 },
408 {
409 114 ▶ condition => sub { defined $define_xml && !@datasetxml_files && !@datasetjson_files },
Subroutine __ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
BranchTrueFalseTotal
defined $define_xml and not @datasetxml_files and not @datasetjson_files 2 112 114
Condition100%3/3
defined $define_xml and not @datasetxml_files
!ll&&!rl&&r
10752
MC/DC100%2/2
defined $define_xml and not @datasetxml_files
defined $define_xml not @datasetxml_files
Truth table100%3/3
A and not(B)
A= defined $define_xmlB= not @datasetxml_files
ABresult
0X0
100
111
410 message => "The flag <--define-xml> is only valid with <-idataset-json> or <-idataset-xml>\n",
411 },
412 {
413 113 ▶ condition => sub {
Subroutine __ANON__: called CC=3 SCAR=11.7
414 @fhir_files
415 113 ▶ && grep { !-f $_ || $_ !~ m/\.json(?:\.gz)?$/i }
Branch: 1 branch
BranchTrueFalseTotal
@fhir_files and grep {not -f $_ && $_ =~ /\.json(?:\.gz)?$/i;} @fhir_files 8 105 113
Condition33%1/3
-f $_ && $_ =~ /\.json(?:\.gz)?$/i
!ll&&!rl&&r
008
MC/DC0%0/2
-f $_ && $_ =~ /\.json(?:\.gz)?$/i
-f $_ $_ =~ /\.json(?:\.gz)?$/i
Truth table33%1/3
A && B
A= -f $_B= $_ =~ /\.json(?:\.gz)?$/i
ABresult
0X0
100
111
416 @fhir_files;
417 },
418 message => "Please specify valid FHIR R4 Bundle file(s) (.json or .json.gz)\n",
419 },
420 {
421 113 ▶ condition => sub {
Subroutine __ANON__: called CC=6 SCAR=20.8
422 2 ▶ ( @i2b2_files && grep { !_valid_table_package_input($_) } @i2b2_files )
Condition66%2/3
@sentinel_files and grep {not _valid_table_package_input($_);} @sentinel_files
!ll&&!rl&&r
11120
MC/DC0%0/2
@sentinel_files and grep {not _valid_table_package_input($_);} @sentinel_files
@sentinel_files grep {not _valid_table_package_input($_);} @sentinel_files
Truth table66%2/3
A and B
A= @sentinel_filesB= grep {not _valid_table_package_input($_);} @sentinel_files
ABresult
0X0
100
111
423 2 ▶ || ( @sentinel_files && grep { !_valid_table_package_input($_) } @sentinel_files )
Condition66%2/3
@pcornet_files and grep {not _valid_table_package_input($_);} @pcornet_files
!ll&&!rl&&r
11030
MC/DC0%0/2
@pcornet_files and grep {not _valid_table_package_input($_);} @pcornet_files
@pcornet_files grep {not _valid_table_package_input($_);} @pcornet_files
Truth table66%2/3
A and B
A= @pcornet_filesB= grep {not _valid_table_package_input($_);} @pcornet_files
ABresult
0X0
100
111
424 113 ▶ || ( @pcornet_files && grep { !_valid_table_package_input($_) } @pcornet_files );
Branch: 1 branch
BranchTrueFalseTotal
@i2b2_files and grep {not _valid_table_package_input($_);} @i2b2_files or @sentinel_files and grep {not _valid_table_package_input($_);} @sentinel_files or @pcornet_files and grep {not _valid_table_package_input($_);} @pcornet_files 0 113 113
Condition44%4/9
@i2b2_files && grep({not _valid_table_package_input($_);} @i2b2_files) || @sentinel_files && grep({not _valid_table_package_input($_);} @sentinel_files) || @pcornet_files && grep({not _valid_table_package_input($_);} @pcornet_files)
l!l&&r!l&&!r
00113
@i2b2_files and grep {not _valid_table_package_input($_);} @i2b2_files or @sentinel_files and grep {not _valid_table_package_input($_);} @sentinel_files
l!l&&r!l&&!r
00113
@i2b2_files and grep {not _valid_table_package_input($_);} @i2b2_files
!ll&&!rl&&r
11120
MC/DC0%0/4
@i2b2_files && grep({not _valid_table_package_input($_);} @i2b2_files) || @sentinel_files && grep({not _valid_table_package_input($_);} @sentinel_files) || @pcornet_files && grep({not _valid_table_package_input($_);} @pcornet_files)
@i2b2_files grep {not _valid_table_package_input($_);} @i2b2_files @sentinel_files and grep {not _valid_table_package_input($_);} @sentinel_files @pcornet_files && grep({not _valid_table_package_input($_);} @pcornet_files)
Truth table0%0/7
A and B or C || D
A= @i2b2_filesB= grep {not _valid_table_package_input($_);} @i2b2_filesC= @sentinel_files and grep {not _valid_table_package_input($_);} @sentinel_filesD= @pcornet_files && grep({not _valid_table_package_input($_);} @pcornet_files)
ABCDresult
11XX1
0X1X1
101X1
0X011
10011
0X000
10000
425 },
426 message => "Please specify valid clinical CDM table files, a directory, or a ZIP package\n",
427 },
428 {
429 113 ▶ condition => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
430 113 ▶ @omop_files && grep { !_valid_omop_input($_) } @omop_files;
Branch: 1 branch
BranchTrueFalseTotal
@omop_files and grep {not _valid_omop_input($_);} @omop_files 14 99 113
431 },
432 message => "Please specify valid OMOP-CDM table files, a directory, a ZIP package, or an SQL dump\n",
433 },
434 {
435 113 ▶ condition => sub { @openehr_files && grep { $_ !~ m/\.(json|ya?ml)(?:\.gz)?$/i } @openehr_files },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
@openehr_files and grep {not $_ =~ /\.(json|ya?ml)(?:\.gz)?$/i;} @openehr_files 4 109 113
436 message => "Please specify valid openEHR JSON/YAML file(s)\n",
437 },
438 {
439 113 ▶ condition => sub { @omop_tables && !@omop_files },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
@omop_tables and not @omop_files 2 111 113
440 message => "The flag <--omop-tables> is only valid with <-iomop>\n",
441 },
442 {
443 112 ▶ condition => sub { $stream && $out_pxf },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$stream and $out_pxf 5 107 112
444 message => "The flag <--stream> is only valid with <-obff>\n",
445 },
446 {
447 112 ▶ condition => sub { $stream && $sql2csv },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$stream and $sql2csv 5 107 112
448 message =>
449 "The flags <--stream> and <--sql2csv> are mutually exclusive.\nIf you are using <--stream> is because you are likely processing huge files and we don't want to duplicate them in your HDD\n",
450 },
451 {
452 112 ▶ condition => sub {
Subroutine __ANON__: called CC=6 SCAR=19.1
453 @omop_files
454 112 ▶ && ( ( defined $out_bff && length $out_bff && $out_bff !~ m/\.json/i )
Branch: 1 branch
BranchTrueFalseTotal
@omop_files and defined $out_bff && length $out_bff && !($out_bff =~ /\.json/i) || defined $out_pxf && !($out_pxf =~ /\.json/i) 14 98 112
Condition66%10/15
@omop_files && (defined $out_bff && length $out_bff && !($out_bff =~ /\.json/i) || defined $out_pxf && !($out_pxf =~ /\.json/i))
!ll&&!rl&&r
98140
defined $out_bff and length $out_bff and not $out_bff =~ /\.json/i or defined $out_pxf and not $out_pxf =~ /\.json/i
l!l&&r!l&&!r
0014
defined $out_bff and length $out_bff and not $out_bff =~ /\.json/i
!ll&&!rl&&r
680
defined $out_bff and length $out_bff
!ll&&!rl&&r
248
defined $out_pxf and not $out_pxf =~ /\.json/i
!ll&&!rl&&r
1310
MC/DC0%0/6
@omop_files && (defined $out_bff && length $out_bff && !($out_bff =~ /\.json/i) || defined $out_pxf && !($out_pxf =~ /\.json/i))
@omop_files defined $out_bff length $out_bff not $out_bff =~ /\.json/i defined $out_pxf not $out_pxf =~ /\.json/i
Truth table45%5/11
A && B and C and not(D) or E and not(F)
A= @omop_filesB= defined $out_bffC= length $out_bffD= not $out_bff =~ /\.json/iE= defined $out_pxfF= not $out_pxf =~ /\.json/i
ABCDEFresult
0XXXXX0
10XX0X0
10XX100
110X0X0
110X100
11100X0
1110100
1111XX1
10XX111
110X111
1110111
455 || ( defined $out_pxf && $out_pxf !~ m/\.json/i ) );
456 },
457 message => "The flag <--iomops> only supports output files in <json|json.gz> format\n",
458 },
459 {
460 112 ▶ condition => sub { !-f $schema_file },
Subroutine __ANON__: called CC=1 SCAR=0.0
461 message => "Please specify a valid schema for the mapping file --schema-file <file>\n",
462 },
463 {
464 112 ▶ condition => sub { defined $path_to_ohdsi_db && !-d $path_to_ohdsi_db },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
defined $path_to_ohdsi_db and not -d $path_to_ohdsi_db 5 107 112
465 message => "Please specify a valid directory for the mapping file --path-to-ohdsi-db <dir>\n",
466 },
467 {
468 112 ▶ condition => sub { defined $exposures_file && !-f $exposures_file },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
defined $exposures_file and not -f $exposures_file 1 111 112
469 message => "Please specify a valid --exposures-file <file>\n",
470 },
471 {
472 112 ▶ condition => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
473 112 ▶ defined $term_audit
Branch: 1 branch
BranchTrueFalseTotal
defined $term_audit and not $term_audit =~ /\.(?:tsv(?:\.gz)?|xlsx)\z/i 6 106 112
474 && $term_audit !~ /\.(?:tsv(?:\.gz)?|xlsx)\z/i;
475 },
476 message => "Please use --term-audit with a .tsv, .tsv.gz, or .xlsx output file\n",
477 },
478 {
479 110 ▶ condition => sub { ( $out_csv || $out_jsonf || $out_jsonld ) && ( !$in_bff && !$in_pxf ); },
Subroutine __ANON__: called CC=5 SCAR=16.2
Branch: 1 branch
BranchTrueFalseTotal
$out_csv || $out_jsonf || $out_jsonld and not $in_bff || $in_pxf 9 101 110
Condition83%10/12
($out_csv || $out_jsonf || $out_jsonld) && !($in_bff || $in_pxf)
!ll&&!rl&&r
10190
$out_csv or $out_jsonf or $out_jsonld
l!l&&r!l&&!r
81101
$out_csv or $out_jsonf
l!l&&r!l&&!r
53102
$in_bff || $in_pxf
l!l&&r!l&&!r
360
MC/DC0%0/5
($out_csv || $out_jsonf || $out_jsonld) && !($in_bff || $in_pxf)
$out_csv $out_jsonf $out_jsonld $in_bff $in_pxf
Truth table60%6/10
A or B or C && not(D || E)
A= $out_csvB= $out_jsonfC= $out_jsonldD= $in_bffE= $in_pxf
ABCDEresult
000XX0
1XX1X0
1XX010
01X1X0
01X010
0011X0
001010
1XX001
01X001
001001
480 message => "Sorry, <--ocsv>, <--ojsonf> and <--ojsonf> are only compatible with <--ibff> or <--ipxf>\n",
481 },
482 {
483 110 ▶ condition => sub { $out_omop_selected && !$ohdsi_db },
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$out_omop_selected and not $ohdsi_db 11 99 110
484 118 message => "Error: Please use --ohdsi-db when using OMOP CDM as an output",
485 },
486 );
487  
488 118 for my $check (@validation_checks) {
489 2730 ▶ $usage_error->( $check->{message} ) if $check->{condition}->();
Branch: 1 branch
BranchTrueFalseTotal
if $check->{"condition"}->() 9 2721 2730
490 }
491  
492 $usage_error->("Please provide <--entities> as a space-separated list, e.g. <--entities individuals biosamples>")
493 109 ▶ if grep { defined $_ && /,/ } @entities_args;
Branch: 1 branch
BranchTrueFalseTotal
if grep {defined $_ and /,/;} @entities_args 2 107 109
Condition66%2/3
defined $_ && /,/
!ll&&!rl&&r
0302
MC/DC50%1/2
defined $_ && /,/
defined $_ /,/
Truth table66%2/3
A && B
A= defined $_B= /,/
ABresult
0X0
100
111
494  
495 my @entity_list =
496 @entities_args
497 107 ▶ ? map { uc($_) eq 'ALL' ? () : $_ } grep { length } map { s/^\s+|\s+$//gr } @entities_args
Branch: 2 branches
BranchTrueFalseTotal
@entities_args ? : 21 86 107
uc $_ eq 'ALL' ? : 0 30 30
498 : ('individuals');
499  
500 107 ▶ @entity_list = ('individuals') unless @entity_list;
Branch: 1 branch
BranchTrueFalseTotal
unless @entity_list 0 107 107
501  
502 107 my %supported_entities = map { $_ => 1 } qw(individuals biosamples datasets cohorts);
503 107 for my $entity (@entity_list) {
504 $usage_error->("Unsupported entity <$entity> in --entities")
505 116 ▶ unless $supported_entities{$entity};
Branch: 1 branch
BranchTrueFalseTotal
unless $supported_entities{$entity} 1 115 116
506 }
507  
508 106 ▶ $usage_error->("The flag <--entities> is only valid with BFF output")
Branch: 1 branch
BranchTrueFalseTotal
if @entities_args and $out_pxf || $out_csv || $out_jsonf || $out_jsonld || $out_omop_selected 1 105 106
Condition73%11/15
@entities_args and $out_pxf || $out_csv || $out_jsonf || $out_jsonld || $out_omop_selected
!ll&&!rl&&r
86191
$out_pxf or $out_csv or $out_jsonf or $out_jsonld or $out_omop_selected
l!l&&r!l&&!r
1019
$out_pxf or $out_csv or $out_jsonf or $out_jsonld
l!l&&r!l&&!r
1019
$out_pxf or $out_csv or $out_jsonf
l!l&&r!l&&!r
1019
$out_pxf or $out_csv
l!l&&r!l&&!r
1019
MC/DC33%2/6
@entities_args and $out_pxf || $out_csv || $out_jsonf || $out_jsonld || $out_omop_selected
@entities_args $out_pxf $out_csv $out_jsonf $out_jsonld $out_omop_selected
Truth table42%3/7
A and B or C or D or E or F
A= @entities_argsB= $out_pxfC= $out_csvD= $out_jsonfE= $out_jsonldF= $out_omop_selected
ABCDEFresult
0XXXXX0
1000000
11XXXX1
101XXX1
1001XX1
10001X1
1000011
509 if @entities_args && ( $out_pxf || $out_csv || $out_jsonf || $out_jsonld || $out_omop_selected );
510  
511 105 ▶ $usage_error->("The flag <--stream> is only valid with <-iomop> and <-obff>")
Branch: 1 branch
BranchTrueFalseTotal
if $stream and not @omop_files 1 104 105
Condition100%3/3
$stream and not @omop_files
!ll&&!rl&&r
10041
MC/DC100%2/2
$stream and not @omop_files
$stream not @omop_files
Truth table100%3/3
A and not(B)
A= $streamB= not @omop_files
ABresult
0X0
100
111
512 if $stream && !@omop_files;
513  
514 104 ▶ $usage_error->("The openEHR input path currently supports only BFF or PXF output")
Branch: 1 branch
BranchTrueFalseTotal
if @openehr_files || defined $normalized_in_type && $normalized_in_type eq "openehr" and $out_csv || $out_jsonf || $out_jsonld || $out_omop_selected 1 103 104
Condition61%11/18
@openehr_files || defined $normalized_in_type && $normalized_in_type eq "openehr" and $out_csv || $out_jsonf || $out_jsonld || $out_omop_selected
!ll&&!rl&&r
10031
@openehr_files or defined $normalized_in_type and $normalized_in_type eq "openehr"
l!l&&r!l&&!r
40100
defined $normalized_in_type and $normalized_in_type eq "openehr"
!ll&&!rl&&r
75250
$out_csv or $out_jsonf or $out_jsonld or $out_omop_selected
l!l&&r!l&&!r
013
$out_csv or $out_jsonf or $out_jsonld
l!l&&r!l&&!r
004
$out_csv or $out_jsonf
l!l&&r!l&&!r
004
MC/DC28%2/7
@openehr_files || defined $normalized_in_type && $normalized_in_type eq "openehr" and $out_csv || $out_jsonf || $out_jsonld || $out_omop_selected
@openehr_files defined $normalized_in_type $normalized_in_type eq "openehr" $out_csv $out_jsonf $out_jsonld $out_omop_selected
Truth table33%4/12
A or B and C and D or E or F or G
A= @openehr_filesB= defined $normalized_in_typeC= $normalized_in_type eq "openehr"D= $out_csvE= $out_jsonfF= $out_jsonldG= $out_omop_selected
ABCDEFGresult
00XXXXX0
010XXXX0
1XX00000
01100000
1XX1XXX1
1XX01XX1
1XX001X1
1XX00011
0111XXX1
01101XX1
011001X1
01100011
515 if ( @openehr_files || ( defined $normalized_in_type && $normalized_in_type eq 'openehr' ) )
516 && ( $out_csv || $out_jsonf || $out_jsonld || $out_omop_selected );
517  
518 $usage_error->("The entities <datasets> and <cohorts> are not supported with <--stream>; please request only <individuals> and/or <biosamples>")
519 103 ▶ if $stream && grep { $_ eq 'datasets' || $_ eq 'cohorts' } @entity_list;
Branch: 1 branch
BranchTrueFalseTotal
if $stream and grep {$_ eq "datasets" or $_ eq "cohorts";} @entity_list 1 102 103
Condition83%5/6
$stream and grep {$_ eq "datasets" or $_ eq "cohorts";} @entity_list
!ll&&!rl&&r
9931
$_ eq 'datasets' || $_ eq 'cohorts'
l!l&&r!l&&!r
105
MC/DC100%2/2
$stream and grep {$_ eq "datasets" or $_ eq "cohorts";} @entity_list
$stream grep {$_ eq "datasets" or $_ eq "cohorts";} @entity_list
MC/DC50%1/2
$_ eq 'datasets' || $_ eq 'cohorts'
$_ eq 'datasets' $_ eq 'cohorts'
Truth table100%3/3
A and B
A= $streamB= grep {$_ eq "datasets" or $_ eq "cohorts";} @entity_list
ABresult
0X0
100
111
Truth table66%2/3
A || B
A= $_ eq 'datasets'B= $_ eq 'cohorts'
ABresult
1X1
011
000
520  
521 102 ▶ $usage_error->("When using <--entities>, please select BFF output with <-obff> and write the requested entities with <--out-dir>. Use either <-obff FILE> for individuals-only BFF output or <-obff --entities ... --out-dir DIR> for entity-aware BFF output")
Branch: 1 branch
BranchTrueFalseTotal
if @entities_args and not $out_bff_selected 2 100 102
Condition100%3/3
@entities_args and not $out_bff_selected
!ll&&!rl&&r
84162
MC/DC100%2/2
@entities_args and not $out_bff_selected
@entities_args not $out_bff_selected
Truth table100%3/3
A and not(B)
A= @entities_argsB= not $out_bff_selected
ABresult
0X0
100
111
522 if @entities_args && !$out_bff_selected;
523  
524 100 ▶ $usage_error->("When using <-obff FILE> together with <--entities>, please omit the file and use <-obff --entities ... --out-dir DIR>")
Branch: 1 branch
BranchTrueFalseTotal
if @entities_args and defined $out_bff and length $out_bff 1 99 100
Condition83%5/6
@entities_args and defined $out_bff and length $out_bff
!ll&&!rl&&r
84151
@entities_args and defined $out_bff
!ll&&!rl&&r
84016
MC/DC66%2/3
@entities_args and defined $out_bff and length $out_bff
@entities_args defined $out_bff length $out_bff
Truth table75%3/4
A and B and C
A= @entities_argsB= defined $out_bffC= length $out_bff
ABCresult
0XX0
10X0
1100
1111
525 if @entities_args && defined $out_bff && length $out_bff;
526  
527 99 ▶ $usage_error->("The flag <--out-name> requires either entity-aware BFF output or OMOP output")
Branch: 1 branch
BranchTrueFalseTotal
if @out_name_specs and not @entities_args and not $out_omop_selected 1 98 99
Condition100%6/6
@out_name_specs and not @entities_args and not $out_omop_selected
!ll&&!rl&&r
9621
@out_name_specs and not @entities_args
!ll&&!rl&&r
9153
MC/DC100%3/3
@out_name_specs and not @entities_args and not $out_omop_selected
@out_name_specs not @entities_args not $out_omop_selected
Truth table100%4/4
A and not(B) and not(C)
A= @out_name_specsB= not @entities_argsC= not $out_omop_selected
ABCresult
0XX0
10X0
1100
1111
528 if @out_name_specs && !@entities_args && !$out_omop_selected;
529  
530 98 ▶ if ( defined $default_vital_status ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $default_vital_status) 4 94 98
531 4 $default_vital_status =~ s/^\s+|\s+$//g;
532 4 ▶ $usage_error->("Unsupported value <$default_vital_status> for --default-vital-status")
Branch: 1 branch
BranchTrueFalseTotal
unless $default_vital_status =~ /\A(?:ALIVE|DECEASED|UNKNOWN_STATUS)\z/ 1 3 4
533 unless $default_vital_status =~ /\A(?:ALIVE|DECEASED|UNKNOWN_STATUS)\z/;
534 }
535  
536 97 ▶ $usage_error->("The flag <--default-vital-status> is only valid with PXF output")
Branch: 1 branch
BranchTrueFalseTotal
if defined $default_vital_status and not $out_pxf 1 96 97
Condition100%3/3
defined $default_vital_status and not $out_pxf
!ll&&!rl&&r
9421
MC/DC100%2/2
defined $default_vital_status and not $out_pxf
defined $default_vital_status not $out_pxf
Truth table100%3/3
A and not(B)
A= defined $default_vital_statusB= not $out_pxf
ABresult
0X0
100
111
537 if defined $default_vital_status && !$out_pxf;
538  
539 96 my %output_name_overrides;
540 96 for my $spec (@out_name_specs) {
541 7 ▶ $usage_error->("Invalid <--out-name> value <$spec>; use key=filename")
Branch: 1 branch
BranchTrueFalseTotal
unless defined $spec and $spec =~ /\A([^=]+)=(.+)\z/ 1 6 7
Condition66%2/3
defined $spec and $spec =~ /\A([^=]+)=(.+)\z/
!ll&&!rl&&r
016
MC/DC50%1/2
defined $spec and $spec =~ /\A([^=]+)=(.+)\z/
defined $spec $spec =~ /\A([^=]+)=(.+)\z/
Truth table66%2/3
A and B
A= defined $specB= $spec =~ /\A([^=]+)=(.+)\z/
ABresult
0X0
100
111
542 unless defined $spec && $spec =~ /\A([^=]+)=(.+)\z/;
543 6 my ( $key, $filename ) = ( $1, $2 );
544 6 $key =~ s/^\s+|\s+$//g;
545 6 $filename =~ s/^\s+|\s+$//g;
546  
547 6 ▶ $usage_error->("Please provide a filename for <--out-name $key=...>")
Branch: 1 branch
BranchTrueFalseTotal
unless length $filename 0 6 6
548 unless length $filename;
549  
550 6 ▶ if (@entities_args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@entities_args) 4 2 6
551 $usage_error->("Unsupported entity <$key> in --out-name")
552 4 ▶ unless $supported_entities{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless $supported_entities{$key} 0 4 4
553 $usage_error->("The entity <$key> must also be requested in <--entities>")
554 4 ▶ unless grep { $_ eq $key } @entity_list;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ eq $key;} @entity_list 1 3 4
555 3 $output_name_overrides{$key} =
556 _resolve_output_path( $out_dir, $filename );
557 3 next;
558 }
559  
560 2 my $table = uc $key;
561 2 my %supported_tables = map { $_ => 1 } @omop_supported_tables;
562 $usage_error->("Unsupported OMOP table <$key> in --out-name")
563 2 ▶ unless $supported_tables{$table};
Branch: 1 branch
BranchTrueFalseTotal
unless $supported_tables{$table} 0 2 2
564 2 $output_name_overrides{$table} =
565 _resolve_output_path( $out_dir, $filename );
566 }
567  
568 94 ▶ my $out_file =
Branch: 7 branches
BranchTrueFalseTotal
$out_pxf ? : 17 77 94
defined $out_bff && length $out_bff ? : 41 36 77
$out_csv ? : 5 31 36
$out_jsonf ? : 3 28 31
$out_jsonld ? : 1 27 28
$out_omop_selected ? : 9 18 27
@entity_list == 1 ? : 12 6 18
Condition100%3/3
defined $out_bff and length $out_bff
!ll&&!rl&&r
231341
MC/DC100%2/2
defined $out_bff and length $out_bff
defined $out_bff length $out_bff
Truth table100%3/3
A and B
A= defined $out_bffB= length $out_bff
ABresult
0X0
100
111
569 $out_pxf ? _resolve_output_path( $out_dir, $out_pxf )
570 : defined $out_bff && length $out_bff ? _resolve_output_path( $out_dir, $out_bff )
571 : $out_csv ? _resolve_output_path( $out_dir, $out_csv )
572 : $out_jsonf ? _resolve_output_path( $out_dir, $out_jsonf )
573 : $out_jsonld ? _resolve_output_path( $out_dir, $out_jsonld )
574 : $out_omop_selected ? undef
575 : @entity_list == 1
576 ? catfile( $out_dir, $entity_list[0] . '.json' )
577 : catfile( $out_dir, 'individuals.json' );
578  
579 94 ▶ my $log_file =
Branch: 1 branch
BranchTrueFalseTotal
$log ? : 1 93 94
580 catfile( $out_dir, ( $log ? $log : 'convert-pheno-log.json' ) );
581 94 ▶ my $term_audit_file =
Branch: 1 branch
BranchTrueFalseTotal
defined $term_audit ? : 4 90 94
582 defined $term_audit
583 ? _resolve_output_path( $out_dir, $term_audit )
584 : undef;
585  
586 94 ▶ my $in_type =
Branch: 14 branches
BranchTrueFalseTotal
$in_pxf ? : 19 75 94
$in_bff ? : 10 65 75
$in_cbioportal ? : 4 61 65
$in_redcap ? : 4 57 61
$in_cdiscodm ? : 5 52 57
@datasetjson_files ? : 8 44 52
@datasetxml_files ? : 5 39 44
@fhir_files ? : 8 31 39
@i2b2_files ? : 2 29 31
@sentinel_files ? : 2 27 29
@pcornet_files ? : 3 24 27
$in_csv ? : 8 16 24
@openehr_files ? : 3 13 16
@omop_files ? : 13 0 13
587 $in_pxf ? 'pxf'
588 : $in_bff ? 'bff'
589 : $in_cbioportal ? 'cbioportal'
590 : $in_redcap ? 'redcap'
591 : $in_cdiscodm ? 'cdiscodm'
592 : @datasetjson_files ? 'datasetjson'
593 : @datasetxml_files ? 'datasetxml'
594 : @fhir_files ? 'fhir'
595 : @i2b2_files ? 'i2b2'
596 : @sentinel_files ? 'sentinel'
597 : @pcornet_files ? 'pcornet'
598 : $in_csv ? 'csv'
599 : @openehr_files ? 'openehr'
600 : @omop_files ? 'omop'
601 : 'bff';
602 94 ▶ my $out_type =
Branch: 6 branches
BranchTrueFalseTotal
$out_pxf ? : 17 77 94
$out_bff_selected ? : 54 23 77
$out_csv ? : 5 18 23
$out_jsonf ? : 3 15 18
$out_jsonld ? : 1 14 15
$out_omop_selected ? : 9 5 14
603 $out_pxf ? 'pxf'
604 : $out_bff_selected ? 'bff'
605 : $out_csv ? 'csv'
606 : $out_jsonf ? 'jsonf'
607 : $out_jsonld ? 'jsonld'
608 : $out_omop_selected ? 'omop'
609 : 'bff';
610 94 my $method = $in_type . '2' . $out_type;
611 94 ▶ $usage_error->("Unsupported conversion <$method>")
Branch: 1 branch
BranchTrueFalseTotal
unless is_public_conversion($method) 1 93 94
612 unless is_public_conversion($method);
613 93 my $conversion_spec = conversion_spec($method);
614 $usage_error->("--include-dataset-id is only supported for BFF output")
615 93 ▶ if $include_dataset_id && $conversion_spec->{target} ne 'beacon';
Branch: 1 branch
BranchTrueFalseTotal
if $include_dataset_id and $conversion_spec->{"target"} ne "beacon" 0 93 93
Condition66%2/3
$include_dataset_id and $conversion_spec->{"target"} ne "beacon"
!ll&&!rl&&r
9210
MC/DC0%0/2
$include_dataset_id and $conversion_spec->{"target"} ne "beacon"
$include_dataset_id $conversion_spec->{"target"} ne "beacon"
Truth table66%2/3
A and B
A= $include_dataset_idB= $conversion_spec->{"target"} ne "beacon"
ABresult
0X0
100
111
616  
617 93 ▶ if ($out_bff_selected) {
Branch: 1 branch
BranchTrueFalseTotal
if ($out_bff_selected) 53 40 93
618 my %supported_for_route =
619 53 map { $_ => 1 } @{ $conversion_spec->{entities}{supported} };
620 53 for my $entity (@entity_list) {
621 $usage_error->(
622 "The entity <$entity> is not supported by conversion <$method>"
623 61 ▶ ) unless $supported_for_route{$entity};
Branch: 1 branch
BranchTrueFalseTotal
unless $supported_for_route{$entity} 0 61 61
624 }
625 }
626  
627 $usage_error->("The conversion <$method> does not support --stream")
628 93 ▶ if $stream && !$conversion_spec->{streaming};
Branch: 1 branch
BranchTrueFalseTotal
if $stream and not $conversion_spec->{"streaming"} 0 93 93
Condition66%2/3
$stream and not $conversion_spec->{"streaming"}
!ll&&!rl&&r
9030
MC/DC0%0/2
$stream and not $conversion_spec->{"streaming"}
$stream not $conversion_spec->{"streaming"}
Truth table66%2/3
A and not(B)
A= $streamB= not $conversion_spec->{"streaming"}
ABresult
0X0
100
111
629  
630 93 my $id = time . substr( "00000$$", -5 );
631  
632 93 ▶ my %data = (
Branch: 6 branches
BranchTrueFalseTotal
$sql2csv ? : 0 93 93
$ohdsi_db ? : 10 83 93
$stream ? : 3 90 93
$test ? : 48 45 93
$source_info ? : 92 1 93
$include_dataset_id ? : 1 92 93
633 out_dir => $out_dir,
634 in_textfile => 1,
635 method => $method,
636 sql2csv => $sql2csv ? 1 : 0,
637 exposures_file => $exposures_file,
638 search => $search,
639 ohdsi_db => $ohdsi_db ? 1 : 0,
640 omop_tables => \@omop_tables,
641 username => $username,
642 text_similarity_method => $text_similarity_method,
643 min_text_similarity_score => $min_text_similarity_score,
644 levenshtein_weight => $levenshtein_weight,
645 max_lines_sql => $max_lines_sql,
646 stream => $stream ? 1 : 0,
647 schema_file => $schema_file,
648 out_file => $out_file,
649 id => $id,
650 test => $test ? 1 : 0,
651 source_info => $source_info ? 1 : 0,
652 include_dataset_id => $include_dataset_id ? 1 : 0,
653 entities => \@entity_list,
654 );
655  
656 93 ▶ $data{output_name_overrides} = \%output_name_overrides if %output_name_overrides;
Branch: 1 branch
BranchTrueFalseTotal
if %output_name_overrides 5 88 93
657  
658 93 ▶ my $resolved_in_file =
Branch: 6 branches
BranchTrueFalseTotal
$in_pxf ? : 19 74 93
$in_bff ? : 9 65 74
$in_cbioportal ? : 4 61 65
$in_redcap ? : 4 57 61
$in_cdiscodm ? : 5 52 57
$in_csv ? : 8 44 52
659 $in_pxf ? $in_pxf
660 : $in_bff ? $in_bff
661 : $in_cbioportal ? $in_cbioportal
662 : $in_redcap ? $in_redcap
663 : $in_cdiscodm ? $in_cdiscodm
664 : $in_csv ? $in_csv
665 : undef;
666  
667 93 ▶ $data{in_file} = $resolved_in_file if defined $resolved_in_file;
Branch: 1 branch
BranchTrueFalseTotal
if defined $resolved_in_file 49 44 93
668 93 ▶ $data{in_files} = \@datasetjson_files if @datasetjson_files;
Branch: 1 branch
BranchTrueFalseTotal
if @datasetjson_files 8 85 93
669 93 ▶ $data{in_files} = \@datasetxml_files if @datasetxml_files;
Branch: 1 branch
BranchTrueFalseTotal
if @datasetxml_files 5 88 93
670 93 ▶ $data{in_files} = \@fhir_files if @fhir_files;
Branch: 1 branch
BranchTrueFalseTotal
if @fhir_files 8 85 93
671 93 ▶ $data{in_files} = \@i2b2_files if @i2b2_files;
Branch: 1 branch
BranchTrueFalseTotal
if @i2b2_files 2 91 93
672 93 ▶ $data{in_files} = \@sentinel_files if @sentinel_files;
Branch: 1 branch
BranchTrueFalseTotal
if @sentinel_files 2 91 93
673 93 ▶ $data{in_files} = \@pcornet_files if @pcornet_files;
Branch: 1 branch
BranchTrueFalseTotal
if @pcornet_files 3 90 93
674 93 ▶ $data{in_files} = \@omop_files if @omop_files;
Branch: 1 branch
BranchTrueFalseTotal
if @omop_files 13 80 93
675 93 ▶ $data{in_files} = \@openehr_files if @openehr_files;
Branch: 1 branch
BranchTrueFalseTotal
if @openehr_files 3 90 93
676 93 ▶ $data{sep} = $sep if defined $sep;
Branch: 1 branch
BranchTrueFalseTotal
if defined $sep 8 85 93
677 93 ▶ $data{redcap_dictionary} = $redcap_dictionary if defined $redcap_dictionary;
Branch: 1 branch
BranchTrueFalseTotal
if defined $redcap_dictionary 6 87 93
678 93 ▶ $data{mapping_file} = $mapping_file if defined $mapping_file;
Branch: 1 branch
BranchTrueFalseTotal
if defined $mapping_file 19 74 93
679 93 ▶ $data{define_xml} = $define_xml if defined $define_xml;
Branch: 1 branch
BranchTrueFalseTotal
if defined $define_xml 6 87 93
680 93 ▶ $data{self_validate_schema} = $self_validate_schema if defined $self_validate_schema;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self_validate_schema 1 92 93
681 93 ▶ $data{path_to_ohdsi_db} = $path_to_ohdsi_db if defined $path_to_ohdsi_db;
Branch: 1 branch
BranchTrueFalseTotal
if defined $path_to_ohdsi_db 5 88 93
682 93 ▶ $data{term_audit_file} = $term_audit_file if defined $term_audit_file;
Branch: 1 branch
BranchTrueFalseTotal
if defined $term_audit_file 4 89 93
683 93 ▶ $data{default_vital_status} = $default_vital_status if defined $default_vital_status;
Branch: 1 branch
BranchTrueFalseTotal
if defined $default_vital_status 2 91 93
684 93 ▶ $data{debug} = $debug if defined $debug;
Branch: 1 branch
BranchTrueFalseTotal
if defined $debug 1 92 93
685 93 ▶ $data{log} = $log if defined $log;
Branch: 1 branch
BranchTrueFalseTotal
if defined $log 1 92 93
686 93 ▶ $data{verbose} = $verbose ? 1 : 0 if defined $verbose;
Branch: 2 branches
BranchTrueFalseTotal
if defined $verbose 1 92 93
$verbose ? : 1 0 1
687  
688 return {
689 93 action => 'run',
690 color => $color,
691 overwrite => $overwrite,
692 out_file => $out_file,
693 log_file => $log_file,
694 verbose => $verbose,
695 stream => $stream,
696 data => \%data,
697 };
698 }
699  
700 62 1;
↑ Summary lib/Convert/Pheno/CDISC/DefineXML.pm »