Skip to main content

Patient Information Applet

Overview

The Patient Information Applet is an applet designed to display important patient information without navigation.

The applet automatically handles data retrieval and formatting depending on dynamic configuration and inputs.

Display

The applet renders a mona-card containing:

  • Patient name
  • Date of birth (formatted including age)
  • Case ID
  • configurable observation values
  • Operation / Service Request Reason

Input Parameters

InputTypeRequiredDescription
encounterIdstringNoThe unique identifier of the encounter. If provided, this takes precedence over the service request's encounter reference.
serviceRequestIdstringNoThe unique identifier of the service request. Used to retrieve associated encounter.
configPatientInformationConfigYesConfiguration object for customizing code mappings and data display options. See configuration section below.
Required Input

This applet requires either an encounterId or a serviceRequestId to function.

  • If encounterId is provided → it is used directly
  • If not, the Encounter is resolved indirectly via the serviceRequest.encounter.reference
  • If neither is provided → no data can be loaded

Make sure at least one of these inputs is always passed.

encounterId

Type: string (optional)

Unique identifier for an encounter. If provided the associated patient and its observations are loaded.

encounterId: "encounter-id-123"

serviceRequestId

Type: string (optional)

Unique identifier for a service request. Used to load and resolve the associated ServiceRequest. Mostly used as fallback to determine the encounter if no encounterId is passed.

serviceRequestId: "service-request-id-123"

config

Type: PatientInformationConfig (required)

interface PatientInformationConfig {
keys: CodeConfig[];
}

CodeConfig

interface CodeConfig {
label: string;
codes: string[];
fixed: number;
}

CodeConfig is a configuration object that defines which observations are displayed. It contains the following properties:

  • label (string): A descriptive name or title for the code configuration that will be displayed to the user (e.g., "BMI", "Height", "Weight")

  • codes (string[]): An array of strings used to identify and filter observations.The code format follows the pattern: system|code (e.g., http://loinc.org|8302-2).

  • fixed (number): A fixed numeric value that determines the precision for formatting and displaying the measurement value (e.g., the number of decimal places for rounding). Fallback is 0.

Behavior

Encounter Resolution Strategy

The applet determines which Encounter to display using a two-step priority mechanism:

  • If an explicit encounterId input is provided → use it.
  • Otherwise, resolve the encounter from the loaded ServiceRequest by extracting the ID from serviceRequest.encounter.reference.

This dual-resolution approach ensures that the component is flexible and supports both direct and indirect usage contexts.

Observation Display

The Patient Information component automatically loads all observations associated with the current encounter. These observations are then searched and filtered based on the codes specified in the CodeConfig to find matching medical measurements. If no matching observation found, 'N/A' is returned.

Determination of the Service Request Reason

The applets computes the displayed “Operation” or “Reason” using all service requests linked to the current encounter and the helper function determineServiceRequestReason(). This includes the current priority cascade:

  • Direct ServiceRequest (reasonReference → code)
  • Parent "basedOn" ServiceRequest (reasonReference -> code) - only if step 1 found nothing.
  • Encounter (reasonCode) - only if steps 1 & 2 found nothing.

Example Usage

const config: PatientInformationConfig = {
keys = [{
label: 'Height',
codes: ['http://loinc.org|8302-2'],
fixed: 0,
},
{
label: 'Weight',
codes: ['http://loinc.org|29463-7'],
fixed: 0,
},
{
label: 'BMI',
codes: ['http://loinc.org|39156-5'],
fixed: 1,
}
}]
};
const encounterId: 'e8f4d3c2-5b6a-4d1e-9f2a-3b4c5d6e7f8a',

<mona-patient-information [config]=config [encounterId]=encounterId></mona-patient-information>