From f9d4502301dc9b1b73cf99d7f2f1db2446cdde22 Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Wed, 2 Nov 2022 17:03:56 -0400 Subject: [PATCH] DV Script and Walmart changes --- CustomerNotes/Pipedrive.md | 23 +++++ Scripts/AddGroupsUsers/addgroup_users.py | 97 ++++++++++++++++++ Scripts/WalmartExcel/walmart.py | 8 +- Scripts/WalmartExcel/walmart_numeric.py | 68 ++++++++++++ Timetagger/_timetagger/users/norm~bm9ybQ==.db | Bin 155648 -> 155648 bytes Todos.md | 2 + 6 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 CustomerNotes/Pipedrive.md create mode 100644 Scripts/AddGroupsUsers/addgroup_users.py create mode 100644 Scripts/WalmartExcel/walmart_numeric.py diff --git a/CustomerNotes/Pipedrive.md b/CustomerNotes/Pipedrive.md new file mode 100644 index 00000000..c4b90500 --- /dev/null +++ b/CustomerNotes/Pipedrive.md @@ -0,0 +1,23 @@ +## 11/02/2022 +### Strategy Session - Implementation +* Priority is indexed pages +* What does it take to get someone certified? - James +* Explanation of certifications administration +* Can we trigger badging on watching videos + a quiz? +* Segmentation to force that usage for users +* Analytics on the front end - Segment is what they use +* Segment then pipes into Google Analytics +* Data Warehouse: via Segment +* She will get a team together to work on data together. +* Start with design only for the Courses Page +* Tutorials page will also be design - single video tutorials + * These are both for logged in and non-logged in users + * Kaisa is the main content pusher +* All videos are housed in Vidyard - Vidyard has a link and replace feature +* Starting with 4-5 courses +* Their "courses" are video playlists - they are mostly tutorial videos +* Timeline? Mission team needs 7 weeks to complete everything they need to do. +* Launch in Q1 +* Any other questions from Kaisa? Content Sessions - Training on the platform etc. +* Patrycja: onboarding can be two phases - design and content. Norm for content and strategy and Patrycja on design and training. +* The least experience comes in actual course creation. diff --git a/Scripts/AddGroupsUsers/addgroup_users.py b/Scripts/AddGroupsUsers/addgroup_users.py new file mode 100644 index 00000000..8813006b --- /dev/null +++ b/Scripts/AddGroupsUsers/addgroup_users.py @@ -0,0 +1,97 @@ +import requests +import sys +import http +import pandas as pd + +apiKey = "SlpQlju219WnWogn94dQUT6Yt" +#groupName = sys.argv[1] +peopleCsv = "/Users/normrasmussen/Downloads/peopletogroups.csv" + +def createGroup(groupName, apiKey): + # Create a Group endpoint - params: group_uuid + url = "https://api.northpass.com/v2/groups" + payload = {"data": {"attributes": {"name": f"{groupName}"}}} + headers = { + "accept": "application/json", + "content-type": "application/json", + "X-Api-Key": apiKey + } + groupresponse = requests.post(url, json=payload, headers=headers) + if "already have a group with this name" in groupresponse.text: + groupName = input("Group already created, what name would you like instead? ") + print("Got it, thanks! Attempting to create the group now.") + createGroup(groupName, apiKey) + else: + readCSV(apiKey, groupresponse) + +def readCSV(apiKey, groupresponse): + people = [] + readExport = pd.read_csv( + peopleCsv, + usecols=['UUID'], + skipinitialspace=True, + ) + people.extend(readExport['UUID'].tolist()) + getgroupId(people, groupresponse, apiKey) + +def getgroupId(people, groupresponse, apiKey): + groupresponse = groupresponse.json() + groupID = groupresponse['data']['id'] + ppltoGroup(people, groupID, apiKey) + +def ppltoGroup(people, groupID, apiKey): + print(groupID) + + # Add People to a Group. Params needed: group_uuid + url = f"https://api.northpass.com/v2/groups/{groupID}/relationships/people" + # Loop through this payload and/or add everyone as new { "type":"people", "id":"uuid"} + #for uuid in people: + # itempayload = [] + # jsonpayload = { "type":"people", "id":uuid }, + # itempayload.append(jsonpayload) + payload = {"data": [ + { + "type":"people", + "id":people + }, + # { "type":"people", "id":people[1]}, + # { "type":"people", "id":people[2]}, + + ]} + headers = { + "accept": "*/*", + "content-type": "application/json", + "X-Api-Key": apiKey + } + print(url) + print(payload) + print(headers) + response = requests.post(url, json=payload, headers=headers) + print(response.text) + +if __name__ == "__main__": + ppltoGroup(people="0b31c435-c18b-4573-984e-32cda57045b4", groupID="4f83841f-939f-469f-b98f-29ce7f980c6e",apiKey="SlpQlju219WnWogn94dQUT6Yt") + #createGroup(groupName, apiKey) + + + url = "https://api.northpass.com/v2/groups/4c2e807c-2b65-4ce7-a359-2e470fe4f322/relationships/people" + +payload = {"data": [ + { + "type": "people", + "id": "0b31c435-c18b-4573-984e-32cda57045b4" + }, + { + "type": "people", + "id": "0b31c435-c18b-4573-984e-32cda57045b4" + } + ]} +headers = { + "accept": "*/*", + "content-type": "application/json", + "X-Api-Key": "SlpQlju219WnWogn94dQUT6Yt" +} + +response = requests.post(url, json=payload, headers=headers) + +print(response.text) diff --git a/Scripts/WalmartExcel/walmart.py b/Scripts/WalmartExcel/walmart.py index 30e468e9..f6224b0a 100644 --- a/Scripts/WalmartExcel/walmart.py +++ b/Scripts/WalmartExcel/walmart.py @@ -34,9 +34,11 @@ def copytoDash(latestdownload, currentDash): latestdownload, index_col=False, header=0, + low_memory=False, dtype={ - 'Progress':int - }) + 'Progress':object + } + ) print(readExport) readExport.drop( readExport.filter( @@ -45,7 +47,6 @@ def copytoDash(latestdownload, currentDash): inplace=True) copiedData = readExport.copy() bringtoExcel(latestdownload, currentDash, copiedData) - #with pd.ExcelWriter("") def bringtoExcel(latestdownload, currentDash, copiedData): with pd.ExcelWriter( @@ -60,7 +61,6 @@ def bringtoExcel(latestdownload, currentDash, copiedData): sheet_name="Data", index=False, ) -# cleanitUp(currentDash) def cleanitUp(currentDash): cleanExcel = pd.read_excel(currentDash, sheet_name="Data", index_col=None) diff --git a/Scripts/WalmartExcel/walmart_numeric.py b/Scripts/WalmartExcel/walmart_numeric.py new file mode 100644 index 00000000..275aa693 --- /dev/null +++ b/Scripts/WalmartExcel/walmart_numeric.py @@ -0,0 +1,68 @@ +import os +import sys +from datetime import date +import glob +import shutil +import csv +import pandas as pd + +rootdir = "/Users/normrasmussen/Documents/Resources/Walmart/" +downloadir = "/Users/normrasmussen/Google Drive/My Drive/Shared with Clients/Walmart/" +basefile = "WalmartTemplate.xlsx" + +def copytemplate(rootdir, basefile): + today = date.today() + today = today.strftime("%m.%d.%Y") + template = rootdir+basefile + todayFile = f"Walmart-{today}.xlsx" + if os.path.exists(rootdir): + shutil.copy2(template, rootdir+todayFile) + #dirfiles = os.listdir(rootdir) + #print(dirfiles) + currentDash = rootdir+f"Walmart-{today}.xlsx" + print(currentDash) + findlatestExport(currentDash) + +def findlatestExport(currentDash): + listfiles = glob.glob(downloadir + '*.xlsx') + latestdownload = max(listfiles, key=os.path.getctime) + print(latestdownload) + copytoDash(latestdownload, currentDash) + +def copytoDash(latestdownload, currentDash): + readExport = pd.read_excel( + latestdownload, + index_col=False, + header=0, + ) + readExport.drop( + readExport.filter( + regex="Unname" + ),axis=1, + inplace=True) + readExport['Progress_replace'] = readExport['Progress'].str.replace('%','') + readExport['Progress_replace'] = pd.to_numeric(readExport['Progress_replace']) + copiedData = readExport.copy() + bringtoExcel(latestdownload, currentDash, copiedData) + #cleanitUp(latestdownload, currentDash, copiedData) + +def bringtoExcel(latestdownload, currentDash, copiedData): + with pd.ExcelWriter( + currentDash, + mode="a", + engine="openpyxl", + if_sheet_exists="overlay", + ) as writer: + copiedData.to_excel( + writer, + engine="xlsxwriter", + sheet_name="Data", + index=False, + ) + +#def cleanitUp(latestdownload, currentDash, copiedData): + #cleanExcel = pd.read_excel(currentDash, sheet_name="Data", index_col=None) +# print(cleanExcel) + +if __name__ == "__main__": + copytemplate(rootdir, basefile) diff --git a/Timetagger/_timetagger/users/norm~bm9ybQ==.db b/Timetagger/_timetagger/users/norm~bm9ybQ==.db index 1510a9467fe6597ac543ca309365404776d9315c..daf6b100c691525255444f470a0440d3aa6c7095 100644 GIT binary patch delta 5756 zcmZu#3v?9a6`p_gF|#}S2=XQgd0-WJEVDDav%7$_fP@%cc|t&}?oJXU$>zZ>1n|%# zYALow2?GoP#R!VWN0hL|?LjKR2L~l$5J^*Q4+#&2(rV}_YHO*zGqeAOiRBy)|NrsN z&b{}$_q+F>rcO&!r)66zy3&$17hUOic>hl)IfxWvs*lmmSjW8S$OwpCy7*oT zO&=wc&2V{T7LugY+~-Kkx3OcnGmz0Pp^5NQcOx`ju73x$N>dl?i>+8#M;ZviA#Lv2 z9V=h*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-13,3 +13,5 @@ * [ ] (Talkspace) [10/27/2022] Pull report of all users in NPP with activated/deactived status * [ ] (Wildhealth) [10/31/2022] Pass PTO information onto Brian so he knows about the support tickets from Baeleigh & WildHealth. * [ ] (Wildhealth) [10/31/2022] Update Branding on WPG - Abby to send new logo and Norm to figure out colors/branding for styling. +* [ ] (Talkspace) [11/1/2022] Send Gracie and Molly the correct URLs for the Fountain links. +* [X] (DV) [11/1/2022] Write Script for creating a new group and adding people to that group via API from reading off a CSV.