Widget Resource Client
This client uses standard html to pull in javascript resources and can then call functions defined in those
javascript files directly from local code. For example the patient survey submit button calls
generateScore(patient) to use the generateScore function defined in decision-support.js
Custom widgets can also be loaded using this method. The vc-slider.js file defines an HTML tag called
<vc-slider> that can be used to render the entire slider input and output shown below.
This slider has one required attribute called score which is used to determine the
lower bound, upper bound and scaling of the algorithm used in converting the patient's preference into a risk
value displayed on the lower gradient. There are also attributes that change the text of the slider options,
the gradient labels and the gradient colors.
The slider widget uses a function called getRiskFunction() which returns a function
that is used to calculate the output risk given the position of the slider and the initial risk score passed
into the widget. A sample implementation is provided in decision-support.js but a user can supply their
own implementation to translate the slider input into the final bleeding vs stroke risk.
The widget also uses a needsAc(score) function which returns either "YES",
"MAYBE" or "NO". In the "YES"
and "NO" cases the appropriate message is displayed, otherwise the values
clarification slider is shown. Like the getRiskFunction() function this is provided
in decision-support.js but can also be swapped out with another function that returns the three values
mentioned above.