Commit d491967
* - Fixing Missing calculatedExpression animations Fixes aehrc#1643
Test with below Questionnaire
{
"resourceType": "Questionnaire",
"id": "AssemblyInstructions",
"meta": {
"profile": []
},
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "heightValue",
"language": "text/fhirpath",
"expression": "%resource.descendants().where(linkId='heightValue').answer.valueDecimal"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "mxValueDisplay",
"language": "text/fhirpath",
"expression": "%resource.descendants().where(linkId='medical-history-condition1').answer.valueCoding.display"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "mxValue",
"language": "text/fhirpath",
"expression": "%resource.descendants().where(linkId='medical-history-condition1').answer.valueCoding"
}
},
{
"url": "http://hl7.org/fhir/StructureDefinition/variable",
"valueExpression": {
"name": "dob",
"language": "text/fhirpath",
"expression": "%resource.descendants().where(linkId='dob1').answer.value"
}
}
],
"contained": [
{
"resourceType": "ValueSet",
"id": "MedicalHistory",
"url": "https://smartforms.csiro.au/ig/ValueSet/MedicalHistory",
"name": "MedicalHistory",
"title": "Medical History",
"status": "draft",
"experimental": false,
"description": "The Medical History value set includes values that may be used to represent medical history, operations and hospital admissions.",
"compose": {
"include": [
{
"system": "http://snomed.info/sct",
"filter": [
{
"property": "constraint",
"op": "=",
"value": "^32570581000036105|Problem/Diagnosis reference set| OR ^32570141000036105|Procedure foundation reference set|"
}
]
}
]
}
},
{
"resourceType": "ValueSet",
"id": "MedicalHistory2",
"url": "https://smartforms.csiro.au/ig/ValueSet/MedicalHistory",
"name": "MedicalHistory",
"title": "Medical History",
"status": "draft",
"experimental": false,
"description": "The Medical History value set includes values that may be used to represent medical history, operations and hospital admissions.",
"compose": {
"include": [
{
"system": "http://snomed.info/sct",
"filter": [
{
"property": "constraint",
"op": "=",
"value": "^32570581000036105|Problem/Diagnosis reference set| OR ^32570141000036105|Procedure foundation reference set|"
}
]
}
]
}
}
],
"url": "http://www.health.gov.au/assessments/mbs/715",
"version": "0.3.0-assembled",
"name": "AboriginalTorresStraitIslanderHealthCheck",
"title": "Aboriginal and Torres Strait Islander Health Check",
"status": "draft",
"experimental": false,
"subjectType": [
"Patient"
],
"date": "2025-03-14",
"publisher": "AEHRC CSIRO",
"contact": [
{
"name": "AEHRC CSIRO",
"telecom": [
{
"system": "url",
"value": "https://confluence.csiro.au/display/PCDQFPhase2/Primary+Care+Data+Quality+Foundations+-+Phase+2"
}
]
}
],
"jurisdiction": [
{
"coding": [
{
"system": "urn:iso:std:iso:3166",
"code": "AU",
"display": "Australia"
}
]
}
],
"copyright": "Copyright © 2022+ Australian Government Department of Health and Aged Care - All rights reserved.\nThis content is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.\nSee https://creativecommons.org/licenses/by-sa/4.0/.\n",
"item": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
"valueString": "Height"
}
],
"linkId": "heightValue",
"text": "Height (Change Here)",
"type": "decimal",
"required": true,
"item": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "unit"
}
]
}
}
],
"linkId": "bmi-height-unit1",
"text": "m",
"type": "display"
}
]
},
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
"valueString": "Height"
},
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "iif(exists(%heightValue), %heightValue, 0.0)"
}
}
],
"linkId": "bmi-height-decimal",
"text": "Height Calc Expr Animation",
"type": "decimal",
"required": true,
"item": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "unit"
}
]
}
}
],
"linkId": "bmi-height-unit",
"text": "m",
"type": "display"
}
]
},
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "autocomplete"
}
]
}
}
],
"linkId": "medical-history-condition1",
"text": "Medical History Condition (Change Here)",
"type": "open-choice",
"answerValueSet": "#MedicalHistory"
},
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "autocomplete"
}
]
}
},
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "%resource.descendants().where(linkId='medical-history-condition1').answer.valueCoding"
}
}
],
"linkId": "medical-history-condition2",
"text": "Medical History Condition Open Choice CalcExp Animation",
"type": "open-choice",
"answerValueSet": "#MedicalHistory2"
},
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "autocomplete"
}
]
}
},
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "%mxValue"
}
}
],
"linkId": "medical-history-condition3",
"text": "Medical History Condition Choice CalcExp Animation",
"type": "choice",
"answerValueSet": "#MedicalHistory2"
},
{
"extension": [
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "iif(%mxValue.exists(), %mxValue.code, {})"
}
}
],
"linkId": "medical-health-condition-text",
"text": "Medical History Condition Text",
"type": "text"
},
{
"linkId": "dob1",
"type": "dateTime",
"repeats": false,
"text": "Datetime of birth change here"
},
{
"extension": [
{
"url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
"valueExpression": {
"language": "text/fhirpath",
"expression": "iif(%dob.exists(), %dob, {} )"
}
}
],
"linkId": "dob2",
"type": "dateTime",
"repeats": false,
"text": "Datetime of birth CalcExpr Animation"
}
]
}
* Refactor QR Item ID handling across form components
- Introduced `getQRItemId` utility function to manage QR Item IDs, ensuring that IDs generated from calculated expressions are unique.
- Updated multiple form components (AttachmentItem, BooleanItem, ChoiceAutocompleteItem, etc.) to utilize `getQRItemId` for initializing answer keys.
- This change enhances the reliability of ID handling in components that rely on QR Item answers, particularly in scenarios involving calculated expressions.
* - Reverting SingleItemSwitcher based on code review.
* - fix lint
---------
Co-authored-by: Janardhan Vignarajan <itzjana@gmail.com>
1 parent 0c09791 commit d491967
33 files changed
Lines changed: 125 additions & 71 deletions
File tree
- packages/smart-forms-renderer/src
- components/FormComponents
- AttachmentItem
- BooleanItem
- ChoiceItems
- DateTimeItems
- CustomDateItem
- CustomDateTimeItem
- DecimalItem
- IntegerItem
- OpenChoiceItems
- QuantityItem
- SliderItem
- StringItem
- TextItem
- TimeItem
- UrlItem
- hooks
- utils
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
| 130 | + | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
| |||
packages/smart-forms-renderer/src/components/FormComponents/ChoiceItems/ChoiceAutocompleteItem.tsx
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
45 | 46 | | |
46 | | - | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
0 commit comments