DV Script and Walmart changes
This commit is contained in:
23
CustomerNotes/Pipedrive.md
Normal file
23
CustomerNotes/Pipedrive.md
Normal file
@ -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.
|
||||
97
Scripts/AddGroupsUsers/addgroup_users.py
Normal file
97
Scripts/AddGroupsUsers/addgroup_users.py
Normal file
@ -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)
|
||||
@ -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)
|
||||
|
||||
68
Scripts/WalmartExcel/walmart_numeric.py
Normal file
68
Scripts/WalmartExcel/walmart_numeric.py
Normal file
@ -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)
|
||||
Binary file not shown.
2
Todos.md
2
Todos.md
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user