Class: Helper::XmlEnumsToOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/helper/xml_enums_to_output.rb

Constant Summary collapse

RATINGS =
{
  "0" => "N/A",
  "1" => "Very Poor",
  "2" => "Poor",
  "3" => "Average",
  "4" => "Good",
  "5" => "Very Good",
}.freeze
BUILT_FORM =
{
  "1" => "Detached",
  "2" => "Semi-Detached",
  "3" => "End-Terrace",
  "4" => "Mid-Terrace",
  "5" => "Enclosed End-Terrace",
  "6" => "Enclosed Mid-Terrace",
  "7" => "Linked Detached",
  "NR" => "Not Recorded",
}.freeze
SAP_ENERGY_TARIFF =
{
  "1" => "standard tariff",
  "2" => "off-peak 7 hour",
  "3" => "off-peak 10 hour",
  "4" => "24 hour",
  "ND" => "not applicable",
}.freeze
RDSAP_ENERGY_TARIFF =
{
  "1" => "dual",
  "2" => "Single",
  "3" => "Unknown",
  "4" => "dual (24 hour)",
  "5" => "off-peak 18 hour",
  "6" => "off-peak 10 hour",
}.freeze
RDSAP_GLAZED_TYPE =
{
  "1" => "double glazing installed before 2002",
  "2" => "double glazing installed during or after 2002",
  "3" => "double glazing, unknown install date",
  "4" => "secondary glazing",
  "5" => "single glazing",
  "6" => "triple glazing",
  "7" => "double, known data",
  "8" => "triple, known data",
  "ND" => "not defined",
  "6-post20" => "triple glazing, unknown install date",
  "9" => "triple glazing, installed between 2002-2022 in EAW, 2003-2023 in SCT, 2006-2022 NI",
  "10" => "triple glazing, installed before 2002 in EAW, 2003 in SCT, 2006 NI",
  "11" => "secondary glazing, normal emissivity",
  "12" => "secondary glazing, low emissivity",
  "13" => "double glazing, installed during or after 2022 in EAW, 2023 in SCT, 2022 NI",
  "14" => "triple glazing, installed during or after 2022 in EAW, 2023 in SCT, 2022 NI",

}.freeze
RDSAP_GLAZED_AREA =
{
  "1" => "Normal",
  "2" => "More Than Typical",
  "3" => "Less Than Typical",
  "4" => "Much More Than Typical",
  "5" => "Much Less Than Typical",
  "ND" => "Not Defined",
}.freeze
TENURE =
{
  "1" => "Owner-occupied",
  "2" => "Rented (social)",
  "3" => "Rented (private)",
  "ND" =>
    "Not defined - use in the case of a new dwelling for which the intended tenure in not known. It is not to be used for an existing dwelling",
}.freeze
TRANSACTION_TYPE =
{
  "1" => "marketed sale",
  "2" => "non marketed sale",
  "3" =>
    "rental (social) - this is for backwards compatibility only and should not be used",
  "4" =>
    "rental (private) - this is for backwards compatibility only and should not be used",
  "5" => "not sale or rental",
  "ni_5" => "None of the above",
  "6" => "new dwelling",
  "7" =>
    "not recorded - this is for backwards compatibility only and should not be used",
  "8" => "rental",
  "9" => "assessment for green deal",
  "10" => "following green deal",
  "11" => "FiT application",
  "12" => "Stock condition survey",
  "12RdSAP" => "RHI application",
  "13RdSAP" => "ECO assessment",
  "14RdSAP" => "Stock condition survey",
  "15RdSAP" => "Grant scheme (ECO, RHI, etc.)",
  "16RdSAP" => "Non-grant scheme (e.g. MEES)",
  "17RdSAP" => "re-mortgaging",
}.freeze
CONSTRUCTION_AGE_BAND =
{
  "A" => "England and Wales: before 1900",
  "B" => "England and Wales: 1900-1929",
  "C" => "England and Wales: 1930-1949",
  "D" => "England and Wales: 1950-1966",
  "E" => "England and Wales: 1967-1975",
  "F" => "England and Wales: 1976-1982",
  "G" => "England and Wales: 1983-1990",
  "H" => "England and Wales: 1991-1995",
  "I" => "England and Wales: 1996-2002",
  "J" => "England and Wales: 2003-2006",
  "K" => "England and Wales: 2007-2011",
  "K-pre-17.0" => "England and Wales: 2007 onwards",
  "K-12.0" => "Post-2006",
  "L" => "England and Wales: 2012 onwards",
  "L-post-20" => "England and Wales: 2012-2021",
  "M" => "England and Wales: 2022 onwards",
  "0" => "Not applicable",
  "NR" => "Not recorded",
}.freeze
CONSTRUCTION_AGE_BAND_NI =
{
  "A" => "Northern Ireland: before 1919",
  "A-12.0" => "Pre-1900",
  "B" => "Northern Ireland: 1919-1929",
  "B-12.0" => "1900-1929",
  "C" => "Northern Ireland: 1930-1949",
  "C-12.0" => "1930-1949",
  "D" => "Northern Ireland: 1950-1973",
  "D-12.0" => "1950-1966",
  "E" => "Northern Ireland: 1974-1977",
  "E-12.0" => "1967-1975",
  "F" => "Northern Ireland: 1978-1985",
  "F-12.0" => "1976-1982",
  "G" => "Northern Ireland: 1986-1991",
  "G-12.0" => "1983-1990",
  "H" => "Northern Ireland: 1992-1999",
  "H-12.0" => "1991-1995",
  "I" => "Northern Ireland: 2000-2006",
  "I-12.0" => "1996-2002",
  "J" => "Northern Ireland: not applicable",
  "J-12.0" => "2003-2006",
  "K-RdSAP-NI" => "Northern Ireland: 2007-2013",
  "K-SAP-NI" => "Northern Ireland: 2007 onwards",
  "K-12.0" => "Post-2006",
  "L" => "Northern Ireland: 2014 onwards",
  "M" => "Northern Ireland: 2022 onwards",
  "0" => "Not applicable",
  "NR" => "Not recorded",
}.freeze
PROPERTY_TYPE =
{
  "0" => "House",
  "1" => "Bungalow",
  "2" => "Flat",
  "3" => "Maisonette",
  "4" => "Park home",
}.freeze
HEAT_LOSS_CORRIDOR =
{
  "0" => "no corridor",
  "1" => "heated corridor",
  "2" => "unheated corridor",
  "3" => "stairwell",
}.freeze
MECHANICAL_VENTILATION =
{
  "0" => "natural",
  "1" => "mechanical, supply and extract",
  "2" => "mechanical, extract only",
  "0-pre12.0" => "none",
  "1-pre12.0" => "mechanical - heat recovering",
  "2-pre12.0" => "mechanical - non recovering",
  "1-post20" => "mechanical ventilation without heat recovery (MV)",
  "2-post20" => "mechanical extract, decentralised (MEV dc)",
  "3-post20" => "mechanical extract, centralised (MEV c)",
  "4-post20" => "mechanical ventilation with heat recovery (MVHR)",
  "5-post20" => "positive input from loft",
  "6-post20" => "positive input from outside",
}.freeze
CEPC_TRANSACTION_TYPE =
{
  "1" => "Mandatory issue (Marketed sale)",
  "2" => "Mandatory issue (Non-marketed sale)",
  "3" => "Mandatory issue (Property on construction).",
  "4" => "Mandatory issue (Property to let).",
  "5" => "Voluntary re-issue (A valid EPC is already lodged).",
  "6" => "Voluntary (No legal requirement for an EPC).",
  "7" => "Not recorded.",
}.freeze
VENTILATION_TYPE =
{
  "1" => "natural with intermittent extract fans",
  "2" => "natural with passive vents",
  "3" => "positive input from loft",
  "4" => "positive input from outside",
  "5" => "mechanical extract, centralised (MEV c)",
  "6" => "mechanical extract, decentralised (MEV dc)",
  "7" => "balanced without heat recovery (MV)",
  "8" => "balanced with heat recovery (MVHR)",
  "9" => "natural with intermittent extract fans and/or passive vents. For backwards compatibility only, do not use.",
  "10" => "natural with intermittent extract fans and passive vents",
}.freeze
CYLINDER_INSULATION_THICKNESS =
{
  "0" => "0 mm",
  "12" => "12 mm",
  "25" => "25 mm",
  "38" => "38 mm",
  "50" => "50 mm",
  "80" => "80 mm",
  "120" => "120 mm",
  "160" => "160 mm",
}.freeze
RDSAP_FUEL_TYPE =
{
  "0" => "To be used only when there is no heating/hot-water system or data is from a community network",
  "1" => "mains gas - this is for backwards compatibility only and should not be used",
  "2" => "LPG - this is for backwards compatibility only and should not be used",
  "3" => "bottled LPG",
  "4" => "oil - this is for backwards compatibility only and should not be used",
  "5" => "anthracite",
  "6" => "wood logs",
  "7" => "bulk wood pellets",
  "8" => "wood chips",
  "9" => "dual fuel - mineral + wood",
  "10" => "electricity - this is for backwards compatibility only and should not be used",
  "11" => "waste combustion - this is for backwards compatibility only and should not be used",
  "12" => "biomass - this is for backwards compatibility only and should not be used",
  "13" => "biogas - landfill - this is for backwards compatibility only and should not be used",
  "14" => "house coal - this is for backwards compatibility only and should not be used",
  "15" => "smokeless coal",
  "16" => "wood pellets in bags for secondary heating",
  "17" => "LPG special condition",
  "18" => "B30K (not community)",
  "19" => "bioethanol",
  "20" => "mains gas (community)",
  "21" => "LPG (community)",
  "22" => "oil (community)",
  "23" => "B30D (community)",
  "24" => "coal (community)",
  "25" => "electricity (community)",
  "26" => "mains gas (not community)",
  "27" => "LPG (not community)",
  "28" => "oil (not community)",
  "29" => "electricity (not community)",
  "30" => "waste combustion (community)",
  "31" => "biomass (community)",
  "32" => "biogas (community)",
  "33" => "house coal (not community)",
  "34" => "biodiesel from any biomass source",
  "35" => "biodiesel from used cooking oil only",
  "36" => "biodiesel from vegetable oil only (not community)",
  "36-rapeseed-oil" => "rapeseed oil",
  "37" => "appliances able to use mineral oil or liquid biofuel",
  "51" => "biogas (not community)",
  "56" => "heat from boilers that can use mineral oil or biodiesel (community)",
  "57" => "heat from boilers using biodiesel from any biomass source (community)",
  "58" => "biodiesel from vegetable oil only (community)",
  "99" => "from heat network data (community)",
}.freeze
RDSAP_FUEL_TYPE_PRE_143 =
{
  "1-pre14.3-sap" => "mains gas",
  "4-pre14.3-sap" => "oil",
  "10-pre14.3-sap" => "electricity",
  "11-pre14.3-sap" => "waste combustion",
  "12-pre14.3-sap" => "biomass",
  "13-pre14.3-sap" => "biogas - landfill",
  "14-pre14.3-sap" => "house coal",
}.freeze
SAP_FUEL_TYPE =
{
  "1" => "Gas: mains gas",
  "2" => "Gas: bulk LPG",
  "3" => "Gas: bottled LPG",
  "4" => "Oil: heating oil",
  "7" => "Gas: biogas",
  "8" => "LNG",
  "9" => "LPG subject to Special Condition 18",
  "10" => "Solid fuel: dual fuel appliance (mineral and wood)",
  "11" => "Solid fuel: house coal",
  "12" => "Solid fuel: manufactured smokeless fuel",
  "15" => "Solid fuel: anthracite",
  "20" => "Solid fuel: wood logs",
  "21" => "Solid fuel: wood chips",
  "22" => "Solid fuel: wood pellets (in bags, for secondary heating)",
  "23" => "Solid fuel: wood pellets (bulk supply in bags, for main heating)",
  "36" => "Electricity: electricity sold to grid",
  "37" => "Electricity: electricity displaced from grid",
  "39" => "Electricity: electricity, unspecified tariff",
  "41" => "Community heating schemes: heat from electric heat pump",
  "42" => "Community heating schemes: heat from boilers - waste combustion",
  "43" => "Community heating schemes: heat from boilers - biomass",
  "44" => "Community heating schemes: heat from boilers - biogas",
  "45" => "Community heating schemes: waste heat from power stations",
  "46" => "Community heating schemes: geothermal heat source",
  "48" => "Community heating schemes: heat from CHP",
  "49" => "Community heating schemes: electricity generated by CHP",
  "50" => "Community heating schemes: electricity for pumping in distribution network",
  "51" => "Community heating schemes: heat from mains gas",
  "52" => "Community heating schemes: heat from LPG",
  "53" => "Community heating schemes: heat from oil",
  "54" => "Community heating schemes: heat from coal",
  "55" => "Community heating schemes: heat from B30D",
  "56" => "Community heating schemes: heat from boilers that can use mineral oil or biodiesel",
  "57" => "Community heating schemes: heat from boilers using biodiesel from any biomass source",
  "58" => "Community heating schemes: biodiesel from vegetable oil only",
  "71" => "biodiesel from any biomass source",
  "72" => "biodiesel from used cooking oil only",
  "73" => "biodiesel from vegetable oil only",
  "74" => "appliances able to use mineral oil or liquid biofuel",
  "75" => "B30K",
  "76" => "bioethanol from any biomass source",
  "99" => "Community heating schemes: special fuel",
}.freeze
MAIN_HEATING_CATEGORY =
{
  "1" => "none",
  "2" => "boiler with radiators or underfloor heating",
  "3" => "micro-cogeneration",
  "4" => "heat pump with radiators or underfloor heating",
  "5" => "heat pump with warm air distribution",
  "6" => "community heating system",
  "7" => "electric storage heaters",
  "8" => "electric underfloor heating",
  "9" => "warm air system (not heat pump)",
  "10" => "room heaters",
  "11" => "other system",
  "12" => "not recorded",
}.freeze

