12.8. CamCOPS command-line tools

12.8.1. camcops_server

The camcops_server command is the main interface to the CamCOPS server. Options (output from camcops_server --allhelp):

USAGE: camcops_server [-h] [--allhelp] [--version] [-v] [--no_log]
                      {docs,demo_camcops_config,demo_supervisor_config,demo_apache_config,upgrade_db,dev_upgrade_db,dev_downgrade_db,dev_add_dummy_data,show_db_title,show_db_schema,merge_db,create_db,ddl,reindex,check_index,make_superuser,reset_password,enable_user,export,show_export_queue,crate_dd,cris_dd,serve_cherrypy,serve_gunicorn,serve_pyramid,convert_athena_icd_snomed_to_xml,launch_workers,launch_scheduler,launch_monitor,housekeeping,purge_jobs,dev_cli,list_tasks}
                      ...

CamCOPS server, created by Rudolf Cardinal; version 2.4.20.
Use 'camcops_server <COMMAND> --help' for more detail on each command.

OPTIONS:
  -h, --help            show this help message and exit
  --allhelp             show help for all commands and exit
  --version             show program's version number and exit
  -v, --verbose         Be verbose
  --no_log              Disable log (stderr) entirely.

COMMANDS:
  Valid CamCOPS commands are as follows.

  {docs,demo_camcops_config,demo_supervisor_config,demo_apache_config,upgrade_db,dev_upgrade_db,dev_downgrade_db,dev_add_dummy_data,show_db_title,show_db_schema,merge_db,create_db,ddl,reindex,check_index,make_superuser,reset_password,enable_user,export,show_export_queue,crate_dd,cris_dd,serve_cherrypy,serve_gunicorn,serve_pyramid,convert_athena_icd_snomed_to_xml,launch_workers,launch_scheduler,launch_monitor,housekeeping,purge_jobs,dev_cli,list_tasks}
                        Specify one command.
    docs                Launch the main documentation (CamCOPS manual)
    demo_camcops_config
                        Print a demo CamCOPS config file
    demo_supervisor_config
                        Print a demo 'supervisor' config file for CamCOPS
    demo_apache_config  Print a demo Apache config file section for CamCOPS
    upgrade_db          Upgrade database to most recent version (via Alembic)
    dev_upgrade_db      (DEVELOPER OPTION ONLY.) Upgrade a database to a
                        specific revision.
    dev_downgrade_db    (DEVELOPER OPTION ONLY.) Downgrades a database to a
                        specific revision. May DESTROY DATA.
    dev_add_dummy_data  (DEVELOPER OPTION ONLY.) Populates the database with a
                        set of dummy patients and tasks for testing.
    show_db_title       Show database title
    show_db_schema      Show the database schema as PlantUML +/- PNG
    merge_db            Merge in data from an old or recent CamCOPS database
    create_db           Create CamCOPS database from scratch (AVOID; use the
                        upgrade facility instead)
    ddl                 Print database schema (data definition language; DDL)
    reindex             Recreate task index
    check_index         Check index validity (exit code 0 for OK, 1 for bad)
    make_superuser      Make superuser, or give superuser status to an
                        existing user
    reset_password      Reset a user's password
    enable_user         Re-enable a locked user account
    export              Trigger pending exports
    show_export_queue   View outbound export queue (without sending)
    crate_dd            Make draft data dictionary for CRATE anonymisation
                        tool
    cris_dd             Make draft data dictionary for CRIS anonymisation tool
    serve_cherrypy      Start web server via CherryPy
    serve_gunicorn      Start web server via Gunicorn (not available under
                        Windows)
    serve_pyramid       Start test web server via Pyramid (single-thread,
                        single-process, HTTP-only; for development use only)
    convert_athena_icd_snomed_to_xml
                        Fetch SNOMED-CT codes for ICD-9-CM and ICD-10 from the
                        Athena OHDSI data set (https://athena.ohdsi.org/) and
                        write them to the CamCOPS XML format
    launch_workers      Launch Celery workers, for background processing
    launch_scheduler    Launch Celery Beat scheduler, to schedule background
                        jobs
    launch_monitor      Launch Celery Flower monitor, to monitor background
                        jobs
    housekeeping        Run housekeeping tasks (remove stale sessions, etc.)
    purge_jobs          Purge any outstanding background (back-end, worker)
                        jobs
    dev_cli             Developer command-line interface, with config loaded
                        as 'config'.
    list_tasks          List supported tasks.

===============================================================================
Help for command 'docs'
===============================================================================
USAGE: camcops_server docs [-h] [-v]

Launch the main documentation (CamCOPS manual)

OPTIONS:
  -h, --help     show this help message and exit
  -v, --verbose  Be verbose (default: False)

===============================================================================
Help for command 'demo_camcops_config'
===============================================================================
USAGE: camcops_server demo_camcops_config [-h] [-v] [--docker]

Print a demo CamCOPS config file

OPTIONS:
  -h, --help     show this help message and exit
  -v, --verbose  Be verbose (default: False)
  --docker       Use settings for Docker (default: False)

===============================================================================
Help for command 'demo_supervisor_config'
===============================================================================
USAGE: camcops_server demo_supervisor_config [-h] [-v]

Print a demo 'supervisor' config file for CamCOPS

OPTIONS:
  -h, --help     show this help message and exit
  -v, --verbose  Be verbose (default: False)

===============================================================================
Help for command 'demo_apache_config'
===============================================================================
USAGE: camcops_server demo_apache_config [-h] [-v] [--path PATH]

Print a demo Apache config file section for CamCOPS

OPTIONS:
  -h, --help     show this help message and exit
  -v, --verbose  Be verbose (default: False)
  --path PATH    Path where CamCOPS should appear on the server e.g. 'camcops'
                 for https://example.com/camcops (default: )

===============================================================================
Help for command 'upgrade_db'
===============================================================================
USAGE: camcops_server upgrade_db [-h] [-v] --config CONFIG [--show_sql_only]
                                 [--no_reindex]

Upgrade database to most recent version (via Alembic)

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --show_sql_only  Show SQL only (to stdout); don't execute it (default:
                   False)
  --no_reindex     Don't recreate the task index (default: False)

