NAME
CohortExplorer::Command::Query::Search - CohortExplorer class to search entities
SYNOPSIS
search [OPTIONS] [VARIABLE]
s [OPTIONS] [VARIABLE]
DESCRIPTION
The search command enables the user to search entities using variables of interest. The user can also impose conditions on the variables. Moreover, the command also enables the user to view summary statistics and export the tables in csv format. The command is available to both standard and 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 datasource type and 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 returns a hash ref with keys as Entity_ID
and values either a list of visit numbers, if the result-set contains visit column (i.e. dynamic tables- longitudinal datasources), or empty list (i.e. static tables - standard/longitudinal datasources )
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 data includes Entity_ID
followed by variables' values where as, for dynamic tables it includes an additional column Visit
. The column headers for csv are retrieved by variables()
method of the datasource class.
get_stats_data( $result_set )
This method returns a hash ref with Visit
as keys and variable-value hash as its value provided, at least one variable in the query-set belongs to the dynamic table. For all other cases it simply returns a hash ref with variable-value pairs.
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 summary 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 Entity_ID
and Visit
, using the cond
option. The directory specified within the out
option must have RWX enabled for CohortExplorer.
EXAMPLES
search --out /home/user/exports --stats --save-command --cond DS.Status="{'=','CTL'}" SC.Date
search --out /home/user/exports --export-all --cond SD.Subject_Sex="{'=','Male'}" CER.Score DIS.Status
search -o /home/user/exports -e DS -e SD -c Entity_ID="{'like',['SUB100%','SUB200%']}" DIS.Status
search -o /home/user/exports -Ssa -c Visit="{'in',['1','3','5']}" DIS.Status
search -o /home/user/exports -c 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