NAME
CohortExplorer::Command::Query::Compare - CohortExplorer command to compare entities across visits
SYNOPSIS
compare [OPTIONS] [VARIABLE]
c [OPTIONS] [VARIABLE]
DESCRIPTION
The compare command enables the user to compare entities across visits. The user can also impose conditions on variables. Moreover, the command also enables the user to view summary statistics and export tables in csv format. The command is only available to longitudinal datasources.
This class is inherited from CohortExplorer::Command::Query and overrides the following methods:
usage_text()
This method returns the usage information for the command.
get_query_parameters( $opts, $datasource, @args )
This method returns a hash ref with keys, static
, dynamic
or both
depending on the variables supplied within arguments and conditions. The value of each key is a hash containing SQL parameters, -columns
, -from
, -where
, -group_by
and -having
.
process_result_set( $opts, $datasource, $result_set, $dir, $csv, @args )
This method writes result set to csv file and return a ref to the list containing Entity_IDs
.
process_table( $table, $datasource, $table_data, $dir, $csv, $result_entity )
This method writes the table data into a csv file for entities present in the result set. For static tables the csv contains Entity_ID
followed by variables' values and in case of dynamic tables the csv contains Entity_ID
followed by the values of all visit variables.
get_stats_data( $result_set )
This method returns a hash ref with Entity_ID
as keys and variable-value pairs as its value. The statistics in this command are computed with respect to the Entity_ID
and number of observation for each variable is equal to the number of times/visits each variable was recorded.
OPTIONS
- -o DIR, --out=DIR
-
Provide directory to export data
- -e TABLE, --export=TABLE
-
Export table by name
- -a, --export-all
-
Export all tables
- -s, --save--command
-
Save command
- -S, --stats
-
Show statistics
- -c COND, --cond=COND
-
Impose conditions using the operators:
=
,!=
,>
,>=
,<
,<=
,between
,not_between
,like
,not_like
,in
,not_in
andregexp
.
NOTES
The variables Entity_ID
and Visit
(if applicable) must not be provided as arguments as they are already part of the query-set. However, the user has the liberty to impose conditions on both the Entity_ID
and Visit
, using the cond
option. Other variables in arguments and conditions must be referenced as Table.Variable
or Visit.Table.Variable
where Visit = V1
, V2
, Vany
, Vlast
etc. When a condition is imposed on variables with no prefix V1
, V2
, Vany
or Vlast
, it is assumed that the condition applies to all visits of those variables. The directory specified within the out
option must have RWX enabled for CohortExplorer.
EXAMPLES
compare --out=/home/user/exports --stats --save-command --cond=V1.CER.Score="{'>','20'}" V1.SC.Date
compare --out=/home/user/exports --export=CER --cond=SD.Subject_Sex="{'=','Male'}" V1.CER.Score V3.DIS.Status
compare -o /home/user/exports -Ssa -c Vlast.CER.Score="{'in',['25','30','40']}" DIS.Status
compare -o /home/user/exports -e CER -e SD -c Vlast.CER.Score="{'between',['25','30']}" DIS.Status
DIAGNOSTICS
This class throws throw_cmd_run_exception
exception imported from CLI::Framework::Exceptions if Text::CSV_XS fails to construct a csv string from the list containing variables' values.
SEE ALSO
CohortExplorer::Command::Describe
CohortExplorer::Command::History
CohortExplorer::Command::Query::Search
CohortExplorer::Command::Query::Compare
LICENSE AND COPYRIGHT
Copyright (c) 2013-2014 Abhishek Dixit (adixit@cpan.org). All rights reserved.
This program is free software: you can redistribute it and/or modify it under the terms of either:
the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version, or
the "Artistic Licence".
AUTHOR
Abhishek Dixit