Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SnapshotGenerator

Responsible for creating snapshots on StructureDefinition resources based on the differential of the profile.

Hierarchy

  • SnapshotGenerator

Index

Constructors

constructor

Properties

Private Readonly bundle

bundle: Bundle

The bundle passed into the constructor whose structure definitions should have snapshots generated

Private Readonly choiceRegexString

choiceRegexString: "(Instant|Time|Date|DateTime|Decimal|Boolean|Integer|String|Uri|Base64Binary|Code|Id|Oid|UnsignedInt|PositiveInt|Markdown|Url|Canonical|Uuid|Identifier|HumanName|Address|ContactPoint|Timing|Quantity|SimpleQuantity|Attachment|Range|Period|Ratio|CodeableConcept|Coding|SampledData|Age|Distance|Duration|Count|Money|MoneyQuantity|Annotation|Signature|ContactDetail|Contributor|DataRequirement|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Expression|Reference|Narrative|Extension|Meta|ElementDefinition|Dosage|Xhtml)" = '(Instant|Time|Date|DateTime|Decimal|Boolean|Integer|String|Uri|Base64Binary|Code|Id|Oid|UnsignedInt|PositiveInt|Markdown|Url|Canonical|Uuid|Identifier|HumanName|Address|ContactPoint|Timing|Quantity|SimpleQuantity|Attachment|Range|Period|Ratio|CodeableConcept|Coding|SampledData|Age|Distance|Duration|Count|Money|MoneyQuantity|Annotation|Signature|ContactDetail|Contributor|DataRequirement|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Expression|Reference|Narrative|Extension|Meta|ElementDefinition|Dosage|Xhtml)'

A string that represents all options possible in STU3 and R4 for choice elements, ex: value[x], effective[x], etc.) It is used to create a regex that tests that value[x] matches valueQuantity in an ElementDefinition.path.

Private Readonly parser

The parser containing FHIR versioning and base profile information

Private processedUrls

processedUrls: string[] = []

A field that tracks what profiles have been processed during the .generate() operation, so that profiles are not processed multiple times in a single run.

Methods

generate

  • generate(): void
  • Generates a snapshot for all structure definitions in the bundle. If a structure definition in the bundle is a base FHIR structure definition, it is assumed the structure definition already has a snapshot, and it is ignored.

    Returns void

Private getStructureDefinition

  • getStructureDefinition(url: string, type: string): any
  • Gets a StructureDefinition based on the url and type. First determines if the url represents a base resource in the FHIR spec, then looks through the bundle passed to the constructor of the class to find the structure.

    Parameters

    • url: string

      The url of the profile to retrieve

    • type: string

      The type of resource the profile constrains (ex: Composition, or Patient, or Person, etc.)

    Returns any

Private merge

  • merge(diff: any, snapshot: any): any

Private process

  • Generates a snapshot for the specified structure definition. If the structure definition is based on another custom profile, that custom profile is found in the bundle passed to the constructor, and the snapshot is generated for the base profile, as well (recursively).

    Parameters

    Returns void

Static createBundle

  • Creates a bundle out of StructureDefinition resources. This is just for making it easier to pass a bundle to the constructor of this class.

    Parameters

    Returns Bundle

Generated using TypeDoc