Class Method Summary collapse

Class Method Details

.built_form_string(number) ⇒ Object



315
316
317
# File 'lib/helper/xml_enums_to_output.rb', line 315

def self.built_form_string(number)
  BUILT_FORM[number]
end

.cepc_transaction_type(value) ⇒ Object



535
536
537
# File 'lib/helper/xml_enums_to_output.rb', line 535

def self.cepc_transaction_type(value)
  CEPC_TRANSACTION_TYPE[value] || value
end

.construction_age_band_lookup(value, schema_type, report_type) ⇒ Object



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'lib/helper/xml_enums_to_output.rb', line 375

def self.construction_age_band_lookup(value, schema_type, report_type)
  types_of_sap_pre17 = i[
    SAP-Schema-16.3
    SAP-Schema-16.2
    SAP-Schema-16.1
    SAP-Schema-16.0
    SAP-Schema-15.0
    SAP-Schema-14.2
    SAP-Schema-14.1
    SAP-Schema-14.0
    SAP-Schema-13.0
    SAP-Schema-12.0
    SAP-Schema-11.2
    SAP-Schema-11.0
  ].freeze

  schemes_that_use_not_recorded = i[
    SAP-Schema-16.3
    SAP-Schema-16.2
    SAP-Schema-16.1
    RdSAP-Schema-20.0.0
    RdSAP-Schema-19.0
    RdSAP-Schema-18.0
    RdSAP-Schema-17.1
    RdSAP-Schema-17.0
  ]

  schemes_that_use_l = i[
    SAP-Schema-19.1.0
    SAP-Schema-19.0.0
    SAP-Schema-18.0.0
    SAP-Schema-17.1
    SAP-Schema-17.0
    RdSAP-Schema-20.0.0
    RdSAP-Schema-19.0
    RdSAP-Schema-18.0
    RdSAP-Schema-17.1
    RdSAP-Schema-17.0
  ]

  schemes_that_use_0 = i[
    SAP-Schema-16.3
    SAP-Schema-16.2
    SAP-Schema-16.1
    SAP-Schema-16.0
    SAP-Schema-15.0
    SAP-Schema-14.2
    SAP-Schema-14.1
    SAP-Schema-14.0
    SAP-Schema-13.0
    SAP-Schema-12.0
    RdSAP-Schema-20.0.0
    RdSAP-Schema-21.0.0
    RdSAP-Schema-19.0
    RdSAP-Schema-18.0
    RdSAP-Schema-17.1
    RdSAP-Schema-17.0
  ]

  sap_schemas_ni = i[
    SAP-Schema-NI-18.0.0
    SAP-Schema-NI-17.4
    SAP-Schema-NI-17.3
    SAP-Schema-NI-17.2
    SAP-Schema-NI-17.1
    SAP-Schema-NI-17.0
    SAP-Schema-NI-16.1
    SAP-Schema-NI-16.0
    SAP-Schema-NI-15.0
    SAP-Schema-NI-14.2
    SAP-Schema-NI-14.1
    SAP-Schema-NI-14.0
    SAP-Schema-NI-13.0
  ]

  rdsap_schemas_ni = i[
    RdSAP-Schema-NI-21.0.0
    RdSAP-Schema-NI-20.0.0
    RdSAP-Schema-NI-19.0
    RdSAP-Schema-NI-18.0
    RdSAP-Schema-NI-17.4
    RdSAP-Schema-NI-17.3
  ]

  ni_schemas_pre_12 = i[
    SAP-Schema-NI-12.0
    SAP-Schema-NI-11.2
  ]

  if value == "K" && rdsap_schemas_ni.include?(schema_type)
    return CONSTRUCTION_AGE_BAND_NI["K-RdSAP-NI"] || value
  end

  if value == "K" && sap_schemas_ni.include?(schema_type)
    return CONSTRUCTION_AGE_BAND_NI["K-SAP-NI"] || value
  end

  if ni_schemas_pre_12.include?(schema_type)
    key = (value == "0" ? value : "#{value}-12.0")
    return CONSTRUCTION_AGE_BAND_NI[key] || value
  end

  if sap_schemas_ni.include?(schema_type) || rdsap_schemas_ni.include?(schema_type)
    return CONSTRUCTION_AGE_BAND_NI[value] || value
  end

  if value == "K" && schema_type == :"SAP-Schema-12.0" && is_rdsap(report_type)
    return CONSTRUCTION_AGE_BAND["K-12.0"]
  end

  if value == "K" && types_of_sap_pre17.include?(schema_type)
    return CONSTRUCTION_AGE_BAND["K-pre-17.0"]
  end

  if value == "NR" &&
      (!schemes_that_use_not_recorded.include?(schema_type) || is_sap(report_type))
    return value
  end

  if value == "L" && schemas_post_20.include?(schema_type)
    return CONSTRUCTION_AGE_BAND["L-post-20"]
  end

  return value if value == "L" && !schemes_that_use_l.include?(schema_type)

  if value == "0" &&
      (!schemes_that_use_0.include?(schema_type) || is_sap(report_type))
    return value
  end

  value == "" ? nil : CONSTRUCTION_AGE_BAND[value] || value
