Skip to content

Patient-view: encounter access #502

Description

@bvdh

The patient-view context provide an optional field encounter that provides the encounter.id of the current Encounter.

The current specification states in the section "Prefetch Template" (From https://cds-hooks.org/specification/1.0/#hook-maturity-model ):

Regardless of how the CDS Client satisfies the prefetch templates (if at all), the prefetched data given to the CDS Service MUST be equivalent to the data the CDS Service would receive if it were making its own call to the CDS Client's FHIR server using the parameterized prefetch template.

So a prefetch query using the id from the encounter field returns the Encounter. A query to the FHIR Server will return the same Resource.

Other parts of this specification indicate that it is expected that some information is present in the CDS-Client memory and has not yet been persisted to the FHIR-Server, see section "FHIR resources in context" (https://cds-hooks.org/specification/1.0/#hook-maturity-model):

Often, context is populated with in-progress or in-memory data that may not yet be available from the FHIR server. For example, imagine a hook, medication-order that is invoked when a user selects a medication durating an order workflow.

The results in the question: wow does one retrieve the current Encounter, if stored in memory?
Does this mean that a CDS Server must make sure the Encounter resource (and other data in-memory) is accessible from the FHIR-server?

Activity

  1. isaacvetter commented on Oct 9, 2019

    @isaacvetter
    Member

    Hey @bvdh ,

    This distinction in the spec is between context, which can contain "in-memory" data that may not be available via the FHIR server, and prefetch'd data which MUST be the same result if the CDS server executed the prefetch template query against the restful fhir server.

    Generally, it is draft resources supplied via context may not be available on the FHIR server. There are no draft resources in patient-view's context (unlike order-sign and order-select). I'd expect that all of the fields in the patient-view hook's context are available on the FHIR server and therefore the currently documented patient-view hook is clearly consistent with the base spec as published.

    What this really means is that if a prefetch template references a FHIR resource that is only "in memory", the CDS client shouldn't honor it.

    @bvdh - what do you think?

  2. added
    stu-updateIssue generated during STU Update and will be reviewed by CDS Wg.
    on Oct 9, 2019
  3. brynrhodes commented on Oct 9, 2019

    @brynrhodes
    Contributor

    Add to the patient-view documentation a note that the encounter referenced by the encounterId context field is expected to be available via the FHIR Server (if an endpoint is used) or via prefetch if no endpoint is provided. However, the specification does not explicitly require this behavior and implementations should be aware that integrations may not fully support this expectation.

  4. isaacvetter commented on Oct 9, 2019

    @isaacvetter
    Member

    Per wg call conversation:

    Ultimately, the hooks that we've created thus far distinguish between mere FHIR ids in context and full draft resources in context. This distinction implies that the mere FHIR ids are available for query (either through the FHIR server, or through a prefetch template); and that full resources sent in context may not be available for query.

    • Prefetch support is optional for cds clients
    • FHIR server support is optional
  5. added a commit that references this issue on Oct 9, 2019
    2604ade
  6. isaacvetter commented on Oct 9, 2019

    @isaacvetter
    Member

    @bvdh - as a starting point, will you take a look at #506 ?

  7. added a commit that references this issue on Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stu-updateIssue generated during STU Update and will be reviewed by CDS Wg.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions