Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Managing Library Rules

For guidance in Library Rule management and governance, please consult Rule and Library Management.

Library Rule Evaluation in Automated Processing in the Infrastructure

For further details and to assist in understanding intended use and capabilities, please consult Example Library Resources.

Input

The Library.parameter element specifies what resources are to be made available to the Library’s rule execution as input and what is returned as output. Typically, a measurement resource - be that an Observation, QuestionnaireResponse, or Media - is provided as input as part of the evaluate operation.

It is possible to state further input for both calculation-type Library (where Library.type is logic-library) and automated processing-type Library (where Library.type is automated-processing). For the calculation-type, all input resources must be provided as part of the evaluate operation.

For automated processing type, the following can be specified as input but are not provided as they are resolved by the Library service as part of establishing facts:

Resource Type

Description

Patient

The patient for which the measurement was applied.

EpisodeOfCare

EpisodeOfCare to which the measurement is related.

CarePlan

CarePlan to which the measurement is related.

ServiceRequest

ServiceRequest referred from measurement (Observation|QuestionnaireResponse|Media)

PlanDefinition

PlanDefinition to which the measurement is related.

ActivityDefinition

ActivityDefinition to which the measurement is related.

Questionnaire

Questionnaire to which a measurement of type QuestionnaireResponse is a response to.

Establishing of Facts

If specified as an input parameter, the following resources are fetched and made available to an automated processing type Library rule by the Library service. In the rule, the resources can be accessed by adding the variable declaration to the when part.

Resource Type

Resolved As

Variable Declaration

Patient

Fetched as Patient referenced in .subject on measurement resource

$patient : Patient()

EpisodeOfCare

Fetched as EpisodeOfCare referenced in .episodeOfCare on measurement resource

$episodeofcare : EpisodeOfCare()

CarePlan

Fetched as CarePlan where CarePlan.activity.reference refers to the ServiceRequest (see resolve of ServiceRequest below)

$careplan : CarePlan()

ServiceRequest

Fetched as ServiceRequest referenced in .basedOn on measurement resource

$ServiceRequest : ServiceRequest()

PlanDefinition

Fetched as PlanDefinition referenced in CarePlan.definition (see resolve of CarePlan above)

$plandefinition : PlanDefinition()

ActivityDefinition

Fetched as ActivityDefinition referenced in ServiceRequest.definition (see resolve of ServiceRequest above)

$activitydefinition : ActivityDefinition()

Questionnaire

Fetched as Questionnaire referenced in .questionnaire on measurement resource of type QuestionnaireResponse.

$questionnaire : Questionnaire()

Execution of Rule and Output

For automated processing rules, there is a structure, AutomatedProcessingDTO, which lets the rule control aspects of the outcome of evaluating the rule. By adding to the structure, the rule controls if and in what number of ClinicalImpression, Task, and Communication resources are created. A special case is the property activateSelfTreatment which controls whether a check on certain ServiceRequest resources should be made, possibly leading to an update of the status of eligible ServiceRequest resources (see further details in Activation of suspended Self-treatment type ServiceRequest ).

AutomatedProcessingDTO

Property

Type

Description

ClinicalImpressions

List of ClinicalImpressionDTO

Each entry is an instruction to create a resource, and each entry specifies certain details.

Tasks

List of TaskDTO

Each entry is an instruction to create a resource, and each entry specifies certain details.

activateSelfTreatment

boolean

Set to true instructs that sibling ServiceRequests of self-treatment kind should be activated if currently suspended.

ClinicalImpressionDTO

Property

Type

Description

Code

CodingDTO

Used for ClinicalImpression.code in the created resource.

Description

String

Used for ClinicalImpression.description in the created resource.

CodeableConceptFindings

List of CodingDTO

Used for ClinicalImpression.finding.itemCodeableConcept in the created resource.

ObservationFindings

List of ObservationDTO

Used for Observation.code of contained Observation in ClinicalImpression.finding.itemReference in the created resource.

