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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions Examples/Rule Sets/Questionnaires/enableWhen.fsh
Original file line number Diff line number Diff line change
@@ -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.

RuleSet: enableWhenCode(question, code)
* 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?


RuleSet: enableWhenComorbidity(code)
* insert enableWhenCode(comorbidities, {code})

ValueSet: ComorbidityHistory
Id: ComorbidityHistory
Title: "Comorbidity history"
Description: "Documented history of comorbidities"
* ^copyright = "This value set includes content from SNOMED CT, which is copyright © 2002+ International Health Terminology Standards Development Organisation (IHTSDO), and distributed by agreement between IHTSDO and HL7. Implementer use of SNOMED CT is not covered by this agreement"
* include SCT#363443007 "Malignant tumour of ovary"
* include SCT#35489007 "Depression"

Instance: TestQuestionnaire
InstanceOf: Questionnaire
Usage: #definition
Description: "Test Questionnaire to demonstrate enableWhen"

* name = "TestQuestionnaire"
* title = "Test Questionnaire to demonstrate enableWhen"
* status = #draft

* item[+]
* linkId = "general-information"
* type = #group
* text = "General information"
* required = true

* item[+]
* linkId = "age-known"
* type = #boolean
* text = "Do you remember how old you are?"
* required = true

* item[+]
* linkId = "age"
* 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.


* item[+]
* linkId = "comorbidities"
* type = #choice
* text = "Have you been told by a doctor that you have any of the following?"
* answerValueSet = Canonical(ComorbidityHistory)
* required = true
* repeats = true

* item[+]
* linkId = "depression-treatment"
* type = #boolean
* text = "Do you receive treatment for depression?"
* insert enableWhenComorbidity(SCT#35489007)