Documentation
¶
Overview ¶
Package loader handles loading FHIR packages from the NPM cache, local .tgz files, or remote URLs.
Index ¶
- Variables
- func DefaultPackagePath() string
- func ParsePackageSpec(spec string) (name, version string)
- type Loader
- func (l *Loader) BasePath() string
- func (l *Loader) ListPackages() ([]string, error)
- func (l *Loader) LoadFromEmbeddedData(data [][]byte) ([]*Package, error)
- func (l *Loader) LoadFromResources(resources [][]byte) (*Package, error)
- func (l *Loader) LoadFromTgz(tgzPath string) (*Package, error)
- func (l *Loader) LoadFromTgzData(data []byte) (*Package, error)
- func (l *Loader) LoadFromURL(url string) (*Package, error)
- func (l *Loader) LoadPackage(name, version string) (*Package, error)
- func (l *Loader) LoadPackageRef(ref PackageRef) (*Package, error)
- func (l *Loader) LoadVersion(version string) ([]*Package, error)
- type Package
- type PackageManifest
- type PackageRef
Constants ¶
This section is empty.
Variables ¶
var DefaultPackages = map[string][]PackageRef{
"4.0.1": {
{Name: "hl7.fhir.r4.core", Version: "4.0.1"},
{Name: "hl7.terminology.r4", Version: "7.0.1"},
{Name: "hl7.fhir.uv.extensions.r4", Version: "5.2.0"},
},
"4.3.0": {
{Name: "hl7.fhir.r4b.core", Version: "4.3.0"},
{Name: "hl7.terminology.r4", Version: "7.0.1"},
{Name: "hl7.fhir.uv.extensions.r4", Version: "5.2.0"},
},
"5.0.0": {
{Name: "hl7.fhir.r5.core", Version: "5.0.0"},
{Name: "hl7.terminology.r5", Version: "7.0.1"},
{Name: "hl7.fhir.uv.extensions.r5", Version: "5.2.0"},
},
}
DefaultPackages maps FHIR versions to their default package configurations. Based on latest stable versions as of January 2025.
Functions ¶
func DefaultPackagePath ¶
func DefaultPackagePath() string
DefaultPackagePath returns the default FHIR package cache path.
func ParsePackageSpec ¶
ParsePackageSpec parses "name#version" into separate components.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads FHIR packages from the NPM cache.
func (*Loader) ListPackages ¶
ListPackages returns all available packages in the cache.
func (*Loader) LoadFromEmbeddedData ¶ added in v1.9.0
LoadFromEmbeddedData loads multiple FHIR packages from embedded .tgz data.
func (*Loader) LoadFromResources ¶ added in v1.6.0
LoadFromResources creates a Package from individual conformance resource JSON bytes. Each entry should be a valid JSON FHIR conformance resource (StructureDefinition, ValueSet, CodeSystem, etc.).
func (*Loader) LoadFromTgz ¶
LoadFromTgz loads a FHIR package from a local .tgz file. The package is extracted to a temporary directory and loaded.
func (*Loader) LoadFromTgzData ¶ added in v1.6.0
LoadFromTgzData loads a FHIR package from .tgz bytes in memory. Useful for packages embedded in the binary via //go:embed.
func (*Loader) LoadFromURL ¶
LoadFromURL loads a FHIR package from a remote URL pointing to a .tgz file. The package is downloaded to a temporary location and loaded.
func (*Loader) LoadPackage ¶
LoadPackage loads a specific package by name and version.
func (*Loader) LoadPackageRef ¶
func (l *Loader) LoadPackageRef(ref PackageRef) (*Package, error)
LoadPackageRef loads a package from a PackageRef.
type Package ¶
type Package struct {
Name string
Version string
Path string
FHIRVersion string
Resources map[string]json.RawMessage // URL or resourceType/id -> raw JSON
}
Package represents a loaded FHIR package.
type PackageManifest ¶
type PackageManifest struct {
Name string `json:"name"`
Version string `json:"version"`
FHIRVersion string `json:"fhirVersion,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"`
}
PackageManifest represents the package.json of a FHIR NPM package.
type PackageRef ¶
PackageRef represents a reference to a FHIR package.
func (PackageRef) String ¶
func (p PackageRef) String() string
String returns the package spec in "name#version" format.