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 the 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 data in csv format. The command is available to both standard/cross-sectional 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_valid_variables()
This method returns a ref to the list of variables for validating arguments and condition option(s).
create_query_params( $opts, @args )
This method returns a hash ref with keys, static
, dynamic
or both depending on the datasource type and variables supplied as arguments and conditions. The value of each key is a hash containing SQL parameters such as -columns
, -from
, -where
, -group_by
and -having
.
process_result( $opts, $rs, $dir, @args )
This method returns a hash ref with keys as entity_id
and values can be a list of visit numbers provided the result-set contains visit column (dynamic tables), or empty list (static tables).
process_table( $table, $ts, $dir, $rs_entity )
This method writes the table set ($ts
) into a csv file. The data includes entity_id
of all entities present in the result set followed by values of all variables. In case of dynamic tables the csv also contains visit
column.
create_dataset( $rs )
This method returns a hash ref with visit
as keys and variable-value hash as its value provided the query set contains at least one dynamic variable. For all other cases it simply returns a hash ref with variable name-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
,ilike
,in
,not_in
,regexp
andnot_regexp
.
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 can impose conditions on both variables.
The directory specified in out
option must have RWX enabled for CohortExplorer.
EXAMPLES
search --out=/home/user/exports --stats --save-command --cond=DS.Status='=, CTL, MCI' GDS.Score
search --out=/home/user/exports --stats --save-command --cond=CER.Score='<=, 30' GDS.Score
search --out=/home/user/exports --export-all --cond=SD.Sex='=, Male' CER.Score DIS.Status
search -o/home/user/exports -eDS -eSD -c entity_id='like, DCR%' 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 variable 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