REQUIRED NAMED ARGUMENTS:
  --config CONFIG  Configuration file (default: None)

===============================================================================
Help for command 'dev_upgrade_db'
===============================================================================
USAGE: camcops_server dev_upgrade_db [-h] [-v] --config CONFIG
                                     --destination_db_revision
                                     DESTINATION_DB_REVISION [--show_sql_only]

(DEVELOPER OPTION ONLY.) Upgrade a database to a specific revision.

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --destination_db_revision DESTINATION_DB_REVISION
                        The target database revision (default: None)
  --show_sql_only       Show SQL only (to stdout); don't execute it (default:
                        False)

REQUIRED NAMED ARGUMENTS:
  --config CONFIG       Configuration file (default: None)

===============================================================================
Help for command 'dev_downgrade_db'
===============================================================================
USAGE: camcops_server dev_downgrade_db [-h] [-v] --config CONFIG
                                       --destination_db_revision
                                       DESTINATION_DB_REVISION
                                       [--confirm_downgrade_db]
                                       [--show_sql_only]

(DEVELOPER OPTION ONLY.) Downgrades a database to a specific revision. May
DESTROY DATA.

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --destination_db_revision DESTINATION_DB_REVISION
                        The target database revision (default: None)
  --confirm_downgrade_db
                        Must specify this too, as a safety measure (default:
                        False)
  --show_sql_only       Show SQL only (to stdout); don't execute it (default:
                        False)

REQUIRED NAMED ARGUMENTS:
  --config CONFIG       Configuration file (default: None)

===============================================================================
Help for command 'dev_add_dummy_data'
===============================================================================
USAGE: camcops_server dev_add_dummy_data [-h] [-v] --config CONFIG
                                         [--confirm_add_dummy_data]

