Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handlebars-helpers-fhir

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-helpers-fhir

Helper functions for the Handlebars templating engine using fhirpath to reference HL7 FHIR resources from within templates.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
58
increased by41.46%
Maintainers
1
Weekly downloads
 
Created
Source

Handlebars

handlebars-helpers-fhir

Helper functions for the Handlebars templating engine using fhirpath to reference HL7 FHIR resources from within templates.

Prerequisites

Handlebars!

$ npm install handlebars --save

Installation

Install package

$ npm install handlebars-helpers-fhir --save

Register helpers with handlebars

const Handlebars = require('handlebars');
require('handlebars-helpers-fhir').registerWith(Handlebars);

Use

#if-fhir

The if-fhir block helper will conditionally render a block based on a fhirpath expression. If the fhirpath expression returns an empty array, Handlebars will not render the block.

{{#if-fhir . expression='Patient.address.where(use=\'temp\')'}}
  <p>Patient has a temporary address.</p>
{{/if-fhir}}

The helper can render an {{else}} section.

{{#if-fhir . expression='Patient.address.where(use=\'temp\')'}}
  <p>Patient has a temporary address.</p>
{{else}}
  <p>Patient does not have a temporary address.</p>
{{/if-fhir}}

#unless-fhir

The unless-fhir block helper will conditionally render a block based on a fhirpath expression. If the fhirpath expression returns an empty array, Handlebars will render the block.

{{#unless-fhir . expression='Patient.address.where(use=\'temp\')'}}
  <p class="button">Add temporary address</p>
{{/unless-fhir}}

#each-fhir

The each-fhir block helper will render a block for each item found using a fhirpath expression.

{{#each-fhir . expression='Patient.address'}}
  <p>{{use}}: {{text}}</p>
{{/each-fhir}}

You can optionally supply an {{else}} section which will render only if evaluating the fhirpath expression returns no matches.

{{#each-fhir . expression='Patient.address'}}
  <p>{{use}}: {{text}}</p>
{{else}}
  <p>No address found</p>
{{/each-fhir}}

The each-fhir block helper supports the @index, @key, @first and @last loop variables.

The each-fhir block helper does not support block parameters.

#with-fhir

The with-fhir block helper will render a block after switching context to the first item found using a fhirpath expression.

{{#with-fhir . expression='Patient.address.first()'}}
  <p>{{text}}</p>
{{/with-fhir}}

You can optionally supply an {{else}} section which will render only if evaluating the fhirpath expression returns no matches.

{{#with-fhir . expression='Patient.address.first()'}}
  <p>{{text}}</p>
{{else}}
  No address
{{/with-fhir}}

#resolve-fhir

The resolve-fhir block helper will render a block after switching context to the first FHIR resource from the first reference found by evaluating the fhirpath expression.

{{#resolve-fhir . expression='Patient.managingOrganization.reference'}}
  <p>Healthcare provider is {{name}}</p>
{{/resolve-fhir}}

You can optionally supply an {{else}} section which will render when with the fhirpath expression returns no matches OR the referenced FHIR resource cannot be found.

{{#resolve-fhir . expression='Patient.managingOrganization.reference'}}
  <p>Healthcare provider is {{name}}</p>
{{else}}
  <p>Healthcare provider unknown</p>
{{/resolve-fhir}}

The resolve-fhir block helper suppports only internal references (i.e. within @root.entry and @root.contained).

License

handlebars-helpers-fhir is free software: you can redistribute it and/or modify it under the terms of the MIT license.

Acknowledgements

Supported by Black Pear Software

Keywords

FAQs

Package last updated on 14 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc