Class: FHIR::STU3::StructureDefinitionFinding

Inherits:
Object
  • Object
show all
Defined in:
lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributeObject

Returns the value of attribute attribute.



10
11
12
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 10

def attribute
  @attribute
end

#messageObject

Returns the value of attribute message.



11
12
13
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 11

def message
  @message
end

#pathObject

Returns the value of attribute path.



9
10
11
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 9

def path
  @path
end

#profileIdAObject

Returns the value of attribute profileIdA.



6
7
8
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 6

def profileIdA
  @profileIdA
end

#profileIdBObject

Returns the value of attribute profileIdB.



7
8
9
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 7

def profileIdB
  @profileIdB
end

#resourceTypeObject

This is not an official FHIR Resource type. It is a data structure used for reporting.



5
6
7
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 5

def resourceType
  @resourceType
end

#statusObject

Returns the value of attribute status.



8
9
10
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 8

def status
  @status
end

#valueAObject

Returns the value of attribute valueA.



12
13
14
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 12

def valueA
  @valueA
end

#valueBObject

Returns the value of attribute valueB.



13
14
15
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 13

def valueB
  @valueB
end

Instance Method Details

#cloneObject



42
43
44
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 42

def clone
  from_json(to_json)
end

#error(path, attribute, message, value_a, value_b) ⇒ Object



57
58
59
60
61
62
63
64
65
66
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 57

def error(path, attribute, message, value_a, value_b)
  obj = clone
  obj.status = 'ERROR'
  obj.path = path
  obj.attribute = attribute
  obj.message = message
  obj.valueA = value_a
  obj.valueB = value_b
  obj
end

#from_json(json) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 23

def from_json(json)
  obj = FHIR::STU3::StructureDefinitionFinding.new
  if json.is_a? String
    begin
      if json.encoding.names.include? 'UTF-8'
        json.gsub!("\xEF\xBB\xBF".force_encoding('UTF-8'), '') # remove UTF-8 BOM
      end
      hash = JSON.parse(json)
      hash.each do |key, value|
        obj.send("#{key}=".to_sym, value) if value
      end
    rescue => e
      FHIR.logger.error "Failed to parse JSON: #{e.message}"
      return nil
    end
  end
  obj
end

#to_jsonObject



19
20
21
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 19

def to_json
  JSON.pretty_unparse(as_json)
end

#to_sObject



15
16
17
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 15

def to_s
  "#{resourceType},#{profileIdA},#{profileIdB},#{path},#{attribute},#{status},#{message},#{valueA},#{valueB}"
end

#warning(path, attribute, message, value_a, value_b) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb', line 46

def warning(path, attribute, message, value_a, value_b)
  obj = clone
  obj.status = 'WARNING'
  obj.path = path
  obj.attribute = attribute
  obj.message = message
  obj.valueA = value_a
  obj.valueB = value_b
  obj
end