Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add enableWhen ruleset #21

wants to merge 3 commits into from

Conversation

vadi2
Copy link
Contributor

@vadi2 vadi2 commented Sep 30, 2022

I heard of a call for more rulesets at the WGM - contributing one I found handy for dynamic behaviour in Questionnaires.

@vadi2
Copy link
Contributor Author

vadi2 commented Sep 30, 2022

How it looks like -

Screen.Recording.2022-09-30.at.16.31.26.mov

Copy link
Member

@cmoesel cmoesel left a 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  1. Are the three ys at the end of enableWhenComorbidityyy intentional or a typo?
  2. Might it make sense to generalize this even more, so it is RuleSet: enableWhenCode(question, code)?

Copy link
Contributor Author

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.

Copy link
Member

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})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Member

@cmoesel cmoesel left a 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'
Copy link
Member

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}
Copy link
Member

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)
Copy link
Member

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.

@cmoesel
Copy link
Member

cmoesel commented Jun 21, 2023

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants