Skip to content

Commit d039db8

Browse files
docs: add NEMAR tools documentation
* docs: add NEMAR tools documentation Add NEMAR dataset discovery tools page documenting search_nemar_datasets and get_nemar_dataset_details. Update tools index and mkdocs nav. * docs: address review feedback for NEMAR tools Match 3-column parameter table format from hed.md, expand NEMAR abbreviation on first use in index.md, add missing return fields (BIDS version, latest snapshot, how-to-acknowledge) to details docs. * docs: expand BIDS and HED abbreviations on first use in NEMAR page
1 parent e91d0b2 commit d039db8

3 files changed

Lines changed: 103 additions & 0 deletions

File tree

docs/osa/tools/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Tools for working with the EEGLAB analysis toolbox.
2828

2929
**Status:** Available
3030

31+
### NEMAR Tools
32+
33+
Tools for discovering and exploring BIDS-formatted datasets from the NeuroElectroMagnetic Archive (NEMAR).
34+
35+
- [NEMAR Tools](nemar.md) - Dataset search and metadata retrieval
36+
37+
**Status:** Available
38+
3139
---
3240

3341
## Common Tool Categories

docs/osa/tools/nemar.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# NEMAR Tools
2+
3+
Tools for discovering and exploring EEG, MEG, and iEEG datasets formatted according to the Brain Imaging Data Structure (BIDS) from the NeuroElectroMagnetic Archive (NEMAR).
4+
5+
NEMAR hosts hundreds of BIDS-formatted neuroscience datasets sourced from [OpenNeuro](https://openneuro.org/), covering various experimental paradigms and recording modalities. These tools query the NEMAR public API to help researchers find datasets matching their research interests.
6+
7+
## Dataset Search
8+
9+
### `search_nemar_datasets`
10+
11+
Search NEMAR datasets with flexible text search and filtering. Fetches all datasets from the NEMAR API and filters client-side, returning compact summaries suitable for browsing.
12+
13+
**Parameters:**
14+
15+
| Parameter | Type | Description |
16+
|-----------|------|-------------|
17+
| `query` | string | Text search across dataset names, tasks, README, and authors (case-insensitive substring match) |
18+
| `modality_filter` | string | Filter by recording modality: `"EEG"`, `"MEG"`, `"iEEG"`, `"MRI"` (partial match, case-insensitive) |
19+
| `task_filter` | string | Filter by experimental task name, e.g. `"rest"`, `"gonogo"`, `"memory"` (partial match, case-insensitive) |
20+
| `has_hed` | boolean | If `true`, only return datasets with Hierarchical Event Descriptors (HED) annotations |
21+
| `min_participants` | int | Minimum number of participants required |
22+
| `limit` | int | Maximum results to return (default: 20, capped at 50) |
23+
24+
**Example:**
25+
26+
```python
27+
from src.assistants.nemar.tools import search_nemar_datasets
28+
29+
# Find EEG datasets related to attention with at least 20 participants
30+
result = search_nemar_datasets.invoke({
31+
"query": "attention",
32+
"modality_filter": "EEG",
33+
"min_participants": 20
34+
})
35+
36+
# Find all datasets with HED annotations
37+
result = search_nemar_datasets.invoke({
38+
"has_hed": True
39+
})
40+
```
41+
42+
**Returns:** Formatted markdown string with matching dataset summaries, each showing dataset ID, name, modalities, tasks, participant count, and size. When no matches are found, returns a message listing the active filters and total dataset count.
43+
44+
### `get_nemar_dataset_details`
45+
46+
Get comprehensive metadata for a specific NEMAR dataset, including description, citation, licensing, experimental details, and README content.
47+
48+
**Parameters:**
49+
50+
| Parameter | Type | Description |
51+
|-----------|------|-------------|
52+
| `dataset_id` | string | Dataset identifier in the format `ds` followed by 4-6 digits (e.g. `"ds000248"`, `"ds005697"`) |
53+
54+
**Example:**
55+
56+
```python
57+
from src.assistants.nemar.tools import get_nemar_dataset_details
58+
59+
result = get_nemar_dataset_details.invoke({
60+
"dataset_id": "ds000248"
61+
})
62+
```
63+
64+
**Returns:** Formatted markdown string with complete dataset information including:
65+
66+
- OpenNeuro and NEMAR links
67+
- DOI and citation information
68+
- Authors, license, and BIDS version
69+
- Data characteristics (modalities, tasks, participants, sessions, file count, size, age range)
70+
- HED annotation status and version
71+
- Latest snapshot version
72+
- References, funding, acknowledgements, and how-to-acknowledge guidance
73+
- README content (truncated to 1500 characters for long entries)
74+
75+
## Implementation Notes
76+
77+
- The NEMAR API has no server-side search capability, so `search_nemar_datasets` fetches all datasets (~485) and filters client-side
78+
- Results are cached with a 5-minute TTL to avoid repeated API calls
79+
- The API endpoint is `https://nemar.org/api/dataexplorer/datapipeline`
80+
- Dataset IDs must match the pattern `ds` + 4-6 digits (validated before API calls)
81+
82+
## External APIs
83+
84+
| Service | Endpoint | Purpose |
85+
|---------|----------|---------|
86+
| NEMAR API | `https://nemar.org/api/dataexplorer/datapipeline/records` | Fetch all datasets for search |
87+
| NEMAR API | `https://nemar.org/api/dataexplorer/datapipeline/datasetid` | Fetch single dataset details |
88+
89+
## Related Links
90+
91+
- [NEMAR homepage](https://nemar.org)
92+
- [NEMAR Data Explorer](https://nemar.org/dataexplorer)
93+
- [OpenNeuro](https://openneuro.org/) (source platform for all NEMAR datasets)
94+
- [BIDS Specification](https://bids-specification.readthedocs.io/) (format standard for all NEMAR datasets)

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,6 @@ nav:
171171
- HED Tools: osa/tools/hed.md
172172
- BIDS Tools: osa/tools/bids.md
173173
- EEGLAB Tools: osa/tools/eeglab.md
174+
- NEMAR Tools: osa/tools/nemar.md
174175
- Development: osa/development.md
175176
- Version Management: osa/version-management.md

0 commit comments

Comments
 (0)