Tasks

List of TaskDTO

Each entry is an instruction to create a Task resource, and each entry specifies certain details. Each created Task refers to the ClinicalImpression through Task.focus.

FindingBasis

List of QuestionnaireResponseFindingBasisDTO

Used for ClinicalImpression.ehealth-questionnaireresponse-finding-basis in the created resource. The list contains information regarding the basis for the overall clinical impression.

TaskDTO

Property

Type

Description

Category

CodingDTO

Used for Task.category in the created resource.

Description

String

Used for Task.description in the created resource.

Priority

String

Used for Task.priority in the created resource.

It must be ensured that the priority is entered in lower-case as defined for Task.priority.

RestrictionCategories

List of CodingDTO

Used for Task.ehealth-restriction-category in the created resource.

Communications

List of CommunicationDTO

Each entry is an instruction to create a Communication resource, and each entry specifies certain details. By default, the Commnunication.topic refers to the created Task but this may vary depending on the receiver.

QuestionnaireResponseFindingBasisDTO

Property

Type

Description

LinkId

String

Used for ehealth-questionnaireresponse-finding-basis.linkId in the created resource.

Finding

CodingDTO

Used for ehealth-questionnaireresponse-finding-basis.findingin created resource.

ValueString

String

One of the value elements is populated and used for ClinicalImpression.ehealth-questionnaireresponse-finding-basis.value in the created resource.

ValueDecimal

Double

ValueInteger

Integer

ValueBoolean

Boolean

ValueCoding

CodingDTO

AnswerSignificance

AnswerSignificanceDTO

Used for ehealth-questionnaireresponse-finding-basis.ehealth-questionnaire-answerSignificance in created resource.

AnswerSignificanceDTO

Property

Type

Description

Significance

CodingDTO

Used for ehealth-questionnaire-answerSignificance.significance in the created resource.

AnswerConditions

List of AnswerConditionDTO

Used for ehealth-questionnaire-answerSignificance.ehealth-answer-Condition in the created resource.

Must be a list of size 1 or 2.

AnswerConditionDTO

Property

Type

Description

Operator

String

Used for ehealth-questionnaire-answerSignificance.ehealth-answer-Condition.operator in the created resource.

ValueString

String

One of the value elements is populated and used for ehealth-questionnaire-answerSignificance.ehealth-answer-Condition.value in the created resource.

ValueDecimal

Double

ValueInteger

Integer

ValueBoolean

Boolean

ValueCoding

CodingDTO

CommunicationDTO

Property

Type

Description

Categories

List of CodingDTO

Used for Communication.reasonCode in the created resource.

Text

String

Used for Communication.payload.content in the created resource.

RestrictionCategories

List of CodingDTO

Used for Communication.ehealth-restriction-category in the created resource.

CodingDTO

Property

Type

Description

system

String

Corresponds to Coding.system in FHIR Coding.

code

String

Corresponds to Coding.code in FHIR Coding.

display

String

Corresponds to Coding.display in FHIR Coding.

It is the responsibility of the rule writer to ensure that a CodingDTO reflects a valid concept in a CodeSystem existing in the eHealth infrastructure and that the concept is part of the expanded ValueSet for which there is a binding to the particular resource element where it is used.

ObservationDTO

Property

Type

Description

Status

String

Used for Observation.status in the created resource.

Code

CodingDTO

Used for Observation.code in the created resource.

ValueString

String

One of the value elements is populated and used for Observation.value in the created resource.

ValueBoolean

Boolean

ValueQuantity

QuantityDTO

Output from automated processing

For each automated processing type Library evaluated, the returned GuidanceResponse typically contains an AutomatedProcessingDTO with instructions for further processing.

The handling is shown in the sequence diagram Automated Processing of Measurements - Handling.

Resources created

When populated by the Library in the AutomatedProcessingDTO, it results in the following resources being created. Please note that Communication resources described below are subjected to the handling described in Taking applicable CommunicationRequest into account, which further influences the number of Communication resources created and their recipient.

