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

fhirfix

v0.1.0

Published

FHIRfix REST API client. Validate, fix, and convert FHIR conformance issues.

Readme

fhirfix

JavaScript and TypeScript client for the FHIRfix REST API. Validate, fix, and convert FHIR conformance issues.

Works on Node 18+, Bun, Deno, browsers, and edge runtimes. No dependencies.

Install

npm install fhirfix

Usage

import { Fhirfix } from "fhirfix";

const fhirfix = new Fhirfix({
  apiKey: "ffx_test_...",
  baseUrl: "http://localhost:3001/api/v1",
});

const result = await fhirfix.fix({ input: patientJson });

console.log(result.conformanceScoreBefore, "->", result.conformanceScoreAfter);
console.log(result.corrected);

Both are read from the environment when you do not pass them:

export FHIRFIX_API_KEY=ffx_test_...
export FHIRFIX_BASE_URL=http://localhost:3001/api/v1

baseUrl points at the FHIRfix API you are calling. There is no built-in default, so a client can never silently talk to the wrong host.

Validate without changing anything

const { findings, findingsTotal } = await fhirfix.validate({ input: patientJson });

for (const finding of findings) {
  console.log(finding.severity, finding.plainMessage, finding.suggestedFix);
}

Convert HL7v2 or C-CDA to FHIR

const { fhir } = await fhirfix.convert({ input: hl7v2Message });

Large inputs

batch queues the work and returns immediately. Poll the run or receive a run.completed webhook.

const { runId } = await fhirfix.batch({ input: bigNdjson });
const { run } = await fhirfix.runs.get(runId);

Runs

const page = await fhirfix.runs.list({ status: "completed", limit: 20 });
const next = page.hasMore ? await fhirfix.runs.list({ cursor: page.nextCursor! }) : null;

const corrected = await fhirfix.runs.corrected(runId);
const report = await fhirfix.runs.report(runId, "operationoutcome");

Idempotency

Pass idempotencyKey to make a call safe to retry. The same key with the same body replays the original run instead of running and charging again. The same key with a different body is rejected.

await fhirfix.fix({ input: patientJson, idempotencyKey: "order-1234" });

Errors

Every error extends FhirfixError. Failed requests throw an ApiError subclass carrying status, code, headers, and the parsed body.

import { OutOfCreditsError, RateLimitError, UnprocessableError } from "fhirfix";

try {
  await fhirfix.fix({ input });
} catch (err) {
  if (err instanceof RateLimitError) {
    await sleep((err.retryAfter ?? 1) * 1000);
  } else if (err instanceof OutOfCreditsError) {
    // add credits or enable auto-recharge
  } else if (err instanceof UnprocessableError) {
    // the input is not a recognized FHIR or HL7v2 shape
  }
}

| Class | Status | | --- | --- | | BadRequestError | 400, 413 | | AuthenticationError | 401 | | OutOfCreditsError | 402 | | PermissionDeniedError | 403 | | NotFoundError | 404 | | ConflictError | 409 | | UnprocessableError | 422 | | RateLimitError | 429 | | ServerError | 5xx | | ConnectionError / TimeoutError | no response |

Rate limited (429) and server (5xx) responses are retried automatically with backoff, honouring Retry-After. Other errors are not retried, because they fail the same way every time.

Options

new Fhirfix({
  apiKey: "ffx_live_...", // or $FHIRFIX_API_KEY
  baseUrl: "http://localhost:3001/api/v1", // or $FHIRFIX_BASE_URL. required.
  timeoutMs: 120_000,
  maxRetries: 2,
  fetch: customFetch,
});