N-DOS

The N-DOS standard

Version 0.1 — draft. Derived from N-DOS: A Practical Framework for Neural Data Organization (Alikarami, in preparation), which is the source of this specification and the reasoning behind it. This document states the standard in the form an implementation can be checked against; the manuscript explains why it takes this shape.

This is the base the rest of the repository rests on. The tools exist to make a project conform to what is written here, and ndos validate reports whether one does.

How to read the requirement levels

MUST — a project that does otherwise does not conform. SHOULD — recommended; a project may depart from it with reason. MAY — optional.

A project conforms to N-DOS 0.1 when it satisfies every MUST below.


1. Project structure

A project MUST have these directories at its root:

Directory Contents
raw_data/ Unmodified data as it came from acquisition
processed_data/ Cleaned, sorted and pre-processed data
analysis/ Exploratory analyses and intermediate results
derivatives/ Validated, finalised analyses approved for sharing
flagged_data/ Corrupted, incomplete or uncertain data
figures/ Visualisations built from processed or derived data
scripts/ Code used for acquisition, preprocessing and analysis
metadata/ Experiment, acquisition, protocol and session descriptions

A project MUST have a README.md at its root.

A directory MAY be empty. Empty is a statement — that this project has no figures yet — and is more useful than the directory’s absence, which says nothing.

A project MAY contain other directories. Their contents are outside this specification.

2. Session structure

Data MUST be organised by subject and then session:

raw_data/<SubjectID>/<SessionID>/

Each acquisition payload MUST sit directly under <SessionID>/. A payload is either a single file or a directory written by an acquisition or analysis tool — a SpikeGLX run, a Kilosort sorting, an Open Ephys recording. The internal structure and filenames of such a directory MUST be left as the tool wrote them (§5); it counts as one payload, not as nested data.

What this forbids is an implementation inventing a level of its own. A tool rebuilding a layout MUST NOT place acquisitions in a subdirectory it chose — <SessionID>/raw/ rather than <SessionID>/ — because the next tool then has to guess whether that level is the lab’s or the last tool’s.

processed_data/ SHOULD mirror the same shape:

processed_data/<SubjectID>/<SessionID>/
├── temp/                    scratch from sorting, safe to remove once validated
├── <processed files>
└── derived_metadata.json    how these files came to be

Scratch written by a sorter SHOULD be placed in temp/ and flagged temporary (§6), so it can be found and removed later without anyone having to remember which files were intermediates.

3. Identifiers

SubjectID MUST identify one experimental subject, and MUST be stable for the life of that subject. It SHOULD be short and human-readable: M123 for mouse 123.

SessionID MUST be unique within a subject, and MUST NOT contain a date in a form where day and month can be confused: 03/04/2025 names two different days depending on the reader’s country.

It SHOULD be the acquisition date as YYYYMMDD, and YYYYMMDD_NN where a subject was recorded more than once that day, numbered from 01 in acquisition order. This is the convention N-DOS establishes, and the reason is traceability: an identifier that carries the date places a recording in time without opening anything, sorts chronologically on its own, and can be matched against a notebook, a surgery log or an order record years later. ses-01 can do none of that.

Some data records a session without recording when it happened. Such a project still conforms, because inventing a date the data does not have would be worse than an imperfect label. That flexibility is for data, not for choice: a project being organised now SHOULD use the date.

Where the date is known to a person but absent from the folders, it SHOULD be recorded in the session metadata, from where the layout can take it. Doing so converts an untraceable ses-01 into a dated identifier without anyone guessing.

4. File naming

Files SHOULD be named:

<SubjectID>_<SessionID>_<type>.<ext>

with <type> from this list where one applies:

Type Contents Example
raw Raw electrophysiology M123_20250314_raw.dat, .nwb
lfp Local field potential M123_20250314_lfp.npy
spikes Sorted spikes M123_20250314_spikes.csv
behavior Behavioural measurements M123_20250314_behavior.tsv
task Task events: maze, reward, trial structure M123_20250314_task.tsv
position Position tracking M123_20250314_position.tsv
experimenter Experimenter input, keypresses, annotations M123_20250314_experimenter.tsv
video Video M123_20250314_video.mp4
imaging Functional imaging: two-photon, widefield, miniscope calcium M123_20250314_imaging.tif, .isxd, .sbx
histology Fixed tissue and microscopy of it M123_20250314_histology.czi, .lif, .nd2
timestamps Clock or sync pulses aligning the streams above M123_20250314_timestamps.npy