For every ClinicalImpressionDTO in AutomatedProcessingDTO.ClinicalImpressions:

Resource

Element

Value

ClinicalImpression

code

ClinicalImpressionDTO.Code

status

completed

description

ClinicalImpressionDTO.Description

investigation.code

Coding with:

  • code set to 271336007

  • system set to http://snomed.info/sct (SNOMED CT)

  • display set to Examination/signs

investigation.item

One version-less reference to the measurement, one versioned referenced to the measurement

finding.itemCodeableConcept

Coding added for each CodingDTO in ClinicalImpressionDTO.CodeableConceptFindings

finding.itemReference

For each ObservationDTO in ClinicalImpressionDTO.ObservationFindings, a reference to a contained Observation is added with the:

  • Observation.code set to one corresponding to ObservationDTO.Code

  • Observation.status set to ObservationDTO.Status

  • Observation.value set to the one populated of ObservationDTO.ValueString, ObservationDTO.ValueBoolean or Observation.ValueQuantity.

  • ObservationDTO.episodeOfCareset to GuidanceResponse.episodeOfCare

  • ObservationDTO.subject set to GuidanceResponse.subject

  • ObservationDTO.performer set to GuidanceResponse.subject

  • ObservationDTO.effective set to current date/time

  • ObservationDTO.device set to a reference to a Device representing the automated processing system

  • ObservationDTO.basedOn set to reference the ServiceRequest of the measurement

date

current date/time

subject

Same as GuidanceResponse.subject (which is the same as the subject of measurement)

episodeOfCare

Same as GuidanceResponse.episodeOfCare (which is the same as episodeOfCare of measurement)

effective

Same as measurement effective (which is Observation.effective or QuestionnaireResponse.authored)

ehealth-clinicalimpression-decisionContext

A reference to a contained Parameters with:

  • An added parameter with:

    • name set to library

    • value referring to the Library from GuidanceResponse.module.relatedArtifact.resource

  • An added parameter for each parameter named fact in GuidanceResponse.outputParameters with:

    • name set to fact

    • the value set to a reference to the parameter.value (from GuidanceResponse.outputParameters)

ehealth-questionnaireresponse-finding-basis

For each QuestionnaireResponseFindingBasisDTO in ClinicalImpressionDTO.FindingBasis, an ehealth-questionnaireresponse-finding-basis is added with:

  • ehealth-questionnaireresponse-finding-basis.linkId set to QuestionnaireResponseFindingBasisDTO.LinkId

  • ehealth-questionnaireresponse-finding-basis.value set to the one populated of QuestionnaireResponseFindingBasisDTO.ValueString, QuestionnaireResponseFindingBasisDTO.ValueBoolean, QuestionnaireResponseFindingBasisDTO.ValueInteger, QuestionnaireResponseFindingBasisDTO.ValueDecimcal or QuestionnaireResponseFindingBasisDTO.ValueCoding

  • ehealth-questionnaireresponse-finding-basis.finding set to QuestionnaireResponseFindingBasisDTO.Finding

  • ehealth-questionnaireresponse-finding-basis.ehealth-questionnaire-answerSignificance set to QuestionnaireResponseFindingBasisDTO.AnswerSignificanceDTO

    • ehealth-questionnaire-answerSignificance.significance set to AnswerSignificanceDTO.Significance

    • ehealth-questionnaire-answerSignificance.ehealth-answer-Condition set to AnswerSignificanceDTO.AnswerConditionsDTO

      • ehealth-answer-Condition.operator set to AnswerConditionsDTO.Operator

      • ehealth-answer-Condition.value set to the one populated of AnswerConditionsDTO.ValueBoolean , AnswerConditionsDTO.ValueCoding, AnswerConditionsDTO.ValueDecimal, AnswerConditionsDTO.ValueInteger or AnswerConditionsDTO.ValueString

For every TaskDTO in the ClinicalImpressionDTO.Tasks

