David Hietpas Library Web Developer University of Wisconsin - Polk Library
Ted Mulvey Information Literacy Librarian University of Wisconsin - Polk Library
ANVIL General Understanding Integration into D2L through Valence Samples and examples None Technical Technical Geek Level
ANVIL… “huh???” Active iNstructional Videos for Information Literacy External learning and assessment application disguised as “Bar Trivia” Leaderboards Game play Fun themes
USP – Universities Study Program Required learning outcomes uwosh.edu/usp Research Instruction & Information Literacy Learning through repetition and competition. Learning through a fun, game environment
Quick Demo
“it was helpful” “this was more helpful too” “By the way, I LOVE ANVIL” “This is great!” “This is awesome! Nice work.” "Very cool game, by the way. I can see (having had some fun with it myself), that this is very valuable [early] in the research process." “That was fun” “It was resourceful”
This happened this week! Player Nated32 played game over 50 times to be #1 on all the leaderboards The next day, another player beat Nated32 Nated32 replayed the game, past midnight, for a total of 137 times played to regain the #1 spot Nated32 approached our librarian Ted Mulvey and told him how “he owned that game” and how he was “upset when someone beat him”
Currently used in 44 courses! Some courses not even USP! In some courses this is 10% of the total grade! Feedback has only been positive Leaderboard Pro’s Completed questions each question in 2 seconds! Played dozens of times, learning through repetition! First Semester Success
Lets move into the technical ANVIL is built on the Pyramid framework Python language Our campus web presence is python ▪ Plone CMS
ANVIL Python 2.7 Valence Client SDK Only Python 3.* I made the Valence Client SDK backwards compatible with python 2.7 Packaged the client code back up
Read the Valence documentation Apply for API Key Have your D2L administrator setup a sandbox course for you to work in with test users Don’t do anything live with real users Have a local environment ready to go with your Valence SDK Client
Understand RESTful Representational State Transfer Learn from the Sample Code which comes with the Valence Client SDK You MUST read this… (The following slide picture is from the link above.)
What Valence API components are we using? Authentication (AppContext, UserContext) WhoAmI (UserContext) Enrollment (UserContext) Dropbox (UserContext, OrgUnit) Dropbox Files (UserContext, OrgUnit)
Authentication Creating App Context Retrieving User Context In My Opinion “Hardest Part” Lots of requests and redirects with D2L Lets walk through it!
App Context Requires Application ID and Key Provide ID and Key to AppContext Creator in your SDK Will create your AppContext Object Again…
Python AppContext Example def get_app_context(self): global app_context if app_context == None: app_context = d2lauth.fashion_app_context(app_id=D2L_ID, app_key=D2L_KEY) return app_context def get_app_context(self): global app_context if app_context == None: app_context = d2lauth.fashion_app_context(app_id=D2L_ID, app_key=D2L_KEY) return app_context
User Context Requires AppContext Object Also requires ▪ Redirection URL ▪ D2L Host Again…
Python UserContext Example def get_user_context(self): url = self.request.url # your current url try: if not self.check_auth_tokens(): return Redirect(self.get_app_context().create_url_for_authentication(d2l_domain, url)) return self.get_app_context().create_user_context(result_uri=url, host=d2l_domain, encrypt_requests=True) except Exception as e: return HTTPForbidden() def get_user_context(self): url = self.request.url # your current url try: if not self.check_auth_tokens(): return Redirect(self.get_app_context().create_url_for_authentication(d2l_domain, url)) return self.get_app_context().create_user_context(result_uri=url, host=d2l_domain, encrypt_requests=True) except Exception as e: return HTTPForbidden() Go to D2L Return response here
Ready to make API request def authenticated_d2l_user(self): user_context = self.get_user_context() if not isinstance(user_context, d2lauth.D2LUserContext): return user_context # Below do any Valence API Calls with your User Context whoami = d2lservice.get_whoami(user_context) def authenticated_d2l_user(self): user_context = self.get_user_context() if not isinstance(user_context, d2lauth.D2LUserContext): return user_context # Below do any Valence API Calls with your User Context whoami = d2lservice.get_whoami(user_context) Type Introspection
Ready to make API request def authenticated_d2l_user_enrollment(self): user_context = self.my_get_user_context() if not isinstance(user_context, d2lauth.D2LUserContext): return user_context # Below do any Valence API Calls with your User Context courses = d2lservice.get_my_enrollments(user_context) def authenticated_d2l_user_enrollment(self): user_context = self.my_get_user_context() if not isinstance(user_context, d2lauth.D2LUserContext): return user_context # Below do any Valence API Calls with your User Context courses = d2lservice.get_my_enrollments(user_context) Type Introspection
App Context Permanently kept around User Context Created and contained within the scope of function and destroyed once function call completes No information is logged
Setup App Context Request from D2L the current users authorization D2L verifies and returns Auth Tokens Request from D2l the User Context D2l returns User Context With the User Context you can now make API requests API Requests Finished, User Context Destroyed Overview
Limitations in API Give me everything or nothing ▪ e.g. user information ▪ Services are not fine grained Not everything is available yet ▪ e.g. Creating new Dropbox folders ▪ Lots more… Role restrictions ▪ “Even as a power user, I wasn’t able to do certain things”
Python SDK does a lot of the work for me The PHP SDK seems more complex Seems to require lots of CURL Seems to require more url redirections
Authentication API Index Stackoverflow D2L Clients SDK Sample Code
Goal to Open Source the product ANVIL Capabilities All content is created through-the-web Export/Import trivia content Easy theming and changing themes Goal: Community of sharable educational content ▪ Information Literacy Package is available Coming Soon: Assessment and Report Generation
Feel free and try out the demo site D2L integration has been removed due to it being publicly accessible We want YOUR opinion on the following: Do you want it open sourced? What services would you want us to provide?
David Hietpas University of Wisconsin - Polk Library (Only free used)