Skip to content

feat: describe data variables, write CSV copies of tables, get session objects from a project - #149

Draft
ehennestad wants to merge 3 commits into
session-remote-file-downloadfrom
variable-descriptions-csv-copies-and-session-objects
Draft

ehennestad wants to merge 3 commits into
session-remote-file-downloadfrom
variable-descriptions-csv-copies-and-session-objects

Conversation

@ehennestad

@ehennestad ehennestad commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Mechanism

A data variable is a struct validated against VariableModel.getBlankItem. A metatable is a .mat file. A session object can load data only when it holds the project's data location and variable models, which the app passes to MetaTable.getMetaObjects.

Problem

Nothing recorded what a variable's file holds (channels, columns, units). The session and subject tables could not be read without MATLAB. A script had to know to pass both models to getMetaObjects, or loadData failed with "Dot indexing is not supported".

Changes

  • Variables get a Description field. Models saved without it load with it empty, and an item inserted without it gets it, since the catalog requires every field. The DSM converter fills it from the file pattern's description.
  • With the project preference WriteMetaTableCsvCopies (Project.setWriteMetaTableCsvCopies), MetaTable.save also writes <table>.csv next to the .mat file, with the text, numeric, logical, datetime, string and categorical columns, and one DataLocation_<name> column per data location with the path of the row's folder there, also when rows have different numbers of data locations. A table with no rows gets a copy too. A copy that cannot be written gives the warning NANSEN:MetaTable:CsvCopyFailed; the table itself is saved. writeCsvCopy writes a copy on request. Only a table in the current project's folder uses that project's preference.
  • Project.getSessionObjects(sessionIDs) returns session objects with both models, looking sessions up in the table's ID column. It requires the project to be the current project and errors on unknown IDs.
  • Tests: VariableDescriptionTest, two in Dsm2DataLocationModelTest, MetaTableCsvCopyTest (including no rows, unequal data locations, a copy that cannot be written), GetSessionObjectsTest.

🤖 Generated with Claude Code

ehennestad and others added 3 commits September 19, 2026 18:34
A data variable now has a Description field, for what its file holds,
such as its channels, columns or units. The DSM converter fills it from
the description of the file pattern.

Models saved without the field get it empty when they load. An item
inserted without it, such as a variable template of a module, gets it
empty too, because the catalog requires every field of the blank item.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A metatable is a .mat file, which cannot be read without MATLAB. With
the project preference WriteMetaTableCsvCopies on
(Project.setWriteMetaTableCsvCopies), MetaTable.save also writes the
entries to a CSV file of the same name, and MetaTable.writeCsvCopy
writes one on request.

The copy holds the columns of text, numbers, logical values and dates.
The DataLocation column becomes one column per data location with the
path of the row's folder or file there, also where rows have different
numbers of data locations and the column is a cell array. Nested
columns such as Progress and Notebook are left out. Only a table in
the folder of the current project uses that project's preference,
because a table can be saved while another project is current. A copy
that cannot be written gives the warning
NANSEN:MetaTable:CsvCopyFailed; the table itself is saved by then.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A session object made from a row of the session table can load and
save data only when it has the project's data location and variable
models. The app passes them to MetaTable.getMetaObjects; a script had
to know to do the same, and without them loadData failed with "Dot
indexing is not supported for variables of this type".

Project.getSessionObjects returns the sessions of the project, all or
those with given IDs, with both models. It requires the project to be
the current project, because the session table completes its data
location paths from the current project.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ehennestad
ehennestad added this pull request to stack #122 September 19, 2026 16:41
@ehennestad ehennestad changed the title variable descriptions csv copies and session objects feat: describe data variables, write CSV copies of tables, get session objects from a project Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant