Comments (7)
thanks @allan-on can you share your questionnaire?
from android-fhir.
thanks @allan-on can you share your questionnaire?
Hi @jingtang10 This is the Questionnaire I used in the demo above:
{
"resourceType": "Questionnaire",
"item": [
{
"linkId": "1",
"type": "group",
"text": "Repeated Group",
"repeats": true,
"item": [
{
"linkId": "1-2",
"type": "choice",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "drop-down",
"display": "Drop down"
}
],
"text": "Drop down"
}
}
],
"text": "Sample dropdown question",
"answerOption": [
{
"valueCoding": {
"code": "answer-a",
"display": "A"
}
},
{
"valueCoding": {
"code": "answer-b",
"display": "B"
}
},
{
"valueCoding": {
"code": "answer-c",
"display": "C"
}
},
{
"valueCoding": {
"code": "answer-other",
"display": "Other"
}
}
],
"item": [
{
"linkId": "1-3-1",
"text": "Dropdown question helper text",
"type": "display",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "flyover",
"display": "Fly-over"
}
],
"text": "Flyover"
}
}
]
}
]
},
{
"linkId": "1-1",
"text": "Sample date question",
"type": "date",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
"valueString": "yyyy-mm-dd"
},
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "%resource.descendants().where(linkId='1-2').answer.value.code = 'answer-a'"
}
}
]
}
]
}
]
}
from android-fhir.
thanks @allan-on can you share your questionnaire?
Hi @jingtang10 This is the Questionnaire I used in the demo above:
{ "resourceType": "Questionnaire", "item": [ { "linkId": "1", "type": "group", "text": "Repeated Group", "repeats": true, "item": [ { "linkId": "1-1", "text": "Sample date question", "type": "date", "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/entryFormat", "valueString": "yyyy-mm-dd" } ] }, { "linkId": "1-2", "type": "choice", "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", "valueCodeableConcept": { "coding": [ { "system": "http://hl7.org/fhir/questionnaire-item-control", "code": "drop-down", "display": "Drop down" } ], "text": "Drop down" } } ], "text": "Sample dropdown question", "answerOption": [ { "valueCoding": { "code": "answer-a", "display": "A" } }, { "valueCoding": { "code": "answer-b", "display": "B" } }, { "valueCoding": { "code": "answer-c", "display": "C" } }, { "valueCoding": { "code": "answer-other", "display": "Other" } } ], "item": [ { "linkId": "1-3-1", "text": "Dropdown question helper text", "type": "display", "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", "valueCodeableConcept": { "coding": [ { "system": "http://hl7.org/fhir/questionnaire-item-control", "code": "flyover", "display": "Fly-over" } ], "text": "Flyover" } } ] } ] } ] } ] }
@allan-on Can you please check whether posted questionnaire has the enable-when expression?
from android-fhir.
Hi @santosh-pingle. I'm sorry about that. I've updated the sample I shared earlier.
from android-fhir.
Hey @allan-on i'm not sure i agree with the use of %resource
in the enable when expression I think you end up losing the context of your answer inside the repeated group.
I think the best way to handle this is actually use enable when element defined in the questionnaire base spec.
Take a look at the comemnts section of this element: https://build.fhir.org/questionnaire-definitions.html#Questionnaire.item.enableWhen.question it very clearly defines the order or traversal so I think the behaviour is more predictable.
from android-fhir.
Hey @allan-on,
I posted a question on fhir chat https://chat.fhir.org/#narrow/stream/179266-fhirpath/topic/parent.28.29.20or.20siblings.28.29.3F and I've yet to try this method.
But I've I tried to use enable when statement instead of enablewhen expression, and I tried the following questionnaire:
{
"resourceType": "Questionnaire",
"item": [
{
"linkId": "1",
"type": "group",
"text": "Repeated Group",
"repeats": true,
"item": [
{
"linkId": "1-2",
"type": "choice",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "drop-down",
"display": "Drop down"
}
],
"text": "Drop down"
}
}
],
"text": "Sample dropdown question",
"answerOption": [
{
"valueCoding": {
"code": "answer-a",
"display": "A"
}
},
{
"valueCoding": {
"code": "answer-b",
"display": "B"
}
},
{
"valueCoding": {
"code": "answer-c",
"display": "C"
}
},
{
"valueCoding": {
"code": "answer-other",
"display": "Other"
}
}
],
"item": [
{
"linkId": "1-3-1",
"text": "Dropdown question helper text",
"type": "display",
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "flyover",
"display": "Fly-over"
}
],
"text": "Flyover"
}
}
]
}
]
},
{
"linkId": "1-1",
"text": "Sample date question",
"type": "date",
"enableWhen": [
{
"question": "1-2",
"operator": "=",
"answerCoding": {
"code": "answer-a",
"display": "A"
}
}
],
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
"valueString": "yyyy-mm-dd"
}
]
}
]
}
]
}
which worked with #2597 which I've just sent out.
from android-fhir.
Thanks @jingtang10 and @santosh-pingle for working on this!
I've tested this on my end and it works with the enableWhen
statement 👍🏾
from android-fhir.
Related Issues (20)
- Add Distinct in SQL query instead of kotlin function in search query
- Previous button shows up on the first page
- Cookie Support in Headers through networkConfiguration HOT 7
- Snapshot Packages are not published or visiblie HOT 5
- Update documentation for custom ui components
- Dependabot should not add google/android-fhir group as reviewers to its PRs HOT 2
- Unknown owner on line 11: make sure @santosh-pingle exists and has write access to the repository HOT 1
- Crash when using QuestionnaireFragment.Builder.setShowNavigationInDefaultLongScroll
- Upon deleting a repeatedGroup answer, the other repeatedGroup answers are also reset. HOT 1
- UI/UX Design: The name for a specific field be equidistant from its intended field and another field HOT 2
- UI/UX Design: Warning text (i.e. text that are nudging clinical decision guideline to users) looks visually similar with other fields HOT 1
- Isolating Room Components with hapi dependencies HOT 1
- Incorporate `%context` into variable expression evaluation
- > Could not PUT 'https://maven.pkg.github.com/google/android-fhir/com/google/android/fhir/common/0.1.0-alpha05-SNAPSHOT/common-0.1.0-alpha05-20240710.120641-20.module'. Received status code 409 from server: Conflict HOT 1
- https://google.github.io/android-fhir/ documentation website is broken HOT 4
- Using GitHub Codespaces for documentation writing does not work due to: "The SDK directory is not writable (/opt/android)" error HOT 7
- Dependabot not creating updates? (Which?) HOT 9
- Helper function to match the correct pair of qItem and qrItem HOT 4
- Extending the db.transaction removal fix to the FhirEngine.search HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-fhir.