From e9af572102c2baca72e4cfffc1730c6cc8ee5a89 Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Mon, 8 Jul 2024 20:01:29 -0400 Subject: [PATCH] Anthology Notes and updated the google script for the CSV parser. --- CustomerNotes/Anthology/Anthology.md | 2 +- .../MasterCSV_Parser.js | 55 +++++++++++++------ Todos.md | 17 +----- 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/CustomerNotes/Anthology/Anthology.md b/CustomerNotes/Anthology/Anthology.md index 1d7c7e75..dcf10a41 100644 --- a/CustomerNotes/Anthology/Anthology.md +++ b/CustomerNotes/Anthology/Anthology.md @@ -16,7 +16,7 @@ Aaron Odden - LX architect, works with content creators, Learning Ed team Katie Felton - Director for the academies, oversee all content creators & the teams. Ultimately responsible for the strategic direction Nicole Melander - Exec Sponsor -Met with Patrcyja and got an overview. They still have a lot of questions. +Met with Patrycja and got an overview. They still have a lot of questions. * KC is responsible for project plan & the entirety of launch and running. She needs to understand what their team has to deliver. * Needs to better understand what is in their subscription model, data tagging, extracts, etc. diff --git a/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js b/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js index 53a9bd35..da6f4a60 100644 --- a/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js +++ b/Scripts/GAS_GS/AnthologyCSV-Parse-Prod/MasterCSV_Parser.js @@ -47,7 +47,7 @@ function austinComparseData(outdated_data, updated_data) { let domains_to_update = []; let updatedFlag = 1; let outdatedFlag = 1; - + while(updatedFlag < updated_data.length && outdatedFlag < outdated_data.length){ if(updated_data[updatedFlag][0] == outdated_data[outdatedFlag][0]) { let allUpdatedGroups = []; @@ -73,36 +73,41 @@ function austinComparseData(outdated_data, updated_data) { } } } - + updatedFlag++; outdatedFlag++; } else { if(updated_data[updatedFlag][0] > outdated_data[outdatedFlag][0]){ outdatedFlag++; - } + } else if(updated_data[updatedFlag][0] < outdated_data[outdatedFlag][0]){ domains_to_update.push(updated_data[updatedFlag]); updatedFlag++; } } - + if(updatedFlag > updated_data.length-1 || outdatedFlag > outdated_data.length-1){ break; } } - MailApp.sendEmail("nrasmussen@gainsight.com", - "Anthology has submitted a CSV", - "Here are the domains that will be updated: "+domains_to_update); updatedDomainsOnly(domains_to_update); } function updatedDomainsOnly(domains_to_update) { - Logger.log(domains_to_update) + var errorList = []; + var corrList = []; for (var x = 0; x < domains_to_update.length; x++) { var array = domains_to_update[x]; + var currDomain = domains_to_update[x][0] + var errorObj = new Object(); + var noErrorObj = new Object(); + Logger.log("Current Domain: "+currDomain); + var errorGroups = [] + var correctGroups = [] for (var i = 1; i < array.length; i++) { var item = array[i] if (item != "") { + Logger.log("Item/Domain: "+item) var api_url = 'https://api.northpass.com/v2/groups/?filter[name][eq]='+encodeURIComponent(item); const settings = { async: true, @@ -116,19 +121,35 @@ function updatedDomainsOnly(domains_to_update) { const sendMsg = UrlFetchApp.fetch(api_url, settings); var uuidResponse = sendMsg.getContentText(); var parseData = JSON.parse(uuidResponse); - var groupID = parseData['data'][0]['id']; - var groupName = array.indexOf(item); - if (groupName != -1) { - array[groupName] = groupID; + if (parseData['data'].length >= 1) { + var groupID = parseData['data'][0]['id']; + var groupName = array.indexOf(item); + if (groupName != -1) { + array[groupName] = groupID; + } + correctGroups.push(item) + } else { + errorGroups.push(item); } } } + errorObj[currDomain] = errorGroups; + noErrorObj[currDomain] = correctGroups; + corrList.push(noErrorObj) + errorList.push(errorObj) + const dom = array.shift(); const groups = array; Logger.log("{domain_to_update : {domain :"+dom+", group_ids : "+groups+" }}") sendWebhook({domain_to_update : { domain: dom, group_ids: groups }}) replaceOnSheet(dom, groups); } + MailApp.sendEmail("nrasmussen@gainsight.com", + "Anthology has submitted a CSV", + "Here are the domains that will be updated: "+JSON.stringify(noErrorObj)+"\n\n"+"Group Errors (they likely don't exist): "+JSON.stringify(errorList)); + MailApp.sendEmail("amitd@anthology.com", + "Anthology has submitted a CSV", + "Here are the domains that will be updated: "+JSON.stringify(noErrorObj)+"\n\n"+"Group Errors (they likely don't exist): "+JSON.stringify(errorList)); } function replaceOnSheet(dom, groups) { @@ -141,8 +162,8 @@ function replaceOnSheet(dom, groups) { let boo = sheet.createTextFinder(dom).findNext() if (boo != null ) { - Logger.log("Replace on Sheet Domain: "+dom) - Logger.log("New groups: "+groups) + //Logger.log("Replace on Sheet Domain: "+dom) + //Logger.log("New groups: "+groups) group2 = [] currCell = boo.getRowIndex(); groups.forEach(item => { if (item.length > 0) { group2.push(item) }}); @@ -151,12 +172,12 @@ function replaceOnSheet(dom, groups) { sheet.getRange(currCell, 1).setValue(dom); sheet.getRange(currCell, 2, 1, group2[0].length).setValues(group2) } else { - Logger.log("Add to Sheet: "+dom) - Logger.log("else groups: "+groups) + //Logger.log("Add to Sheet: "+dom) + //Logger.log("else groups: "+groups) group2 = [] //groups.forEach(item => { if (item.includes("")){ } else { group2.push(item) }}); groups.forEach(item => { if (item.length > 0) { group2.push(item) }}); - Logger.log(group2); + //Logger.log(group2); group2 = [group2]; sheet.getRange(dataRow+1, 1).setValue(dom); sheet.getRange(dataRow+1, 2, 1, group2[0].length).setValues(group2) diff --git a/Todos.md b/Todos.md index a80d8056..7e480b99 100644 --- a/Todos.md +++ b/Todos.md @@ -350,7 +350,7 @@ message](https://northpasshq.slack.com/archives/C04RER4PH09/p1709147957374999?th ## 06-24-2024 -- [ ] Anthology - URL Cut over to `academy.anthology.com` +- [X] Anthology - URL Cut over to `academy.anthology.com` ## 06-26-2024 @@ -361,17 +361,6 @@ message](https://northpasshq.slack.com/archives/C04RER4PH09/p1709147957374999?th - [ ] Datasnipper, look up webhook ID: 3a33b194-c51c-40aa-98c1-d477f6ca4dda -## 07-03-2024 +## 07-08-2024 -- [ ] Chubb - they want 100% participation but that's not realistic. They are looking at 90%. CISA is receiving great feedback. They are looking at how many agents have been appointed (~1000/year) and of those 1000, how many are completing the cirriculum. This should lead them to their first submission! CISA is an in-house agency. "Agents that are coming in through CISA". With SSO connected, this is great. The list they send me is the list of already onboarding agents. They have received the onboarding email. - -First Submission is the data they are really after. Steve will try and get a baseline of number of CISA agents that have done their first submission with x months. This baseline is what we can compare to post-academy influence. - -Jenelle does the greater reporting at the account level. Agent360 profile. They report on courses and completions, and looking to find "top organizations". She is reporting on everything, but not all agents have Agency Names. - -Chubb has huge investment in residential/academic program. This analysis that we're talking about right now is new to even the larger org and the huge investment from Chubb! This will set a precedent for the rest of the org. - -Outside of data: they want to start using Gainsight across webinar archives and tracking those recordings. They want to track _all_ attendance. Provides a nice lead! So this is pre-agent. Webinars are for agents that are already appointed but for new lines of business. - -Steve & keeping us in the loop of rolling this out. July 10th moving away from legacy (Cornerstone). That population will come in around mid-July, so we should see a bump. All-Agent was originally end of July, but will likely be back to school. Agency Education in August. By September we should be fully launched. -Canada - they don't have access to agent portal and we don't have multi-auth. Decision will be in 6-9 months. +- [ ] Anthology - Write up flow to test search bar