-
Notifications
You must be signed in to change notification settings - Fork 183
Developer's Instrument Guide
Stella Lee edited this page Aug 25, 2016
·
24 revisions
This guide reflects a typical workflow and best practices used by Loris developers at the MNI. Some specifics such as git workflow steps may not apply to all projects and implementations.
##What is an Instrument? An instrument should likely be coded manually in PHP if it involves:
- dependencies between fields (rules)
- special data formats or restricted types
- special scoring
- look-up tables (t-scores etc)
- age-dependencies in administering the instrument
##Developer Workflow
- Get the entire PDF/paper copy, including any “lookup” tables used for scoring/normalization. Key questions to ask before starting are:
- Has it been coded before? [link to instruments list]
- Clarify requirements: which sections of the questionnaire to include/omit. Typically, administrative details included on the original form can be ignored, but instructions that will be helpful for the examiner might be included.
- PHP or Linst: Simple instruments can use Linst (see above).
- How will all your fields map to the element types allowed by Loris form (beta!) (also see here for a list of allowed elements)
- Does your instrument require certification? Are there certified examiners? Can/should users be certified as examiners for this instrument using the Training module?
- Create a new git branch based off the up-to-date branch for your project-specific repo. For any Git inquiries, consult → link
- Create an instrument in the project/instruments/ directory
- Make a copy of the template instrument (from docs/instruments/ directory).
- Rename it to “NDB_BVL_$TABLE_NAME$.class.inc”
- Find-replace the template’s instrument name (e.g. TEST_NAME, ABC, etc.) with the proper instrument name in the form of “VisitLabel_TestName”. eg. Clinical_Biosample_Collection.
- Add pages ( if necessary )
- Usually the number of pages corresponds to the number pages in the pdf.
- Create a new function for every page i.e. function _page2(), function _page3()...
- Add questions to each page using $this->addType() wrappers or use $this->createType() wrappers (in case of table/groups)
- Run PHPCS on the instrument, and use PHPCBF to fix them. How? → link
- Insert the Instrument
- Add database records for your new instrument
- Create and source the instrument sql file into your database.
- Front end testing: Populate a record for a dummy candidate using assign_missing_instruments Test in your virtual machine to see if it works.
- Push branch and create pull request to your project-specific repo, how → link. Assign relevant tags and tester.
- Update any management document that you may be required to update.