end

.cylinder_insulation_thickness(value, report_type = "2") ⇒ Object



539
540
541
542
543
544
545
# File 'lib/helper/xml_enums_to_output.rb', line 539

def self.cylinder_insulation_thickness(value, report_type = "2")
  if is_rdsap(report_type)
    CYLINDER_INSULATION_THICKNESS[value]
  else
    value
  end
end

.energy_rating_string(value) ⇒ Object



319
320
321
# File 'lib/helper/xml_enums_to_output.rb', line 319

def self.energy_rating_string(value)
  RATINGS[value]
end

.energy_tariff(value, report_type) ⇒ Object



323
324
325
326
327
328
329
330
331
# File 'lib/helper/xml_enums_to_output.rb', line 323

def self.energy_tariff(value, report_type)
  if is_sap(report_type)
    SAP_ENERGY_TARIFF[value] || value
  elsif is_rdsap(report_type)
    RDSAP_ENERGY_TARIFF[value] || value
  else
    value
  end
end

.fuel_type(value, schema_type = "", report_type = "2") ⇒ Object



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
# File 'lib/helper/xml_enums_to_output.rb', line 573

def self.fuel_type(value, schema_type = "", report_type = "2")
  rdsap = i[
    RdSAP-Schema-21.0.1
    RdSAP-Schema-21.0.0
    RdSAP-Schema-20.0.0
    RdSAP-Schema-19.0
    RdSAP-Schema-18.0
    RdSAP-Schema-17.1
    RdSAP-Schema-17.0
    RdSAP-Schema-NI-21.0.1
    RdSAP-Schema-NI-21.0.0
    RdSAP-Schema-NI-20.0.0
    RdSAP-Schema-NI-19.0
    RdSAP-Schema-NI-18.0
    RdSAP-Schema-NI-17.4
    RdSAP-Schema-NI-17.3
  ]

  pre143_sap = i[
    SAP-Schema-14.2
    SAP-Schema-14.1
    SAP-Schema-14.0
    SAP-Schema-13.0
    SAP-Schema-12.0
    SAP-Schema-11.2
    SAP-Schema-11.0
    SAP-Schema-10.2
    SAP-Schema-NI-14.2
    SAP-Schema-NI-14.1
    SAP-Schema-NI-14.0
    SAP-Schema-NI-13.0
    SAP-Schema-NI-12.0
    SAP-Schema-NI-11.2
  ]

  includes_rapeseed_oil = i[
    SAP-Schema-16.3
    SAP-Schema-16.2
    SAP-Schema-16.1
    SAP-Schema-16.0
    SAP-Schema-15.0
    SAP-Schema-NI-17.2
    SAP-Schema-NI-17.1
    SAP-Schema-NI-17.0
    SAP-Schema-NI-16.1
    SAP-Schema-NI-16.0
    SAP-Schema-NI-15.0
  ]

  sap = i[
    SAP-Schema-19.1.0
    SAP-Schema-19.0.0
    SAP-Schema-18.0.0
    SAP-Schema-17.1
    SAP-Schema-17.0
    SAP-Schema-16.3
    SAP-Schema-16.2
    SAP-Schema-16.1
    SAP-Schema-16.0
    SAP-Schema-15.0
    SAP-Schema-14.2
    SAP-Schema-14.1
    SAP-Schema-14.0
    SAP-Schema-13.0
    SAP-Schema-12.0
    SAP-Schema-11.2
    SAP-Schema-11.0
    SAP-Schema-10.2
    SAP-Schema-NI-18.0.0
    SAP-Schema-NI-17.4
    SAP-Schema-NI-17.3
    SAP-Schema-NI-17.2
    SAP-Schema-NI-17.1
    SAP-Schema-NI-17.0
    SAP-Schema-NI-16.1
    SAP-Schema-NI-16.0
    SAP-Schema-NI-15.0
    SAP-Schema-NI-14.2
    SAP-Schema-NI-14.1
    SAP-Schema-NI-14.0
    SAP-Schema-NI-13.0
    SAP-Schema-NI-12.0
    SAP-Schema-NI-11.2
  ]

  if rdsap.include?(schema_type)
    RDSAP_FUEL_TYPE[value]
  elsif sap.include?(schema_type) && is_sap(report_type)
    SAP_FUEL_TYPE[value]
  elsif sap.include?(schema_type) && is_rdsap(report_type)
    if includes_rapeseed_oil.include?(schema_type) && value == "36"
      return RDSAP_FUEL_TYPE["#{value}-rapeseed-oil"]
    end

    if pre143_sap.include?(schema_type)
      RDSAP_FUEL_TYPE_PRE_143["#{value}-pre14.3-sap"] || RDSAP_FUEL_TYPE[value]
    else
      RDSAP_FUEL_TYPE[value]
    end
  end
