FHIR FHIRPath Function: weight
This page is part of FHIR FHIRPath (FHIR-specific extensions). Base spec lives at FHIRPath.
weight() : decimal
This functions returns the ordinal value for an element. This may be based on an itemWeight extension defined on an element such as QuestionnaireResponse answer, or it may be based on the weight property defined on a code. In some cases, this may require looking across resources. For example, QuestionnaireResponse.item.where(linkId='123').answer.first().weight() may need to find the corresponding item in the Questionnaire and then look up the coding specified in 'answer' with the corresponding answerOption in Questionnaire.item with the same linkId. If no weight is defined for the context element, the return value is empty. If the FHIRPath engine is unable to resolve the corresponding value set, code system or questionnaire options, it SHOULD cause the expression to fail. This function will typically be used to support scoring of Questionnaires, but it can be used with observations or potentially other elements as well.