isicSection = m1 sicDivision = m2 hasBrands = m3 financeMetrics = [m4, m5] supplierMetrics = [m6, m7, m8, m9, m10] gri = m11 act = m12 sicMap = A: "A" B: "B" C: "F" D: "C" F: "G" G: "G" H: "K" J: "O" griMap = "Automotive": ["C", "G"] "Chemicals": "C" "Energy": "D" "Metals Products": "C" "Telecommunications": "J" "Financial Services": "K" actMap = "Consumption": "G" "Energy & Resource Extraction": "D" "Financials": "K" "Health Care": "Q" "Resource Transformation": "C" "Technology & Communications": "J" "Transportation": "H" isKnown = (answer) -> answer != "Unknown" anyKnown = (answerList) -> answerList.find isKnown mappedCodes = (answer, map) -> return unless isKnown answer codes = answer.map (a) -> map[a] codes = codes.filter Boolean return codes if codes.length if isKnown isicSection isicSection else if val = mappedCodes sicDivision, sicMap val else if isKnown hasBrands "G" else if anyKnown financeMetrics "K" else if anyKnown supplierMetrics "C" else if val = griMap[gri] val else if val = mappedCodes act, actMap val else "Unknown"