Truveta Prose — VSCode Extension
Syntax highlighting, bracket matching, comment toggling, and code snippets for the Truveta Prose query language.
Truveta Prose is a domain-specific language for patient cohort selection, data extraction, and aggregation over electronic health record (EHR) data in Truveta Studio.
Features
- Syntax highlighting for all Prose constructs — keywords, codesets, event set types, operators, interval literals (
@2026-03), template substitutions, and more
- Distinct terminology coloring —
"ICD10CM", "SNOMED CT", "RxNorm", "CPT", etc. stand out from regular strings
- Comment toggling —
Cmd+/ (Ctrl+/ on Windows/Linux) for line comments, Shift+Alt+A for block comments
- Bracket matching and auto-closing for
{}, (), [], ""
- Auto-indentation after
{ blocks
- Code snippets — type
filter, codeset, build, table, etc. and press Tab
Snippets
| Prefix |
Description |
imports |
Import base + event-base definitions |
codeset |
Codeset with terminology and hierarchy mode picker |
filter |
Filter events from a base event set |
filterperson |
Filter PersonSet by demographics |
build |
Build/transform events with output projection |
buildindex |
Build an index event with asIndex |
bbs |
buildBySequence multi-event join |
union |
Merge event sets |
table |
Feature table |
population |
Population statement |
return |
Return statement |
aggregate |
Aggregate statistics |
section |
Section header comment banner |
Installation
From the VSCode Marketplace
Search for "Truveta Prose" in the Extensions panel (Cmd+Shift+X).
From .vsix file
code --install-extension truveta-prose-0.1.0.vsix
From source
git clone https://github.com/xiaosongz/truveta-prose-vscode.git
cd truveta-prose-vscode
npm install -g @vscode/vsce
vsce package
code --install-extension truveta-prose-*.vsix
Token Highlighting Reference
| Prose Element |
Highlighted As |
filter, build, population, return, table, aggregate |
Keywords |
and, or, not, in, matches |
Logical operators |
"ICD10CM", "SNOMED CT", "RxNorm", "CPT", etc. |
Terminology constants (distinct color) |
self, selfAndDescendants, descendants |
Hierarchy modes |
@2022, @2024-02, @2024-02-05 |
Interval literals |
years, days, weeks, hours, etc. |
Time units |
ConditionSet, PersonSet, EncounterSet, etc. |
Event set types |
hasValue(), coalesce(), ageAt(), countEvents(), etc. |
Built-in functions |
Patient, indexTime, indexEvent, indexSet |
Reserved names |
${{ variable\|tocodeset }} |
Template substitution |
- truveta-prose-skill — Claude Code skill for writing, reviewing, and debugging Truveta Prose queries with AI assistance
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
MIT
| |