Skip to content
Closed
Show file tree
Hide file tree
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
109 changes: 109 additions & 0 deletions resources/Questionnaire/calculated-options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
resourceType: Questionnaire
id: calculated-options
name: calculated-options
title: Calculated options
status: active
url: "http://example.org/fhir/Questionnaire/calculated-options"
meta:
profile:
- https://emr-core.beda.software/StructureDefinition/fhir-emr-questionnaire
item:
- linkId: instructions
text: >-
Instructions: Enter given name and family name manually; full name and initials recalculate
from those fields. Enter pulse (e.g. 55, 80, 120); pulse rate band (calculated choice) and
is-tachycardia (calculated boolean) update from pulse input.
type: display

- linkId: calculated-section
text: CalculatedExpression examples (different answer types)
type: group
item:
- linkId: given-name
text: Given name
type: string
entryFormat: Enter given name

- linkId: family-name
text: Family name
type: string
entryFormat: Enter family name

- linkId: full-name
text: Full name (calculated string)
type: string
readOnly: true
calculatedExpression:
language: text/fhirpath
expression: >-
%resource.repeat(item).where(linkId='given-name').answer.valueString.first() &
' ' &
%resource.repeat(item).where(linkId='family-name').answer.valueString.first()

- linkId: initials
text: Initials (calculated string)
type: string
readOnly: true
calculatedExpression:
language: text/fhirpath
expression: >-
%resource.repeat(item).where(linkId='given-name').answer.valueString.first().substring(0, 1) &
%resource.repeat(item).where(linkId='family-name').answer.valueString.first().substring(0, 1)

- linkId: pulse-input
text: Pulse input
type: integer
entryFormat: Enter pulse bpm (e.g. 55, 80, 120)

- linkId: pulse-rate-band
text: Pulse rate band (calculated choice)
type: choice
readOnly: true
answerOption:
- valueCoding:
system: "http://example.org/fhir/CodeSystem/pulse-band"
code: unknown
display: "—"
- valueCoding:
system: "http://example.org/fhir/CodeSystem/pulse-band"
code: low
display: Low (<60 bpm)
- valueCoding:
system: "http://example.org/fhir/CodeSystem/pulse-band"
code: normal
display: Normal (60–110 bpm)
- valueCoding:
system: "http://example.org/fhir/CodeSystem/pulse-band"
code: high
display: High (>110 bpm)
calculatedExpression:
language: text/fhirpath
expression: >-
iif(
%resource.repeat(item).where(linkId='pulse-input').answer.valueInteger.exists(),
%qitem.answerOption.valueCoding.where(
code = iif(
%resource.repeat(item).where(linkId='pulse-input').answer.valueInteger.first() < 60,
'low',
iif(
%resource.repeat(item).where(linkId='pulse-input').answer.valueInteger.first() > 110,
'high',
'normal'
)
)
).first(),
%qitem.answerOption.valueCoding.where(code='unknown').first()
)

- linkId: is-tachycardia
text: Tachycardia (> 110) (calculated boolean)
type: boolean
readOnly: true
calculatedExpression:
language: text/fhirpath
expression: >-
iif(
%resource.repeat(item).where(linkId='pulse-input').answer.valueInteger.exists(),
%resource.repeat(item).where(linkId='pulse-input').answer.valueInteger.first() > 110,
false
)
33 changes: 33 additions & 0 deletions resources/Questionnaire/initial.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
resourceType: Questionnaire
id: initial
name: initial
title: Initial
status: active
url: "http://example.org/fhir/Questionnaire/initial"
meta:
profile:
- https://emr-core.beda.software/StructureDefinition/fhir-emr-questionnaire
item:
- linkId: instructions
text: >-
Instructions: Open the form and review static defaults populated from
Questionnaire.item.initial (without initialExpression).
type: display

- linkId: consent
text: Consent received
type: boolean
initial:
- valueBoolean: false

- linkId: visit-date
text: Visit date (example static initial)
type: date
initial:
- valueDate: "2026-01-01"

- linkId: triage-note
text: Triage note
type: string
initial:
- valueString: "Awaiting triage"
80 changes: 80 additions & 0 deletions resources/Questionnaire/score-calculation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
resourceType: Questionnaire
id: score-calculation
name: score-calculation
title: Score Calculation
status: active
url: "http://example.org/fhir/Questionnaire/score-calculation"
meta:
profile:
- https://emr-core.beda.software/StructureDefinition/fhir-emr-questionnaire
item:
- linkId: instructions
text: >-
Instructions: Select pain and nausea intensity values.
Total score (0–4) is the sum of the two selected weights (each item weight is 0–2).
type: display

- linkId: pain-intensity
text: Pain intensity
type: choice
answerOption:
- valueCoding:
system: "http://example.org/fhir/CodeSystem/score"
code: "0"
display: No pain
extension:
- url: "http://hl7.org/fhir/StructureDefinition/ordinalValue"
valueDecimal: 0
- valueCoding:
system: "http://example.org/fhir/CodeSystem/score"
code: "1"
display: Mild pain
extension:
- url: "http://hl7.org/fhir/StructureDefinition/itemWeight"
valueDecimal: 1
- valueCoding:
system: "http://example.org/fhir/CodeSystem/score"
code: "2"
display: Moderate pain
extension:
- url: "http://hl7.org/fhir/StructureDefinition/itemWeight"
valueDecimal: 2

- linkId: nausea-intensity
text: Nausea intensity
type: choice
answerOption:
- valueCoding:
system: "http://example.org/fhir/CodeSystem/score"
code: "0"
display: None
extension:
- url: "http://hl7.org/fhir/StructureDefinition/itemWeight"
valueDecimal: 0
- valueCoding:
system: "http://example.org/fhir/CodeSystem/score"
code: "1"
display: Mild
extension:
- url: "http://hl7.org/fhir/StructureDefinition/itemWeight"
valueDecimal: 1
- valueCoding:
system: "http://example.org/fhir/CodeSystem/score"
code: "2"
display: Severe
extension:
- url: "http://hl7.org/fhir/StructureDefinition/itemWeight"
valueDecimal: 2

- linkId: total-score
text: Total score (0–4)
type: decimal
readOnly: true
calculatedExpression:
language: text/fhirpath
expression: >-
%resource.repeat(item)
.answer.valueCoding.extension
.where(url='http://hl7.org/fhir/StructureDefinition/itemWeight')
.valueDecimal
.sum()