Where no listed type applies, the file SHOULD keep a descriptive word of its own in the same position. A file MUST NOT be given a type from this list that misdescribes it: a wrong label is worse than an unfamiliar one, because the filename is what everyone reads first.

imaging and histology are separate types because they answer different questions about the same animal — what it was doing, and what its tissue looked like afterwards — and are often acquired on the same microscope in the same file format. A .tif is either, and nothing in the file says which. Where the distinction cannot be established, the file SHOULD keep a descriptive word of its own rather than be assigned one of the two at random.

Video SHOULD be H.264-encoded MP4 where the acquisition system allows it. This is a decision for whoever configures the rig; re-encoding afterwards costs either quality or a second copy, and raw data is meant to stay as acquired.

Versions

A reprocessing SHOULD be marked with a suffix: _v1, _v2. A new version MUST NOT overwrite the one before it.

5. Analysis-tool output

Directories written by an analysis tool — a Phy or Kilosort sorting, a SpikeInterface folder, suite2p output, an Open Ephys recording, a Zarr store, a DeepLabCut project — MUST be kept exactly as the tool wrote them. Their filenames and internal structure are how the tool finds its own data.

Such a directory SHOULD be placed under the session it belongs to, and MUST NOT have its contents renamed to §4. The naming convention applies to files a lab writes, not to a format another program reads back.

6. Flags

A dataset MAY carry flags recording what is known about it:

{"validated": true, "temp": false, "deletable": false}
Flag Meaning
validated Someone checked this and considers it good
temp Scratch, existing only until validation
deletable Confirmed safe to remove

A file marked validated MUST NOT be removed by an automated cleanup, whatever else it is flagged. Deletion MUST NOT happen without a person confirming the specific files.

A project MAY carry a table of its validated files as a reference index for analyses, so a pipeline reads what has been checked rather than whatever a directory happens to contain.

7. Metadata

A value that has never been supplied MUST be distinguishable from one that was checked and could not be determined. An absent value and an unknown value are different facts, and treating them alike biases anything built on top of them: a cohort assembled without that distinction is weighted towards whichever animals happened to have fuller records, and reports no sign of it.

This is the one requirement in this section. Everything below is the shape NDOS writes and reads, stated so that another implementation can match it.

7.1 Three linked tables

Metadata SHOULD be recorded as three tables, joined on subject_id. They MAY be stored as CSV, JSON or YAML; CSV is what the tools read and write, because it is what a lab already has. They SHOULD live in metadata/.

animals.csv — one row per experimental subject.

Field  
subject_id optional
species required
strain optional
sex required
date_of_birth optional
genotype optional
source optional
notes optional

procedures.csv — one row per intervention: surgery, injection, implant, lesion, drug, stimulation, training, perfusion.

Field  
procedure_id optional
subject_id required
procedure_date optional
procedure_type optional
target_region optional
construct_or_drug optional
dose optional
notes optional

sessions.csv — one row per session. Alongside these, NDOS writes columns prefixed observed_ recording what it found on disk; those are machine-filled and are overwritten on each export, so they MUST NOT be hand-edited.

Field  
subject_id required
session_date required
session_type optional
task optional
qc_status optional
notes optional

7.2 Controlled vocabularies

Where a field below has a vocabulary, a value outside it SHOULD be reported as unrecognised rather than accepted silently. Common spellings SHOULD be mapped onto the listed value — mouse onto mus musculus, ephys onto electrophysiology — and the original SHOULD be retained alongside, because a normalisation is a claim about what somebody meant.

Field Allowed values
sex F, M, unknown
species mus musculus, rattus norvegicus, macaca mulatta, danio rerio, drosophila melanogaster, unknown
session_type electrophysiology, calcium imaging, behaviour, histology, surgery, training, other, unknown
qc_status pass, fail, review, unknown
procedure_type surgery, injection, implant, lesion, drug, stimulation, training, perfusion, other, unknown

strain, genotype, task, target_region, construct_or_drug, dose, source and notes are free text. A field MAY additionally carry a resolvable identifier — NCBITaxon for a species, an RRID for a strain, UBERON for a target region — and such an identifier MUST NOT contradict the text beside it.

