Class: Generator::IGResourcesExtractor
- Inherits:
-
Object
- Object
- Generator::IGResourcesExtractor
- Defined in:
- lib/au_ps_inferno/generator/ig_resources_extractor.rb
Overview
Extracts FHIR resources from an Implementation Guide (IG) package archive and optionally from a folder of additional JSON resources.
Reads a .tar.gz (or .tgz) package, parses JSON entries that represent FHIR
resources (excluding OpenAPI JSON), and populates #ig_resources with
FHIR model instances. If additional_resources_path is set, all .json
files from that folder (and subfolders) are loaded after the package,
so you can supply missing StructureDefinitions, SearchParameters, etc.
Instance Attribute Summary collapse
-
#ig_resources ⇒ Array<FHIR::Model>
readonly
FHIR resources extracted from the IG package and optional folder.
-
#ig_version ⇒ Array<FHIR::Model>
readonly
FHIR resources extracted from the IG package and optional folder.
Instance Method Summary collapse
-
#extract ⇒ void
Processes the package archive and optional folder, and populates #ig_resources.
-
#initialize(ig_path, additional_resources_path: nil) ⇒ IGResourcesExtractor
constructor
A new instance of IGResourcesExtractor.
Constructor Details
#initialize(ig_path, additional_resources_path: nil) ⇒ IGResourcesExtractor
Returns a new instance of IGResourcesExtractor.
32 33 34 35 36 37 |
# File 'lib/au_ps_inferno/generator/ig_resources_extractor.rb', line 32 def initialize(ig_path, additional_resources_path: nil) @ig_path = ig_path @additional_resources_path = additional_resources_path @ig_resources = [] @ig_version = nil end |
Instance Attribute Details
#ig_resources ⇒ Array<FHIR::Model> (readonly)
Returns FHIR resources extracted from the IG package and optional folder.
27 28 29 |
# File 'lib/au_ps_inferno/generator/ig_resources_extractor.rb', line 27 def ig_resources @ig_resources end |
#ig_version ⇒ Array<FHIR::Model> (readonly)
Returns FHIR resources extracted from the IG package and optional folder.
27 28 29 |
# File 'lib/au_ps_inferno/generator/ig_resources_extractor.rb', line 27 def ig_version @ig_version end |
Instance Method Details
#extract ⇒ void
This method returns an undefined value.
Processes the package archive and optional folder, and populates #ig_resources. Handles gzip/tar errors and prints messages to stdout on failure.
43 44 45 46 |
# File 'lib/au_ps_inferno/generator/ig_resources_extractor.rb', line 43 def extract process_package_archive load_additional_resources_from_folder if @additional_resources_path end |