(DEVELOPER OPTION ONLY.) Populates the database with a set of dummy patients
and tasks for testing.

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --confirm_add_dummy_data
                        Must specify this too, as a safety measure (default:
                        False)

REQUIRED NAMED ARGUMENTS:
  --config CONFIG       Configuration file (default: None)

===============================================================================
Help for command 'show_db_title'
===============================================================================
USAGE: camcops_server show_db_title [-h] [-v] [--config CONFIG]

Show database title

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'show_db_schema'
===============================================================================
USAGE: camcops_server show_db_schema [-h] [-v] [--config CONFIG]
                                     [--schemastem SCHEMASTEM] [--make_image]
                                     [--java JAVA] [--plantuml PLANTUML]
                                     [--height_width_limit HEIGHT_WIDTH_LIMIT]
                                     [--java_memory_limit_mb JAVA_MEMORY_LIMIT_MB]

Show the database schema as PlantUML +/- PNG

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --config CONFIG       Configuration file (if not specified, the environment
                        variable CAMCOPS_CONFIG_FILE is checked) (default:
                        None)
  --schemastem SCHEMASTEM
                        Stem for output filenames (for schema diagrams);
                        '.plantuml' and '.png' are appended (default: schema)
  --make_image          Create a PNG image (impractically large!) (default:
                        False)
  --java JAVA           Java executable (for schema diagrams) (default: java)
  --plantuml PLANTUML   PlantUML Java .jar file (for schema diagrams)
                        (default: plantuml.jar)
  --height_width_limit HEIGHT_WIDTH_LIMIT
                        Maximum image height/width in pixels (default: 20000)
  --java_memory_limit_mb JAVA_MEMORY_LIMIT_MB
                        Java virtual machine memory limit in Mb (default:
                        2048)

===============================================================================
Help for command 'merge_db'
===============================================================================
USAGE: camcops_server merge_db [-h] [-v] --config CONFIG
                               [--report_every REPORT_EVERY] [--echo]
                               [--dummy_run] [--info_only]
                               [--default_group_id DEFAULT_GROUP_ID]
                               [--default_group_name DEFAULT_GROUP_NAME] --src
                               SRC --whichidnum_map WHICHIDNUM_MAP
                               --groupnum_map GROUPNUM_MAP

Merge in data from an old or recent CamCOPS database

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --report_every REPORT_EVERY
                        Report progress every n rows (default: 10000)
  --echo                Echo SQL to source database (default: False)
  --dummy_run           Perform a dummy run only; do not alter destination
                        database (default: False)
  --info_only           Show table information only; don't do any work
                        (default: False)
  --default_group_id DEFAULT_GROUP_ID
                        Default group ID (integer) to apply to old records
                        without one. If none is specified, a new group will be
                        created for such records. (default: None)
  --default_group_name DEFAULT_GROUP_NAME
                        If default_group_id is not specified, use this group
                        name. The group will be looked up if it exists, and
                        created if not. (default: None)

REQUIRED NAMED ARGUMENTS:
  --config CONFIG       Configuration file (default: None)
  --src SRC             Source database (specified as an SQLAlchemy URL). The
                        contents of this database will be merged into the
                        database specified in the config file. (default: None)
  --whichidnum_map WHICHIDNUM_MAP
                        Map to convert ID number types, in the format
                        'from_a:to_a,from_b:to_b,...', where all values are
                        integers. (default: None)
  --groupnum_map GROUPNUM_MAP
                        Map to convert group numbers, in the format
                        'from_a:to_a,from_b:to_b,...', where all values are
                        integers. (default: None)

===============================================================================
Help for command 'create_db'
===============================================================================
USAGE: camcops_server create_db [-h] [-v] --config CONFIG --confirm_create_db

Create CamCOPS database from scratch (AVOID; use the upgrade facility instead)

OPTIONS:
  -h, --help           show this help message and exit
  -v, --verbose        Be verbose (default: False)

