diff --git a/resources/Questionnaire/calculated-options.yaml b/resources/Questionnaire/calculated-options.yaml new file mode 100644 index 0000000..9b86842 --- /dev/null +++ b/resources/Questionnaire/calculated-options.yaml @@ -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 + ) \ No newline at end of file diff --git a/resources/Questionnaire/initial.yaml b/resources/Questionnaire/initial.yaml new file mode 100644 index 0000000..219ce9f --- /dev/null +++ b/resources/Questionnaire/initial.yaml @@ -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" \ No newline at end of file diff --git a/resources/Questionnaire/score-calculation.yaml b/resources/Questionnaire/score-calculation.yaml new file mode 100644 index 0000000..40fc110 --- /dev/null +++ b/resources/Questionnaire/score-calculation.yaml @@ -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() \ No newline at end of file