API Reference Overview¶
The HED Web Tools API provides a comprehensive set of modules for processing Hierarchical Event Descriptor (HED) data through web interfaces and programmatic access. The API is designed around a service-oriented architecture with clear separation of concerns.
Architecture Overview¶
Web Interface ──┐
├─► Flask Routes ──┬─► StringOperations
Client ─► REST API ──┘ ├─► EventOperations
├─► SchemaOperations
├─► SidecarOperations
└─► SpreadsheetOperations
Module Structure¶
1. Application Layer¶
App Factory - Flask application configuration and initialization
Routes - Web interface endpoints and HTTP request handling
2. Service Layer¶
Process Service - Core orchestration and business logic
Process Form - Form data extraction and validation
Base Operations - Common base classes and shared functionality
3. Operation Modules¶
Event Operations - Process event files with HED annotations
Schema Operations - Validate and manipulate HED schemas
Sidecar Operations - Handle BIDS sidecar JSON files
Spreadsheet Operations - Process tabular data with HED columns
String Operations - Validate and manipulate HED strings
4. Utility Modules¶
Service Categories¶
HED Schema Services¶
Handle HED schema files and validation:
Schema validation and compliance checking
Format conversion (XML ↔ MediaWiki)
Schema comparison and analysis
Version management
HED String Services¶
Process individual HED annotation strings:
Syntax validation and error reporting
Format conversion (short ↔ long form)
String assembly and validation
Placeholder resolution
HED Event Services¶
Work with event data files:
Event file validation against HED schemas
HED annotation assembly from spreadsheets
Event file format conversion
Batch processing capabilities
HED Sidecar Services¶
Handle BIDS-compliant sidecar files:
JSON sidecar validation
HED annotation extraction and validation
Sidecar format conversion
Integration with BIDS datasets
HED Spreadsheet Services¶
Process tabular data with HED annotations:
Excel and CSV file processing
Column mapping and validation
HED string assembly from columns
Data export and format conversion
Getting Started¶
Tip
New to the API? Start with the Getting Started Guide for a quick introduction.
Quick Example¶
from hedweb import create_app
from hedweb.string_operations import StringOperations
# Initialize the application
app = create_app()
# Create string operations service
string_ops = StringOperations()
# Validate a HED string
result = string_ops.process_string_data({
'hed_string': 'Sensory-event, Visual-presentation',
'schema_version': '8.2.0',
'command': 'validate'
})
print(result['data']) # Validation results
API Reference¶
External References¶
HED Standard - Official HED specification
BIDS Standard - Brain Imaging Data Structure
Flask Documentation - Web framework documentation