Updated WilliamsSonoma post-new hire templates. Made good progress on migration tool scripts.

This commit is contained in:
Norm Rasmussen
2024-08-29 20:56:48 -04:00
parent 691bf67219
commit 5f1ed149bf
10 changed files with 415 additions and 304 deletions

View File

@ -1,8 +1,7 @@
{% assign customer_care_badges = "https://s3.amazonaws.com/static.northpass.com/Williams-Sonoma/badge-customer-service.png,https://s3.amazonaws.com/static.northpass.com/Williams-Sonoma/badge-furniture.png,https://s3.amazonaws.com/static.northpass.com/Williams-Sonoma/badge-registry-management.png,https://s3.amazonaws.com/static.northpass.com/Williams-Sonoma/badge-sales.png" %}
<div class="row">
<div class="col-xs-12">
<div class="badges-cont" style="max-width: 80%; align-content: space-evenly;">
<div class="np-dashboard-resources-title">
My Badges
</div>
@ -35,7 +34,6 @@
{% endfor %}
</div>
</div>
</div>
</div>
<style>

View File

@ -1,3 +1,7 @@
<div class="col-sm-10">
<div class="np-dashboard-resources-title">
Course Progress
</div>
<div class="np-dashboard-resources course-progress-widget">
<div class="card">
<div class="np-card-container np-dashboard-border">
@ -42,6 +46,7 @@
</div>
</div>
</div>
</div>
<style>
@ -60,5 +65,6 @@
border: 1px solid #ccc;
box-shadow: none;
border-radius: 0;
width: 55%;
}
</style>

View File

@ -17,24 +17,19 @@
{% include "sub_navigation" %}
<main class="np-main np-dashboard np-subpage-container np-max-width">
{%- comment -%}
{%- endcomment -%}
<div class="row np-flex-center">
<div class="col-xs-12 col-sm-8"></div>
<div class="np-grid-spacing col-xs-12 col-sm-4">
<div class="np-dashboard-resources-title">
Course Progress
</div>
{% include "widget_course_progress" %}
</div>
</div>
<div class="row np-flex-center">
<div class="col-xs-12">
<div class="col-xs-12 col-sm-8">
<div class="np-dashboard-header">
<div class="np-resource-title">MY TRAINING DASHBOARD</div>
</div>
</div>
</div>
<div class="row col-sm-8 col-sm-10" style="display: flex; flex-wrap: nowrap;">
{% include "widget_badges" %}
{% include "widget_course_progress" %}
</div>
{% include "dashboard_filters" %}
<div class="row np-flex-center">

View File

@ -229,3 +229,16 @@ Value they are tracking:
* The whole goal with this is self service and remove hands-on touch points
* Qualitatively, ticket numbers haven't changed much
* Partly on how Luminate is structuring their content (shorter answers faster is their goal)
Notes sent to the team:
Hey all, wanted to share some key insights from my monthly call with Stephanie at Luminate.
1. Johnny (PM) and the engineering team is a blocker for them buying the CC product. This is directly related to recent communications issues (their expectation vs reality, see below). @Chelsey Bonsante this one's especially pertinent for you.
2. Walmart is expecting more frequent updates on items _even if there are no updates_. Stephanie said that if we are committed to delivering something by Tuesday then by the Thursday before some communication should be sent out if we are still going to (or not going to) hit that deadline. This is especially true for active projects, but also true for roadmap items as well. @Allyson re: the roadmap part.
3. Walmart's culture, especially engineering, is that of deadlines and meetings. Krupali, we saw yesterday that Dave and Ritu on the Walmart side had a long side-conversation because they weren't aligned on an item. I called that out and she said that they won't always meet about these things because they are expecting our live/in-meeting support and it takes meetings with the vendor to bring out their own alignment. @gmichlin @Marek
4. As a follow up to the deadline portion, if Stephanie has a deadline for two weeks from now, she will get pinged more than a few times on if she is going to hit that deadline. She feels she cannot _just say_ "yep, it's all on track" but needs to share details. This is why she comes to us asking for details and expects us to give her details. She said that when she doesn't hear from us, it's hard for her to justify or spin it positively.
5. She knows nothing quantitative about how the academy has affected business. From a CS perspective, that was a huge huge bummer to hear and I'll be reaching out to her boss after @chuckg gets introduced. It appears that most of their reasoning for changes in the academy is solely based on feedback from leaders and customers. She had no good indicators of ticket numbers, retention, churn, etc. @Kat Kenny for us to discuss.
There's obviously a lot here. Fundamentally, our orgs operate differently. I don't know if we set a line in the sand with our biggest customer for number of engineering meetings or weekly updates, but the truth is that is a lot of extra work for everyone involved. There is plenty that Walmart can do to "meet us half way" but making these changes at such a large org may be incredibly slow.
And finally, @Armin and I have uncovered via our meetings with Source & Supplier that the content and people from Source & Supplier will get pushed to Luminate's academy after they are done with S&S. We are ironing out the details on what that exactly means, but our point of contact said that at it's core, it means that Luminate will be soon getting an influx of new users. While this is great overall, it may only exacerbate some of the above points as Stephanie will be getting even more feedback and want to incorporate even more changes that requires our TAM support.