end

.glazed_area_rdsap(value) ⇒ Object



333
334
335
# File 'lib/helper/xml_enums_to_output.rb', line 333

def self.glazed_area_rdsap(value)
  RDSAP_GLAZED_AREA[value]
end

.glazed_type_rdsap(value, schema_type = "") ⇒ Object



337
338
339
340
341
342
343
# File 'lib/helper/xml_enums_to_output.rb', line 337

def self.glazed_type_rdsap(value, schema_type = "")
  if value == "6" && schemas_post_20.include?(schema_type)
    return RDSAP_GLAZED_TYPE["#{value}-post20"]
  end

  RDSAP_GLAZED_TYPE[value]
end

.heat_loss_corridor(value) ⇒ Object



512
513
514
# File 'lib/helper/xml_enums_to_output.rb', line 512

def self.heat_loss_corridor(value)
  HEAT_LOSS_CORRIDOR[value] || value
end

.main_heating_category(value:) ⇒ Object



675
676
677
# File 'lib/helper/xml_enums_to_output.rb', line 675

def self.main_heating_category(value:)
  MAIN_HEATING_CATEGORY[value] || value
end

.mechanical_ventilation(value, schema_type, report_type) ⇒ Object



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/helper/xml_enums_to_output.rb', line 516

def self.mechanical_ventilation(value, schema_type, report_type)
  types_of_sap_pre12 = i[
    SAP-Schema-11.2
    SAP-Schema-11.0
    SAP-Schema-10.2
    SAP-Schema-NI-11.2
  ].freeze

  if types_of_sap_pre12.include?(schema_type) && is_rdsap(report_type)
    return MECHANICAL_VENTILATION["#{value}-pre12.0"]
  end

  if schemas_post_20.include?(schema_type) && is_rdsap(report_type)
    return MECHANICAL_VENTILATION["#{value}-post20"]
  end

  MECHANICAL_VENTILATION[value] || value
