VS Code Extension
Validate openEHR FLAT format compositions against Web Templates directly in VS Code. Catch invalid paths, wrong suffixes, and missing required fields before they reach EHRBase.
Or install manually: code --install-extension oehrpy-validator-0.1.0.vsix
Features
Inline Diagnostics
Red squiggles on invalid FLAT paths with detailed error messages. Yellow warnings for missing required fields.
Hover Documentation
Hover over any FLAT path to see the RM type, cardinality, whether it’s required, and valid suffixes.
Validate on Save
Automatic validation when you save a FLAT composition JSON file. Configurable and debounced at 500ms.
Quick Fix
“Did you mean?” suggestions via the lightbulb menu. One click to replace an invalid path with the correct one.
Template Auto-Detection
Finds Web Templates from workspace settings, same directory, or templates/ folder automatically.
Status Bar
See validation state at a glance — valid, error count, or “no template” — in the bottom bar.
Getting Started
Install Python 3.10+ with oehrpy: pip install oehrpy
Install the extension in VS Code
Open a FLAT composition JSON file — keys like vital_signs/blood_pressure/systolic|magnitude
Place a Web Template (web_template.json or *.wt.json) in the same directory, or configure paths in settings
Save the file — diagnostics appear automatically
Commands
| Command | Keybinding | Description |
|---|---|---|
oehrpy: Validate FLAT Composition |
Ctrl+Shift+F10 | Validate the active JSON file |
oehrpy: Select Web Template |
— | Pick a Web Template for the current file |
oehrpy: Show Valid Paths |
— | List all valid FLAT paths in the output panel |
Web Template Resolution
The extension finds the Web Template for a composition by checking these locations in order:
- Explicit config —
oehrpy.webTemplatePathsin workspace settings - Same directory —
web_template.jsonor*.wt.jsonnext to the composition - Project root —
web_templates/ortemplates/directory in the workspace - User prompt — asks you to pick a file and remembers the choice
Configuration
Add to .vscode/settings.json:
Roadmap
v0.1.0 — Core Extension Done
- Inline diagnostics
- Validate on save
- Hover documentation
- Quick Fix
- Status bar
- Template auto-detection
v0.2.0 — Enhanced UX Next
- Path autocomplete
- Web Template tree view
- Marketplace publication
v0.3.0 — Template Validation Planned
- OPT 1.4 XML validation
- Web Template schema validation
- OPT hover & FLAT path impact
v0.4.0 — AQL Language Support Planned
- AQL syntax highlighting
- AQL validation
- AQL path autocomplete
- AQL snippet library