class HS.FHIRMeta.Load.NpmLoader extends %Library.RegisteredObject

The NpmLoader is used to import and access FHIR metadata resources. The importPackages method is used to register one or more 'npm-like' packages containing FHIR Metadata.

Each package has a unique Key that is used to identify its collection of Metadata resources. The Key is formed from a unique 'name' property and a semantic 'version' property concatenated separated by an '@' character. For example, The current FHIR R4 release has the name 'hl7.fhir.r4.core' and version '4.0.1', yielding an ID of 'hl7.fhir.r4.core@4.0.1'

Each package is contained in a single directory with the following structure:

Note that a properly formed "Implementation Guide" or core FHIR release are packaged in this form. For hand-build customization, the two JSON files must be provided with the required fields present at a minimum.

package.json properties
The following string fields are required for proper metadata ingestion:

Accessing FHIR Metadata Resources Use the Load method to create a NpmLoader instance that provides access to the metadata contained in a related set of packages. The NpmLoader can then be used to access a resource using the getRsrcByUrl or getRsrcById method. To iterate through a collection of resources, you can create a RsrcIterator object.

Property Inventory

Method Inventory


property coreVersion as %String;
Property methods: coreVersion(), coreVersionDisplayToLogical(), coreVersionGet(), coreVersionIsValid(), coreVersionLogicalToDisplay(), coreVersionLogicalToOdbc(), coreVersionNormalize(), coreVersionSet()
property packageIdList as %List;
Property methods: packageIdListGet(), packageIdListIsValid(), packageIdListLogicalToOdbc(), packageIdListOdbcToLogical(), packageIdListSet()
property packageList as list of HS.FHIRMeta.Storage.Package;
Property methods: packageListBuildValueArray(), packageListCollectionToDisplay(), packageListCollectionToOdbc(), packageListDisplayToCollection(), packageListGet(), packageListGetObject(), packageListGetObjectId(), packageListGetSwizzled(), packageListIsValid(), packageListOdbcToCollection(), packageListSet(), packageListSetObject(), packageListSetObjectId()


method %OnNew(mdsKeyList As %List) as %Status [ Language = objectscript ]
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

classmethod CanUninstallPackage(packageId As %String) as %Status [ Language = objectscript ]
@API Returns whether a package can safely be deleted. It performs the following operations:
  1. Checks if the package has any dependencies. NOTE: This API will not check whether the package is in use by applications that depend on it (like a FHIRServer endpoint).
@Input key Unique key for the package. @Returns A %Status of why the package can't be deleted, or $$$OK if it can.
classmethod IsPackageLoaded(packageId As %String) as %Boolean [ Language = objectscript ]
classmethod Load(mdsKeyList As %List) as NpmLoader [ Language = objectscript ]
classmethod Test(mdsKey As %String = "HL7v40", verbose=1) [ Language = objectscript ]
classmethod UninstallPackage(packageId As %String) [ Language = objectscript ]
@API This method uninstalls a FHIR package. It performs the following operations:
  1. Checks if the package can be safely deleted. NOTE: This API will not check whether the package is in use by applications that depend on it (like a FHIRServer endpoint).
  2. Removes the configuration
  3. Deletes the metadata globals
@Input key Unique key for the package. @Throws %Exception why the package couldn't be uninstalled.
classmethod coreVersion(package As HS.FHIRMeta.Storage.Package) as %String [ Language = objectscript ]
classmethod findPackages(inDir As %String) as %List [ Language = objectscript ]
Utility method that returns a list of pathnames to FHIR package directories within a specified directory.
@Input inDir A path to a directory that is either a FHIR package directory or contains one or more FHIR package directories.
@Returns A %List of normalized pathnames to the package directories.
method getRsrcById(resourceType As %String, id As %String) as %DynamicObject [ Language = objectscript ]
Returns a resource given the specified resourceType and id.
method getRsrcByUrl(url As %String) as %DynamicObject [ Language = objectscript ]
Returns a resource given the specified 'url' property value. Note that the resourceType need not be specified because it is implicit in the URL.
method getRsrcIterator(resourceType As %String) as HS.FHIRMeta.RsrcIterator [ Language = objectscript ]
Returns a RsrcIterator object that will iterate through all resources of the specified type.
classmethod importPackages(packageDirList As %List, force As %Boolean = 0) as %List [ Language = objectscript ]
Imports one or more 'npm-like' packages of FHIR Metadata into the system, creating a HS.FHIRMeta.Storage.Package object to describe each imported package and a HS.FHIRMeta.Storage.Rsrc object for each metadata Resource. A package cannot be successfully imported unless all dependent packages are either already imported, or included in 'packagePathList'
@Input packagePathList A %List of directory paths each containing a FHIR Metadata package.
@Input force (default=false) If true, remove any previous import of the package before importing. If false, previously imported packages will be skipped.
@Returns A %List of all package Id's that were updated

Inherited Members

Inherited Methods