7.3 How a value is known

Every recorded value carries how it is known. A reader MUST be able to tell these apart:

   
observed Read from storage: a path, a size, a checksum, a timestamp
declared Entered by a person: species, injection target, task
computed Derived by NDOS from values already recorded, never typed — age at a session, days since an injection
unknown Checked and could not be determined

A value nobody has supplied is absent, which is not the same as unknown.

7.4 Dates

A date MUST be written YYYY-MM-DD. A date in a form where day and month can be confused — 03/04/2025 names two different days depending on the reader’s country — MUST be refused rather than guessed at.

8. Storage

Raw data MUST NOT be modified after acquisition. It SHOULD be made read-only once a session is complete, and SHOULD be held in more than one place.

Processed data SHOULD record which code and parameters produced it.

Data whose integrity is uncertain SHOULD be placed in flagged_data/ with a note saying why, rather than deleted or left where it might be mistaken for sound data.

9. Interoperability

An N-DOS project SHOULD be convertible to BIDS and NWB without re-organisation, since subject, session and acquisition are already explicit. Conversion is outside this specification, and N-DOS does not replace either.


Three things a project can be

These are separate, and only the second is what ndos validate measures. The distinction matters because the most common reason not to adopt a standard is believing you must reorganise everything before it does anything for you.

N-DOS-readable — NDOS can inventory it, search it, and answer questions about it in the organisation it already has. This requires nothing: no layout, no metadata, no permission to change anything. Every directory is readable. Most of what NDOS does is available at this level, which is where a lab with an inherited archive starts and may reasonably stay.

N-DOS-conformant — the project satisfies every MUST in §1–§4: the directories, the subject-then-session shape, the identifier rules. This is what ndos validate reports and what the section below defines. A project becomes conformant when a lab chooses to, not in order to be read.

N-DOS-traceable — conformant, and additionally records how its facts are known: metadata carrying the evidence statuses of §7, flags recording what has been checked (§6), and provenance linking a result to the inputs and code that produced it. This is the level at which a cohort selection can be defended and a figure traced to raw data.

A project may be readable without being conformant, and conformant without being traceable. Nothing in NDOS requires climbing the ladder, and the tools do not withhold anything at the lower levels — a cohort query over a readable archive still reports what cannot be ruled out.

Conformance

A project conforms to N-DOS 0.1 when:

  1. The eight directories of §1 and a README.md are present.
  2. Every file under raw_data/ sits at <SubjectID>/<SessionID>/ (§2).
  3. Every SessionID is unique within its subject and free of ambiguous dates (§3). A session not named as a date is reported as a recommendation, not a failure.

These are the requirements a tool can check by looking at a project. The other MUSTs in this document — that raw data is not modified after acquisition, that tool output is not renamed, that validated files are not deleted — constrain what may be done to a project rather than what it looks like afterwards. A checker cannot see that a file was renamed last year, only that it has the name it has now. They are stated as requirements because they are, not because they can be enforced.

Check the first three with:

ndos validate /path/to/project

Everything else in this document is SHOULD or MAY: recommended practice that a project may depart from, deliberately, and still conform.

Versioning of this document

This specification is versioned separately from the software. 0.1 is a draft: it states current practice and may change in response to labs using it. A change that would make a conforming project non-conforming requires a new version number.

imaging, histology and timestamps were added to §4 within 0.1. The list is a SHOULD and the additions are optional, so a project that conformed before still conforms: the version number does not move. They were added because the tools recognised the file formats and the scope claimed the modalities, while the type list offered nothing to name them with — a project could hold a two-photon recording and have no conforming way to say so.

§7 was expanded within 0.1 from prose into the tables, vocabularies and evidence statuses the tools already implemented. That was documentation catching up with the code rather than a change to the standard, with one exception: §7.4 now states that a metadata date MUST be written YYYY-MM-DD. §3 already forbade an ambiguous date in a SessionID and said nothing about metadata, so this is a new requirement. ndos validate does not test it – like the other MUSTs about what may be done to a project, it is stated because it is true, not because a checker can see it. ndos table check reports it.

Separately, ndos validate now reports duplicate SessionIDs, which the Conformance section below has always required and the checker did not test. A project may fail this check having passed before. The standard did not change; the checker caught up with it.