HS.FHIRMeta.Load.NpmLoader
class HS.FHIRMeta.Load.NpmLoader extends %Library.RegisteredObject
The NpmLoader is used to import and access FHIR metadata resources. TheimportPackages
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:
- A JSON file named 'package.json' which contains identifying information. The required properties are enumerated below.
- A set of JSON files each containing a single FHIR resource.
package.json properties
The following string fields are required for proper metadata ingestion:
- name A unique identifier of the package exclusive of version. It is possible to have multiple versions of a single package each in its own directory with its own 'package.json'. (Example: for FHIR-R4, the value is 'hl7.fhir.r4.core')
- version A semantic version number identifying the version for this package. (Example: for FHIR-R4, the value is '4.0.1').
- type A code describing the type of package. Three values are defined; 'fhir.core' or 'Core' for base FHIR metadata packages supplied by HL7, and 'fhir.ig' for custom or profile packages.
- dependencies (Required for non-core packages) An object whose property name(s) identify the name of a package that this package requires. The property value(s) identify the version of the
required package. For example, to depend on the core FHIR R4 package the property would be:
Every package must either BE a core package, or ultimately resolve to having a single core package as a dependency."dependencies": { "hl7.fhir.r4.core": "4.0.1" },
- canonical A unique URL associated with the package. (This value is required by the HL7 package specification)
- title (Optional) A brief human-readable description of the package
- description (Optional) A full description of the package
- filename The simple name of a file, in the package directory (no path information)
- version The version number for the resource in the file.
- resourceType The resource type.
- canonical A unique URL associated with the package. (This value is required by the HL7 package specification)
- title (Optional) A brief human-readable description of the package
- description (Optional) A full description of the package
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
- %OnNew()
- AltCoreVersion()
- CanUninstallPackage()
- IsPackageLoaded()
- Load()
- UninstallPackage()
- coreVersion()
- findPackages()
- getRsrcById()
- getRsrcByUrl()
- getRsrcIterator()
- importPackages()
Properties
Methods
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.
- 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).
- 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).
- Removes the configuration
- Deletes the metadata globals
@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.
RsrcIterator
object that will iterate through all
resources of the specified type.@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
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()