-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add enableWhen ruleset #21
base: main
Are you sure you want to change the base?
Conversation
How it looks like - Screen.Recording.2022-09-30.at.16.31.26.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks for the contribution, @vadi2! See my individual comment for a couple of questions/suggestions about this.
* answerBoolean = true | ||
|
||
// this question will only be shown if of another question (comorbidities) has been answered in a certain way | ||
RuleSet: enableWhenComorbidityyy(code) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions:
- Are the three
y
s at the end ofenableWhenComorbidityyy
intentional or a typo? - Might it make sense to generalize this even more, so it is
RuleSet: enableWhenCode(question, code)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The y's were a typo!
I've generalised it, have a look. I don't feel enableWhenCode(comorbidities, SCT#35489007)
has the same good flow to it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just thinking it's more generalizable for people who copy/paste the example. The RuleSet w/ comorbities hard-coded only works as-is for people with that exact question in their questionnaire. If you really want the comorbidities RuleSet, you could take it a bit further and also add:
RuleSet: enableWhenComorbidity(code)
* insert enableWhenCode(comorbidities, {code})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vadi2 -- Thanks again for the contribution! I think there are a few inconsistencies here that need to be addressed. I apologize -- they probably snuck in when you were implementing my suggestions!
Thanks again for your help on this!
@@ -0,0 +1,59 @@ | |||
// this question will only be shown when another question has been answered as 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description doesn't match the name of the RuleSet (enableWhenCode
). I think it might be left over from your previous RuleSet.
* enableWhen | ||
* question = "{question}" | ||
* operator = #= | ||
* answerBoolean = {code} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be answerCoding
?
* type = #integer | ||
* text = "So how old are you?" | ||
* required = true | ||
* insert enableWhenCode(age-known, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
is a boolean, not a code. You probably need to reintroduce the enableWhenTrue
RuleSet to handle booleans.
@vadi2 - I just noticed this PR is still open. I had made a few minor comments on your PR that haven't been resolved yet. Are you still interested in moving this PR forward? Or would you prefer that we make those last few updates for you? |
I heard of a call for more rulesets at the WGM - contributing one I found handy for dynamic behaviour in Questionnaires.