REQUIRED NAMED ARGUMENTS:
  --config CONFIG      Configuration file (default: None)
  --confirm_create_db  Must specify this too, as a safety measure (default:
                       False)

===============================================================================
Help for command 'ddl'
===============================================================================
USAGE: camcops_server ddl [-h] [-v] [--config CONFIG] [--dialect DIALECT]

Print database schema (data definition language; DDL)

OPTIONS:
  -h, --help         show this help message and exit
  -v, --verbose      Be verbose (default: False)
  --config CONFIG    Configuration file (if not specified, the environment
                     variable CAMCOPS_CONFIG_FILE is checked) (default: None)
  --dialect DIALECT  SQL dialect (options: firebird, mssql, mysql, oracle,
                     postgresql, sqlite, sybase) (default: mysql)

===============================================================================
Help for command 'reindex'
===============================================================================
USAGE: camcops_server reindex [-h] [-v] [--config CONFIG]

Recreate task index

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'check_index'
===============================================================================
USAGE: camcops_server check_index [-h] [-v] [--config CONFIG] [--show_all_bad]

Check index validity (exit code 0 for OK, 1 for bad)

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)
  --show_all_bad   Show all bad index entries (rather than stopping at the
                   first) (default: False)

===============================================================================
Help for command 'make_superuser'
===============================================================================
USAGE: camcops_server make_superuser [-h] [-v] [--config CONFIG]
                                     [--username USERNAME]
                                     [--password PASSWORD]

Make superuser, or give superuser status to an existing user

OPTIONS:
  -h, --help           show this help message and exit
  -v, --verbose        Be verbose (default: False)
  --config CONFIG      Configuration file (if not specified, the environment
                       variable CAMCOPS_CONFIG_FILE is checked) (default:
                       None)
  --username USERNAME  Username of superuser to create/promote (if omitted,
                       you will be asked to type it in) (default: None)
  --password PASSWORD  Password of superuser to create (if omitted, you will
                       be asked to type it in) (default: None)

===============================================================================
Help for command 'reset_password'
===============================================================================
USAGE: camcops_server reset_password [-h] [-v] [--config CONFIG]
                                     [--username USERNAME]

Reset a user's password

OPTIONS:
  -h, --help           show this help message and exit
  -v, --verbose        Be verbose (default: False)
  --config CONFIG      Configuration file (if not specified, the environment
                       variable CAMCOPS_CONFIG_FILE is checked) (default:
                       None)
  --username USERNAME  Username to change password for (if omitted, you will
                       be asked to type it in) (default: None)

===============================================================================
Help for command 'enable_user'
===============================================================================
USAGE: camcops_server enable_user [-h] [-v] [--config CONFIG]
                                  [--username USERNAME]

Re-enable a locked user account

OPTIONS:
  -h, --help           show this help message and exit
  -v, --verbose        Be verbose (default: False)
  --config CONFIG      Configuration file (if not specified, the environment
                       variable CAMCOPS_CONFIG_FILE is checked) (default:
                       None)
  --username USERNAME  Username to enable (if omitted, you will be asked to
                       type it in) (default: None)

===============================================================================
Help for command 'export'
===============================================================================
USAGE: camcops_server export [-h] [-v] [--config CONFIG]
                             [--recipients [RECIPIENTS ...]]
                             [--all_recipients] [--disable_task_index]
                             [--schedule_via_backend]

Trigger pending exports

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --config CONFIG       Configuration file (if not specified, the environment
                        variable CAMCOPS_CONFIG_FILE is checked) (default:
                        None)
  --recipients [RECIPIENTS ...]
                        Export recipients (as named in config file) (default:
                        None)
  --all_recipients      Use all recipients (default: False)
  --disable_task_index  Disable use of the task index (for debugging only)
                        (default: False)
  --schedule_via_backend
                        Export tasks as a background job (default: False)

===============================================================================
Help for command 'show_export_queue'
===============================================================================
USAGE: camcops_server show_export_queue [-h] [-v] [--config CONFIG]
                                        [--recipients [RECIPIENTS ...]]
                                        [--all_recipients]
                                        [--disable_task_index] [--pretty]
                                        [--debug_show_fhir]
                                        [--debug_fhir_include_docs]

