Giter Site home page Giter Site logo

shr-cli's Introduction

SHR Command-Line Interface

The Standard Health Record (SHR) initiative is working to create a single, high-quality health record for every individual in the United States. For more information, see standardhealthrecord.org.

This GitHub repository contains a Node.js command-line interface for parsing SHR text definitions and exporting them as JSON and markdown/html. Future versions of the CLI will support additional capabilities.

The SHR text definitions and grammar files can be found in the shr_spec repo. As the SHR text format (and content files) are still evolving, so is this toolset.

Getting the Code

To run the SHR command-line interface, you need to first download the shr-cli code. This can be done via git clone or by clicking the green "Clone or download" button and choosing "Download Zip" (which you will then need to unzip to a folder of your choosing).

Setting Up the Environment

To run the command-line interface, you must perform the following steps to install its dependencies:

  1. Install Node.js
  2. Install Yarn
  3. Execute the following from this project's root directory: yarn

Exporting SHR to Markdown, HTML, JSON, and FHIR

After setting up the environment, you can use node to import a folder of files from CAMEO (SHR text format) to a number of other formats, including Markdown, HTML, JSON, and FHIR definitions:

$ node . /path/to/shr_spec/spec

The command above will export these formats to the out directory.

It is also possible to override the default logging level, logging format, and output folder:

$ node . --help

  Usage: shr-cli <path-to-shr-defs> [options]

  Options:

    -h, --help               output usage information
    -l, --log-level <level>  the console log level <fatal,error,warn,info,debug,trace> (default: info)
    -m, --log-mode <mode>    the console log mode <short,long,json,off> (default: short)
    -o, --out <out>          the path to the output folder (default: ./out)

For example:

node . ../shr_spec/spec -l error -o out2

Advanced Logging

The SHR tools use the Bunyan structured logging framework, and store a full log file in the output folder (note: it will be appended to on subsequent runs). You can use the Bunyan CLI tool to perform advanced filtering of the log file. For example:

node_modules/.bin/bunyan -c 'this.shrId=="shr.vital.BloodPressure"'  -o short out/out.log

(On Windows, replace / with \ in the example).

For more information on Bunyan and Bunyan CLI, see the Bunyan documentation.

Creating the FHIR Implementation Guide

After exporting the SHR definitions, the FHIR IG Publisher tool can be used to create a FHIR implementation guide, containing HTML documentation, bundled definitions, and more. This requires that the Java Runtime Environment (JRE) or Java SDK (JSDK) are installed on your system. It also requires Jekyll (Mac/Linux / Windows). After ensuring they are installed, run the following command:

$ yarn run ig:publish

Creating the FHIR Implementation Guide Using an HTTP Proxy

If your system requires a proxy to access the internet, you'll need to take a more complex approach than above.

First, export a system environment variable called JAVA_OPTS, setting the proxies as appropriate.

On Mac or Linux:

$ export JAVA_OPTS=-Dhttp.proxyHost=my.proxy.org -Dhttp.proxyPort=80 -Dhttps.proxyHost=my.proxy.org -Dhttps.proxyPort=80 -DsocksProxyHost=my.proxy.org -DsocksProxyPort=80

On Windows:

> SET JAVA_OPTS=-Dhttp.proxyHost=my.proxy.org -Dhttp.proxyPort=80 -Dhttps.proxyHost=my.proxy.org -Dhttps.proxyPort=80 -DsocksProxyHost=my.proxy.org -DsocksProxyPort=80

Next, create the IG using the HL7 IG Publisher Tool.

On Mac or Linux:

$ java -jar $JAVA_OPTS out/fhir/guide/org.hl7.fhir.igpublisher.jar -ig out/fhir/guide/shr.json -tx http://test.fhir.org/r3

On Windows:

> java -jar %JAVA_OPTS% out/fhir/guide/org.hl7.fhir.igpublisher.jar -ig out/fhir/guide/shr.json -tx http://test.fhir.org/r3

License

Copyright 2016, 2017 The MITRE Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

shr-cli's People

Contributors

cmoesel avatar gregquinn2001 avatar troycrews avatar andrequina avatar

Watchers

James Cloos avatar Abhijay Saran avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.