openEHR VAQM Assistant
VAQM is a configuration format used by DIPS in their openEHR systems to define reusable, versioned queries written in AQL (Archetype Query Language). VAQM files package AQL queries, data bindings, format expressions, and metadata into a single, version-controlled XML file that can be deployed across openEHR applications.
A VS Code extension for extracting and assembling openEHR VAQM configuration files.
Features
- Extract VAQM Files: Break down
.vaqm XML files into editable components
- Extract All VAQM Files: Batch extract all
.vaqm files in a folder at once
- Extract All VAQMs and Forms: Extract all VAQMs and Forms in the workspace in one operation
- Assemble VAQM Files: Rebuild
.vaqm files from components with automatic version bumping
- AI-Powered Version Comments: GitHub Copilot integration for generating version change descriptions
- Version Management: Semantic versioning with mandatory version bumps and BasedOnVersion tracking
- Component Organization: Clean directory structure for AQL queries and calc expressions
- Format Expressions: Full support for FormatExpressions with WhenExpression extraction
- Proper XML Formatting: Professional XML output with correct encoding and indentation
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "VAQM Assistant"
- Click "Install"
From VSIX File
- Download the latest
vaqm-assistant-X.X.X.vsix file from the releases page
- Open VS Code
- Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
- Click the "..." menu at the top of the Extensions view
- Select "Install from VSIX..."
- Browse to and select the downloaded
.vsix file
- Restart VS Code if prompted
Prerequisites
- VS Code 1.85.0 or higher
- GitHub Copilot extension (optional, for AI-powered version comments)
The extension includes all required dependencies:
@xmldom/xmldom - XML parsing and DOM manipulation
xpath - XPath queries for XML navigation
he - HTML entity encoding/decoding
xml-formatter - Professional XML formatting
Usage
- Right-click a
.vaqm file in the explorer
- Select "VAQM: Extract VAQM File"
- Components are extracted to
definition/vaqm-components/{vaqm-name}/
Extracted structure:
definition/vaqm-components/My-VAQM/
├── META/
│ ├── vaqm-metadata.json # VAQM root attributes
│ ├── version-info.txt # Current version
│ └── extraction-info.json # Extraction metadata
├── vaqm.xml # Formatted original VAQM
├── aql-bindings/
│ └── {binding-name}/
│ ├── base-query.aql # AQL query with headers
│ ├── paths.xml
│ ├── where-expressions.xml
│ ├── order-by-expressions.xml
│ ├── predicates.xml
│ └── key-values.xml
└── data-elements/
└── {element-oid}/
├── metadata.json
├── display-format.calc # Calc expressions
├── sort-format.calc # (decoded from HTML entities)
├── range-format.calc
├── x-format.calc
├── y-format.calc
├── key-values.xml
└── format-expressions/ # FormatExpressions subfolder
├── format-expressions.xml
├── when-expression-0.calc
└── when-expression-1.calc
Assemble VAQM File
- Right-click a VAQM component directory
- Select "VAQM: Assemble VAQM File"
- Choose version bump: Patch, Minor, Major, or Custom
- Choose how to add version comment:
- Generate with Copilot - AI analyzes file changes and suggests comment
- Enter manually - Type your own description
- Skip - No version comment
- Assembled
.vaqm file saved to src/vaqms/
Version bumping is mandatory - you cannot keep the same version. The BasedOnVersion attribute is automatically updated.
- Right-click a folder containing
.vaqm files (e.g., src/vaqms)
- Select "VAQM: Extract All VAQM Files"
- All VAQM files in the folder are extracted sequentially
- Progress is shown with a summary of successful and failed extractions
- Right-click the workspace root,
src/, or definition/ folder
- Select "VAQM: Extract All VAQMs and Forms"
- The extension recursively scans for all
.vaqm files in the workspace
- Extracts all VAQMs and calls the Form Assistant extension to extract forms
- Shows unified progress and summary for both operations
Note: If the Form Assistant extension is not installed, you'll be prompted to continue with VAQMs only.
Right-click a component directory and select "VAQM: Show VAQM Information" to view:
- VAQM metadata (name, version, OID)
- Component counts (bindings, elements)
- Extraction information
Configuration
Configure the extension in VS Code settings:
{
"vaqmAssistant.extractionPath": "definition/vaqm-components",
"vaqmAssistant.outputPath": "src/vaqms",
"vaqmAssistant.defaultVersionBump": "patch",
"vaqmAssistant.formatXml": true,
"vaqmAssistant.addCommentHeaders": true,
"vaqmAssistant.openAfterExtract": "directory",
"vaqmAssistant.openAfterAssemble": "file"
}
Technical Details
HTML Entity Handling
The extension automatically:
- Decodes entities when extracting (readable .calc files)
- Encodes entities when assembling (valid XML)
Version Management
- Semantic versioning (X.Y.Z format)
- Mandatory version bumping on assembly
- BasedOnVersion attribute automatically tracks previous version
- AI-generated version comments via GitHub Copilot integration
- Git diff detection shows what changed since extraction
- Validation ensures new version > current version
- Version tracked in
META/version-info.txt
- Professional formatting with
xml-formatter library
- Proper indentation (2 spaces)
- All attributes preserved (RangeFormat, XFormat, YFormat, etc.)
Known Limitations
- No syntax validation for AQL/calc expressions yet
- No code completion or IntelliSense for calc expressions
- Validation command not yet fully implemented
License
See LICENSE file
Contributing
This extension is part of openEHR Norway's openEHR tooling ecosystem.