View outbound export queue (without sending)

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --config CONFIG       Configuration file (if not specified, the environment
                        variable CAMCOPS_CONFIG_FILE is checked) (default:
                        None)
  --recipients [RECIPIENTS ...]
                        Export recipients (as named in config file) (default:
                        None)
  --all_recipients      Use all recipients (default: False)
  --disable_task_index  Disable use of the task index (for debugging only)
                        (default: False)
  --pretty              Pretty (but slower) formatting for tasks (default:
                        False)
  --debug_show_fhir     Show FHIR output for tasks (default: False)
  --debug_fhir_include_docs
                        (If --debug_show_fhir) Included FHIR documents? Large.
                        (default: False)

===============================================================================
Help for command 'crate_dd'
===============================================================================
USAGE: camcops_server crate_dd [-h] [-v] [--config CONFIG] --filename FILENAME
                               --recipient RECIPIENT

Make draft data dictionary for CRATE anonymisation tool

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --config CONFIG       Configuration file (if not specified, the environment
                        variable CAMCOPS_CONFIG_FILE is checked) (default:
                        None)
  --filename FILENAME   Output filename (data dictionary to write) (default:
                        None)
  --recipient RECIPIENT
                        Export recipient (as named in config file) (default:
                        None)

===============================================================================
Help for command 'cris_dd'
===============================================================================
USAGE: camcops_server cris_dd [-h] [-v] [--config CONFIG] --filename FILENAME
                              --recipient RECIPIENT

Make draft data dictionary for CRIS anonymisation tool

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --config CONFIG       Configuration file (if not specified, the environment
                        variable CAMCOPS_CONFIG_FILE is checked) (default:
                        None)
  --filename FILENAME   Filename of data dictionary to write (default: None)
  --recipient RECIPIENT
                        Export recipient (as named in config file) (default:
                        None)

===============================================================================
Help for command 'serve_cherrypy'
===============================================================================
USAGE: camcops_server serve_cherrypy [-h] [-v] [--config CONFIG]

Start web server via CherryPy

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'serve_gunicorn'
===============================================================================
USAGE: camcops_server serve_gunicorn [-h] [-v] [--config CONFIG]

Start web server via Gunicorn (not available under Windows)

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'serve_pyramid'
===============================================================================
USAGE: camcops_server serve_pyramid [-h] [-v] [--config CONFIG]

Start test web server via Pyramid (single-thread, single-process, HTTP-only;
for development use only)

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'convert_athena_icd_snomed_to_xml'
===============================================================================
USAGE: camcops_server convert_athena_icd_snomed_to_xml [-h] [-v]
                                                       [--config CONFIG]
                                                       --athena_concept_tsv_filename
                                                       ATHENA_CONCEPT_TSV_FILENAME
                                                       --athena_concept_relationship_tsv_filename
                                                       ATHENA_CONCEPT_RELATIONSHIP_TSV_FILENAME
                                                       --icd9_xml_filename
                                                       ICD9_XML_FILENAME
                                                       --icd10_xml_filename
                                                       ICD10_XML_FILENAME

