Scripts for Anthology. Datasnipper notes.

This commit is contained in:
Norm Rasmussen
2024-05-30 17:26:35 -04:00
parent 486c2e9dea
commit ec2ef3a808
3 changed files with 54 additions and 11 deletions

View File

@ -339,6 +339,19 @@ API Endpoint:
Issuer: Issuer:
* https://login.microsoftonline.com/43f1ba74-0140-48d7-9ded-17e6e43a6ef6/wsfed * 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

View File

@ -5,7 +5,7 @@ import Apikeys
import json import json
APIKEY = Apikeys.SANDATA APIKEY = Apikeys.ANTHOLOGY
groups_dict = {} groups_dict = {}
pp = pprint.PrettyPrinter(indent=4) pp = pprint.PrettyPrinter(indent=4)
@ -36,7 +36,7 @@ def get_groups(APIKEY):
print(groups) print(groups)
with open( with open(
"/Users/normrasmussen/Downloads/Sandata-Groups.csv", "a+", newline="\n" "/Users/normrasmussen/Downloads/Anthology-Groups.csv", "a+", newline="\n"
) as csvfile: ) as csvfile:
for group in groups: for group in groups:
for key, value in group.items(): for key, value in group.items():

View File

@ -12,6 +12,8 @@ HEADERS = {
} }
BASEURL = "https://api.northpass.com/v2/" BASEURL = "https://api.northpass.com/v2/"
GROUPS = [ GROUPS = [
"Academic Economics",
"Academy Use/Navigation",
"Accreditation", "Accreditation",
"Anthology 101", "Anthology 101",
"Baseline", "Baseline",
@ -27,6 +29,30 @@ GROUPS = [
"Student", "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(): def group_ids():
""" """
@ -48,6 +74,8 @@ def group_ids():
get_courses(ids) get_courses(ids)
#portfolio t1 - dc50ca43-5071-45b3-bf42-e1e64416ffd0
#academy use/nav t1 - 3875a210-f86d-4b4a-a86a-980022374936
def get_courses(ids): def get_courses(ids):
df = pd.DataFrame() df = pd.DataFrame()
@ -55,19 +83,20 @@ def get_courses(ids):
for tupe in ids: for tupe in ids:
id = tupe[0] id = tupe[0]
group = tupe[1] group = tupe[1]
print(group) print(f"Get Courses Function. Group:{ group } and id: {id}")
for count in range(1, 10): for count in range(1, 10):
url2 = f"groups/{id}/courses?limit=100&page={count}" url2 = f"groups/{id}/courses?limit=100&page={count}"
courseurl = f"{BASEURL}{url2}" courseurl = f"{BASEURL}{url2}"
coursereq = requests.get(courseurl, headers=HEADERS) coursereq = requests.get(courseurl, headers=HEADERS)
coursedata = coursereq.json() coursedata = coursereq.json()
print(coursedata)
nextlink = coursedata["links"] nextlink = coursedata["links"]
for cdata in coursedata["included"]: for cdata in coursedata["included"]:
if cdata["attributes"]["status"] == "archived": # if cdata["attributes"]["status"] == "archived":
coursedict = parse_data(cdata, group) coursedict = parse_data(cdata, group)
print(f"Coursedict --> {coursedict} for page {count}") print(f"Coursedict --> {coursedict} for page {count}")
if coursedict is not None: if coursedict is not None:
courses.append(coursedict) courses.append(coursedict)
if "next" not in nextlink: if "next" not in nextlink:
break break
@ -96,4 +125,5 @@ def parse_data(cdata, group):
if __name__ == "__main__": if __name__ == "__main__":
group_ids() # group_ids()
all_groups()