Skip to content

Commit 71e4896

Browse files
committed
Fix MATLAB-Python .ndi folder compatibility
Rename database file from `ndi.db` to `did-sqlite.sqlite` and binary storage directory from `binary/` to `files/` to match NDI-MATLAB's .ndi folder layout, so datasets downloaded by either language can be opened by the other. https://claude.ai/code/session_0113MRjbNRY1VZQbn84uav4w
1 parent eb890d7 commit 71e4896

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/ndi/database.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,18 @@ def __init__(self, session_path: str | Path, db_name: str = ".ndi", **backend_kw
216216
db_dir.mkdir(parents=True, exist_ok=True)
217217

218218
# Initialize SQLite driver (wraps DID-python's SQLiteDB)
219-
db_path = db_dir / "ndi.db"
219+
db_path = db_dir / "did-sqlite.sqlite"
220220
self._driver = SQLiteDriver(db_path, **backend_kwargs)
221221

222-
# Binary directory for file attachments
223-
self._binary_dir = self.session_path / db_name / "binary"
222+
# Binary/files directory for file attachments
223+
# Named "files" for compatibility with NDI-MATLAB
224+
self._binary_dir = self.session_path / db_name / "files"
224225
self._binary_dir.mkdir(parents=True, exist_ok=True)
225226

226227
@property
227228
def database_path(self) -> Path:
228229
"""Path to the SQLite database file."""
229-
return self.session_path / self._db_name / "ndi.db"
230+
return self.session_path / self._db_name / "did-sqlite.sqlite"
230231

231232
@property
232233
def binary_path(self) -> Path:

tests/test_database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_create_database(self, temp_session):
6464
db = Database(temp_session)
6565
assert db.session_path == temp_session
6666
assert (temp_session / ".ndi").exists()
67-
assert (temp_session / ".ndi" / "ndi.db").exists()
67+
assert (temp_session / ".ndi" / "did-sqlite.sqlite").exists()
6868

6969
def test_create_with_custom_db_name(self, temp_session):
7070
"""Test creating database with custom name."""
@@ -395,7 +395,7 @@ def test_database_path(self, temp_session):
395395
"""Test database_path property points to SQLite file."""
396396
db = Database(temp_session)
397397
assert db.database_path.exists()
398-
assert str(db.database_path).endswith("ndi.db")
398+
assert str(db.database_path).endswith("did-sqlite.sqlite")
399399

400400
def test_binary_path(self, temp_session):
401401
"""Test binary_path property."""

0 commit comments

Comments
 (0)