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

@yorm/fhir

v0.1.0

Published

FHIR building blocks for YORM: a resource-aware JSON codec, stable element identity, and extension preservation helpers.

Readme

@yorm/fhir

FHIR building blocks for YORM: a resource-aware JSON codec, stable element identity, and extension preservation helpers. This is the minimum slice for the Contacts ⇄ Patient POC (PLAN.md Milestone 5a) — not a FHIR validator, terminology server, or full R4 type model. See the root README ("A FHIR-first motivation", "Stable identity", "Source codecs", "FHIR-specific patterns") and PLAN.md.

What's in the minimum slice

Resource codec — fhirResource(resourceType)

A thin, resource-type-aware layer over the generic @yorm/yjs jsonCodec (all Yjs traversal is delegated). Uses the default "resource" root map, so it composes with @yorm/yjs document sessions.

import { fhirResource, type Patient } from "@yorm/fhir";

const codec = fhirResource<Patient>("Patient");
codec.write(doc, patient); // throws if patient.resourceType !== "Patient"
const read = codec.read(doc); // resourceType guaranteed on the result

Minimal structural types used by the POC are exported alongside: FhirResource, Patient, HumanName, ContactPoint, Address, Extension, Identifier — pragmatic subsets with index signatures so unmapped content is preserved.

Stable element identity — fhirElementId, ensureElementIds

Array position is not identity. Identity precedence:

  1. explicit element id;
  2. configured business key (options.businessKey);
  3. ingestion-assigned id (options.assign, default: short random id) — applied by ensureElementIds only. fhirElementId throws at step 3, because assigning at read time would not be stable.
import { ensureElementIds, fhirElementId } from "@yorm/fhir";

// On ingestion: give every repeating element a stable id (immutable copy).
const patient = ensureElementIds(raw, [["name"], ["telecom"], ["address"]]);

// In mappings: resolve the stable identity of one element.
const rowKey = fhirElementId(telecom);

Extension preservation — src/extensions.ts

Unmapped contact fields ride along on the canonical resource as FHIR extensions under the documented namespace https://yorm.dev/fhir/StructureDefinition/<name>:

import { extensionUrl, setExtension, getExtensionValue, listYormExtensions } from "@yorm/fhir";

const url = extensionUrl("contact-ringtone");
const next = setExtension(telecom, url, { valueString: "Marimba" }); // immutable, replace-by-url
getExtensionValue(next, url); // "Marimba"
listYormExtensions(next); // all extensions under the yorm namespace

All helpers are immutable: they return copies and never mutate their input.