Skip to content

Skip schema validation when building a dataset from documents - #370

Merged
stevevanhooser merged 2 commits into
mainfrom
claude/relaxed-carson-3q0avy
Nov 13, 2026
Merged

stevevanhooser merged 2 commits into
mainfrom
claude/relaxed-carson-3q0avy

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

Python counterpart of VH-Lab/NDI-matlab#1242 (fixes VH-Lab/NDI-matlab#1240).

Problem

downloadDataset builds the local dataset through ndi_dataset_dir(..., documents=...), which added every document via DID's add_docs with schema validation on. That is slow for large datasets and unnecessary: the documents were validated when they were first added.

Changes

  • ndi_database.add, ndi_database.add_many and SQLiteDriver.add take a keyword-only validate=True, passed to DID-python's add_docs(validate=...). Mirrors MATLAB's new 'Validate' name/value pair on ndi.database/add.
  • ndi_dataset_dir's documents= form adds with validate=False, both in the batch add and in the per-document fallback.
  • Interface update: bridge contracts for ndi_database.add, add_many and ndi_dataset_dir record the option.
  • New tests/test_add_validate.py: default still validates, validate=False skips it, add_many forwards the flag, and building a dataset from documents never calls validate_docs on them (this test fails without the dataset change).

Testing

  • black --check and ruff check pass.
  • Full suite locally: 6621 passed. The only failures were test_matlab_bridge_hashes.py erroring on a shallow NDI-matlab checkout; with full history it passes against NDI-matlab main.

Follow-up after the MATLAB PR merges

Against the MATLAB PR branch, test_matlab_bridge_hashes.py flags database (+ndi/database.m) and dir (+ndi/+dataset/dir.m) as moved. Once VH-Lab/NDI-matlab#1242 merges, their matlab_last_sync_hash needs bumping to the merge commit; I'll add that to this PR then.


Generated by Claude Code

Mirrors NDI-matlab#1240 (VH-Lab/NDI-matlab PR 1242). downloadDataset
builds the local dataset through ndi_dataset_dir(..., documents=...),
which added every document through DID's add_docs with schema
validation on. That is slow for large datasets and unnecessary: the
documents were validated when they were first added.

- ndi_database.add / add_many and SQLiteDriver.add take a keyword-only
  validate=True, passed to did add_docs. Mirrors MATLAB's new 'Validate'
  name/value pair on ndi.database/add.
- ndi_dataset_dir's documents= form adds with validate=False, in the
  batch add and the per-document fallback.
- Bridge contracts updated for add, add_many and ndi_dataset_dir.
- tests/test_add_validate.py covers the option and the dataset path.

INTERFACE UPDATE: bridge contracts for ndi_database.add, add_many and
ndi_dataset_dir now record the validate option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5tNtwQ7Vkn99T1o7uM
Both entries now record the NDI-matlab commit whose 'Validate' change
(VH-Lab/NDI-matlab#1240) this branch ports, so the drift check no
longer flags them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5tNtwQ7Vkn99T1o7uM
@stevevanhooser
stevevanhooser merged commit 51930f5 into main Nov 13, 2026
15 checks passed
@stevevanhooser
stevevanhooser deleted the claude/relaxed-carson-3q0avy branch November 13, 2026 17:39
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.

when downloading a dataset, the validation step takes a long time (when building the new dataset locally), it might be unnecessary

2 participants