Task

ehealth-task-responsible

List of CareTeam from the CarePlan

ehealth-restriction-category

TaskDTO.RestrictionCategories

category

TaskDTO.Category

status

requested

intent

plan

priority

TaskDTO.Priority

description

TaskDTO.Description

focus

The ClinicalImpression created for the current ClinicalImpressionDTO

episodeOfCare

Same as GuidanceResponse.episodeOfCare (and CarePlan.episodeOfCare)

authoredOn

current date/time

For every CommunicationDTO in ClinicalImpressionDTO.Tasks.Communications

Communication (of profile ehealth-message)

category

Coding for message

status

completed

reasonCode

Coding for each CodingDTO in CommunicationDTO.Categories

payload.content

CommunicationDTO.Text

ehealth-title

CodingDTO.Display of first CodingDTO in CommunicationDTO.Categories

ehealth-restriction-category

Coding for each CodingDTO in CommunicationDTO.RestrictionCategories

subject

Same as GuidanceResponse (and CarePlan)

episodeOfCare

Same as GuidanceResponse (and CarePlan)

topic

Reference to Task created for current TaskDTO

sent

current date/time

For every TaskDTO in AutomatedProcessingDTO.Tasks:

Resource

Element

Value

Task

ehealth-task-responsible

List of CareTeam from the CarePlan

ehealth-restriction-category

TaskDTO.RestrictionCategories

category

TaskDTO.Category

status

requested

intent

plan

priority

TaskDTO.Priority

description

TaskDTO.Description

focus

Reference to the measurement

episodeOfCare

Same as GuidanceResponse.episodeOfCare (and CarePlan.episodeOfCare)

authoredOn

current date/time

For every CommunicationDTO in TaskDTO.Communications

Communication (of profile ehealth-message)

category

Coding for message

status

completed

reasonCode

Coding for each CodingDTO in CommunicationDTO.Categories

payload.content

CommunicationDTO.Text

ehealth-title

CodingDTO.Display of first CodingDTO in CommunicationDTO.Categories

ehealth-restriction-category

Coding for each CodingDTO in CommunicationDTO.RestrictionCategories

subject

Same as GuidanceResponse (and CarePlan)

episodeOfCare

Same as GuidanceResponse (and CarePlan)

topic

Reference to Task created for current TaskDTO

sent

current date/time

Taking applicable CommunicationRequest into account

When Communication resources (of ehealth-message profile) are created by automated processing, the intended receivers would typically be one or more CareTeam designated as CarePlan.careTeam on the involved CarePlan. As Communication can have at most a single CareTeam as the recipient (through Communication.ehealth-communication-recipientCareTeam), this involves duplication of the original Communication where the duplicates vary by the recipient.

The recipient(s) and duplication made for Communication created by automated processing are influenced by CommunicationRequest. By creating appropriately crafted CommunicationRequest, a Practitioner can control whether:

  • to suppress automated processing’s default creation of a Communication for a particular CareTeam

  • to duplicate Communication with the Patient as the recipient

The handling is shown in the sequence diagram Automated Processing of Measurements - Create Communications.

See https://ehealth-dk.atlassian.net/wiki/spaces/EDTW/pages/edit-v2/2415034369 on what values to use when creating CommunicationRequest.

Activation of suspended Self-treatment type ServiceRequest

When the AutomatedProcessingDTO specifies activation through the element activateSelfTreatmentset to true, automated processing performs a lookup for all sibling ServiceRequest resources which have:

  1. ServiceRequest.status set to suspended

  2. ServiceRequest.definition referencing an ActivityDefinition where ActivityDefinition.topic has value self-treatment.

The sibling ServiceRequest resources are those referenced fromCarePlan.activity.reference for the same CarePlan that references the ServiceRequest referenced from the measurement (be that Observation, QuestionnaireResponse or Media).

For those ServiceRequest meeting the criteria above, the ServiceRequest.status is updated to active.

  • No labels