Last active
November 9, 2015 14:25
-
-
Save hyperking/81ea1ea1905a0a84bd24 to your computer and use it in GitHub Desktop.
How to structure BBCRM api designations response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CRMresponse = [{ | |
"Values": ["Arboretum Development Fund", "Arboretum", "University of Hyper\\Ontario Agricultural College\\Arboretum", "7b5ced38-53f1-412d-8a2a-98b947f086db", "", "Arboretum Development Fund", "7b5ced38-53f1-412d-8a2a-98b947f086db"] | |
}, { | |
"Values": ["Dean's Innovation Fund", "College of Arts", "University of Hyper\\College of Arts", "1ea85925-c4a9-4c3e-81f5-228b21ab1ec8", "Focuses on meeting the overall needs of the College of Arts.", "College of Arts Dean's Innovation Fund", "1ea85925-c4a9-4c3e-81f5-228b21ab1ec8"] | |
}, { | |
"Values": ["College of Arts Student Assistance", "College of Arts", "University of Hyper\\College of Arts", "bc17fa75-16c6-4c6a-876c-ef0ba284ec6f", "", "College of Arts Student Assistance", "bc17fa75-16c6-4c6a-876c-ef0ba284ec6f"] | |
}, { | |
"Values": ["CBS Highest Priority", "College of Biological Science", "University of Hyper\\College of Biological Science", "0e0863fd-92e3-40e7-a832-0ca0afdaf850", "", "CBS Highest Priority", "0e0863fd-92e3-40e7-a832-0ca0afdaf850"] | |
}, { | |
"Values": ["CBS Graduate Scholarship", "College of Biological Science", "University of Hyper\\College of Biological Science", "4bc32e2f-c84f-4f82-a882-53079ead29df", "", "CBS Graduate Scholarship", "4bc32e2f-c84f-4f82-a882-53079ead29df"] | |
}, { | |
"Values": ["CBS Undergraduate Student Assistance", "College of Biological Science", "University of Hyper\\College of Biological Science", "920e435a-41a5-4e1d-84de-9e1e93cbddcb", "", "CBS Undergraduate Student Assistance", "920e435a-41a5-4e1d-84de-9e1e93cbddcb"] | |
}, { | |
"Values": ["Macdonald Hall Project", "College of Business and Economics", "University of Hyper\\College of Business and Economics", "eda3605d-d1c2-4a8f-88a9-94830015f2e1", "", "Macdonald Hall Project", "eda3605d-d1c2-4a8f-88a9-94830015f2e1"] | |
}, { | |
"Values": ["Transformational Learning Fund", "College of Business and Economics", "University of Hyper\\College of Business and Economics", "7e1237d1-ad45-46af-8cc2-c41438500522", "", "Transformational Learning Fund", "7e1237d1-ad45-46af-8cc2-c41438500522"] | |
}, { | |
"Values": ["CBE Student Assistance", "College of Business and Economics", "University of Hyper\\College of Business and Economics", "02a2b8d2-591d-424a-a365-dc630a980a17", "", "CBE Student Assistance", "02a2b8d2-591d-424a-a365-dc630a980a17"] | |
}, { | |
"Values": ["College of Physical and Engineering Science Student Assistance", "College of Physical and Engineering Science", "University of Hyper\\College of Physical and Engineering Science", "ff2068f0-72ac-4a89-a13d-6e08a2cf0fd4", "Supports undergraduate and graduate CPES students through scholarships and bursaries.", "CPES Student Assistance", "ff2068f0-72ac-4a89-a13d-6e08a2cf0fd4"] | |
}, { | |
"Values": ["CPES Highest Priority", "College of Physical and Engineering Science", "University of Hyper\\College of Physical and Engineering Science", "d8af71da-099d-4738-85ac-8ca351613151", "", "CPES Highest Priority", "d8af71da-099d-4738-85ac-8ca351613151"] | |
}, { | |
"Values": ["Engineering Highest Priority", "College of Physical and Engineering Science", "University of Hyper\\College of Physical and Engineering Science", "045ccba5-e123-47b8-807b-8fc63632647e", "", "Engineering Highest Priority", "045ccba5-e123-47b8-807b-8fc63632647e"] | |
}, { | |
"Values": ["CSAHS Student Assistance", "College of Social and Applied Human Sciences", "University of Hyper\\College of Social and Applied Human Sciences", "3ca31397-80ea-4e7d-848e-233b4636f6dd", "", "CSAHS Student Assistance", "3ca31397-80ea-4e7d-848e-233b4636f6dd"] | |
}, { | |
"Values": ["Macdonald Institute Heritage Conservation Fund", "College of Social and Applied Human Sciences", "University of Hyper\\College of Social and Applied Human Sciences", "0a5410c0-eefd-47ef-87b9-30547fad629e", "", "Macdonald Institute Heritage Conservation Fund", "0a5410c0-eefd-47ef-87b9-30547fad629e"] | |
}, { | |
"Values": ["Learning Opportunities Trust", "College of Social and Applied Human Sciences", "University of Hyper\\College of Social and Applied Human Sciences", "74e34de5-7702-49c0-aea5-fca66f05ddb1", "", "Learning Opportunities Trust", "74e34de5-7702-49c0-aea5-fca66f05ddb1"] | |
}, { | |
"Values": ["Institute for Community Engagement", "College of Social and Applied Human Sciences", "University of Hyper\\College of Social and Applied Human Sciences", "78543293-df30-4776-8644-fdc7501c2394", "", "Institute for Community Engagement", "78543293-df30-4776-8644-fdc7501c2394"] | |
}, { | |
"Values": ["Athletics Scholarships", "Department of Athletics", "University of Hyper\\Student Affairs\\Department of Athletics", "35042894-b4e4-405c-a387-5a850d4e9472", "", "Athletics Scholarships", "35042894-b4e4-405c-a387-5a850d4e9472"] | |
}, { | |
"Values": ["Athletic Facilities Capital Fund", "Department of Athletics", "University of Hyper\\Student Affairs\\Department of Athletics", "09cd9381-b88f-41c9-94b4-5cd4634f15f0", "", "Athletic Facilities Capital Fund", "09cd9381-b88f-41c9-94b4-5cd4634f15f0"] | |
}, { | |
"Values": ["Adopt-A-Gryphon - General", "Department of Athletics", "University of Hyper\\Student Affairs\\Department of Athletics", "9ee3c4f2-c872-402e-8b9a-5f2b78463d85", "", "Adopt-A-Gryphon - General", "9ee3c4f2-c872-402e-8b9a-5f2b78463d85"] | |
}, { | |
"Values": ["Learning Commons", "Library", "University of Hyper\\Library", "e06e00c6-d31f-4e53-8aad-8e8cadb4e272", "", "Learning Commons", "e06e00c6-d31f-4e53-8aad-8e8cadb4e272"] | |
}, { | |
"Values": ["Library Highest Priority", "Library", "University of Hyper\\Library", "713da5ba-f5bc-42ac-8675-be1478b2abbd", "", "Library Highest Priority", "713da5ba-f5bc-42ac-8675-be1478b2abbd"] | |
}, { | |
"Values": ["Macdonald Stewart Art Centre", "Macdonald Stewart Art Centre", "University of Hyper\\Macdonald Stewart Art Centre", "1e83420b-abee-40f4-8d9a-b468febe9223", "", "Macdonald Stewart Art Centre", "1e83420b-abee-40f4-8d9a-b468febe9223"] | |
}, { | |
"Values": ["OAC Student Liaison Program", "OAC Alumni Foundation", "OAC Alumni Foundation", "1b6f05b8-759c-430b-856a-4d7ab921d589", "", "OAC Student Liaison Program", "1b6f05b8-759c-430b-856a-4d7ab921d589"] | |
}, { | |
"Values": ["OAC Student Assistance", "Ontario Agricultural College", "University of Hyper\\Ontario Agricultural College", "15933a87-2104-4501-8135-5d2d6aecdf73", "", "OAC Student Assistance", "15933a87-2104-4501-8135-5d2d6aecdf73"] | |
}, { | |
"Values": ["Food Leadership Trust", "Ontario Agricultural College", "University of Hyper\\Ontario Agricultural College", "73effa06-7999-4b2a-af4b-6d2cfe2bcd33", "", "Food Leadership Trust", "73effa06-7999-4b2a-af4b-6d2cfe2bcd33"] | |
}, { | |
"Values": ["OAC Learning Trust", "Ontario Agricultural College", "University of Hyper\\Ontario Agricultural College", "08e62261-5daa-4270-9a64-97cd5aa954a8", "", "OAC Learning Trust", "08e62261-5daa-4270-9a64-97cd5aa954a8"] | |
}, { | |
"Values": ["Equine Hyper - Greatest Need", "Ontario Veterinary College", "University of Hyper\\Ontario Veterinary College", "4d0c8db7-a1fe-4dc4-ae87-0b04970e9746", "", "Equine Hyper - Greatest Need", "4d0c8db7-a1fe-4dc4-ae87-0b04970e9746"] | |
}, { | |
"Values": ["Bovine Education Trust", "Ontario Veterinary College", "University of Hyper\\Ontario Veterinary College", "4bea3c02-afdb-42d2-b977-af8d5e57052e", "", "Bovine Education Trust", "4bea3c02-afdb-42d2-b977-af8d5e57052e"] | |
}, { | |
"Values": ["OVC Student Assistance", "Ontario Veterinary College", "University of Hyper\\Ontario Veterinary College", "41b204b2-92c2-4190-971c-b409bc1c40d9", "", "OVC Student Assistance", "41b204b2-92c2-4190-971c-b409bc1c40d9"] | |
}, { | |
"Values": ["OVC Highest Priority", "Ontario Veterinary College", "University of Hyper\\Ontario Veterinary College", "7367d94b-f0c5-4ac8-a2de-bf394af2e4e5", "", "OVC Highest Priority", "7367d94b-f0c5-4ac8-a2de-bf394af2e4e5"] | |
}, { | |
"Values": ["Pet Trust - Greatest Need", "Pet Trust", "University of Hyper\\Ontario Veterinary College\\Pet Trust", "f29f30ce-d9b4-440c-94d9-6109b48f899b", "Dedicated to advancing the health and well being of companion animals.", "Pet Trust - Greatest Need", "f29f30ce-d9b4-440c-94d9-6109b48f899b"] | |
}, { | |
"Values": ["Animal Cancer Centre", "Pet Trust", "University of Hyper\\Ontario Veterinary College\\Pet Trust", "2a91c876-e168-498e-8f1b-d1623d18558b", "", "Animal Cancer Centre", "2a91c876-e168-498e-8f1b-d1623d18558b"] | |
}, { | |
"Values": ["Ridgetown Highest Priority", "Ridgetown", "University of Hyper\\Ontario Agricultural College\\Ridgetown", "60f38261-69dd-4ea0-a242-fa1182afdd8f", "", "Ridgetown Highest Priority", "60f38261-69dd-4ea0-a242-fa1182afdd8f"] | |
}, { | |
"Values": ["Sustainability Fund", "University of Hyper", "University of Hyper", "fbb4e691-1864-475b-9cd3-2249d440655a", "", "Sustainability Fund", "fbb4e691-1864-475b-9cd3-2249d440655a"] | |
}, { | |
"Values": ["Student Affairs Highest Priority", "University of Hyper", "University of Hyper", "0da36e9a-3170-4961-a0ca-89265ea9f4bd", "", "Student Affairs Highest Priority", "0da36e9a-3170-4961-a0ca-89265ea9f4bd"] | |
}, { | |
"Values": ["Centre for Students with Disabilities", "University of Hyper", "University of Hyper", "f4cc11f2-4fc5-4fe0-86ed-a7cc6ca97dd1", "", "Centre for Students with Disabilities", "f4cc11f2-4fc5-4fe0-86ed-a7cc6ca97dd1"] | |
}, { | |
"Values": ["First Year Seminars", "University of Hyper", "University of Hyper", "5714cbe9-e2d3-41a7-853e-a91c1eac27ce", "", "First Year Seminars", "5714cbe9-e2d3-41a7-853e-a91c1eac27ce"] | |
}, { | |
"Values": ["University's Highest Priority", "University of Hyper", "University of Hyper", "9950f427-ffcb-432a-93c3-d0ab7170c474", "", "University's Highest Priority", "9950f427-ffcb-432a-93c3-d0ab7170c474"] | |
}, { | |
"Values": ["University of Hyper Humber Highest Priority", "University of Hyper-Humber", "University of Hyper\\University of Hyper-Humber", "53d3d7d2-709d-4da3-882b-148af27722cb", "", "University of Hyper Humber Highest Priority", "53d3d7d2-709d-4da3-882b-148af27722cb"] | |
}, { | |
"Values": ["University of Hyper-Humber Student Assistance", "University of Hyper-Humber", "University of Hyper\\University of Hyper-Humber", "e8348615-858a-4d8a-a781-ebc3d18b105f", "", "University of Hyper-Humber Student Assistance", "e8348615-858a-4d8a-a781-ebc3d18b105f"] | |
}] | |
function hyperScrub(CRMresponse){ | |
colleges = {} | |
$(CRMresponse).each(function (key, val) { | |
var list = val['Values']; | |
var cname = list[2].split("\\").pop(), | |
fund = list[0], | |
guid = list[3], | |
desc = list[4], | |
category = list[2].split("\\"); | |
try{ | |
colleges[cname].push({"fund":fund,"guid":guid,"categories":category,"description":desc}) | |
}catch(err){ | |
colleges[cname] = [{"fund":fund,"guid":guid,"categories":category,"description":desc}] | |
} | |
}); | |
return colleges | |
} | |
console.log(hyperScrub(CRMresponse)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment