From ec2ef3a8083fa18c8517a97c06af536a9bb514a3 Mon Sep 17 00:00:00 2001 From: Norm Rasmussen Date: Thu, 30 May 2024 17:26:35 -0400 Subject: [PATCH] Scripts for Anthology. Datasnipper notes. --- CustomerNotes/DataSnipper/DataSnipper.md | 17 +++++++- Scripts/API_Tests/get-group-ids.py | 4 +- Scripts/API_Tests/get_courses_from_groups.py | 44 ++++++++++++++++---- 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/CustomerNotes/DataSnipper/DataSnipper.md b/CustomerNotes/DataSnipper/DataSnipper.md index 7a06097e..7e3a6882 100644 --- a/CustomerNotes/DataSnipper/DataSnipper.md +++ b/CustomerNotes/DataSnipper/DataSnipper.md @@ -339,6 +339,19 @@ API Endpoint: Issuer: * https://login.microsoftonline.com/43f1ba74-0140-48d7-9ded-17e6e43a6ef6/wsfed -## 04-29-2024 - +## 05-30-2024 +Health Scoring for DataSnipper +* Started very sentiment based and everyone had a different sentiment +* Zoom and CE bringing in data for new healthscores. +* Zoom: if attendee, this improves score. Live attendee data being pulled. +* All based on email domain - anyone with a domain can influence the health score +* Courses: Enrolled or Completions +* Health Scoring is strictly based on completions +* Recent "middle step" of health score found some misalignments and found health scores are better than sentiment would lead them to believe. +* Outside of client engagement, making the process more complex - activated in product, how many features being used, total activity numbers in use etc. +* Ideally they would like to attach specific courses to features and track feature usage post course completion +* Number of features being used has direct correlation to stickiness +* KPIs are the health scores +* Academy can negatively affect the score from the perspective if _no one_ accesses or completes a course. +* 0-10, below 50% of people have completed a course, health score is 0 diff --git a/Scripts/API_Tests/get-group-ids.py b/Scripts/API_Tests/get-group-ids.py index 7a56dc83..5d4ee5f6 100644 --- a/Scripts/API_Tests/get-group-ids.py +++ b/Scripts/API_Tests/get-group-ids.py @@ -5,7 +5,7 @@ import Apikeys import json -APIKEY = Apikeys.SANDATA +APIKEY = Apikeys.ANTHOLOGY groups_dict = {} pp = pprint.PrettyPrinter(indent=4) @@ -36,7 +36,7 @@ def get_groups(APIKEY): print(groups) with open( - "/Users/normrasmussen/Downloads/Sandata-Groups.csv", "a+", newline="\n" + "/Users/normrasmussen/Downloads/Anthology-Groups.csv", "a+", newline="\n" ) as csvfile: for group in groups: for key, value in group.items(): diff --git a/Scripts/API_Tests/get_courses_from_groups.py b/Scripts/API_Tests/get_courses_from_groups.py index 2ae8cfe2..10825d3c 100644 --- a/Scripts/API_Tests/get_courses_from_groups.py +++ b/Scripts/API_Tests/get_courses_from_groups.py @@ -12,6 +12,8 @@ HEADERS = { } BASEURL = "https://api.northpass.com/v2/" GROUPS = [ + "Academic Economics", + "Academy Use/Navigation", "Accreditation", "Anthology 101", "Baseline", @@ -27,6 +29,30 @@ GROUPS = [ "Student", ] +def all_groups(): + """ + Get all Group IDs + """ + gids = [] + group_count = 0 + while True: + group_count += 1 + url = f"https://api.northpass.com/v2/groups?page={group_count}" + gresponse = requests.get(url, headers=HEADERS) + gdata = gresponse.json() + gnext = gdata["links"] + + for response in gdata["data"]: + group_id = response["id"] + group_name = response["attributes"]["name"] + group_tupe = (group_id, group_name) + print(group_tupe) + gids.append(group_tupe) + + if "next" not in gnext: + break + + get_courses(gids) def group_ids(): """ @@ -48,6 +74,8 @@ def group_ids(): get_courses(ids) + #portfolio t1 - dc50ca43-5071-45b3-bf42-e1e64416ffd0 + #academy use/nav t1 - 3875a210-f86d-4b4a-a86a-980022374936 def get_courses(ids): df = pd.DataFrame() @@ -55,19 +83,20 @@ def get_courses(ids): for tupe in ids: id = tupe[0] group = tupe[1] - print(group) + print(f"Get Courses Function. Group:{ group } and id: {id}") for count in range(1, 10): url2 = f"groups/{id}/courses?limit=100&page={count}" courseurl = f"{BASEURL}{url2}" coursereq = requests.get(courseurl, headers=HEADERS) coursedata = coursereq.json() + print(coursedata) nextlink = coursedata["links"] for cdata in coursedata["included"]: - if cdata["attributes"]["status"] == "archived": - coursedict = parse_data(cdata, group) - print(f"Coursedict --> {coursedict} for page {count}") - if coursedict is not None: - courses.append(coursedict) + # if cdata["attributes"]["status"] == "archived": + coursedict = parse_data(cdata, group) + print(f"Coursedict --> {coursedict} for page {count}") + if coursedict is not None: + courses.append(coursedict) if "next" not in nextlink: break @@ -96,4 +125,5 @@ def parse_data(cdata, group): if __name__ == "__main__": - group_ids() + # group_ids() + all_groups()