View File

@ -0,0 +1,36 @@
import requests
import Apikeys
import pprint
PP = pprint.PrettyPrinter(indent=4)
APIKEY = Apikeys.SANDBOX
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
BASEURL = "https://api.northpass.com/v2"
def get(url):
try:
get_response = requests.get(url, headers=HEADERS)
# print(f"Executed Get Request. Status code is {get_response.status_code}")
except HTTPError as h:
print(
f"Error occurred. Here's the info: {h} and status code: {get_response.status_code}"
)
finally:
json_get = get_response.json()
# PP.pprint(json_get)
return json_get
def post(url, payload):
try:
post_response = requests.get(url, headers=HEADERS, json=payload)
print(f"Executed Post Request. Status code is {get_response.status_code}")
except HTTPError as h:
print(
f"Error occurred. Here's the info: {h} and status code: {get_response.status_code}"
)
finally:
json_post = get_response.json()
# PP.pprint(json_post)

View File

@ -122,8 +122,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -136,16 +135,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"400": {
"description": "invalid params",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -199,9 +196,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -324,8 +319,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -338,16 +332,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"400": {
"description": "invalid params",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -464,9 +456,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -566,8 +556,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -580,16 +569,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"400": {
"description": "invalid params",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -643,9 +630,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -741,8 +726,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -755,16 +739,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"400": {
"description": "invalid params",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -818,9 +800,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -852,8 +832,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -913,9 +892,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -968,8 +945,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1023,9 +999,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
},
@ -1088,8 +1062,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1127,8 +1100,7 @@
"description": "not found",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1154,8 +1126,7 @@
"description": "unprocessable entity",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1181,9 +1152,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -1222,8 +1191,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1261,8 +1229,7 @@
"description": "not found",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1288,9 +1255,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
},
@ -1303,9 +1268,7 @@
"consumes": [
"application/json"
],
"produces": [
],
"produces": [],
"parameters": [
{
"name": "project_id",
@ -1327,8 +1290,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"cache-control": {
@ -1337,16 +1299,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"404": {
"description": "not found",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1372,9 +1332,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -1501,8 +1459,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1515,16 +1472,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"400": {
"description": "invalid params",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1656,9 +1611,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -1754,8 +1707,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1768,16 +1720,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"400": {
"description": "invalid params",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1820,9 +1770,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -1837,9 +1785,7 @@
"consumes": [
"application/json"
],
"produces": [
],
"produces": [],
"parameters": [
{
"name": "project_id",
@ -1892,8 +1838,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"cache-control": {
@ -1902,17 +1847,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
}
},
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -1951,8 +1893,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -1999,9 +1940,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -2019,16 +1958,13 @@
"produces": [
"application/json"
],
"parameters": [
],
"parameters": [],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2092,9 +2028,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
},
@ -2140,8 +2074,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2184,9 +2117,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -2218,8 +2149,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2262,9 +2192,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
},
@ -2277,9 +2205,7 @@
"consumes": [
"application/json"
],
"produces": [
],
"produces": [],
"parameters": [
{
"name": "project_id",
@ -2294,8 +2220,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"cache-control": {
@ -2304,17 +2229,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
}
},
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
},
@ -2367,8 +2289,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2411,9 +2332,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -2516,8 +2435,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2530,16 +2448,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"400": {
"description": "invalid params",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2626,9 +2542,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -2688,8 +2602,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2731,8 +2644,7 @@
"description": "not found",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2758,9 +2670,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -2856,8 +2766,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2870,16 +2779,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"400": {
"description": "invalid params",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -2933,9 +2840,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -2967,8 +2872,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3003,8 +2907,7 @@
"description": "not found",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3030,9 +2933,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
},
@ -3110,8 +3011,7 @@
"description": "not found",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3137,9 +3037,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
},
@ -3152,9 +3050,7 @@
"consumes": [
"application/json"
],
"produces": [
],
"produces": [],
"parameters": [
{
"name": "project_id",
@ -3169,8 +3065,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"cache-control": {
@ -3179,16 +3074,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"404": {
"description": "not found",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3214,9 +3107,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
},
@ -3294,8 +3185,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3330,8 +3220,7 @@
"description": "not found",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3357,9 +3246,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -3391,8 +3278,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3433,9 +3319,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -3467,8 +3351,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3509,9 +3392,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -3543,8 +3424,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3585,9 +3465,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -3619,8 +3497,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3661,9 +3538,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}
@ -3695,8 +3570,7 @@
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3709,16 +3583,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"204": {
"description": "successful operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"cache-control": {
@ -3727,16 +3599,14 @@
}
},
"examples": {
"application/json": {
}
"application/json": {}
}
},
"422": {
"description": "failed operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3762,8 +3632,7 @@
"description": "failed operation",
"schema": {
"type": "object",
"properties": {
}
"properties": {}
},
"headers": {
"content-type": {
@ -3789,9 +3658,7 @@
"deprecated": false,
"security": [
{
"X-Api-Key": [
]
"X-Api-Key": []
}
]
}

View File

@ -1,51 +0,0 @@
import requests
import Apikeys
import pprint
PP = pprint.PrettyPrinter(indent=4)
APIKEY = Apikeys.SANDBOX
HEADERS = {"content-type": "application/json", "X-Api-Key": APIKEY}
BASEURL = "https://api.northpass.com/v2/migration"
def create_project():
"""
Function to create a project with just a name. While ID is in the example payload, it isn't needed.
Will generate a project ID for you in the return that you can use to transfer everything.
Note that it will not give you an error if a project already exists with that name!
"""
payload = { "data": {
"type": "migration_projects",
"attributes": {
"name": "My Second Migration Project"
},
} }
create_req = requests.post(f"{BASEURL}/projects", headers=HEADERS, json=payload)
print(payload)
print(create_req.status_code)
print(create_req.text)
def get_all_projects():
"""
Returns all projects. Leverage PrettyPrint or uncomment the name to just return names and ids.
"""
get_proj = requests.get(f"{BASEURL}/projects", headers=HEADERS)
print(get_proj.status_code)
# PP.pprint(get_proj.json())
for items in get_proj.json()['data']:
print(f"{ items['attributes']['name'] } -- { items['id'] }")
def get_specific_project():
"""
Returns results from a specific project.
"""
proj_id = "13aa7aed-3fb5-4488-9185-3befd0c1ae86"
get_spec_proj = requests.get(f"{BASEURL}/projects/{proj_id}", headers=HEADERS)
print(get_spec_proj.status_code)
PP.pprint(get_spec_proj.json())
if __name__ == "__main__":
# create_project()
# get_all_projects()
get_specific_project()

View File

@ -0,0 +1,101 @@
import Calls
baseurl = Calls.BASEURL
def get_people():
email = "norm@rsmsn.co"
if type(email) is str:
learner_uuid = __get_individual_person__(email)
get_courses(learner_uuid)
elif type(email) is list:
person_uuids = __get_group_person__(email)
else:
print("Couldn't recognize the type of data you're trying to use.")
def get_courses(learner_uuid):
course = "Norm Manager Test"
if type(course) is str:
course_uuids = __get_individual_course__(course, learner_uuid)
elif type(course) is list:
courses_uuids = __get_group_course__(course, learner_uuid)
else:
print("Couldn't recognize the type of data you're trying to use.")
def __get_individual_course__(name, learner_uuid):
url = f"{baseurl}/courses?filter[name][eq]={name}"
returned = Calls.get(url)
for items in returned["data"]:
single_uuid = items["id"]
print(f"Cool. Course {single_uuid} exists. Checking enrollments.")
enrollment = __get_enrollment_status__(single_uuid, learner_uuid)
def __get_enrollment_status__(uuid, learner_uuid):
enrollment_url = f"{baseurl}/courses/{uuid}/enrollments?filter[person_id][eq]={learner_uuid}"
enrolled = Calls.get(enrollment_url)
if enrolled['data'] == "":
print("Oof, no enrollments. Not to worry. We'll get one created for you.")
"""
If the learner isn't enrolled yet, we need to create one first. Here's the URL:
(
"/v2/migration/projects/{project_id}/items/{item_id}/enrollment_resources",
"post",
)
"""
else:
print("Nice! We have an enrollment. So now we just need to update progress.")
"""
If the learner is enrolled, we can go straight to creating an attempt.
(
"/v2/migration/projects/{project_id}/items/{item_id}/course_attempt_resources",
"post",
)"""
def __get_group_course__(list):
multiple_uuids = []
for person in email:
url = f"{baseurl}/people?filter[email][eq]={email}"
returned = Calls.get(url)
for items in returned["data"]:
multiple_uuids.append(learner_uuid)
def __get_individual_person__(email):
url = f"{baseurl}/people?filter[email][eq]={email}"
returned = Calls.get(url)
for items in returned["data"]:
if items["attributes"]["registration_status"] == "activated":
single_uuid = items["id"]
print(
f"Awesome. This dude is activated. Proceeding with learner {single_uuid}"
)
return single_uuid
else:
print("Sorry bruv, but ya mate ain't activated yet. Can't do nuffin.")
def __get_group_person__(list):
multiple_uuids = []
for person in email:
url = f"{baseurl}/people?filter[email][eq]={email}"
returned = Calls.get(url)
for items in returned["data"]:
if items["attributes"]["registration_status"] == "activated":
print("Awesome. This dude is activated. Proceeding.")
single_uuid = items["id"]
multiple_uuids.append(learner_uuid)
else:
print("Sorry bruv, but ya mate ain't activated yet. Can't do nuffin.")
return multiple_uuids
if __name__ == "__main__":
get_people()
# get_courses()

View File

@ -0,0 +1,146 @@
"""
This file serves as the basecamp for all the calls for the projects.
The Creation and Deletion functions will likely be put into different files after some time.
For now, each function needs to be selected below.
*********
Questions:
- Does creating an attempt also create an enrollment?
- Does an attempt/enrollment create a course?
- No to either of these.
- What is the point of multiple item_ids? They seem as variable as projects.
- What is a display name in enrollment or attempt resources?
Notes:
- If client delivers just course progress, do we call completed activities in the array 1, 2, and 3.
- 427 within completed activities shows id, 281 within completed activities shows UUID.
"""
import json
import Calls
JSONDOC = "./api_docs.json"
BASEURL = "https://api.northpass.com/v2/migration"
# All possible URLs and their functions:
tupee = [
# *************************
# The most fundamental of calls.
# *************************
("/v2/migration/projects", "get", "post"),
("/v2/migration/projects/{project_id}", "get", "delete", "patch"),
("/v2/migration/projects/{project_id}/items", "get", "post"),
("/v2/migration/projects/{project_id}/items/{item_id}", "get", "delete"),
# *************************
# Get Resources (Done after you've added them from below)
# *************************
("/v2/migration/projects/{project_id}/items/{item_id}/resources", "get"),
# *************************
# Post calls for creating new resources.
# *************************
("/v2/migration/projects/{project_id}/items/{item_id}/section_resources", "post"),
("/v2/migration/projects/{project_id}/items/{item_id}/person_resources", "post"),
("/v2/migration/projects/{project_id}/items/{item_id}/process_resources", "post"),
("/v2/migration/projects/{project_id}/items/{item_id}/course_resources", "post"),
(
"/v2/migration/projects/{project_id}/items/{item_id}/quiz_attempt_resources",
"post",
),
(
"/v2/migration/projects/{project_id}/items/{item_id}/activity_resources",
"post",
),
(
"/v2/migration/projects/{project_id}/items/{item_id}/course_attempt_resources",
"post",
),
(
"/v2/migration/projects/{project_id}/items/{item_id}/enrollment_resources",
"post",
),
(
"/v2/migration/projects/{project_id}/items/{item_id}/learning_path_attempt_resources",
"post",
),
# *************************
# This is just for setting up the Skilljar Config. Not needed yeet.
# *************************
(
"/v2/migration/projects/{project_id}/skilljar_configuration",
"get",
"post",
"delete",
"patch",
),
# *************************
# Extract is just for getting things out of Skilljar
# *************************
("/v2/migration/projects/{project_id}/extraction_processes", "get"),
("/v2/migration/projects/{project_id}/extract_course_attempts", "post"),
("/v2/migration/projects/{project_id}/extract_courses", "post"),
("/v2/migration/projects/{project_id}/extract_enrollments", "post"),
("/v2/migration/projects/{project_id}/extract_people", "post"),
(
"/v2/migration/projects/{project_id}/extraction_processes/{extraction_process_id}/processing_logs",
"get",
),
# *************************
# Migrate is putting things into CE.
# *************************
("/v2/migration/projects/{project_id}/start_migration", "post"),
]
def read_json_docs():
file = open(JSONDOC)
data = json.load(file)
for items, vals in data["paths"].items():
print(items)
for cmds in vals:
print(cmds)
file.close()
def create_project():
"""
Function to create a project with just a name. While ID is in the example payload, it isn't needed.
Will generate a project ID for you in the return that you can use to transfer everything.
Note that it will not give you an error if a project already exists with that name!
"""
project_name = ""
payload = {
"data": {
"type": "migration_projects",
"attributes": {"name": project_name},
}
}
url = f"{BASEURL}/projects"
Calls.post(url, payload)
def get_all_projects():
"""
Returns all projects.
"""
url = f"{BASEURL}/projects"
ret = Calls.get(url)
for items in ret["data"]:
print(f"{ items['attributes']['name'] } -- { items['id'] }")
def get_specific_project():
"""
Returns results from a specific project.
"""
proj_id = "13aa7aed-3fb5-4488-9185-3befd0c1ae86"
url = f"{BASEURL}/projects/{proj_id}"
Calls.get(url)
if __name__ == "__main__":
# read_json_docs()
# create_project()
get_all_projects()
# get_specific_project()