Automating your FHIR Workflow
9 Min Read

Automating Your FHIR Workflow with Firely Terminal

Ward Weistra

Subscribe to our newsletter


Firely Terminal is the new name for our FHIR command line tool Torinox. With this name change, we also released exciting new features and an overview video of this nifty cross-platform automation tool.

For a full overview of the core features of Firely Terminal, and the new ValueSet expansion and powerful FQL querying, watch the video or continue reading below! To directly get started, go to the installation instructions or the Firely Terminal documentation.

Firely Terminal is a tool for working with FHIR on the command line. It is built on our open-source Firely .NET SDK and works on any operating system: Linux, Mac, or Windows. It is the most powerful tool for automating anything in your FHIR development process. This includes synchronizing with projects, talking to FHIR APIs and validating FHIR specifications and examples.

Below we will expand on the video and end with a future outlook.

Intro to Firely Terminal (0:16)

The first things to use are:

  • fhir help: This will provide you with all the commands and how to use them. And this can also be used to learn more about any other subcommand, for example with fhir help search.
  • fhir stack: Firely Terminal works in most cases with an internal ‘stack’ of resources such as an internal memory of resources we are working with. The fhir stack command will show you what’s currently on there. In the beginning this will be empty, but you can add one or more files to it with fhir push (for example, fhir push Patient.json or fhir push StuctureDefinition-*.xml) and fhir show displays the first resource on the list.

Using Firely terminal as a FHIR client (0:51)

For starters, Firely Terminal can function as a command-line based FHIR client. It sends resources to FHIR servers and back via their FHIR API.

  • fhir search allows you to search a FHIR server for resources matching your criteria, for instance:
    fhir search Patient name=Chalmers
  • fhir read, fhir post and fhir put perform the client operations you’d expect on the server and resource of your choice.

Synchronization with FHIR projects (2:37)

Firely Terminal is also a great way to easily synchronize a local folder with a public or private project. This is useful when you want to work on them with Forge or have created a bunch of resources with FHIR Shorthand.

  • fhir login logs you in and gives you secure access on the command-line to your private projects and resources.
  • fhir projects lists all projects you have access to.
  • fhir sync allows you to send your local files to a project (with --up) or the other way around (with --down). With fullsync also the files that do not exist on the server will be removed from your local folder, so use that one with care.

If your project now contains a package.json file, which contains your project dependencies and is automatically created by, we can install those dependencies locally too with fhir restore. If you don’t have a package.json yet, just fhir install any FHIR packages (from the Implementation Guides and projects you are building on top of) and Firely Terminal will download them to your cache so your project can refer to them.

Validation bundles

Validation and (un)packing bundles (4:41)

Now you have resources from your project on your local machine we have something to work with!

Snapshot generation (7:37)

Not every tool is able to take all the rules FHIR profiles layer on top of each other to create a resulting FHIR data model, the snapshot. Firely Terminal makes snapshot generation just a single command: fhir snapshot.

Filtering and file format conversion (9:15)

  • fhir filter is a way to take only a few specific resources from your FHIR project, based on the powerful Firely Query Language.
  • Taking these resources of interest, you can save them to XML or JSON with fhir save. In addition, this allows you to quickly convert a bunch of XML files to JSON and back.

ValueSet expansion (and saving back to (11:27)

New in the latest release, available for all our paying customers: Filling the ValueSet expansion part with the actual terms that are part of it:

  • fhir expand takes your ValueSet, finds the CodeSystem it refers to (as long as the CodeSystem is ‘complete’, having all codes directly in it) and updates the ValueSet to have all its codes.

Querying with the Firely Query Language (13:20)

Firely has expanded FHIRPath to a SQL like query language that allows you to quickly query over many FHIR resources: the Firely Query Language.

  • With fhir query you can run a FQL statement on your entire project and its dependencies. For example:
    fhir query 'using scope from StructureDefinition select name, url' --output json

What’s next?

Automation with Firely Terminal

Firely Terminal opens up a world of FHIR automation to the community. Large customers already use it to validate and generate snapshots on every release or even every commit. But, more is coming! We will soon add the following:

  • Support for full Quality Control: In we have just released Quality Control, which allows our users to run FHIR validation and their own custom business rules validation with the click of one button. Immensely powerful. What if you could run this on the command-line every time you made a change? Coming soon.
  • And continuing from that: What if you could run Quality Control and any other Firely Terminal feature on every commit and Pull Request in Git? You would know for each contribution whether the resources are still correct and whether your examples still conform to your spec. We will soon make a template available for putting Firely Terminal in Github Actions or any other Git automation flow.

Get started with Firely Terminal right now and let us know how it helps your FHIR automation!

Recommendations for you

Explore more topics

Post a comment

Your email address will not be published. Required fields are marked *