Package | hl7.fhir.uv.javascript |
Resource Type | Questionnaire |
Id | BMI |
FHIR Version | R4 |
Source | http://hl7.org/fhir/uv/javascript/https://build.fhir.org/ig/bvdh/hl7-javascript-expression/Questionnaire-BMI.html |
URL | http://research.philips.com/fhirplayground/r4/sdc/Questionnaire/bmi-example |
Version | 0.1.0 |
Status | active |
Date | 2025-05-12T10:18:26+00:00 |
Title | BMI example |
Realm | uv |
Authority | hl7 |
Description | Prepopulates height and weight based on data in the repository based on Observations in the repository. BMI is calculated and presented when weight and height are present. When stored, weight and height observations are created/updated and a BMI observation is added. |
No resources found
No resources found
Note: links and images are rebased to the (stated) source
Generated Narrative: Questionnaire BMI
Profiles: Populatable Questionnaire - Observation, Extractable Questionnaire - Observation, Advanced Rendering Questionnaire
LinkID | Text | Cardinality | Type | Flags | Description & Constraints |
---|---|---|---|---|---|
![]() ![]() | Prepopulates height and weight based on data in the repository based on Observations in the repository. BMI is calculated and presented when weight and height are present. When stored, weight and height observations are created/updated and a BMI observation is added. | Questionnaire | http://research.philips.com/fhirplayground/r4/sdc/Questionnaire/bmi-example#0.1.0 | ||
![]() ![]() ![]() | Body weight | 1..1 | decimal | ||
![]() ![]() ![]() | Body height | 1..1 | decimal | ||
![]() ![]() ![]() | Body Mass index (BMI) | 1..1 | decimal | ![]() ![]() | |
{ "resourceType": "Questionnaire", "id": "BMI", "meta": { "profile": [ "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-pop-obsn", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-extr-obsn", "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-render" ] }, "text": { "status": "extensions", "div": "<!-- snip (see above) -->" }, "extension": [ { "extension": [ { "url": "name", "valueId": "launchPatient" }, { "url": "type", "valueCode": "Patient" }, { "url": "description", "valueString": "Patient the questionnaire is about." } ], "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext" }, { "url": "http://hl7.org/fhir/uv/javascript/StructureDefinition/JavascriptTargetExpression", "valueExpression": { "language": "javascript", "expression": "createBundle();\n\nfunction createBundle(){\n\n let resTemplate = {\n resourceType: 'Bundle',\n type: 'transaction',\n entry: [\n {\n fullUrl: 'questionnaire-response',\n resource: ENV.resource,\n request: {\n method: \"POST\",\n url: \"QuestionnaireResponse\"\n }\n },\n {\n fullUrl: 'height',\n resource: createHeightObservation(),\n request: {\n method: \"POST\",\n url: \"Observation\"\n }\n },\n {\n fullUrl: 'height',\n resource: createWeightObservation(),\n request: {\n method: \"POST\",\n url: \"Observation\"\n }\n },\n {\n fullUrl: 'bmi',\n resource: createWeightObservation(),\n request: {\n method: \"POST\",\n url: \"Observation\"\n }\n },\n {\n fullUrl: 'provenance',\n resource: createProvenance(),\n request: {\n method: \"POST\",\n url: \"Provenance\"\n }\n }\n\n ]\n }\n}\n\nfunction createHeightObservation(){\n let obs = {\n resourceType: 'Observation',\n active: true,\n status: `final`,\n category:[\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n \"code\": \"vital-signs\",\n \"display\": \"Vital Signs\"\n }\n ]\n }\n ],\n derivedFrom: {\n reference: \"questionnaire-response\"\n },\n code: FHIR.fhirpath( ENV.resource, '%resource.item.where(linkId=\\'height\\')' ),\n subject: ENV.resource.subject,\n issued: FHIR.fhirpath( ENV.resource, 'now()'),\n effectiveDateTime: FHIR.fhirpath( ENV.resource, 'now()'),\n performer: ENV.resource.author,\n valueQuantity: {\n value: ENV.height,\n unit: 'm',\n code: 'm',\n system: 'http://unitsofmeasure.org'\n }\n\n }\n return obs;\n}\n\n\nfunction createWeightObservation(){\n let obs = \n {\n resourceType: 'Observation',\n active: true,\n status: `final`,\n category:[\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n \"code\": \"vital-signs\",\n \"display\": \"Vital Signs\"\n }\n ]\n }\n ],\n code: FHIR.fhirpath( ENV.resource, '%resource.item.where(linkId=\\'weight\\')' ),\n derivedFrom: {\n reference: \"questionnaire-response\"\n }, \n subject: ENV.resource.subject,\n issued: FHIR.fhirpath( ENV.resource, 'now()'),\n performer: ENV.resource.author,\n valueQuantity: {\n value: ENV.height,\n unit: 'kg',\n code: 'kg',\n system: 'http://unitsofmeasure.org'\n }\n\n }\n return obs;\n}\n\nfunction createBmiObservation(){\n let obs = \n {\n resourceType: 'Observation',\n active: true,\n status: `final`,\n category:[\n {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/observation-category\",\n \"code\": \"vital-signs\",\n \"display\": \"Vital Signs\"\n }\n ]\n }\n ],\n derivedFrom: [\n { reference: \"questionnaire-response\" },\n { reference: \"weight\" },\n { reference: \"height\" },\n ],\n code: {\n \"coding\": [\n {\n \"system\": \"http://loinc.org\",\n \"code\": \"39156-5\",\n \"display\": \"Body mass index (BMI) [Ratio]\"\n }\n ],\n \"text\": \"BMI\"\n },\n subject: ENV.resource.subject,\n issued: FHIR.fhirpath( ENV.resource, 'now()'),\n effectiveDateTime: FHIR.fhirpath( ENV.resource, 'now()')[0],\n performer: ENV.resource.author,\n valueQuantity: {\n value: FHIR.fhirpath( ENV.resource, '%resource.item.where(linkId=\\'bmi\\').value'),\n unit: 'kg/m^2',\n code: 'kg/m^2',\n system: 'http://unitsofmeasure.org'\n }\n }\n return obs;\n}\n\n\nfunction createProvenance(){\n let provenance = {\n resourceType: 'Provenance',\n id: 'provenance',\n occurredPeriod: {\n start: ENV.resource.authored,\n end: FHIR.fhirpath( ENV.resource, 'now()')[0]\n },\n recorded: FHIR.fhirpath( ENV.resource, 'now()')[0],\n agent: [\n {\n type: {\n system: \"http://terminology.hl7.org/CodeSystem/provenance-participant-type\", \n code: \"enterer\", \n display: \"Enterer\"\n },\n who: ENV.resource.author\n }\n ],\n target: [\n {\n extension:[\n { url: 'http://hl7.org/fhir/StructureDefinition/resolve-as-version-specific',\n valueBoolean: true\n\n }\n ],\n reference: 'questionnaire-response'\n },\n {\n extension:[\n { url: 'http://hl7.org/fhir/StructureDefinition/resolve-as-version-specific',\n valueBoolean: true\n\n }\n ],\n reference: 'height'\n },\n {\n extension:[\n { url: 'http://hl7.org/fhir/StructureDefinition/resolve-as-version-specific',\n valueBoolean: true\n\n }\n ],\n reference: 'weight'\n },\n {\n extension:[\n { url: 'http://hl7.org/fhir/StructureDefinition/resolve-as-version-specific',\n valueBoolean: true\n\n }\n ],\n reference: 'bmi'\n } \n ] \n }\n}" } } ], "url": "http://research.philips.com/fhirplayground/r4/sdc/Questionnaire/bmi-example", "version": "0.1.0", "title": "BMI example", "status": "active", "date": "2025-05-12T10:18:26+00:00", "publisher": "Hl7 International/ FHIR infrastructure", "contact": [ { "name": "Hl7 International/ FHIR infrastructure", "telecom": [ { "system": "url", "value": "http://www.hl7.org/Special/committees/" } ] } ], "description": "Prepopulates height and weight based on data in the repository\nbased on Observations in the repository. BMI is calculated and presented\n\nwhen weight and height are present. When stored, weight and height observations\n\nare created/updated and a BMI observation is added.", "item": [ { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", "valueCoding": { "system": "http://unitsofmeasure.org", "code": "kg" } }, { "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract", "valueBoolean": true }, { "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "valueDuration": { "value": 1, "unit": "week", "system": "http://unitsofmeasure.org", "code": "wk" } } ], "linkId": "weight", "code": [ { "system": "http://loinc.org", "code": "29463-7", "display": "Weight" } ], "text": "Body weight", "type": "decimal", "required": true }, { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", "valueCoding": { "system": "http://unitsofmeasure.org", "code": "m" } }, { "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract", "valueBoolean": true }, { "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationLinkPeriod", "valueDuration": { "value": 1, "unit": "year", "system": "http://unitsofmeasure.org", "code": "a" } } ], "linkId": "height", "code": [ { "system": "http://loinc.org", "code": "8302-2", "display": "Height" } ], "text": "Body height", "type": "decimal", "required": true }, { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", "valueCoding": { "system": "http://unitsofmeasure.org", "code": "kg/m2" } }, { "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract", "valueBoolean": true }, { "url": "http://hl7.org/fhir/StructureDefinition/variable", "valueExpression": { "name": "height", "language": "text/fhirpath", "expression": "%resource.item.where(linkId='height').answer.value" } }, { "url": "http://hl7.org/fhir/StructureDefinition/variable", "valueExpression": { "name": "weight", "language": "text/fhirpath", "expression": "%resource.item.where(linkId='weight').answer.value" } }, { "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression", "valueExpression": { "language": "javascript", "expression": "Math.round(100*(ENV.weight/(ENV.height^2)))/100" } } ], "linkId": "bmi", "code": [ { "system": "http://loinc.org", "code": "39156-5", "display": "BMI" } ], "text": "Body Mass index (BMI)", "type": "decimal", "required": true, "readOnly": true } ] }