Repository navigation
feat: describe data variables, write CSV copies of tables, get session objects from a project - #149
Draft
ehennestad wants to merge 3 commits into
Conversation
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
added this pull request to stack #122
September 19, 2026 16:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mechanism
A data variable is a struct validated against
VariableModel.getBlankItem. A metatable is a.matfile. A session object can load data only when it holds the project's data location and variable models, which the app passes toMetaTable.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, orloadDatafailed with "Dot indexing is not supported".Changes
Descriptionfield. 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'sdescription.WriteMetaTableCsvCopies(Project.setWriteMetaTableCsvCopies),MetaTable.savealso writes<table>.csvnext to the.matfile, with the text, numeric, logical, datetime, string and categorical columns, and oneDataLocation_<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 warningNANSEN:MetaTable:CsvCopyFailed; the table itself is saved.writeCsvCopywrites 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.VariableDescriptionTest, two inDsm2DataLocationModelTest,MetaTableCsvCopyTest(including no rows, unequal data locations, a copy that cannot be written),GetSessionObjectsTest.🤖 Generated with Claude Code