Skip to content

Latest commit

 

History

History
58 lines (50 loc) · 3.1 KB

File metadata and controls

58 lines (50 loc) · 3.1 KB

The weight() function

Description

Returns numeric values from the score extension associated with the input collection of resource nodes (e.g. QuestionnaireResponse item answers).

Currently, when searching for a score extension, we respect the "Context of Use" for each possible extension used to store a score:

Since the first mention of the ordinal() (a.k.a. weight()) function was in SDC 3 (https://hl7.org/fhir/uv/sdc/expressions.html#fhirpath-supplements), we don't support this function in STU3 and DSTU2 for extensions described in these links:

Also, according to the resolution of this JIRA issue https://jira.hl7.org/browse/FHIR-49329, we support a score extension for all possible [x] in value[x] in QuestionnaireResponse answers.

Algorithm for searching the score extension

We search for the first score extension for each source node to add its value to the result in the following order:

  1. Check the source node for a score extension.
  2. If the source node is an answer from a QuestionnaireResponse or its value[x]:
    • Check the value[x] element for a score extension.
    • Check the corresponding answer option (if any) of the corresponding Questionnaire item for a score extension.
    • Otherwise, if the Questionnaire item references a contained ValueSet, check the corresponding element there for a score extension.
  3. If the source resource (to which the source node belongs, e.g. QuestionnaireResponse) or Questionnaire contains a corresponding CodeSystem, check for a score extension (for R4) or property (for R5) there.
  4. Look for a score extension (for R4) or property (for R5) in the corresponding CodeSystem loaded from the terminology server.

Terminology servers

The CodeSystem lookup in step 5 uses the terminologyUrl option. When terminologyUrl is an array of server URLs, the servers are tried in order and the first one that provides the CodeSystem is used; that server is then preferred for the follow-up $lookup request (for R5 properties) and for later evaluations. If no configured server provides the CodeSystem - whether a server responds without it or a request fails (e.g. a network/server error) - no score is added for that code. Request failures are not cached, so a later evaluation retries the terminology lookup. Successfully resolved scores and confirmed absence of a score in a retrieved CodeSystem remain cached.