Templates for Zenjob, Mizuno, Artera. Scripts for Wild Health.
This commit is contained in:
@ -4,15 +4,16 @@ from pathlib import Path
|
||||
import Apikeys
|
||||
import os
|
||||
|
||||
basefile = "/Users/normrasmussen/Downloads/Recast-learners.csv"
|
||||
api_key = Apikeys.recast
|
||||
basefile = "/Users/normrasmussen/Downloads/Mizuno_May.csv"
|
||||
api_key = Apikeys.mizuno
|
||||
uuid_url = "https://api.northpass.com/v2/people?filter[email][eq]="
|
||||
prop_url = "https://api.northpass.com/v2/properties/people/"
|
||||
headers = {
|
||||
"accept": "*/*",
|
||||
"x-api-key": api_key,
|
||||
"content-type": "application/json",
|
||||
}
|
||||
"accept": "*/*",
|
||||
"x-api-key": api_key,
|
||||
"content-type": "application/json",
|
||||
}
|
||||
|
||||
|
||||
def load_file(basefile):
|
||||
dict_list = []
|
||||
@ -24,7 +25,7 @@ def load_file(basefile):
|
||||
print(f"File found! Importing {basefile}")
|
||||
for email in completions.itertuples():
|
||||
row_num = email[0]
|
||||
row_dict = {"row_num":row_num}
|
||||
row_dict = {"row_num": row_num}
|
||||
email = email[3]
|
||||
url = uuid_url + f"{email}"
|
||||
response = requests.get(url, headers=headers)
|
||||
@ -42,18 +43,17 @@ def load_file(basefile):
|
||||
print(e)
|
||||
finally:
|
||||
for info in dict_list:
|
||||
row = info['row_num']
|
||||
pid = info['pgaid']
|
||||
row = info["row_num"]
|
||||
pid = info["pgaid"]
|
||||
completions.loc[completions.index[row], "PGA ID"] = pid
|
||||
completions = completions[completions["PGA ID"] != "0"]
|
||||
#completions = completions.iloc[:, 0:]
|
||||
# completions = completions.iloc[:, 0:]
|
||||
print(completions)
|
||||
completions.to_csv(
|
||||
"/Users/normrasmussen/Downloads/MizunoCompletions_with_PGAIDs.csv",
|
||||
index=False
|
||||
)
|
||||
"/Users/normrasmussen/Downloads/MizunoCompletions_with_PGAIDs.csv",
|
||||
index=False,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
load_file(basefile)
|
||||
|
||||
|
||||
1
Scripts/GoogleScripts/WildHealth_Assignments/.clasp.json
Normal file
1
Scripts/GoogleScripts/WildHealth_Assignments/.clasp.json
Normal file
@ -0,0 +1 @@
|
||||
{"scriptId":"1W9jVjAVjIivO2sj1flvoofftiZ4v0BgAMD_RPBsSTGZBcedPN_DUEW7m","rootDir":"/Users/normrasmussen/Documents/Work/Scripts/GoogleScripts/WildHealth_Assignments"}
|
||||
@ -0,0 +1,70 @@
|
||||
/* This function needs to run either once a day OR after a webhook that contains the course name.
|
||||
Date range: 2/1/23 - 7/31/23
|
||||
|
||||
Order of operations:
|
||||
- Parse Webhook, if course name == Coaching Certification, assignment == Practice Coaching Session 3 (PSA),
|
||||
Activity name == Step 1: Practice Coaching Session 3 - Recording Upload
|
||||
- GET List Assignments: https://api.northpass.com/v2/assignments/{assignment_uuid}/submissions
|
||||
- GET Person https://api.northpass.com/v2/people/{uuid}
|
||||
|
||||
Fill in columns: Date Submitted, Person's Name, Email, Assignment Name, Assignment Download Link.
|
||||
|
||||
|
||||
UUIDS:
|
||||
Activity: a94171bb-0184-433e-a62d-2b8c67ad196e
|
||||
Course: 03bb0fa0-df1f-4f40-b550-b59b113fd79f
|
||||
Assignment: a4e082a2-9416-4fdf-9ef6-a817e25d26ee
|
||||
API Key: HWxj6VTNPwbc3WghFTPzr7SjE
|
||||
*/
|
||||
|
||||
const sheet = SpreadsheetApp.getActiveSheet();
|
||||
const apiKey = "HWxj6VTNPwbc3WghFTPzr7SjE";
|
||||
var assign_uid = "a4e082a2-9416-4fdf-9ef6-a817e25d26ee"
|
||||
let page = 0;
|
||||
|
||||
function getAssignment() {
|
||||
var sheet = SpreadsheetApp.getActiveSheet();
|
||||
var api_url =
|
||||
'https://api.northpass.com/v2/assignments/'+assign_uid+'/submissions?page='+page;
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
}
|
||||
const sendMsg = UrlFetchApp.fetch(api_url, settings);
|
||||
var apiResponse = sendMsg.getContentText();
|
||||
var parsedata = JSON.parse(apiResponse);
|
||||
var data = parsedata["data"];
|
||||
if (data.length != 0){
|
||||
let rowArray = []
|
||||
for (item of data) {
|
||||
var submit_date = item["attributes"]["created_at"];
|
||||
var person = item["relationships"]["person"]["data"]["id"];
|
||||
var download_link = item["links"]["download"];
|
||||
var person_url = 'https://api.northpass.com/v2/people/'+person;
|
||||
const settings = {
|
||||
async: true,
|
||||
crossDomain: true,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'X-Api-Key': apiKey
|
||||
}
|
||||
};
|
||||
const sendMsg = UrlFetchApp.fetch(person_url, settings);
|
||||
var uuidResponse = sendMsg.getContentText();
|
||||
var parsing = JSON.parse(uuidResponse);
|
||||
var info = parsing["data"]
|
||||
var full_name = info["attributes"]["full_name"];
|
||||
var email = info["attributes"]["email"];
|
||||
let rowArray = [submit_date, download_link, person, full_name, email];
|
||||
Logger.log(rowArray);
|
||||
};
|
||||
}
|
||||
page++;
|
||||
getAssignment(page);
|
||||
};
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"timeZone": "America/New_York",
|
||||
"dependencies": {
|
||||
},
|
||||
"exceptionLogging": "STACKDRIVER",
|
||||
"runtimeVersion": "V8"
|
||||
}
|
||||
Reference in New Issue
Block a user