The existing LINST format is a text file where each row represents a field on a form (with some exceptions) with an ad-hoc number of attributes for each field depending on it's type. The attributes are separated by an inhouse {@} separator and are only indexed by location in the row with no header or description of what the attribute is meant to be. The format is hard to read and hard to edit by technical and non-technical users, one bad edit causes the instrument loading to fail in the most confusing ways.
Proposal:
A defined in-house TSV formated instrument descriptor where each attribute is clearly structured under a header (type, name, label, list options, min, max, ...) with validation when attributes are mis-associated with incorrect types. A TSV can easily be opened and edited by users reducing greatly potential errors stemming of mishandling of a text file. Delimiters are more standard. Explicit headers ensure the editor knows what each field serves. The current LINST format is also associated with a .meta, .rules and .score file here is the break down of changes proposed here:
.linst
- A described above, direct mapping of each field type to the new TSV format and organization of attributes under dedicated columns.
- For ENUM fields (selects, multiselects) the enum should probably follwo a JSON format as key:value pairs. JSON is easy to encode/decode and a popular enough structure to not confuse editors from different backgrounds
_status fields historically are listed as their own row i nthe current standard. the new format would add the necessary headers such as include_status and status_options where the former defines if we need a status field and the latter enumerates the options as a JSON
.rules
- rules no longer need a separate file, they can be included in the main tsv
- the new format would explicitly define a
required column to avoid implicitly making everything required and bypassing it with hacks like the "NEVER_REQUIRED" rules and the "norules" meta field
- a
required_if column alternatively offers conditional requirement where if the cell is filled the rule in the cell applies. In the initial implementation the rules can be very simple and formed as reference_field_name==value operators can be limited to == and != and logic statements only need to support AND and OR.
.score
No planned changes in the short term.
.meta
- Simplify the format to a TSV as well with no additional changes
In terms of implementation, a phased approach is recommended:
Phase 1:
1. Build basic template for the TSV with all the possible headers defined for instrument structure only (no rules)
2. Build NDB_BVL_Instrument extension class to support reading the TSV
3. Build LINST -> LINST2.0 conversion scripts
Phase 2:
1. Incorporate rules headers into the TSV template
2. Add rule parsing logic to the PHP class
3. create rule conversion script from .rule files to the main TSV
Phase 3:
1. Modify .meta files to become instrumentname_meta.tsv files
Phase 4:
1. Adapt instrument builder to use the new TSV format
2. Adapt instrument manager to support installing the TSV format
Phase 5:
1. Create LINST2.0->BIDS exporters
The existing LINST format is a text file where each row represents a field on a form (with some exceptions) with an ad-hoc number of attributes for each field depending on it's type. The attributes are separated by an inhouse
{@}separator and are only indexed by location in the row with no header or description of what the attribute is meant to be. The format is hard to read and hard to edit by technical and non-technical users, one bad edit causes the instrument loading to fail in the most confusing ways.Proposal:
A defined in-house TSV formated instrument descriptor where each attribute is clearly structured under a header (type, name, label, list options, min, max, ...) with validation when attributes are mis-associated with incorrect types. A TSV can easily be opened and edited by users reducing greatly potential errors stemming of mishandling of a text file. Delimiters are more standard. Explicit headers ensure the editor knows what each field serves. The current LINST format is also associated with a
.meta,.rulesand.scorefile here is the break down of changes proposed here:.linst_statusfields historically are listed as their own row i nthe current standard. the new format would add the necessary headers such asinclude_statusandstatus_optionswhere the former defines if we need a status field and the latter enumerates the options as a JSON.rulesrequiredcolumn to avoid implicitly making everything required and bypassing it with hacks like the "NEVER_REQUIRED" rules and the "norules" meta fieldrequired_ifcolumn alternatively offers conditional requirement where if the cell is filled the rule in the cell applies. In the initial implementation the rules can be very simple and formed asreference_field_name==valueoperators can be limited to==and!=and logic statements only need to supportANDandOR..scoreNo planned changes in the short term.
.metaIn terms of implementation, a phased approach is recommended:
Phase 1:
1. Build basic template for the TSV with all the possible headers defined for instrument structure only (no rules)
2. Build NDB_BVL_Instrument extension class to support reading the TSV
3. Build LINST -> LINST2.0 conversion scripts
Phase 2:
1. Incorporate rules headers into the TSV template
2. Add rule parsing logic to the PHP class
3. create rule conversion script from .rule files to the main TSV
Phase 3:
1. Modify .meta files to become instrumentname_meta.tsv files
Phase 4:
1. Adapt instrument builder to use the new TSV format
2. Adapt instrument manager to support installing the TSV format
Phase 5:
1. Create LINST2.0->BIDS exporters