Skip to content

Align Python API with MATLAB naming conventions for session and dataset#23

Merged
stevevanhooser merged 3 commits into
mainfrom
claude/create-bridge-files-ldFIj
Mar 12, 2026
Merged

Align Python API with MATLAB naming conventions for session and dataset#23
stevevanhooser merged 3 commits into
mainfrom
claude/create-bridge-files-ldFIj

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Summary

This PR establishes a formal MATLAB-Python bridge contract for the ndi.session and ndi.dataset namespaces, renaming Python methods to match MATLAB's naming conventions exactly. This ensures API consistency across both languages and improves maintainability.

Key Changes

New Bridge Documentation

  • Added src/ndi/session/ndi_matlab_python_bridge.yaml — comprehensive contract documenting all session classes, methods, properties, and their MATLAB equivalents
  • Added src/ndi/dataset/ndi_matlab_python_bridge.yaml — comprehensive contract for dataset classes and methods
  • Both documents establish "Strict MATLAB Mirror" naming policy with semantic parity for indexing

Session API Renames

  • get_session_table()getsessiontable()
  • get_session_path()getsessionpath()
  • add_entry()addtableentry()
  • remove_entry()removetableentry()
  • check_table()checktable()
  • is_valid_table()isvalidtable()
  • backup()backupsessiontable()
  • backup_file_list()backupfilelist()
  • clear()clearsessiontable()
  • local_table_filename()localtablefilename()
  • _write_table()_writesessiontable()
  • delete_session_data_structures()deleteSessionDataStructures()

Dataset API Renames

  • delete_ingested_session()deleteIngestedSession()

New Methods Added

  • Session.unique_reference_string() — deprecated method that wraps id() with DeprecationWarning
  • Session.isIngestedInDataset() — checks if session is ingested (not just linked) in a dataset
  • Session.findexpobj() — searches for objects by name and class name
  • Dataset.database_existbinarydoc() — checks if binary document file exists

Test Updates

  • Updated all test files to use new method names
  • Tests now call getsessiontable(), addtableentry(), deleteIngestedSession(), etc.
  • Updated docstrings and comments to reflect new naming

Implementation Details

  • All renames preserve functionality; only method names changed
  • Protected methods use Python convention (leading underscore) while maintaining MATLAB-style names
  • Return types and signatures remain unchanged
  • Deprecated methods issue DeprecationWarning to guide users to replacements
  • Bridge YAML documents serve as the single source of truth for API contracts

https://claude.ai/code/session_01VJENBg37bS8hwtJ3oDbwYu

claude added 3 commits March 12, 2026 13:20
…match MATLAB

Create ndi_matlab_python_bridge.yaml contract files for src/ndi/dataset/ and
src/ndi/session/ per the bridge protocol defined in AGENTS.md. Rename all
Pythonized method names back to their exact MATLAB equivalents:

- Dataset: delete_ingested_session -> deleteIngestedSession
- DirSession: delete_session_data_structures -> deleteSessionDataStructures
- SessionTable: get_session_table -> getsessiontable,
  get_session_path -> getsessionpath, add_entry -> addtableentry,
  remove_entry -> removetableentry, check_table -> checktable,
  is_valid_table -> isvalidtable, backup -> backupsessiontable,
  backup_file_list -> backupfilelist, clear -> clearsessiontable,
  local_table_filename -> localtablefilename, _write_table -> _writesessiontable

All test files updated to use the new method names.

https://claude.ai/code/session_01VJENBg37bS8hwtJ3oDbwYu
…aset

- Session.unique_reference_string: deprecated method returning
  '{reference}_{identifier}', issues DeprecationWarning per MATLAB
- Session.isIngestedInDataset: searches for session_in_a_dataset docs
  with is_linked=0 to check if session is ingested in a dataset
- Session.findexpobj: searches DAQ systems and probes by name/class
- DatasetDir.dataset_erase (static): removes .ndi directory from dataset
- Dataset.database_existbinarydoc: delegates to session, was present in
  MATLAB but missing from Python Dataset class

Bridge YAML files updated to remove not_yet_ported status.

https://claude.ai/code/session_01VJENBg37bS8hwtJ3oDbwYu
Create ndi_matlab_python_bridge.yaml for all cloud subpackages:
- src/ndi/cloud/ (root): auth, orchestration, download, upload, filehandler, internal
- src/ndi/cloud/api/: datasets, documents, files, users, compute
- src/ndi/cloud/sync/: mode, operations, index
- src/ndi/cloud/admin/: doi, crossref

All Python function names already match MATLAB exactly — no renames needed.
Documents not-yet-ported MATLAB functions and Python-only extensions.

https://claude.ai/code/session_01VJENBg37bS8hwtJ3oDbwYu
@stevevanhooser stevevanhooser merged commit e439a0d into main Mar 12, 2026
4 checks passed
@stevevanhooser stevevanhooser deleted the claude/create-bridge-files-ldFIj branch March 12, 2026 14:04
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.

2 participants