end

.property_type(value) ⇒ Object



508
509
510
# File 'lib/helper/xml_enums_to_output.rb', line 508

def self.property_type(value)
  PROPERTY_TYPE[value] || value
end

.tenure(value) ⇒ Object



345
346
347
# File 'lib/helper/xml_enums_to_output.rb', line 345

def self.tenure(value)
  TENURE[value] || value
end

.transaction_type(value, report_type = "2", schema_type = "") ⇒ Object



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/helper/xml_enums_to_output.rb', line 349

def self.transaction_type(value, report_type = "2", schema_type = "")
  types_of_ni = i[
    RdSAP-Schema-NI-21.0.0
    RdSAP-Schema-NI-20.0.0
    RdSAP-Schema-NI-19.0
    RdSAP-Schema-NI-18.0
    RdSAP-Schema-NI-17.4
    RdSAP-Schema-NI-17.3
    SAP-Schema-NI-16.1
    SAP-Schema-NI-17.0
    SAP-Schema-NI-17.1
    SAP-Schema-NI-17.2
    SAP-Schema-NI-17.3
    SAP-Schema-NI-17.4
    SAP-Schema-NI-18.0.0
  ]

  if is_rdsap(report_type) && value.to_i >= 12
    TRANSACTION_TYPE["#{value}RdSAP"]
  elsif types_of_ni.include?(schema_type) && value.to_i == 5
    TRANSACTION_TYPE["ni_5"]
  else
    TRANSACTION_TYPE[value] || value
  end
end

.ventilation_type(value, schema_type = "") ⇒ Object



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/helper/xml_enums_to_output.rb', line 555

def self.ventilation_type(value, schema_type = "")
  ni_sap = i[
    SAP-Schema-NI-16.1
    SAP-Schema-NI-16.0
    SAP-Schema-NI-15.0
    SAP-Schema-NI-14.2
    SAP-Schema-NI-14.1
    SAP-Schema-NI-14.0
    SAP-Schema-NI-13.0
  ].freeze

  if ni_sap.include?(schema_type) && value == "9"
    VENTILATION_TYPE[value].split(".").first
  else
    VENTILATION_TYPE[value]
  end
end