Class: Oddb2xml::FHIR::Bundle

Inherits:
Object
  • Object
show all
Defined in:
lib/oddb2xml/fhir_support.rb

Overview

Bundle represents one line in the NDJSON file

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_line) ⇒ Bundle

Returns a new instance of Bundle.



164
165
166
167
168
# File 'lib/oddb2xml/fhir_support.rb', line 164

def initialize(json_line)
  data = JSON.parse(json_line)
  @entries = data["entry"] || []
  parse_entries
end

Instance Attribute Details

#authorizationsObject (readonly)

Returns the value of attribute authorizations.



162
163
164
# File 'lib/oddb2xml/fhir_support.rb', line 162

def authorizations
  @authorizations
end

#clinical_use_definitionsObject (readonly)

Returns the value of attribute clinical_use_definitions.



162
163
164
# File 'lib/oddb2xml/fhir_support.rb', line 162

def clinical_use_definitions
  @clinical_use_definitions
end

#ingredientsObject (readonly)

Returns the value of attribute ingredients.



162
163
164
# File 'lib/oddb2xml/fhir_support.rb', line 162

def ingredients
  @ingredients
end

#medicinal_productObject (readonly)

Returns the value of attribute medicinal_product.



162
163
164
# File 'lib/oddb2xml/fhir_support.rb', line 162

def medicinal_product
  @medicinal_product
end

#packagesObject (readonly)

Returns the value of attribute packages.



162
163
164
# File 'lib/oddb2xml/fhir_support.rb', line 162

def packages
  @packages
end

Instance Method Details

#cud_text_by_idObject

Lookup map: CUD id (e.g. “NORDIMET” or “GLIVEC.01”) => indication text. Used to resolve limitation texts that are stored as a reference on the RegulatedAuthorization rather than inline.



173
174
175
176
177
178
# File 'lib/oddb2xml/fhir_support.rb', line 173

def cud_text_by_id
  @cud_text_by_id ||= @clinical_use_definitions.each_with_object({}) do |cud, acc|
    next unless cud.id && cud.text
    acc[cud.id] = cud.text
  end
end