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 🙏

© 2026 – Pkg Stats / Ryan Hefner

fhir-controller-cli

v1.4.0

Published

FHIR Controller CLI utilities.

Readme

FHIR Controller Command Line Interface (CLI) Utilities

Build Status

The fhir-controller command line utility for interacting with remote FHIR servers from an on-premise or cloud host. This cross-platform executable provides:

  • Command line interface for FHIR server operations
  • Ability to upload a directory of Synthea FHIR output directly to a FHIR server in the correct dependency sequence
  • Upload terminology systems (SNOMED CT, LOINC, RxNorm) to FHIR servers as CodeSystem resources
  • Polling and auto-import capabilities for FHIR Controller deployments

Installation

NPM Package

# Install globally
npm install -g fhir-controller-cli

# Or use with npx (no installation required)
npx fhir-controller-cli help

Docker Image

# Get high-level subcommand help
docker run --rm p3000/fhir-controller-cli:latest help

# Example of headless polling and auto-loading by reference to a FHIR Controller stack.json file (HTTP URL)
# Data loading will be triggered whenever the server confirms the absence of a special AuditEvent import record
docker run --rm --pull always p3000/fhir-controller-cli:latest poll-auditevent-and-trigger-import http://fhir.example.com/fhir https://stack.foundry.hl7.org/stack.json -i 5

# Local manifest on the host: bind-mount the directory that contains stack.json and referenced data files, then pass the in-container path
docker run --rm --pull always -v /path/to/stack-dir:/manifest p3000/fhir-controller-cli:latest poll-auditevent-and-trigger-import http://fhir.example.com/fhir /manifest/stack.json

# Example of uploading terminology systems
docker run --rm --pull always p3000/fhir-controller-cli:latest terminology import /data/loinc.csv http://fhir.example.com/fhir /tmp/staging --system loinc
docker run --rm --pull always p3000/fhir-controller-cli:latest terminology import /data/snomed/ http://fhir.example.com/fhir /tmp/staging --system snomed
docker run --rm --pull always p3000/fhir-controller-cli:latest terminology import /data/rxnorm.csv http://fhir.example.com/fhir /tmp/staging --system rxnorm

# Advanced options examples
docker run --rm --pull always p3000/fhir-controller-cli:latest terminology import /data/loinc.csv http://fhir.example.com/fhir /tmp/staging --system loinc --batch-size 2000 --verbose
docker run --rm --pull always p3000/fhir-controller-cli:latest terminology import /data/snomed/ http://fhir.example.com/fhir /tmp/staging --system snomed --keep-temporary --replace
docker run --rm --pull always p3000/fhir-controller-cli:latest terminology import /data/rxnorm.csv http://fhir.example.com/fhir /tmp/staging --system rxnorm --dry-run

Available Commands

Synthea Upload

Upload Synthea-generated FHIR resources to a FHIR server:

# Upload Synthea directory
fhir-controller synthea-upload /path/to/synthea/output/ http://localhost:8080/fhir

# With dry-run option
fhir-controller synthea-upload /path/to/synthea/output/ http://localhost:8080/fhir --dry-run

Polling and Auto-Import

Monitor a FHIR server for AuditEvents and automatically trigger imports when the server has no matching import AuditEvent yet.

The second argument is the stack manifest (stack.json): an HTTP(S) URL, a file:// URL, or a filesystem path. Relative paths are resolved from the current working directory; a leading ~/ expands to your home directory (same as other commands). Data files listed in the manifest are loaded from the same base as the manifest (URL resolution for remote manifests, directory-relative paths for local manifests).

# Poll and import using a remote manifest URL
fhir-controller poll-auditevent-and-trigger-import http://fhir.example.com/fhir https://stack.foundry.hl7.org/stack.json

# Local manifest (and local bundle paths next to it)
fhir-controller poll-auditevent-and-trigger-import http://fhir.example.com/fhir ./config/stack.json

# Only import rows tagged for a given scenario (manifest `scenarios[].id`; rows may list that id under `scenarios`)
fhir-controller poll-auditevent-and-trigger-import http://fhir.example.com/fhir https://stack.foundry.hl7.org/stack.json --scenario partial

# Custom polling interval (seconds), verbose logging, dry run (no POST to FHIR)
fhir-controller poll-auditevent-and-trigger-import http://fhir.example.com/fhir https://stack.foundry.hl7.org/stack.json --interval 300 --verbose --dry-run

# One shot: poll once, import if the server has no matching AuditEvent, then exit (no repeat interval)
fhir-controller poll-auditevent-and-trigger-import http://fhir.example.com/fhir ./config/stack.json --exit --dry-run

Polling command options

  • --exit: run a single poll cycle (and manifest import if triggered) then exit; --interval is ignored after that one cycle
  • --scenario <scenario_id>: restrict imports to manifest data rows for that scenario; rows with no scenarios array (or an empty one) still load for every scenario
  • -i, --interval <seconds>: minimum time between polls (default 3600)
  • -v, --verbose: extra debug output
  • -d, --dry-run: log actions without uploading to the FHIR server
  • --audit-event-system / --audit-event-code: match and create the import AuditEvent type (defaults match the examples above)

Terminology Imports

The CLI supports uploading major terminology systems to FHIR servers:

  • SNOMED CT US Edition: Clinical terminology
  • LOINC: Laboratory and clinical observations
  • RxNorm: Clinical drugs and medications

CLI Options

The terminology import command supports the following options:

  • --system <system>: Terminology system to import (snomed, loinc, rxnorm) - Required
  • --dry-run: Perform a dry run without uploading any resources
  • --verbose: Enable verbose debugging mode
  • --keep-temporary: Keep temporary files after upload for debugging
  • --replace: Delete existing CodeSystem and ValueSet before importing new ones
  • --batch-size <size>: Number of concepts to process in each batch (default: 1000)
  • --skip-preprocess: Skip preprocessing stage (use most recent files in temp directory)
  • --skip-split: Skip splitting stage (use most recent files in temp directory)
  • --skip-upload: Skip upload stage (only preprocess and split)

Download Terminology Data

SNOMED CT US Edition

  • Download: https://www.nlm.nih.gov/healthit/snomedct/us_edition.html
  • Format: .zip file (extract before use)

LOINC

  • Download from: https://loinc.org/downloads/
  • Format: .zip file (extract before use)

RxNorm

  • Download from: https://www.nlm.nih.gov/research/umls/rxnorm/
  • Format: .zip file (extract before use)
# Upload individual terminology systems

# SNOMED
fhir-controller terminology import ~/Developer/terminologies/SnomedCT_ManagedServiceUS_PRODUCTION_US1000124_20250901T120000Z http://localhost:8080/fhir tmp -v --keep-temporary --system snomed --replace

# LOINC
fhir-controller terminology import ~/Developer/terminologies/Loinc_2.81 http://localhost:8080/fhir tmp -v --keep-temporary --system loinc --replace

# RxNorm
fhir-controller terminology import ~/Developer/terminologies/RxNorm_full_09022025 http://localhost:8080/fhir tmp -v --keep-temporary --system rxnorm --replace

Development & Testing Usage

# Run the CLI directly from source
tsx src/bin/fhir-controller.ts ...

This software is released under the Apache 2.0 license. Copyright © 2017+ Preston Lee.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/preston/marketplace. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.