From 3c137548f96da64f82f6ea74d71ec51b917c88d4 Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Mon, 21 Jul 2025 14:57:46 -0400 Subject: [PATCH] Tasks were updated. --- "Scripts/API_Tests/\\" | 149 ----------------------------------------- Tasks.md | 7 +- 2 files changed, 5 insertions(+), 151 deletions(-) delete mode 100644 "Scripts/API_Tests/\\" diff --git "a/Scripts/API_Tests/\\" "b/Scripts/API_Tests/\\" deleted file mode 100644 index 8f233032..00000000 --- "a/Scripts/API_Tests/\\" +++ /dev/null @@ -1,149 +0,0 @@ -import requests -import pprint -import pandas as pd -import Apikeys -import time - -pp = pprint.PrettyPrinter(indent=4) -APIKEY = Apikeys.CHUBB -HEADERS = { - "accept": "application/json", - "X-Api-Key": APIKEY, -} -BASEURL = "https://api.northpass.com/v2/" -IMPORTFILE = "/Users/normrasmussen/Downloads/cisa-060225.csv" - - -def bulk_invite_and_group(): - """ - Bulk endpoint which invites new people and adds them to a group via this structure: - { - "email": "me@mac.com" - "groups": "GroupA" - } - - This function looks for the group in the CSV as well. - """ - df = pd.DataFrame() - data = pd.read_csv(IMPORTFILE) - groups = data["Group"].unique() - groups = list(groups) - print(groups) - for group in groups: - payload = "" - print(group) - tmp_group = data[data.Group == group] - people = list(tmp_group["Email"]) - group = str(tmp_group["Group"].unique())[2:-2] - print(f"Group --> {group} ... Amount of People --> {len(people)}") - url = f"{BASEURL}bulk/people" - if len(people) > 1500: - for chunk in range(0, len(people), 1500): - i = chunk - payload_1 = [] - i_to_add = people[i : i + 1500] - for person in i_to_add: - miniload = {"email": person, "groups": group} - payload_1.append(miniload) - print(f"The long length {group} payload has {len(payload_1)}") - payload = {"data": {"attributes": {"people": payload_1}}} - response = requests.post(url, headers=HEADERS, json=payload) - print(f"Completed. Status code is {response.status_code}") - else: - payload_1 = [] - for person in people: - miniload = {"email": person, "groups": group} - payload_1.append(miniload) - print(f"The {group} payload has {len(payload_1)}") - payload = {"data": {"attributes": {"people": payload_1}}} - response = requests.post(url, headers=HEADERS, json=payload) - print(f"Completed. Status code is {response.status_code}") - print(response.text) - print("Running add props from func...") - time.sleep(3) - add_props_from_func(people, data, group) - - -def add_props_from_func(people, data, group): - errorlist = [] - for learner_email in people: - agency_name = data.loc[data["Email"] == learner_email, "AgencyName"] - agname = str(agency_name.values)[2:-2] - print(f"Learner: {learner_email} --> Agency: {agname} from Group: {group}") - ppl_search = f"{BASEURL}people?filter[email][eq]={learner_email}" - ppl_response = requests.get(ppl_search, headers=HEADERS) - try: - ppl_data = ppl_response.json() - nextlink = ppl_data["links"] - learner_uuid = ppl_data["data"][0]["id"] - - # Now update the props - prop_url = f"{BASEURL}properties/people/bulk" - payload = { - "data": [ - { - "attributes": {"properties": {"agency_name": agname}}, - "id": learner_uuid, - "type": "person_properties", - } - ] - } - propresponse = requests.post(prop_url, json=payload, headers=HEADERS) - print(propresponse.status_code) - if propresponse.status_code != 200: - error_tupe = (learner_uuid, learner_email, agname) - errorlist.append(error_tupe) - else: - print(f"Looks like {learner_email} and {agname} was successful.") - except (TypeError, IndexError) as e: - error_tupe = (0, learner_email, agency_name) - errorlist.append(error_tupe) - print(f"{e} has occurred with {learner_email}") - finally: - pass - print(f"Error list: {errorlist}") - - -def add_props_from_csv(): - errorlist = [] - df = pd.DataFrame() - data = pd.read_csv(IMPORTFILE) - for dat in data.iterrows(): - agency_name = dat[1][3] - # agency_name = "EMPLOYEE" - learner_email = dat[1][2] - # print(learner_email) - ppl_search = f"{BASEURL}people?filter[email][eq]={learner_email}" - ppl_response = requests.get(ppl_search, headers=HEADERS) - try: - ppl_data = ppl_response.json() - nextlink = ppl_data["links"] - learner_uuid = ppl_data["data"][0]["id"] - - # Now update the props - prop_url = f"{BASEURL}properties/people/bulk" - payload = { - "data": [ - { - "attributes": {"properties": {"agency_name": agency_name}}, - "id": learner_uuid, - "type": "person_properties", - } - ] - } - propresponse = requests.post(prop_url, json=payload, headers=HEADERS) - print(propresponse.status_code) - if propresponse.status_code != 200: - error_tupe = (learner_uuid, learner_email, agency_name) - errorlist.append(error_tupe) - else: - print(f"Looks like {learner_email} and {agency_name} was successful.") - except TypeError as e: - print(e) - pass - finally: - print(f"Error list: {errorlist}") - - -if __name__ == "__main__": - bulk_invite_and_group() diff --git a/Tasks.md b/Tasks.md index e4dc293a..98547913 100644 --- a/Tasks.md +++ b/Tasks.md @@ -6,7 +6,7 @@ - [ ] Send email to Laura and Desma (with Sreshta) explaining what needs to be done for the self-reg project. - 07-14-2025 ## Artera -- [ ] Submit TMR for Skilljar demo for the week of August 25th. Include Sally and Emily - 07-07-2025 +- [ ] Submit TMR for Skilljar demo for the week of August 25th. Include Sally and Emily - 07-07-2025t ## BuilderTrend - [X] Ask CSSC about release notes. Cam said he uses a Data designer to merge learner and client data. Wants to know if he can remove the data designer. - 04-16-2025 @@ -60,10 +60,13 @@ ## Wood Mackenzie - [ ] Add Associated ILTs to the course overview page. Ref: SPS Training Centre. + - NOTE: All ILTs need to show up on Training Events page, but only some need to show up on course page. + - [ ] Record screen recording of how to config this. - [ ] Embedding PPTX in a course, not all settings transfer from admin to learner. But some do, which means the app has _some_ control this. They would like the continuous/page-by-page to carry over to Learner's LX. -- [ ] Send email follow up about data extracts. +- [X] Send email follow up about data extracts. - [ ] When Allyson returns: follow up on using quizzes as surveys. Reference Big Ideas. - [X] Set default font in LX to Arial 18px +- [ ] Follow up on 8/7 around sharing ILT recordings as a course activity or something else ## Workhuman - [ ] Submit Publishing Request to product. Currently, WH shares direct-to-activtiy links from their community page to showcase certain features. For instance, one of their links [uses this url](https://community.workhuman.com/education/courses/bada004e-b721-4eed-86b2-9fc58edd3276/activities/eae94898-b7e5-4ce9-a4c9-568e8687d92a). If they add new activities, the users who click that link won't see them because they would need to click "Retake course" which doesn't exist.