Generate feedback based on user interactions from models. This repo contains Javascripts for listening to Model CC-Log-Manager Events, and providing student feedback based on how they interacted with the model.
It is intended to be used in LARA as ExternalScript
s. These scripts must be reviewed by a LARA admin before being added to the runtime. Authors must then add one more more Model Feedback script from lara-approved-scripts/
to the interactive page.
Warning: This is a new and experimental feature, and is subject to rapid change.
These scripts are written in TypeScript. They are built using Webpack . It is assumed that the developer has Node and NPM installed on the local workstation.
After cloning the repo follow these steps to get started:
npm i
to install deps.webpack
to build.npm run test
to test.webpack-dev-server
to continuously build.npm run test -- --watch
to continuously run tests.
Branches are automatically built by Travis CI and deployed to https://model-feedback.concord.org .
The event stream is monitored and compared to a feedback decision tree. The decision tree is specified as JSON. See: https://model-feedback.concord.org/index.html for more details about the JSON format for feedback decision trees.
- The CC-Log-Manager event stream is listened to for key events.
Detectors
identify sequences of low level events, and emit new semantic events of interest.Factors
(labeled numeric values) are updated when high-level events are observed.- One or more
DecisionTree
s are evaluated. These trees use the state ofFactors
to evaluate itsconditions
and determineresults
. - Feedback items are displayed as
results
(terminal condition nodes).
This is two step process:
- Create a new Typescript class in
src/lara-approved-scripts
- Modify
webpack.config.js
to create a new build target for webpack.
In order to be able to instrument models scripts must be added to the LARA runtime. You can see examples of these scripts in src/lara-approved-scripts
. These scripts must follow a loosely defined initialization API. The simplest example of the external script API is visible in src/lara-approved-scripts/event-debugging.ts
Your classes constructor should have a signature matching this:
constructor(conf:any, context:Context) { … }
Any user-specified data from LARA (such as DecisionTree
JSON) is passed into conf
. context
includes data set by the LARA Runtime system, and can safely be ignored.
After your class has been defined, you must expose it to LARA:
const context:ExternalScriptHost = (window as any).ExternalScripts;
context.register(<identifier>, <ClassName>);
The identifier
is a string of your choosing, which should uniquely identify this script, and should be given to LARA administrators.
Look for the section named entry: {
and add a new target label for your
script. Follow the example in the debugging
target. The script source <yourclass>.ts
should be the file you just added in step 1.
module.exports = {
entry: {
…
'debugging': ["./src/lara-approved-scripts/event-debugging.ts"],
'<label>': ["./src/lara-approved-scripts/<yourclass>.ts"],
…
},
__tests__
→ Jest test files.components
→ React viewsconfined-model
→WellManager
,LayerHelper
, and Decision Tree for confined model.detectors
→ Event detectorslara-approved-scripts
→ Code entry points for Laramodels
→ Decision Tree JSON files (note these are just for reference, because the idea is that)schemas
→ You can ignore this for now. It specifies the Decision Tree JSON Schema. This was going to be used to help authors edit Decision Tree configurations. This work has been postponed.
There are other 'junk' directories that should be cleaned up eventually. Sorry for the mess. :)
In the TOP of the source tree there are several interesting files too:
types.ts
defines some useful types, including namedLogEvent
EVENT_TYPES
.factor.ts
,result.ts
,condition.ts
, anddecision-tree.ts
all define parts of theDecisionTree
outlined in the block-diagram (illustrated above).