/weasel

Web Enabled AI Support Expression Learner - helping you better understand a digital government

Primary LanguageCSSOtherNOASSERTION

Weasel (Web Enabled AI Support Expression Learner)

Weasels are small yet very competent hunters. They can find things and retrieve things even in the most inaccessible of places.

This app is kind of like one of those weasels... It's an app that helps you find things to help you learn stuff or do stuff. Weasel, the Web Enabled AI Support Expression Learner - helping you better understand a digital government (With Easy Available Smart E-Learning) lets you get the information that matters to you. There's a lot of great content and sites out there for us to improve and grow, but sometimes just getting started is the hard part.

That's where Weasel comes in.

You ask weasel things like "why is digital important for government", "why should TBS care about open source", Suggested Weasel Queries: "why does open source matter to me", "access my service canada account", "I want to become a citizen", "why does digital matter to my department", "I want to learn french", "Renew my passport", "what skills do I need for digital" and weasel will find you online learning tools (and some guiding information to help you get rolling). We don't want to just give you a list, that doesn't help as much as people hope. We aim to give you knowledge, what you can do, how you'd learn, if there are any hints from the experts in the industry.

Our goal is to get you learning by clearing the weeds and critters in your path. That's what Weasel is for.

But it doesn't end there. With the right training the Weasel can play fetch, even help you renew your passport or checkout your benefits.

The only limitations are how well we treat the Weasel.

Tools and Technology

The experimental apps here are built on the following stack:

  • Weasel is built with HTML, SASS, JS / jQuery, Metro4
  • As our ai framework we are using wit.ai, but aim to support multiple frameworks
  • The data is all JSON files, we curated it from various assets across the web
  • The server-side is an Azure cloud running an Ubuntu VM, Python 3, Flask, and nginx
  • We automate our deploys with crontab and pm2

Note: Our long term aspiration goal here is to have you be able to naturally speak to weasel about work related stuff and it would actually be useful. You'd ask a question and the weasel would find you the best way to move forward. Our goal is to experiment with the AI platforms out there to see if we can make really compelling experiences for the humans. We also want to try and stay as AI system agnostic as possible, while still making the data we generate open and modular.

Note: Canada has two official languages. If you want something to resonate with Canadians, you better be able to talk to them. Weasel currently supports listening/reading in english (french coming soon) and can answer in english (we're actively working on bilinguaweasel). This isn't a limitation of the code, just the human writing it. Je travaille à améliorer ma capacité de parler français. And so will weasel.

Getting/Refreshing the Data

All the data is raw JSON, getting the data is as simple as loading the link. The data was generated manually by doing some legwork for the learner and building an easy to navigate hot list of content.

There's also an api baked in which returns json answers. This can be used to embed weasel functionality into almost any endpoint

http://localhost:5050/weasel/api?weasel_ask=why+does+open+source+matter+to+government

And the weaseliest of them all, the action-api. This returns JSON and performs weasel actions (like routing searches and getting results)

http://localhost:5050/weasel/action-api?weasel_ask=renew+my+passport

Note: The aspirational goal here is to have a crowd sourced feed in from people who find nice treats on the web or their own expert brains and feed it to the Weasel. As the answer knowledge increases, and we refine the understanding of the model... It could be truly great.

Weasel answer JSON

The JSON is standard, but we use hints to help serve to best content in the best way. The answer intuition uses a direct match or a * match to determine applicability. Then the action (currently there are display and access) will trigger weasel to do what is needed.

  • "display" is used for returning an html answer card with the details available to the user
  • "access" will use the hyperlink and redirect the human to the appropriate link
{
	"intent": "access site",
	"topic_interest": "canada.ca",
	"impact_on": "*",
	"key_party": "*",
	"answer": {
		"type": "weasel-answer",
		"authority":"core",
		"action": "access",
		"media": "2378528 visitors have accessed the link I found",
		"hyperlink": "https://www.canada.ca/en.html",
		"spoken": "Access Canada.ca Home page",
		"written": "Access Canada.ca Home page"
	}
},

Im a human how do I interact with the Weasel?

Weasel understands a few things but they can get a lot done:

  • why is [a:topic] good for [b:thing]
  • access [a:webpage]
  • search [a:thing] [statement]
  • search lucky [a:thing] [statement]
  • create [a:accountthing]
  • learn [a:thing]
  • what skills do I need for [a:thing]
  • and a bunch more!

You can say things like "search lucky cra the audit process for charities" and weasel will send you to the first result it find after searching cra for you.

Building the Stylesheets

  • Install Sass:
  • If you are on windows without make, just directly use sass
cd wheremystufflives/development/weasel/
sass sass/weasel.css.scss:sass/weasel.css

This will create the css files you need. When your testing is done, move item into the css directory

  • Assuming you have make, to watch the Sass source for changes and build the stylesheets automatically, run:
make watch
  • To compile the Sass stylesheets once, run:
make clean all

or:

# -B tells make to run even if the .css file exists
make -B

Updating code and commit to repo

  • Switch to dev branch, get changes
git checkout temp_branch
git pull
  • Make your changes to templates/styles
  • Rebuild stylesheets (see above)
cd wheremystufflives/development/weasel/
sass sass/weasel.css.scss:sass/weasel.css
  • If your stylesheets look good, go ahead and copy them into the static/whatmyappiscalled/css/ of the app you're modifying. If you're feeling brave, you can just write out the files to the static directory from sass
  • Test changes locally with anaconda in (base) by launching an ananconda terminal window
cd wheremystufflives/development/weasel/
python application.py
  • The site should now serve on localhost:5050
  • Make sure everything works as you expect, then send it into the repo
git add .
git commit -m "update msg"
git push

Deploying the app

  • Have your project lead merge the temp branch into master
  • Deploy master branch code by logging into your cloud instance vm
 ssh myusername@mydomain.wherever
 cd ~
 sh update_app.sh
 logout

Thanks and mentions

The entire team at CSPS Digital Academy both DIS and DAT - you are all an inspiration.

Public domain

This project is in the worldwide public domain. As stated in CONTRIBUTING:

This project is in the public domain within the Canada, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.