Fetch SNOMED-CT codes for ICD-9-CM and ICD-10 from the Athena OHDSI data set
(https://athena.ohdsi.org/) and write them to the CamCOPS XML format

OPTIONS:
  -h, --help            show this help message and exit
  -v, --verbose         Be verbose (default: False)
  --config CONFIG       Configuration file (if not specified, the environment
                        variable CAMCOPS_CONFIG_FILE is checked) (default:
                        None)
  --athena_concept_tsv_filename ATHENA_CONCEPT_TSV_FILENAME
                        Path to CONCEPT.csv file from Athena download
                        (default: None)
  --athena_concept_relationship_tsv_filename ATHENA_CONCEPT_RELATIONSHIP_TSV_FILENAME
                        Path to CONCEPT_RELATIONSHIP.csv file from Athena
                        download (default: None)
  --icd9_xml_filename ICD9_XML_FILENAME
                        Filename of ICD-9-CM/SNOMED-CT XML file to write
                        (default: None)
  --icd10_xml_filename ICD10_XML_FILENAME
                        Filename of ICD-10/SNOMED-CT XML file to write
                        (default: None)

===============================================================================
Help for command 'launch_workers'
===============================================================================
USAGE: camcops_server launch_workers [-h] [-v] [--config CONFIG]

Launch Celery workers, for background processing

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'launch_scheduler'
===============================================================================
USAGE: camcops_server launch_scheduler [-h] [-v] [--config CONFIG]

Launch Celery Beat scheduler, to schedule background jobs

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'launch_monitor'
===============================================================================
USAGE: camcops_server launch_monitor [-h] [-v] [--config CONFIG]
                                     [--address ADDRESS] [--port PORT]

Launch Celery Flower monitor, to monitor background jobs

OPTIONS:
  -h, --help         show this help message and exit
  -v, --verbose      Be verbose (default: False)
  --config CONFIG    Configuration file (if not specified, the environment
                     variable CAMCOPS_CONFIG_FILE is checked) (default: None)
  --address ADDRESS  Address to use for Flower (default: 127.0.0.1)
  --port PORT        Port to use for Flower (default: 5555)

===============================================================================
Help for command 'housekeeping'
===============================================================================
USAGE: camcops_server housekeeping [-h] [-v] [--config CONFIG]

Run housekeeping tasks (remove stale sessions, etc.)

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'purge_jobs'
===============================================================================
USAGE: camcops_server purge_jobs [-h] [-v] [--config CONFIG]

Purge any outstanding background (back-end, worker) jobs

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'dev_cli'
===============================================================================
USAGE: camcops_server dev_cli [-h] [-v] [--config CONFIG]

Developer command-line interface, with config loaded as 'config'.

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

===============================================================================
Help for command 'list_tasks'
===============================================================================
USAGE: camcops_server list_tasks [-h] [-v] [--config CONFIG]

List supported tasks.

OPTIONS:
  -h, --help       show this help message and exit
  -v, --verbose    Be verbose (default: False)
  --config CONFIG  Configuration file (if not specified, the environment
                   variable CAMCOPS_CONFIG_FILE is checked) (default: None)

12.8.2. camcops_server_meta

The camcops_server_meta tool allows you to run CamCOPS over multiple CamCOPS configuration files/databases. It’s less useful than it was, because the dominant mode of “one database per research group” has been replaced by the concept of “a single database with group-level security”.

Options:

USAGE: camcops_server_meta [-h] --filespecs FILESPECS [FILESPECS ...]
                           [--ccargs [CCARGS ...]] [--python PYTHON]
                           [--camcops CAMCOPS] [-d] [-v]
                           cc_command

Run commands across multiple CamCOPS databases

POSITIONAL ARGUMENTS:
  cc_command            Main command to pass to CamCOPS

OPTIONS:
  -h, --help            show this help message and exit
  --filespecs FILESPECS [FILESPECS ...]
                        List of CamCOPS config files (wildcards OK)
  --ccargs [CCARGS ...]
                        List of CamCOPS arguments, to which '--' will be
                        prefixed
  --python PYTHON       Python interpreter (default: /path/to/python)
  --camcops CAMCOPS     CamCOPS server executable (default:
                        /path/to/camcops/server/camcops_server.py)
  -d, --dummyrun        Dummy run (show filenames only)
  -v, --verbose         Verbose

12.8.3. camcops_fetch_snomed_codes

Subject to you having the necessary permissions, and access to a SNOMED CT REST API server, this tool will help you find SNOMED CT codes relevant to CamCOPS. See SNOMED CT coding and SNOMED CT licensing.

Options:

usage: camcops_fetch_snomed_codes [-h] [--allhelp] [--url URL]
                                  [--edition EDITION] [--release RELEASE]
                                  [--language LANGUAGE]
                                  [--rate_limit_hz RATE_LIMIT_HZ] [--verbose]
                                  {test,fetch} ...

Fetch SNOMED CT codes from a SNOMED CT Snapshot REST API provider

options:
  -h, --help            show this help message and exit
  --allhelp             show help for all commands and exit
  --url URL             URL (protocol, host, API root path) for SNOMED-CT API
                        (default: https://termbrowser.nhs.uk/sct-browser-
                        api/snomed)
  --edition EDITION     SNOMED CT edition (default: uk-edition)
  --release RELEASE     Snomed release identifier (version) (default:
                        v20210929)
  --language LANGUAGE   Language (default: english)
  --rate_limit_hz RATE_LIMIT_HZ
                        Maximum number of requests per second (default: 1)
  --verbose             Be verbose (default: False)

commands:
  {test,fetch}          Specify one command. Use 'camcops_fetch_snomed_codes
                        <command> --help' for more help
    test                Run tests. If you specify no arguments, default tests
                        will be run.
    fetch               Fetch data relevant to CamCOPS and write to XML

===============================================================================
Help for command 'test'
===============================================================================
USAGE: camcops_fetch_snomed_codes test [-h] [--concept_id [CONCEPT_ID ...]]
                                       [--term [TERM ...]]
                                       [--semantic_area SEMANTIC_AREA]

OPTIONS:
  -h, --help            show this help message and exit
  --concept_id [CONCEPT_ID ...]
                        For tests: Concept ID(s) to test (default: None)
  --term [TERM ...]     For tests: Term(s) to test (default: None)
  --semantic_area SEMANTIC_AREA
                        For tests: semantic area to restrict to (default:
                        None)

===============================================================================
Help for command 'fetch'
===============================================================================
USAGE: camcops_fetch_snomed_codes fetch [-h] [--outfile OUTFILE]
                                        [--continue_on_error]

OPTIONS:
  -h, --help           show this help message and exit
  --outfile OUTFILE    XML filename to write (default:
                       camcops_tasks_snomed.xml)
  --continue_on_error  Carry on despite errors (default: False)

12.8.4. camcops_backup_mysql_database

This simple tool uses MySQL to dump a MySQL database to a .SQL file (from which you can restore it), and names the file according to the name of the database plus a timestamp.

Options:

usage: camcops_backup_mysql_database [-h]
                                     [--max_allowed_packet MAX_ALLOWED_PACKET]
                                     [--mysqldump MYSQLDUMP]
                                     [--username USERNAME]
                                     [--password PASSWORD]
                                     [--with_drop_create_database]
                                     [--output_dir OUTPUT_DIR] [--verbose]
                                     databases [databases ...]

Back up a specific MySQL database. The resulting filename has the format
'<DATABASENAME>_<DATETIME><SUFFIX>.sql', where <DATETIME> is of the ISO-8601
format '%Y%m%dT%H%M%S' and <SUFFIX> is either blank or
'_with_drop_create_database'. A typical filename is therefore
'mydb_20190415T205524.sql'.

positional arguments:
  databases             Database(s) to back up

options:
  -h, --help            show this help message and exit
  --max_allowed_packet MAX_ALLOWED_PACKET
                        Maximum size of buffer (default: 1GB)
  --mysqldump MYSQLDUMP
                        mysqldump executable (default: mysqldump)
  --username USERNAME   MySQL user (default: root)
  --password PASSWORD   MySQL password (AVOID THIS OPTION IF POSSIBLE; VERY
                        INSECURE; VISIBLE TO OTHER PROCESSES; if you don't use
                        it, you'll be prompted for the password) (default:
                        None)
  --with_drop_create_database
                        Include DROP DATABASE and CREATE DATABASE commands,
                        and append a suffix to the output filename as above
                        (default: False)
  --output_dir OUTPUT_DIR
                        Output directory (if not specified, current directory
                        will be used) (default: None)
  --verbose             Verbose output (default: False)