CPOE: Orders & Medications
Relevant source files
The following files were used as context for generating this wiki page:
Computerized Provider Order Entry (CPOE) within this project is a centralized management system for clinical instructions, covering medications, laboratory tests, procedures, and general orders. It is implemented as a microfrontend module within the OpenMRS 3.0 Patient Chart framework, ensuring that providers can create, modify, and track the lifecycle of clinical orders within a unified workspace.
The system facilitates a structured workflow from order creation via the "Order Basket" to the tracking of results. It relies on a robust metadata contract, utilizing specific UUIDs for encounter types and concept sets to maintain consistency across different hospital deployments.
Sources: openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:1-15, README.md:10-18
Core Functionality and Order Lifecycle
The CPOE system manages the entire progression of a clinical order. This lifecycle includes initial creation, modification for dose or frequency adjustments, renewal of expired orders, and discontinuation.
Order Management Components
The primary interface for managing pending clinical instructions is the Order Basket. This centralized workspace allows providers to stage multiple orders before final submission.
| Feature | Description |
|---|---|
| Order Basket | Centralized workspace for creating and managing pending orders. |
| Order Types | Classification including Medications, Lab Tests, Procedures, and General Orders. |
| Order Lifecycle | Workflow stages: Create → Modify → Renew → Discontinue → Track results. |
| Order Tables | Interfaces to view, search, filter, and manage existing patient orders. |
Sources: openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:7-14
Data Flow for Order Processing
The following diagram illustrates the high-level flow of an order from the user interface through the OpenMRS backend.
The diagram shows the transition from local state management in the Order Basket to persistent storage in the backend database.
Sources: openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:7-30, deployment/HOSPITAL-DEPLOYMENT-GUIDE.md:20-30
Medication and Drug Orders
Medication management is a specialized subset of the CPOE system. It handles complex drug prescriptions, including specific dosing instructions, frequency, and duration. These are categorized under the "Drug Order" UUID within the system configuration.
Sources: openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:26-26, openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:46-46
Configuration Schema
Order types are defined via a configuration schema that maps clinical categories to OpenMRS concept sets.
orderTypes: {
_type: Type.Array,
_elements: {
orderTypeUuid: '131168f4-15f5-102d-96e4-000c29c2a5d7', // Drug Order UUID
orderableConceptSets: ['drug-concepts-uuid'], // Concept set UUIDs
label: 'Medications', // Display label
icon: 'omrs-icon-medication' // OpenMRS icon name
}
}
Sources: openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:44-51
Laboratory Orders and Results Management
The system includes dedicated workflows for laboratory tests. This includes managing specimen requirements and scheduling, as well as an integrated "Results Entry" module.
Dynamic Lab Forms
Lab forms are auto-generated based on metadata stored in the concept_numeric table. This ensures that validation rules (such as range limits) are consistently applied based on the specific test being performed.
| Metadata Field | Source | Purpose |
|---|---|---|
hiAbsolute / lowAbsolute | concept_numeric table | Defines the hard limits for numeric lab results. |
allowDecimal | concept_numeric.allow_decimal | Controls whether decimal inputs are permitted. |
answers | concept.answers | Provides options for coded concepts (e.g., Positive/Negative). |
units | concept_numeric.units | Displays the standard units for the measurement. |
Sources: openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:74-80
Technical Architecture and Integration
As a part of the OpenMRS 3.0 (O3) ecosystem, the orders application is built using React and TypeScript. It interacts with the backend via the OpenMRS REST API and is deployed as a microfrontend.
System Dependencies
The application relies on several core services and configuration points:
- Encounter Type: All orders are associated with a specific encounter type, defaulting to the "Order" encounter type (
39da3525-afe4-45ff-8977-c53b7b359158). - Validation: Primary validation is performed client-side using Zod schemas, while the backend provides basic structural validation.
- Extension Slots: The UI can be customized via slots such as
top-of-lab-order-form-slotandorder-item-additional-info-slot.
Sources: openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:37-41, openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:65-72, openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/README.md:83-86
Microfrontend Relationship Diagram
This diagram represents the relationship between the main patient chart application and the specialized orders microfrontend.
Sources: openmrs-esm-patient-chart-main/README.md:126-140, openmrs-esm-patient-chart-main/packages/esm-patient-orders-app/package.json:1-10
Summary
The "CPOE: Orders & Medications" module provides a critical clinical workflow for managing drug prescriptions and diagnostic tests. By utilizing the Order Basket for staging and dynamic forms for lab results, the system balances flexibility with strict validation governed by OpenMRS concept metadata. Its microfrontend architecture allows it to integrate seamlessly into the O3 Patient Chart while maintaining its own specialized logic for order lifecycles.