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

cs-blue-button-generate

v1.5.11

Published

Blue Button CCDA Generator.

Downloads

6

Readme

blue-button-generate

This is a forked version from OpenEMR Blue Button CCDA Generator

npm i cs-blue-button-generate

blue-button-generate is a module to generate CCDA files from JSON data. Currently, it only supports blue-button JSON data model.

Usage

const json = {...};
const xml = BlueButtonGenerate.generateCCD(json, {
    preventNullFlavor: false
});

Implementation

blue-button-generate uses javascript template objects for implementation. Each template in CCDA is represented with an object. As an example, Reaction Observation object is shown

var reactionObservation = exports.reactionObservation = {
    key: "observation",
    attributes: {
        "classCode": "OBS",
        "moodCode": "EVN"
    },
    content: [
        fieldLevel.templateId("2.16.840.1.113883.10.20.22.4.9"),
        fieldLevel.id,
        fieldLevel.nullFlavor("code"),
        fieldLevel.text(leafLevel.sameReference("reaction")),
        fieldLevel.statusCodeCompleted,
        fieldLevel.effectiveTime, {
            key: "value",
            attributes: [
                leafLevel.typeCD,
                leafLevel.code
            ],
            dataKey: 'reaction',
            existsWhen: condition.codeOrDisplayname,
            required: true
        }, {
            key: "entryRelationship",
            attributes: {
                "typeCode": "SUBJ",
                "inversionInd": "true"
            },
            content: severityObservation,
            existsWhen: condition.keyExists('severity')
        }
    ]
};

This template is internally used with a call

js2xml.update(xmlDoc, input, context, reactionObservation);

where xmlDoc is the parent xml document (Allergy Intolerance Observation) and input is the immediate parent of bluebutton.js object that describes Reaction Observation. context is internally used for indices in text references.

Template Structure

The following are the properties of the templates

  • key: This is the name for the xml element.
  • attributes: This describes the attributes of the element. attributes can be an object of with key and value pairs for each attribute or it can be an array of such objects. Each attribute object or can be a function with input argument that returns attributes.
  • text: This is a function with input attribute that returns text value of the element.
  • content: This is an array of other templates that describe the children of the element. For a single child an object can be used.
  • dataKey: This is the property of input that serves as the data for the template.
  • required: This identifies if template is required or not. If template is required and there is not value in the input a nullFlavor node is created.
  • dataTransform: This is a function to transform the input.
  • existWhen: This is a boolean function with input argument to describe if the elements should exist or not.