Skip to content

LINST II - In-house TSV instrument descriptors #11154

Description

@ridz1208

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:

  1. .linst
    1. A described above, direct mapping of each field type to the new TSV format and organization of attributes under dedicated columns.
    2. 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
    3. _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
  2. .rules
    1. rules no longer need a separate file, they can be included in the main tsv
    2. 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
    3. 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.
  3. .score
    No planned changes in the short term.
  4. .meta
    1. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: InstrumentsPR or issue related instrumentsDifficulty: ComplexPR or issue that require a great effort to implementat, review, or testProposalPR or issue suggesting an improvement that can be accepted, rejected or altered

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions