Skip to content

LORIS scripts in the tools directory

Tara Campbell edited this page May 9, 2016 · 6 revisions

HOME > SETUP > LORIS SCRIPTS IN THE TOOLS/ DIRECTORY



This section is under construction.

Note: scripts may generate PHP Notice messages, which is normal and should not affect output.

assign_missing_instruments.php

Adds instruments to test battery for candidates after timepoints have already been started and populated. By default this script will only print (but not add) instruments detected missing from candidate timepoints according to the current test battery definitions. Add the command-line argument “confirm” to populate these missing instruments in the database.

delete_candidate.php

This script deletes all DB table entries for one candidate.

To run:

// substitute DCCID and PSCID with the IDs of the candidate you wish to delete

php delete_candidate DCCID PSCID

detect_conflicts.php

General description: Detects double data entry conflicts missing from the conflicts_unresolved database table.

Usage:

  • Detect conflicts for a specific instrument:
    php detect_conflicts.php -i InstrumentName
  • Detect conflicts for a specific instrument and visit/timepoint:
    php detect_conflicts.php -i InstrumentName -t Timepoint
  • Detect conflicts for a all instrument:
    php detect_conflicts.php -i all
  • Detect and insert conflicts into conflicts_unresovled table: use flag -c
    php detect_conflicts.php -c -i InstrumentName
  • To update (remove and re-insert) conflicts into conflicts_unresovled table: use flag -m
    php detect_conflicts.php -m -i InstrumentName

fix_timepoint_date_problems.php

General description: This script diagnoses and corrects the date problems in a candidate's profile and adds missing instruments to the behavioural battery. It can also be used to adds an instrument for a candidate, for a specific visit.

The procedure to correct the problems is:

  • run script with command-line argument fix_date to UPDATE the date fields in the candidate/session table (as needed)
  • run script with command-line argument diagnose to get the difference in batteries
  • run script with command-line argument add_instrument to add missing instruments, and create new feedback

Ways to use this script:

  • to get a help screen run: php fix_timepoint_date_problems.php help
  • to fix dates (when fixing stage dates, sessionID must be specified)
    • php fix_timepoint_date_problems.php diagnose <candID> [<sessionID>]
    • php fix_timepoint_date_problems.php diagnose <candID> [<newCorrectDate> <dob/edc/>]
    • php fix_timepoint_date_problems.php diagnose <candID> [<sessionID> <newCorrectDate> <screening/visit>]
  • to fix behavioural battery (run only once the dates are fixed). This adds an instrument to a candidate's visit/session.
    • php fix_timepoint_date_problems.php add_instrument <candID> <sessionID> <test_name>

generate_tables_sql.php

This script takes the ip_output.txt file generated from quickform_parser.php and outputs an sql build file for the table of each instrument it finds in the ip_output.txt file. These sql files are output to the tables_sql/ subdirectory.

To run:

php generate_tables_sql.php

quickform_parser.php

This parses all of the instruments and generates a staging file (ip_output.txt) which can be used by data_dictionary_builder.php and generate_tables_sql.php. You can also run the script for a single instrument at a time.

To run:

// For all instruments:

find ../project/instruments/ | php quickform_parser.php

// For a single instrument (replace INSTRUMENTFILE with the correct filename):

find ../project/instruments/INSTRUMENTFILE | php quickform_parser.php
Clone this wiki locally