Part 2 of Hidden Gems on Simplifier.net That Make Your FHIR Work Easier
Welcome to the second part of our series on Simplifier.net‘s hidden gems and features! In our last article, we covered the best features to help you manage FHIR projects and resources. This time around we will dive into the world of FHIR validation. Let’s get started with an overview of what validation is.
- Part 2 – Validation of FHIR Resources
Introduction to FHIR Validation
Validating FHIR resources is an important aspect of working with FHIR. It is a broad subject with many options and flavors. People will be interested in a specific aspect depending on how they use FHIR. Here we will focus on how FHIR validation is used for Standards Development and FHIR implementations.
Validating resources for Standards Development
To define your FHIR standard (or specification) you need to create conformance resources such as StructureDefinitions and SearchParameters. This can be tedious and complex work. Luckily, tooling exists that can save you from becoming an IT robot. You can say goodbye to plain XML or JSON editing.
Building resources using a graphical user interface like Forge, which has live validation of your work, or using a domain-specific language like FHIR Shorthand will help to prevent errors. However, no matter how meticulous you build your conformance resources errors may still arise in your work. These errors are usually due to incorrect design or bugs in the tooling.
Nobody wants to publish work containing errors. Several methods exist to validate resources and each has its own capabilities, as shown in this overview of validation methods by the FHIR specification. As the first line of defense, schemas for XML and JSON or RTF schemas can be used in any schema-aware text editor. Each FHIR release contains schemas for all resources and can be downloaded in the download section. They are also included in Implementation Guides created by the HL7 Publisher. These schemas are also helpful in creating test instances.
Most tools incorporate run-time validation methods that make sure the output is valid against these schemas.
The second line of defense is to use a validator or even multiple validators. Most of the tooling ecosystem, including public reference FHIR servers, run on either the HL7 Java validator or the Firely .NET validator. Importing resources into these tools and invoking the validator will help identify problems.
Validating profiles for implementing FHIR
FHIR implementers are primarily interested in validating their implementation to check, for example, if they can send or serve resources that are compliant to a specific implementation guide. They are not necessarily interested in validating conformance resources. This requires validation of resources against profiles (conformance resources).
As Simplifier.net is an online FHIR registry, filled with profiles and packages, it is perfectly suited for validation purposes. That’s why the Simplifier team invested a lot of time creating features that address validation. Before we proceed, you should know that all these validation features are accessible with a free account on Simplifier.net, so feel free to sign up here. Now let’s dive into how Simplifier.net can simplify your work.
Copy-paste validation —the simplest way to validate FHIR resources
The easiest and fastest way to validate any kind of FHIR resource is to copy and paste it to simplifier.net/validate. All you need is a free Simplifier account. This feature is useful for both profile authors and consumers.
By default, the input is validated against core specification and it will not be stored. It is possible to adjust the validation scope by choosing the FHIR version and within that a Simplifier.net project or a published FHIR package. In most cases, I recommend the latter option as this offers a more stable context compared to projects. Nowadays, projects can be seen as the head of a develop branch. Scoping the validator provides assurance about knowing the exact validation context and it allows you to quickly check conformance against different specifications and versions.
Hitting the validate button leads you to the results section, as shown here on the left. The Simplifier.net team provides a clear and understandable user interface to interpret the validation results. Apart from that neat looking layout, there are three features to highlight (see the red boxes on the screenshot above).
- The first feature allows you to filter options and choose to only see errors, warnings or informational messages.
- The second feature is highlighted on the right-hand side, where you can see corresponding .NET error codes for the validation results. These are linked to pages that contain more information.
- The third feature is my personal favorite, especially for validating long Bundle resources. It’s the option to view the output in XML. This view shows the validation results inline within the resource.
Hitting the back button brings you to the resource, ready to be edited and tested again!
From there, you can continue working on your resource and validation results by saving it to a snippet. This saves the resource to your own personal snippet collection, which is also convenient for sharing with others.
Snippet —your sketchpad for FHIR resources
The validator logic and user interface are reused in more places on Simplifier.net, such as the simplifier.net/snippet. Snippets act as your sketchpad to render, validate, and share any FHIR resource without having it persist in a serious project. They don’t have to be valid nor complete as the functionality is pretty robust. Everything can be edited afterward as well.
Snippets also have a validation scope that works in the same manner as described above. The snippets can be shared with the given URL, providing the receiver with an XML, JSON, and rendered version of the resource. It is also possible to instantly share the validation results by appending $validate to the URL. For instance, https://simplifier.net/snippet/ardon/107/$validate will lead you to the validation results.
Validation of resources within projects
The validator is available for every FHIR resource that is uploaded to a project on Simplifier.net. This applies to both public and private projects and for conformance resources and examples. This option is particularly useful for authors of profiles, as this allows them to upload all resources and perform a validation step afterwards.
The validation context of this validator is set to the entire content of the project and its dependencies. Dependencies are managed in the dependency tab of a project. By default, a dependency on the FHIR core package is provided based on the FHIR version of the project.
One of the features most anticipated by our customers is the ability to bulk validate resources. Think of this as validation of all resources within a project in one go. Well, good news, this is on its way! Stay tuned to get more helpful tools for quality assurance for your specification.
Other tools you can use for validation
If you want to expand your horizons, here are some other noteworthy validation methods.
Reference FHIR servers are built with validation functionality. Vonk, the FHIR server by Firely, uses the .NET validator and has implemented the $validate operation. The $validate operation can be used to validate a resource that’s given in the body of a POST message or to validate a resource instance in the database against a profile. You can also configure Vonk to validate every incoming resource and even filter on specific profiles. Once Vonk is set up and filled with the right profiles, a client script, for example, build with the .NET FHIR library, could utilize the $validate operation to bulk validate resources.
Firely Terminal (formerly Torinox)
Do you remember Firely Terminal from our previous blog post? Firely Terminal is our cross-platform Swiss army knife and command-line tool for all kinds of FHIR needs, including validation. Hence the reason it is mentioned here too. An offline and local tool can be very useful in rapid validation of your work. It could be incorporated within build or quality assurance processes. With some creativity, Firely Terminal can be scripted to be used for bulk validation too. If you aren’t feeling very creative, don’t worry. This feature will also be implemented natively soon.
Another free and cross-platform validator that is worth mentioning is Hammer. Created by one of Firely’s FHIR consultants, it offers a modern and intuitive user interface. One of its major features is that it combines the .NET and JAVA validator. It is currently in an experimental phase so any feedback or contributions are more than welcome.
This is not really a resource validator but it is a very useful tool to validate FHIRPath expressions. A must-have if you are enriching profiles, TestScripts, or Search Parameters with complex FHIR path expressions. The FHIRPath test by Brian Postlethwaite is easily downloadable as a Microsoft app. It is even available on Xbox or HoloLens!
Another FHIRPath tester, maintained by Josh Mandel, can be found on Github.
Last but not least is the JAVA validator. It’s maintained by HL7 and is provided with the FHIR specification. You can get the latest version from the FHIR downloads page. The use of the validator is documented on the HL7 Confluence. The JAVA validator has a broad range of features including bulk validation.
There you have it! We’ve taken you through a quick overview of FHIR validation and how important it is for your FHIR project. Hopefully, you feel more equipped with these four different ways to validate your FHIR work on Simplifier.net: 1) Copy-paste, 2) Snippet, 3) Project, and 4) Bulk validation. Now you know exactly which buttons and features to look out for the next time you work on your FHIR project. If that isn’t enough, you even have an extra list of tools that you can use apart from Simplifier.net!
If you’re hungry for more FHIR skills, stay tuned for our third and final blog post about the “Hidden Gems on Simplifier.net That Make Your FHIR Work Easier.” Next time we’ll tell you all about version management using Simplifier.net and Forge. See you in the next blog post!