BIDS Compliance Quick Referenceο
For Developers & Contributors
π― At a Glanceο
What: PRISM Studio now enforces BIDS compliance automatically
Where: app/templates/projects.html (UI) + app/src/web/blueprints/projects.py (Backend)
How: Form β dataset_description.json β CITATION.cff sync β Form reload
Why: Ensures metadata consistency and BIDS-app compatibility
π Field Categoriesο
REQUIRED (β οΈ Will fail validation if missing)ο
β
Name: Dataset name (MUST be provided by user)β
BIDSVersion: Auto-set to β1.10.1β (no user input)
RECOMMENDED (β οΈ Will get auto-defaults)ο
π‘
DatasetType: Auto-set to βrawβ if missingπ‘
License: Auto-set to βCC0β if missing (unless CITATION.cff exists)π‘
HEDVersion: Only include if you use HED tagsπ‘
GeneratedBy: API-only (preserved from existing)π‘
SourceDatasets: API-only (preserved from existing)
OPTIONAL (No auto-defaults)ο
βͺ
Authors: Array of {name, email}βͺ
Keywords: Array of strings (β₯3 recommended)βͺ
Acknowledgements: Free textβͺ
HowToAcknowledge: Free textβͺ
Funding: Array of stringsβͺ
EthicsApprovals: Array of {name, reference}βͺ
ReferencesAndLinks: Array of URLsβͺ
DatasetDOI: DOI URIβͺ
DatasetLinks: Array of URLs (API-only)
π CITATION.cff Precedence Rulesο
If CITATION.cff EXISTS:ο
dataset_description.json will NOT contain:
β Authors
β HowToAcknowledge
β License
β ReferencesAndLinks
BUT will still contain:
β
Name
β
DatasetDOI
If CITATION.cff NOT FOUND:ο
dataset_description.json will contain all fields:
β
Authors
β
License (defaults to CC0)
β
HowToAcknowledge
β
ReferencesAndLinks
Why?: Avoid duplication. BIDS spec says these fields belong in CITATION.cff when it exists.
π’ Field Type Conversionsο
// USER INPUT in form (string) β STORAGE in JSON (array)
"psychology, neuroscience, BIDS" β ["psychology", "neuroscience", "BIDS"]
"NSF #123, Other Grant" β ["NSF #123", "Other Grant"]
// RELOAD from JSON (array) β FORM DISPLAY (string)
["psychology", "neuroscience"] β "psychology, neuroscience"
Fields that convert: Keywords, Funding, ReferencesAndLinks
Fields that donβt: Name, License, DatasetType, DOI, etc. (stored as strings)
π οΈ Code Locationsο
Frontend Form Fields (HTML)ο
File: app/templates/projects.html
<!-- REQUIRED -->
<label><span class="badge bg-danger">REQUIRED</span> Dataset Name</label>
<input id="metadataName" required>
<!-- RECOMMENDED -->
<label><span class="badge bg-warning">RECOMMENDED</span> License</label>
<select id="metadataLicense">...</select>
<!-- OPTIONAL -->
<label><span class="badge bg-secondary">OPTIONAL</span> Keywords</label>
<input id="metadataKeywords" placeholder="psychology, experiment, BIDS">
Pattern: <input id="metadata{FieldName}"> or <select id="metadata{FieldName}">
Frontend Save Functionο
File: app/templates/projects.html (Line 2541)
async function saveDatasetDescription() {
// 1. Validate REQUIRED fields
// 2. Collect form values into description object
// 3. Convert strings to arrays (Keywords, Funding, etc.)
// 4. POST to /api/projects/description
// 5. Display validation issues if any
}
Frontend Load Functionο
File: app/templates/projects.html (Line 2472)
async function loadDatasetDescriptionFields() {
// 1. GET /api/projects/description
// 2. Populate form fields from response
// 3. Convert arrays to strings for editing
// 4. Call field-specific setters (setEthicsApprovals, setAuthorsList)
// 5. Display validation issues
}
Backend Save Endpointο
File: app/src/web/blueprints/projects.py (Line 707)
@projects_bp.route("/api/projects/description", methods=["POST"])
def save_dataset_description():
# 1. Extract description JSON from request
# 2. Validate REQUIRED fields (Name)
# 3. Auto-set BIDSVersion = "1.10.1"
# 4. Check if CITATION.cff exists
# 5. Apply precedence rules (omit/keep fields)
# 6. Set auto-defaults for RECOMMENDED fields
# 7. Validate against BIDS schema
# 8. Write dataset_description.json
# 9. Call update_citation_cff()
# 10. Return success/issues
CITATION.cff Syncο
File: app/src/project_manager.py
def update_citation_cff(self, project_path, description):
"""Generate/update CITATION.cff from dataset_description."""
# 1. Extract Name, Authors, DatasetDOI
# 2. Generate CITATION.cff content (CFF v1.2.0)
# 3. Write to <project_path>/CITATION.cff
π Adding a New Metadata Fieldο
To add a new BIDS field (e.g., NewField):
1. Add UI Component (projects.html, line 360-475)ο
<div class="col-md-12">
<label class="form-label fw-bold small text-muted text-uppercase mb-1">
<span class="badge bg-secondary">OPTIONAL</span> New Field
</label>
<input type="text" class="form-control form-control-sm" id="metadataNewField"
placeholder="Example value">
<small class="text-muted">Description of this field.</small>
</div>
2. Add to Save Function (projects.html, line 2541-2565)ο
const description = {
// ... existing fields ...
NewField: document.getElementById('metadataNewField').value,
};
3. Add to Load Function (projects.html, line 2472-2495)ο
document.getElementById('metadataNewField').value = desc.NewField || '';
4. Update Backend (projects.py, line 707+)ο
If REQUIRED: Add to validation check
If RECOMMENDED: Add logic to set default value
If OPTIONAL: No backend changes needed (just validate)
5. Testο
python3 scripts/ci/test_bids_compliance.py
π§ͺ Testing Your Changesο
Unit Testο
python3 scripts/ci/test_bids_compliance.py
Manual Testο
Open PRISM Studio
Create/select a project
Fill in the metadata form
Click Save
Verify
dataset_description.jsoncreated correctlyVerify
CITATION.cffgenerated correctlyClick form reload
Verify all fields repopulated
Visual Checkο
# Check dataset_description.json structure
cat <project>/dataset_description.json | python3 -m json.tool
# Check CITATION.cff syntax
cat <project>/CITATION.cff
β οΈ Common Issues & Solutionsο
Issue: βREQUIRED FIELD: Dataset Name is mandatoryβο
Cause: Name field is empty
Fix: Enter a dataset name in the βDataset Nameβ field
Issue: Keywords not parsing correctlyο
Cause: User entered βkeyword1, keyword2β but it stored as string instead of array
Fix: Check that .split(',').map(s => s.trim()).filter(s => s) is being applied
Issue: CITATION.cff not updatingο
Cause: update_citation_cff() not called or threw exception
Fix: Check Flask logs for error; ensure project_manager is initialized
Issue: Backend issues array shows βLicense is RECOMMENDEDβο
Cause: This is just a warning, not an error
Fix: This is expected behavior; you can ignore it or set a License value
π Quick Debugging Commandsο
# Check project structure
ls -la <project_path>/
# View dataset_description.json
cat <project_path>/dataset_description.json | python3 -m json.tool
# View CITATION.cff
cat <project_path>/CITATION.cff
# Run validation tests
python3 scripts/ci/test_bids_compliance.py
# Check Flask logs
grep -i "dataset_description\|citation" prism-studio.log
π Field Summary Tableο
Field |
Type |
Required |
Default |
Array |
CITATION.cff |
Notes |
|---|---|---|---|---|---|---|
Name |
string |
β |
- |
β |
β Synced |
BIDS core identifier |
BIDSVersion |
string |
β |
β1.10.1β |
β |
β |
Auto-set by backend |
DatasetType |
string |
β οΈ |
βrawβ |
β |
β |
raw, derivative, study |
License |
string |
β οΈ |
βCC0β |
β |
Omitted if CITATION.cff |
SPDX identifier |
Authors |
array |
β |
[] |
β |
Omitted if CITATION.cff |
{name, email} format |
Keywords |
array |
β |
[] |
β |
β |
β₯3 for FAIR |
Acknowledgements |
string |
β |
ββ |
β |
β |
Free text |
HowToAcknowledge |
string |
β |
ββ |
β |
Omitted if CITATION.cff |
Citation instructions |
Funding |
array |
β |
[] |
β |
β |
Free text |
EthicsApprovals |
array |
β |
[] |
β |
β |
{name, reference} |
ReferencesAndLinks |
array |
β |
[] |
β |
Omitted if CITATION.cff |
URLs |
DatasetDOI |
string |
β |
ββ |
β |
β Synced |
DOI URI |
HEDVersion |
string |
β |
ββ |
β |
β |
If HED tags used |
Last Updated: February 2025
For questions: See full documentation in docs/BIDS_COMPLIANCE_IMPLEMENTATION.md