npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

encender

v0.7.1

Published

An asynchronous implementation of the FHIR $apply operation

Downloads

12

Readme

Encender

Encender is a software library written in the JavaScript programming language that implements the $apply operation from the Fast Healthcare Interoperability Resources (FHIR) standard. The $apply operation is defined for both PlanDefinition and ActivityDefinition resources, which are used to describe actions or groups of actions that are general in nature and not specific to any one patient. The name “Encender,” which is also the Spanish word for “to light or turn on,” was chosen for this library because the $apply operation takes the patient-agnostic PlanDefinition and ActivityDefinition resources and customizes them in the context of a specific patient's electronic health record. In other words, Encender "applies" FHIR PlanDefinition and ActivityDefinitions resources to a specific patient.

The $apply operation is central to how clinical decision support (CDS) can be implemented according to the guidance from the FHIR Clinical Reasoning Module (CRM) as well as the FHIR Clinical Guidelines Implementation Guide. Interoperable CDS with FHIR involves representing the possible CDS actions using a combination of PlanDefinition, ActivityDefinition, and other FHIR resources. Logical expressions are defined which are used to determine which CDS actions apply for a particular patient as well as to customize the actions for said patient. With Encender it is assumed the CDS logic is represented using the Clinical Quality Language (CQL). The figure below depicts the $apply operation that Encender implements.

FHIR $apply operation as implemented by Encender

Installation

Encender has been written for the NodeJs JavaScript runtime. It can be installed in an existing project using the npm package manager for NodeJs:

npm install encender

Key Dependencies

Usage

Once it has been added as a dependency, it can be invoked as follows:

import { applyPlan } from 'encender';

// 1. Define planDefinitionObject to hold the JSON representation of the PlanDefinition 
//    resource to be applied.

// 2. Define patientReferenceString for the reference to the Patient resource for 
//    patient to which the PlanDefinition is being applied.

// 3. Define resolver(), a function that takes a FHIR reference and returns matching 
//    FHIR resources.
//    Encender provides simpleResolver(), a function that takes an array of FHIR 
//    resources and returns a resolver() function which can be used with applyPlan().

// 4. Define optional parameters and services and put them in an object called aux.

// **Encender is asynchronous.**
// Calling applyPlan() returns a CarePlan, a RequestGroup, and other FHIR resources.
const [CarePlan, RequestGroup, ...otherResources] = 
  await applyPlan(planDefinitionObject, patientReferenceString, resolver, aux);

CQL

Encender is able to execute CQL expressions referenced in PlanDefinition dynamicValue and condition elements. No type checking is done to make sure that the value returned from the CQL expression matches what is expected by the element being targeted by a dynamicValue. When specifying the path element of a dynamic value, users can include a .ofType(string) at the end of the path and Encender will attempt to stringify the CQL output. This can useful in cases where a CQL expression is generating a list or tuple and this must be serialized for an element with a string type.

Tests and Coverage

The test folder contains several examples for how to run Encender. Tests can be run at the command line by invoking npm run test after running npm install. Code test coverage can be calculated by running npm run coverage.

Examples

In addition to the examples in the test folder, here is a list of examples of using Encender in other projects:

Known Limitations and Caveats

The following aspects of the $apply operation have not been implemented yet:

  • [ ] Support for Goal resources
  • [ ] Support for all PlanDefinition.action elements, including timing and start and stop conditions
  • [ ] Support for actions that reference Questionnaire resources
  • [ ] Support for all ActivityDefinition elements, including participant, location, and transform.

License

(C) 2021 The MITRE Corporation. All Rights Reserved. Approved for Public Release: 21-1556. Distribution Unlimited.

Unless otherwise noted, the CCSM CDS is available under an Apache 2.0 license. It was produced by the MITRE Corporation for the Division of Cancer Prevention and Control, Centers for Disease Control and Prevention in accordance with the Statement of Work, contract number 75FCMC18D0047, task order number 75D30120F09743.