Skip to content

ndi.fun.subjectDocTable

 SUBJECTDOCTABLE Creates a summary table of subjects and their associated metadata.

    subjectTable = subjectDocTable(SESSION)

    This function queries an NDI session to find all subject documents. For each
    subject, it then finds all associated 'element', 'openminds_subject', and
    'treatment' documents that depend on it.

    The function aggregates the properties from these dependent documents (like
    species, strain, mfdaq names, etc.) and formats them into a single summary
    table. Each row in the output table represents a single subject, and the
    columns contain the subject's IDs along with comma-separated lists of the
    unique properties found in its associated documents.

    Inputs:
        SESSION - An active and connected ndi.session or ndi.dataset object.

    Outputs:
        subjectTable - A MATLAB table where each row is a subject and columns
        are dynamically generated based on the data found. Common columns include
        'documentID', 'localID', 'SpeciesName', 'SpeciesOntology', 'mfdaqName',
        'mfdaqType', etc.

    See also: ndi.session, ndi.query, table, struct2table