ndi.fun.docTable.treatment
TREATMENT Gathers NDI treatment document properties into a table.
[treatmentTable, docIDs, dependencyIDs] = TREATMENT(SESSION, OPTIONS)
retrieves 'treatment' type documents from an NDI session and organizes
their properties into a MATLAB table. For each treatment document, it
extracts its numeric and/or string values, interpreting them based on
an associated ontology. It also identifies and returns the IDs of
documents that the treatment documents 'depend on'.
Input Arguments:
session (ndi.session.dir or ndi.dataset.dir) - An NDI session or dataset
directory object from which to retrieve treatment documents.
options.depends_on (char or string, optional) - Specifies a field name
within the treatment document's 'depends_on' structure to extract
dependency IDs. For example, use 'subject_id' to retrieve the IDs of
subjects that the treatment documents depend on. Defaults to an empty
string, meaning no specific dependency IDs are extracted unless specified.
Output Arguments:
treatmentTable (table) - A MATLAB table where each row represents a
treatment document. The table dynamically includes columns based on
the `dataType` derived from the treatment's ontology name. These
columns may include:
- `[dataType]` for numeric or string values.
- `[dataType]Name` and `[dataType]Ontology` if the string value
is an ontology node.
- `[dataType]Number` and `[dataType]String` if both numeric and
string values are present.
The function attempts to combine treatments that share the same
dependency into a single row, concatenating their properties.
docIDs (cell) - A cell array of character vectors. Each element is the
unique document ID of the treatment document corresponding to the
rows in 'treatmentTable', in the same order.
dependencyIDs (cell) - A cell array of character vectors. Each element
is the ID of the document that the corresponding treatment document
'depends on', as specified by 'options.depends_on'. If 'depends_on'
is not specified or no dependency is found, elements will be empty strings.
See also: ndi.query, ndi.session.dir, ndi.dataset.dir, ndi.fun.table.vstack, ndi.ontology.lookup