getAffiliation = ({ org, rep }) => {
const LAW_ENFORCEMENT = [
"pd",
"police",
"poloice",
"ilacp",
"fop",
"public safety",
"law enforce",
"sherif",
"probation",
"911",
"emergency",
"sergeant",
"enforcement",
"law enf",
"responder",
"back the blue",
"prosecutor",
"s attorney",
"seagent",
"sgt",
"pbpa",
"pba",
"map",
"isp",
"9-1-1",
"correction",
"leo ",
" leo",
"le family",
"prison",
"ofc",
"officer",
"investigation",
"idoc"
];
const GOVERNMENT = ["city", "village", "mayor", "county"];
const UNAFFILIATED = [
"none",
"citizen",
"self",
"personal",
"not available",
"applicable",
"resident",
"individual"
];
const affilStr = [org.toLowerCase(), rep.toLowerCase()].join(" ");
if (LAW_ENFORCEMENT.some(s => affilStr.includes(s))) {
return "Law Enforcement";
} else if (GOVERNMENT.some(s => affilStr.includes(s))) {
return "Government";
} else if (
UNAFFILIATED.some(s => affilStr.includes(s)) ||
org.toLowerCase().trim() === "na" ||
rep.toLowerCase().trim() === "na"
) {
return "Unaffiliated";
}
return "Other";
}