What is Glion
A TypeScript application framework for HL7v2 integration — a parser, a validation engine, a plugin system, and an MLLP runtime.
Glion aims to be a full application framework for HL7v2 integration, providing a parser, an MLLP server, a validation engine for HL7v2 profiles, and a plugin system to extend and customize any feature. It is designed to be used as a library that you build your application on top of, rather than as a standalone platform or a graphical UI.
This means that Glion has multiple layers that can be used independently or together, depending on your needs. You can use the parser alone to parse HL7v2 messages into an AST, or you can use the MLLP server to build a complete HL7v2 service that listens for messages, parses them, validates them against profiles, and processes them with custom plugins.
Architecture
At a high level, Glion library includes several core components that work together to provide a complete HL7v2 application framework:
- Development toolkit: A set of tools and utilities for running HL7v2 applications in development and production, including a CLI for running and managing your app.
- MLLP protocol: A fully compliant MLLP server and client implementation, with support for TLS, NAK handling, and Cloudflare Workers.
- Processing engine: A plugin-based processing engine that allows you to write custom logic for handling HL7v2 messages at every stage of the lifecycle, from parsing to validation to transformation to serialization.
Philosophy
Framework, not platform
Glion is an opinionated application framework for building and working with HL7v2 applications. The framework includes an HL7v2 parser, an MLLP server, a validation engine for HL7v2 profiles, and a plugin system to extend and customize any feature.
By being a pure application framework, Glion does not prescribe a runtime, a deployment strategy, or a development workflow — it provides the pieces to build those things in whatever way makes sense for your team.
HL7v2 as a tree
The most fundamental design choice in Glion is that every HL7v2 message is represented as a tree, more specifically as an Abstract Syntax Tree. This means that every operation on an HL7v2 message — parsing, validation, transformation, serialization — can be expressed as an operation on a tree. This is a powerful abstraction that allows for a consistent API across the entire framework, and it enables the plugin system to work at every layer of the stack.
Plugins over configuration
Customization of the framework is mostly achieved via plugins, rather than configuration. For instance, the Glion parser does not have an option to configure decoding escape characters; instead, Glion ships an escape decoder plugin that lives in its own package.
This plugin-based approach means that teams can write their own plugins to customize the behavior of their Glion implementation, without waiting for it to be built into the framework. It also means that teams can share plugins across projects, and even with the community, to build a rich ecosystem of HL7v2 tooling.
Great DX with TypeScript-native APIs
Glion is written in TypeScript, with type definitions that cover every API. The parser produces a typed AST, the validator produces typed diagnostics, and the MLLP server's request and response objects are typed. This is an incredible DX boost for teams building HL7v2 applications in TypeScript, as it provides type safety and autocompletion across the entire stack.
Crafted for performance
Glion is designed to be fast. Performance is a key consideration in every part of the framework, and it has been tested to handle high-throughput HL7v2 applications without becoming a bottleneck.
For instance, the parser is built on a fully custom engine that is specifically optimized for HL7v2's syntax and semantics, rather than being built on a generic parsing library. The validation engine is designed to minimize the number of passes over the tree, and the plugin system is designed to avoid unnecessary overhead.
This is not to say that there aren't trade-offs — for instance, the plugin system's flexibility does introduce some overhead compared to a more rigid configuration system — but overall, Glion is designed to provide a great balance of performance and flexibility.
When to use Glion
Glion is a good fit for teams that want to build HL7v2 applications in TypeScript, and that expect to do more than just parsing. If you need an MLLP server, a validation engine, or a plugin system, Glion provides those pieces in a cohesive package. If you want to write custom transformations or validation rules, Glion's plugin model makes that easy. If you want to avoid the overhead of a separate engine or a graphical UI, Glion's library model means you can ship everything inside your application using a code-based development workflow.
Other healthcare standards (FHIR, HL7v3, etc.)
Glion is focused on HL7v2, and does not currently support other healthcare standards like FHIR or HL7v3. However, the design principles of Glion could be applied to other standards in the future, and the plugin system could potentially be used to add support for other standards on top of the existing HL7v2 functionality.