class ViewModel::Cepc50::AcReport

Public Instance Methods

air_handling_systems() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 152
def air_handling_systems
  []
end
checklist_values(checklist) click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 88
def checklist_values(checklist)
  results =
    checklist&.element_children&.map { |node|
      checklist_item = node.name.underscore.to_sym
      value = node.content == "Yes"
      { checklist_item => value }
    }&.inject(&:merge)

  results.nil? ? {} : results
end
cooling_plants() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 82
def cooling_plants
  @xml_doc
    .search("Air-Conditioning-Inspection-Report/ACI-Cooling-Plant")
    .map { |_node| {} }
end
executive_summary() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 8
def executive_summary
  xpath(%w[Executive-Summary])
end
extract_aci_recommendations(nodes) click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 12
def extract_aci_recommendations(nodes)
  nodes.filter_map do |node|
    unless node.at("Text").content.nil? || node.at("Text").content.empty?
      {
        sequence: node.at("Seq-Number").content,
        text: node.at("Text").content,
      }
    end
  end
end
key_recommendations_control() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 39
def key_recommendations_control
  extract_aci_recommendations(
    @xml_doc.search(
      "ACI-Recommendations/Alternative-Solutions/ACI-Recommendation",
    ),
  )
end
key_recommendations_efficiency() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 23
def key_recommendations_efficiency
  extract_aci_recommendations(
    @xml_doc.search(
      "ACI-Recommendations/System-Efficiency/ACI-Recommendation",
    ),
  )
end
key_recommendations_maintenance() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 31
def key_recommendations_maintenance
  extract_aci_recommendations(
    @xml_doc.search(
      "ACI-Recommendations/Improvement-Options/ACI-Recommendation",
    ),
  )
end
key_recommendations_management() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 47
def key_recommendations_management
  extract_aci_recommendations(
    @xml_doc.search(
      "ACI-Recommendations/Other-Recommendations/ACI-Recommendation",
    ),
  )
end
pre_inspection_checklist() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 99
def pre_inspection_checklist
  pcs_essential =
    checklist_values(
      @xml_doc.at(
        "PCS-Pre-Inspection-Information/PCS-Pre-Inspection-Essential",
      ),
    )
  pcs_desirable =
    checklist_values(
      @xml_doc.at(
        "PCS-Pre-Inspection-Information/PCS-Pre-Inspection-Desirable",
      ),
    )
  pcs_optional =
    checklist_values(
      @xml_doc.at(
        "PCS-Pre-Inspection-Information/PCS-Pre-Inspection-Optional",
      ),
    )

  sccs_essential =
    checklist_values(
      @xml_doc.at(
        "SCCS-Pre-Inspection-Information/SCCS-Pre-Inspection-Essential",
      ),
    )
  sccs_desirable =
    checklist_values(
      @xml_doc.at(
        "SCCS-Pre-Inspection-Information/SCCS-Pre-Inspection-Desirable",
      ),
    )
  sccs_optional =
    checklist_values(
      @xml_doc.at(
        "SCCS-Pre-Inspection-Information/SCCS-Pre-Inspection-Optional",
      ),
    )

  {
    pcs: {
      essential: pcs_essential,
      desirable: pcs_desirable,
      optional: pcs_optional,
    },
    sccs: {
      essential: sccs_essential,
      desirable: sccs_desirable,
      optional: sccs_optional,
    },
  }
end
sub_systems() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 55
def sub_systems
  @xml_doc
    .search("ACI-Sub-Systems/ACI-Sub-System")
    .map do |node|
      {
        volume_definitions:
          node.at("Sub-System-Volume-Definitions")&.content,
        id: node.at("Sub-System-ID")&.content,
        description: node.at("Sub-System-Description")&.content,
        cooling_output: node.at("Sub-System-Cooling-Output")&.content,
        area_served:
          node.at("Sub-System-Area-Served-Description")&.content,
        inspection_date: node.at("Sub-System-Inspection-Date")&.content,
        cooling_plant_count:
          node.at("Sub-System-Cooling-Plant-Count")&.content,
        ahu_count: node.at("Sub-System-AHU-Count")&.content,
        terminal_units_count:
          node.at("Sub-System-Terminal-Units-Count")&.content,
        controls_count: node.at("Sub-System-Controls-Count")&.content,
      }
    end
end
system_controls() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 160
def system_controls
  []
end
terminal_units() click to toggle source
# File lib/view_model/cepc50/ac_report.rb, line 156
def terminal_units
  []
end