### Start Development Server for a Module Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/README.md Starts the development server for a specific module. Replace '' with the actual module name. ```bash yarn start --sources 'packages/esm--app' ``` -------------------------------- ### Pagination Example Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Demonstrates how to request a specific number of results per page and set the starting offset for paginated lists. ```http GET /rest/v1/queue?limit=10&offset=0 ``` -------------------------------- ### Copy Environment Variables Example Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Creates a .env file from the example configuration. This file is used to set environment variables, primarily for end-to-end tests. ```bash cp example.env .env ``` -------------------------------- ### Start Dev Server with Reference Application Configuration Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Starts a development server using the same configuration as the reference application. This ensures local development closely matches the production environment. ```bash yarn start --config-url /openmrs/spa/config-core_demo.json --sources 'packages/esm--app' ``` -------------------------------- ### Start Dev Server for Multiple Modules Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Starts a development server including multiple specified modules. This allows for testing interactions between different modules. ```bash yarn start --sources 'packages/esm-patient-search-app' --sources 'packages/esm-patient-registration-app' ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Installs all necessary project dependencies using yarn. This is a prerequisite for running any development or testing commands. ```bash yarn install ``` -------------------------------- ### Start Development Server for E2E Tests Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Starts the development server, typically before running E2E tests. Ensure the specified package sources are included. ```sh yarn start --sources 'packages/esm-*-app/' ``` -------------------------------- ### Install Playwright Browsers Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Installs the necessary Playwright browsers for end-to-end testing. Run this command before executing tests. ```sh npx playwright install ``` -------------------------------- ### Start Dev Server for a Specific Module Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Starts a development server for a specified module using the openmrs tooling. Replace '' with the actual module name. ```bash yarn start --sources 'packages/esm--app' ``` -------------------------------- ### Bed Management Response Example Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Example JSON response for fetching bed information. It includes bed details like number, type, location, and status. ```json { "results": [ { "uuid": "bed-uuid", "bedNumber": "A-1", "bedType": { "uuid": "type-uuid", "name": "Standard" }, "row": 1, "column": 1, "status": "AVAILABLE" } ] } ``` -------------------------------- ### GET /rest/v1/systemsetting Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetches system settings, which are used for queue configuration. ```APIDOC ## GET /rest/v1/systemsetting ### Description Fetch system settings (used for queue configuration). ### Method GET ### Endpoint /rest/v1/systemsetting ### Response #### Success Response (200) - **results** (array) - An array of system setting objects, each with a 'property' and 'value'. A common setting is `queue.serviceConceptSetName` which holds the Concept set UUID for available services. ``` -------------------------------- ### Create Bed Request Body Example Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Example JSON request body for creating a new bed. It requires bed number, type, location, row, and column. ```json { "bedNumber": "A-2", "bedType": { "uuid": "bed-type-uuid" }, "location": { "uuid": "location-uuid" }, "row": 1, "column": 2 } ``` -------------------------------- ### Patient Search Start Visit Button 2 Component Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-search.md Async component rendering a "Start Visit" button within the patient search banner. This button component is placed in the patient banner, allowing users to initiate a visit for a selected patient. ```typescript export const patientSearchStartVisitButton2 = getAsyncLifecycle( () => import('./patient-search-page/patient-banner/banner/start-visit-button2.component'), options, ); ``` -------------------------------- ### Inpatient Admissions Response Example Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Example JSON response for fetching active inpatient admissions. It details patient information, visit details, and current location. ```json { "results": [ { "patient": { "uuid": "patient-uuid", "display": "Patient Name" }, "visit": { "uuid": "visit-uuid", "startDatetime": "2024-01-01T10:00:00Z" }, "encounterAssigningToCurrentInpatientLocation": { "uuid": "encounter-uuid" }, "currentInpatientLocation": { "uuid": "location-uuid", "display": "Ward A" } } ] } ``` -------------------------------- ### Admission/Transfer Requests Response Example Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Example JSON response for admission or transfer requests. It includes patient, visit, disposition type, and location details. ```json { "results": [ { "patient": { "uuid": "patient-uuid" }, "visit": { "uuid": "visit-uuid" }, "dispositionType": "ADMIT", "disposition": { "uuid": "concept-uuid" }, "dispositionLocation": { "uuid": "location-uuid" } } ] } ``` -------------------------------- ### Set Up Environment Variables for E2E Tests Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Copies the example environment file to `.env` for configuring E2E tests. Modify this file to match your local or remote OpenMRS backend instance. ```sh cp example.env .env ``` ```sh E2E_BASE_URL=https://dev3.openmrs.org/openmrs ``` -------------------------------- ### Launch Patient Registration Modal or Page Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-registration.md Use this example to open the patient registration modal or navigate to the registration page when a button is clicked. It imports the root function from the patient registration app. ```typescript import { root } from '@openmrs/esm-patient-registration-app'; export function RegisterPatientButton() { return ( ); } ``` -------------------------------- ### patientSearchStartVisitButton2 Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-search.md Async component rendering a "Start Visit" button within the patient search banner. This button allows users to initiate a visit for a selected patient. ```APIDOC ## patientSearchStartVisitButton2 ### Description Async component rendering a "Start Visit" button within the patient search banner. This button allows users to initiate a visit for a selected patient. ### Usage Button component placed in patient banner allowing users to initiate a visit for a selected patient. ``` -------------------------------- ### GET /rest/v1/appointmentService Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetches a list of available appointment services, including details like name, description, and operating hours. ```APIDOC ## GET /rest/v1/appointmentService ### Description Fetch available appointment services. ### Method GET ### Endpoint /rest/v1/appointmentService ### Response #### Success Response (200) - **data** (array) - List of appointment services - **uuid** (string) - Unique identifier for the service - **name** (string) - Name of the service - **description** (string) - Description of the service - **startTime** (string) - Service start time (e.g., "08:00") - **endTime** (string) - Service end time (e.g., "17:00") - **maxAppointmentsLimit** (number) - Maximum number of appointments allowed - **durationMins** (number) - Default duration of an appointment in minutes - **specialityUuid** (string) - UUID of the associated speciality ### Response Example ```json { "data": [ { "uuid": "service-uuid", "name": "Service Name", "description": "Service description", "startTime": "08:00", "endTime": "17:00", "maxAppointmentsLimit": 10, "durationMins": 30, "specialityUuid": "speciality-uuid" } ] } ``` ``` -------------------------------- ### Custom Representation Example Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Shows how to use the 'v=custom:(fields)' query parameter to retrieve only specific fields, optimizing data transfer. ```http GET /rest/v1/queue?v=custom:(uuid,name,location) ``` -------------------------------- ### POST /rest/v1/queue-entry Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Creates a new queue entry, linking it to a visit, queue, patient, and specifying status, priority, and start time. ```APIDOC ## POST /rest/v1/queue-entry ### Description Creates a new entry in a queue. Requires details about the visit, queue, patient, status, priority, and start time. ### Method POST ### Endpoint /rest/v1/queue-entry ### Request Body - **visit** (object) - Required - Object containing the UUID of the visit. - **uuid** (string) - Required - **queueEntry** (object) - Required - Object containing details for the new queue entry. - **queue** (object) - Required - Object with the UUID of the queue. - **uuid** (string) - Required - **patient** (object) - Required - Object with the UUID of the patient. - **uuid** (string) - Required - **status** (object) - Required - Object with the UUID of the status. - **uuid** (string) - Required - **priority** (object) - Required - Object with the UUID of the priority. - **uuid** (string) - Required - **startedAt** (string) - Optional - The start time of the queue entry in ISO 8601 format. - **sortWeight** (number) - Optional - A weight for sorting the entry within the queue. ### Request Example ```json { "visit": { "uuid": "visit-uuid" }, "queueEntry": { "queue": { "uuid": "queue-uuid" }, "patient": { "uuid": "patient-uuid" }, "status": { "uuid": "status-uuid" }, "priority": { "uuid": "priority-uuid" }, "startedAt": "2024-01-01T10:00:00.000Z", "sortWeight": 1 } } ``` ### Response #### Success Response (201 Created) Indicates the queue entry was successfully created. ``` -------------------------------- ### Create Queue Endpoint Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/INDEX.md Example of creating a new queue using the REST API. This endpoint requires a name, service UUID, and location UUID. ```http POST /rest/v1/queue Content-Type: application/json { "name": "Queue Name", "service": { "uuid": "..." }, "location": { "uuid": "..." } } Response: 201 Created ``` -------------------------------- ### Create New Queue Entry Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Creates a new queue entry, linking it to a visit, queue, patient, status, and priority. Includes start time and sort weight. ```json { "visit": { "uuid": "visit-uuid" }, "queueEntry": { "queue": { "uuid": "queue-uuid" }, "patient": { "uuid": "patient-uuid" }, "status": { "uuid": "status-uuid" }, "priority": { "uuid": "priority-uuid" }, "startedAt": "2024-01-01T10:00:00.000Z", "sortWeight": 1 } } ``` -------------------------------- ### Get Async Lifecycle for Admit Patient Form Workspace Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Exports the workspace component used for the form to admit a patient to the ward. ```typescript export const admitPatientFormWorkspace = getAsyncLifecycle( () => import('./ward-workspace/admit-patient-form-workspace/admit-patient-form.workspace'), options, ); ``` -------------------------------- ### Get Sync Lifecycle for Ward Dashboard Link Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Exports a synchronous lifecycle component for creating a navigation link to the ward dashboard. ```typescript export const wardDashboardLink = getSyncLifecycle(createDashboardLink(dashboardMeta), options); ``` -------------------------------- ### Get Async Lifecycle for Create Admission Encounter Workspace Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Exports the workspace component responsible for creating an admission encounter record for a patient. ```typescript export const createAdmissionEncounterWorkspace = getAsyncLifecycle( () => import('./ward-workspace/create-admission-encounter/create-admission-encounter.workspace'), options, ); ``` -------------------------------- ### Create New Visit Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Use this endpoint to create a new visit for a patient. Ensure you provide valid UUIDs for patient, visit type, and location, along with the start datetime. ```json { "patient": "patient-uuid", "visitType": "visit-type-uuid", "location": "location-uuid", "startDatetime": "2024-01-01T10:00:00Z" } ``` -------------------------------- ### Get Async Lifecycle for Default Ward View Component Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Exports the default ward view component with a standard layout, configured for a 60-second data refresh interval. ```typescript export const defaultWardView = getAsyncLifecycle( () => import('./ward-view/default-ward/default-ward-view.component'), { featureName: 'default-ward-view', moduleName, swrConfig: { refreshInterval: 60000 }, }, ); ``` -------------------------------- ### startupApp() Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Initializes the ward module by registering breadcrumbs, configuration schemas, and feature flags for integrations like bed management. ```APIDOC ## startupApp() ### Description Initializes the ward module. This function sets up the necessary configurations and integrations for the ward management features. ### Behavior 1. Registers empty breadcrumbs. 2. Defines the main configuration schema for the module. 3. Defines extension-specific configuration for the discharge workspace. 4. Registers a feature flag for bed management module integration. ``` -------------------------------- ### Get Async Lifecycle for Main Ward View Component Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Exports the main ward view component, responsible for displaying the patient layout, using asynchronous loading. ```typescript export const wardView = getAsyncLifecycle(() => import('./ward-view/ward-view.component'), options); ``` -------------------------------- ### Get Async Lifecycle for Maternal Ward View Component Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Exports a specialized ward view component for maternal wards, supporting mother-child admission tracking and a 60-second refresh interval. ```typescript export const maternalWardView = getAsyncLifecycle( () => import('./ward-view/maternal-ward/maternal-ward-view.component'), { featureName: 'maternal-ward-view', moduleName, swrConfig: { refreshInterval: 60000 }, }, ); ``` -------------------------------- ### startupApp() Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md Initializes the appointments module by defining its configuration schema and registering navigation breadcrumbs for the appointments section and patient lists. ```APIDOC ## startupApp() ### Description Initializes the appointments module and registers breadcrumbs. ### Behavior 1. Defines configuration schema 2. Registers navigation breadcrumbs for appointments section 3. Sets up patient list breadcrumb with dynamic service name ``` -------------------------------- ### Making API Calls in OpenMRS ESM Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/INDEX.md Provides an example of making asynchronous API calls to save queue data using the `saveQueue` function from the `esm-service-queues-app` module. Refer to module API references for other available functions. ```typescript import { saveQueue } from '@openmrs/esm-service-queues-app'; async function createQueue() { const response = await saveQueue( 'Queue Name', 'service-uuid', 'Description', 'location-uuid' ); } ``` -------------------------------- ### startupApp() Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-list-management.md Initializes the patient list management module, including setting up offline data synchronization and defining the configuration schema. ```APIDOC ## startupApp() ### Description Initializes the patient list management module. ### Behavior 1. Sets up offline data synchronization for patient lists 2. Defines configuration schema for module ``` -------------------------------- ### startupApp() Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-registration.md Initializes the patient registration module by defining its configuration schema and setting up offline data synchronization. ```APIDOC ## startupApp() ### Description Initializes the patient registration module. This function defines the configuration schema for registration settings and sets up offline data synchronization for patient records. ### Behavior 1. Defines configuration schema for registration settings. 2. Sets up offline data synchronization for patient records. ``` -------------------------------- ### Build for Production Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/README.md Builds all modules for production using Turbo. ```bash yarn turbo run build ``` -------------------------------- ### FHIR Patient Search Response Example Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Example JSON response when searching for patients using the FHIR interface. This structure includes total results and a list of patient entries. ```json { "total": 5, "entry": [ { "resource": { "id": "patient-uuid", "name": [{ "given": ["John"], "family": "Doe" }], "gender": "male", "birthDate": "1990-01-01", "identifier": [{ "value": "12345" }] } } ] } ``` -------------------------------- ### GET /rest/v1/queue Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetches all queues, with an option to filter by location. ```APIDOC ## GET /rest/v1/queue ### Description Fetches all queues. You can optionally filter the results by a specific location UUID. ### Method GET ### Endpoint /rest/v1/queue ### Parameters #### Query Parameters - **location** (string) - Optional - Filter by location UUID - **representation** (string) - Optional - Custom representation (e.g., `custom:(uuid,name,description)`) ### Response #### Success Response (200 OK) An array of Queue objects, each containing details like uuid, display name, name, description, location, service, allowedPriorities, and allowedStatuses. ### Response Example ```json { "results": [ { "uuid": "queue-uuid", "display": "Queue Name", "name": "Queue Name", "description": "Queue description", "location": { "uuid": "location-uuid", "display": "Location" }, "service": { "uuid": "service-uuid", "display": "Service" }, "allowedPriorities": [], "allowedStatuses": [] } ] } ``` ``` -------------------------------- ### Initialization Function: startupApp Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-list-management.md Initializes the patient list management module, including setting up offline data synchronization and defining the configuration schema. ```typescript export function startupApp() { setupOffline(); defineConfigSchema(moduleName, configSchema); } ``` -------------------------------- ### GET /rest/v1/queue-room Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetches all queue rooms, with an option to filter by queue UUID. ```APIDOC ## GET /rest/v1/queue-room ### Description Fetches all queue rooms. You can optionally filter the results by a specific queue UUID. ### Method GET ### Endpoint /rest/v1/queue-room ### Parameters #### Query Parameters - **queue** (string) - Optional - Filter by queue UUID. - **v** (string) - Optional - Representation version. ``` -------------------------------- ### Create New Queue Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Creates a new queue with specified name, description, service, and location. ```json { "name": "Queue Name", "description": "Queue description", "service": { "uuid": "service-uuid" }, "location": { "uuid": "location-uuid" } } ``` -------------------------------- ### GET /rest/v1/visit Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetches a list of visits, with options to filter by patient, location, or to include completed visits. ```APIDOC ## GET /rest/v1/visit ### Description Fetch visits with filtering. ### Method GET ### Endpoint /rest/v1/visit ### Parameters #### Query Parameters - **patient** (string) - Optional - Filter by patient UUID - **location** (string) - Optional - Filter by location - **includeInactive** (boolean) - Optional - Include completed visits ### Response #### Success Response (200) - **visits** (array) - Array of Visit objects ``` -------------------------------- ### GET /rest/v1/appointments Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetches a list of appointments, with options to filter by date range, patient, service, and status. ```APIDOC ## GET /rest/v1/appointments ### Description Fetch appointments with filtering. ### Method GET ### Endpoint /rest/v1/appointments ### Parameters #### Query Parameters - **startDate** (string) - Optional - Filter by start date - **endDate** (string) - Optional - Filter by end date - **patientUuid** (string) - Optional - Filter by patient - **serviceUuid** (string) - Optional - Filter by service - **status** (string) - Optional - Filter by status ### Response #### Success Response (200) - **data** (array) - List of appointments - **uuid** (string) - Unique identifier for the appointment - **appointmentNumber** (string) - The appointment number - **patient** (object) - Patient details - **uuid** (string) - Patient UUID - **name** (string) - Patient name - **service** (object) - Service details - **uuid** (string) - Service UUID - **name** (string) - Service name - **startDateTime** (number) - Start date and time of the appointment (timestamp) - **endDateTime** (number) - End date and time of the appointment (timestamp) - **status** (string) - Current status of the appointment - **appointmentKind** (string) - The type of appointment - **location** (object) - Location details - **uuid** (string) - Location UUID - **name** (string) - Location name - **provider** (object) - Provider details - **uuid** (string) - Provider UUID - **display** (string) - Provider display name ### Response Example ```json { "data": [ { "uuid": "appointment-uuid", "appointmentNumber": "APT-001", "patient": { "uuid": "patient-uuid", "name": "Patient Name" }, "service": { "uuid": "service-uuid", "name": "Service Name" }, "startDateTime": 1704110400000, "endDateTime": 1704114000000, "status": "Scheduled", "appointmentKind": "Scheduled", "location": { "uuid": "location-uuid", "name": "Location" }, "provider": { "uuid": "provider-uuid", "display": "Provider Name" } } ] } ``` ``` -------------------------------- ### startupApp() Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-search.md Initializes the patient search module during application startup. This function sets up the configuration schema, registers a dynamic offline data handler for patient records, and configures the module to fetch and cache patient data for offline use. ```APIDOC ## startupApp() ### Description Initializes the patient search module during application startup. This function sets up the configuration schema, registers a dynamic offline data handler for patient records, and configures the module to fetch and cache patient data for offline use. ### Parameters None ### Behavior 1. Defines configuration schema for the module. 2. Sets up offline data sync handler for patient records. 3. Registers dynamic route for FHIR Patient endpoint. 4. Fetches and caches patient data for offline use. ``` -------------------------------- ### GET /rest/v1/concept/{conceptUuid} Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetches a specific concept by its UUID, used for retrieving details about statuses, priorities, and services. ```APIDOC ## GET /rest/v1/concept/{conceptUuid} ### Description Fetch a specific concept (used for statuses, priorities, services). ### Method GET ### Endpoint /rest/v1/concept/{conceptUuid} ### Parameters #### Path Parameters - **conceptUuid** (string) - Required - The UUID of the concept to fetch ### Response #### Success Response (200) - **uuid** (string) - The UUID of the concept - **display** (string) - The display name of the concept - **datatype** (object) - The datatype of the concept - **answers** (array) - An array of possible answers for the concept - **setMembers** (array) - An array of concepts that are members of this concept set ``` -------------------------------- ### Fetch All Cohorts Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-list-management.md Retrieves a list of all available cohorts. This endpoint is useful for getting an overview of all existing patient lists. ```APIDOC ## GET /cohortm ### Description Fetches all cohorts. ### Method GET ### Endpoint /cohortm ### Response #### Success Response (200) - cohorts (array) - A list of cohort objects. ``` -------------------------------- ### Root Component Initialization Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes the main root component for the service queues module using async lifecycle. Includes SWR configuration for data refreshing. ```typescript export const root = getAsyncLifecycle(() => import('./root.component'), { featureName: 'service-queues-app-root', moduleName: '@openmrs/esm-service-queues-app', swrConfig: { refreshInterval: 60000, }, }); ``` -------------------------------- ### Increment Version and Release Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/README.md Increments the project version and prepares for release. ```bash yarn release ``` -------------------------------- ### Create New Queue Room Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Creates a new queue room with a name, description, and associated queue. ```json { "name": "Room Name", "description": "Room description", "queue": { "uuid": "queue-uuid" } } ``` -------------------------------- ### GET /rest/v1/queue-entry Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetches queue entries, allowing filtering by queue, location, service, status, patient, and whether entries have ended. ```APIDOC ## GET /rest/v1/queue-entry ### Description Fetches queue entries. Supports filtering by one or more queue UUIDs, location UUIDs, service UUIDs, status UUIDs, patient UUID, and a flag to include ended entries. ### Method GET ### Endpoint /rest/v1/queue-entry ### Parameters #### Query Parameters - **queue** (string or array) - Optional - Filter by queue UUID(s). - **location** (string or array) - Optional - Filter by location UUID(s). - **service** (string or array) - Optional - Filter by service UUID(s). - **status** (string or array) - Optional - Filter by status UUID(s). - **isEnded** (boolean) - Required - Include ended entries. - **patient** (string) - Optional - Filter by patient UUID. - **v** (string) - Optional - Representation version. ``` -------------------------------- ### Run Tests Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/README.md Executes tests for all modules using Turbo. ```bash yarn turbo run test ``` -------------------------------- ### Home Page Appointments Overview Component Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md Loads the home page component that displays an overview of appointments asynchronously. ```typescript export const homeAppointments = getAsyncLifecycle(() => import('./home/home-appointments.component'), options); ``` -------------------------------- ### Get Appointment Status Color Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/types.md Maps an appointment status to a corresponding color string. Requires importing AppointmentStatus and AppointmentKind from '@openmrs/esm-appointments-app'. ```typescript import { AppointmentStatus, AppointmentKind } from '@openmrs/esm-appointments-app'; function getAppointmentStatusColor(status: AppointmentStatus): string { switch (status) { case AppointmentStatus.SCHEDULED: return 'blue'; case AppointmentStatus.COMPLETED: return 'green'; case AppointmentStatus.CANCELLED: return 'red'; default: return 'gray'; } } ``` -------------------------------- ### Get Async Lifecycle for Cancel Admission Request Workspace Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Exports the workspace component used for cancelling pending admission requests. ```typescript export const cancelAdmissionRequestWorkspace = getAsyncLifecycle( () => import('./ward-workspace/cancel-admission-request-workspace/cancel-admission-request.workspace'), options, ); ``` -------------------------------- ### POST /rest/v1/queue Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Creates a new queue with specified details including name, description, service, and location. ```APIDOC ## POST /rest/v1/queue ### Description Creates a new queue. Requires a name, description, and the UUIDs for the associated service and location. ### Method POST ### Endpoint /rest/v1/queue ### Request Body - **name** (string) - Required - The name of the queue. - **description** (string) - Optional - A description for the queue. - **service** (object) - Required - An object containing the UUID of the service associated with the queue. - **uuid** (string) - Required - **location** (object) - Required - An object containing the UUID of the location where the queue is established. - **uuid** (string) - Required ### Request Example ```json { "name": "Queue Name", "description": "Queue description", "service": { "uuid": "service-uuid" }, "location": { "uuid": "location-uuid" } } ``` ### Response #### Success Response (201 Created) Returns the newly created queue object, including its UUID and other details. ### Response Example ```json { "uuid": "new-queue-uuid", "display": "Queue Name", "name": "Queue Name", "description": "Queue description", "location": { "uuid": "location-uuid" }, "service": { "uuid": "service-uuid" }, "allowedPriorities": [], "allowedStatuses": [] } ``` ``` -------------------------------- ### System Settings Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/INDEX.md Endpoints for configuring system-wide settings, specifically for queues. ```APIDOC ## System Settings (Queue Configuration) ### Description Endpoints to manage system-level configuration settings, with a focus on queue-related configurations. ### Method GET, PUT ### Endpoint /rest/v1/systemsettings/queue ### Parameters #### Request Body (for PUT) - **refreshInterval** (integer) - Optional - The interval in seconds for refreshing queue data. - **defaultSortWeight** (integer) - Optional - The default sort weight for queue entries. ### Response #### Success Response (200 OK) - **refreshInterval** (integer) - The current queue refresh interval. - **defaultSortWeight** (integer) - The current default sort weight. ``` -------------------------------- ### Summary Left Panel Link Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/remaining-modules.md Exports a synchronous lifecycle component for the bed management summary left panel link. ```typescript export const summaryLeftPanelLink = getSyncLifecycle( createLeftPanelLink({ name: 'bed-management', title: 'Summary', }), options, ); ``` -------------------------------- ### Get Async Lifecycle for Admission Request Workspace Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Exports the workspace component for viewing and managing pending patient admission requests. ```typescript export const admissionRequestWorkspace = getAsyncLifecycle( () => import('./ward-workspace/admission-request-workspace/admission-requests.workspace'), options, ); ``` -------------------------------- ### Appointments Module Configuration Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/INDEX.md Configure behavior for the appointments module, such as allowing all-day appointments and defining available appointment statuses. ```json { "@openmrs/esm-appointments-app": { "allowAllDayAppointments": true, "appointmentStatuses": ["Scheduled", "Completed"] } } ``` -------------------------------- ### Run Unit Tests Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Executes all unit tests within the project. ```bash yarn test ``` -------------------------------- ### Initialize Patient Registration Module Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-registration.md Initializes the patient registration module by defining its configuration schema and setting up offline data synchronization. ```typescript export function startupApp() { defineConfigSchema(moduleName, esmPatientRegistrationSchema); setupOffline(); } ``` -------------------------------- ### Get Cohort Details Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-list-management.md Retrieves detailed information about a specific cohort using its UUID. This is useful for inspecting the contents and properties of a single patient list. ```APIDOC ## GET /cohortm/{uuid} ### Description Gets details for a specific cohort. ### Method GET ### Endpoint /cohortm/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier of the cohort. ### Response #### Success Response (200) - cohort (object) - The cohort object with detailed information. ``` -------------------------------- ### Get Ward Patient Bed Number Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/types.md Retrieves the bed number for a given ward patient, returning null if not assigned. Requires importing WardPatient from '@openmrs/esm-ward-app'. ```typescript import { WardPatient } from '@openmrs/esm-ward-app'; function getPatientBedNumber(wardPatient: WardPatient): string | null { return wardPatient.bed?.bedNumber || null; } ``` -------------------------------- ### Create Bed Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Create a new bed in the system. Requires the bed management module to be enabled. ```APIDOC ## POST /rest/v1/bed ### Description Create a new bed. Requires the bed management module to be enabled. ### Method POST ### Endpoint /rest/v1/bed ### Parameters #### Request Body - **bedNumber** (string) - Required - The number or identifier of the bed - **bedType** (object) - Required - Details about the type of bed (requires `uuid`) - **location** (object) - Required - The location of the bed (requires `uuid`) - **row** (integer) - Required - The row number of the bed - **column** (integer) - Required - The column number of the bed ### Request Example { "bedNumber": "A-2", "bedType": { "uuid": "bed-type-uuid" }, "location": { "uuid": "location-uuid" }, "row": 1, "column": 2 } ``` -------------------------------- ### POST /rest/v1/queue-room Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Creates a new queue room with a name, description, and associated queue UUID. ```APIDOC ## POST /rest/v1/queue-room ### Description Creates a new queue room. Requires a name, description, and the UUID of the associated queue. ### Method POST ### Endpoint /rest/v1/queue-room ### Request Body - **name** (string) - Required - The name of the queue room. - **description** (string) - Optional - A description for the queue room. - **queue** (object) - Required - An object containing the UUID of the queue to which this room belongs. - **uuid** (string) - Required ### Request Example ```json { "name": "Room Name", "description": "Room description", "queue": { "uuid": "queue-uuid" } } ``` ### Response #### Success Response (201 Created) Indicates the queue room was successfully created. ``` -------------------------------- ### Dashboard Link Initialization Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes a sync lifecycle component for creating a dashboard navigation link. ```typescript export const serviceQueuesDashboardLink = getSyncLifecycle(createDashboardLink(dashboardMeta), options); ``` -------------------------------- ### Import Appointment Types Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/INDEX.md Import Appointment and AppointmentPayload types for working with appointment data structures in the appointments module. ```typescript import { Appointment, AppointmentPayload } from '@openmrs/esm-appointments-app'; ``` -------------------------------- ### Fetch All Beds Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetch all beds available in the system. Requires the bed management module to be enabled. ```APIDOC ## GET /rest/v1/bed ### Description Fetch all beds (requires bed management module). Returns details about each bed including its number, type, location, and status. ### Method GET ### Endpoint /rest/v1/bed ### Response #### Success Response (200) - **results** (array) - Array of bed objects - **uuid** (string) - Unique identifier for the bed - **bedNumber** (string) - The number or identifier of the bed - **bedType** (object) - Details about the type of bed - **row** (integer) - The row number of the bed - **column** (integer) - The column number of the bed - **status** (string) - The current status of the bed (e.g., AVAILABLE, OCCUPIED) ### Response Example { "results": [ { "uuid": "bed-uuid", "bedNumber": "A-1", "bedType": { "uuid": "type-uuid", "name": "Standard" }, "row": 1, "column": 1, "status": "AVAILABLE" } ] } ``` -------------------------------- ### Initialize Appointments Module Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md Initializes the appointments module by defining its configuration schema and registering breadcrumbs for navigation. This includes breadcrumbs for the main appointments section and dynamic patient lists based on date and service. ```typescript export function startupApp() { const appointmentsBasePath = `${window.spaBase}/home/appointments`; defineConfigSchema(moduleName, configSchema); registerBreadcrumbs([ { title: 'Appointments', path: appointmentsBasePath, parent: `${window.spaBase}/home`, }, { path: `${window.spaBase}/patient-list/:forDate/:serviceName`, title: ([_, serviceName]) => `Patient Lists / ${decodeURI(serviceName)}`, parent: `${window.spaBase}`, }, ]); } ``` -------------------------------- ### Working with Types in OpenMRS ESM Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/INDEX.md Illustrates how to import and use type definitions for queues and queue entries from the `esm-service-queues-app` module. Consult `types.md` for comprehensive type definitions. ```typescript import { Queue, QueueEntry } from '@openmrs/esm-service-queues-app'; function processQueueEntry(entry: QueueEntry): void { console.log(`Patient ${entry.patient.name} in ${entry.queue.name}`); } ``` -------------------------------- ### Accessing Configuration with useConfig Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Demonstrates how to import and use the useConfig hook to access application configuration within a React component. ```typescript import { useConfig } from '@openmrs/esm-framework'; export function WardComponent() { const config = useConfig(); // Use configuration properties } ``` -------------------------------- ### Transition Queue Entry Modal Initialization Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes the async lifecycle component for the modal used to transition a queue entry to a new status. ```typescript export const transitionQueueEntryModal = getAsyncLifecycle( () => import('./modals/transition-queue-entry.modal'), { featureName: 'transition queue entry', moduleName }, ); ``` -------------------------------- ### Make an API Call Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/00-START-HERE.md Make an API call using the openmrsFetch utility from the framework. Consult endpoints.md for specific endpoint details and structure your request body and headers accordingly. ```typescript // 1. Check endpoints.md for the endpoint details // 2. Use openmrsFetch from framework import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework'; const response = await openmrsFetch(`${restBaseUrl}/queue`, { method: 'POST', body: JSON.stringify({ /* payload */ }), headers: { 'Content-Type': 'application/json' } }); ``` -------------------------------- ### Root Application Component Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/remaining-modules.md Exports the main application root component asynchronously. ```typescript export const root = getAsyncLifecycle(() => import('./root.component'), options); ``` -------------------------------- ### Access Configuration with useConfig Hook Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/configuration.md Demonstrates how to access application configuration within a component using the `useConfig` hook. Ensure the hook is called within a component that can handle the initial loading state. ```typescript import { useConfig } from '@openmrs/esm-framework'; function MyComponent() { const config = useConfig(); if (!config) { return
Loading configuration...
; } return
Using config: {JSON.stringify(config, null, 2)}
; } ``` -------------------------------- ### Run Specific Test Files Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Executes tests that match a given string pattern. This allows for targeted testing of specific functionalities or files. ```bash yarn turbo run test -- basic-search ``` -------------------------------- ### System Settings for Queue Configuration Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Fetch system settings, specifically useful for queue configuration. The response includes properties like 'queue.serviceConceptSetName' which holds a concept set UUID for available services. ```json { "results": [ { "property": "queue.serviceConceptSetName", "value": "service-concept-set-uuid" } ] } ``` -------------------------------- ### homeAppointments Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md An asynchronous component for the home page, displaying an overview of appointments. ```APIDOC ## homeAppointments ### Description Home page component showing appointment overview. ### Component Type Async Lifecycle Component ``` -------------------------------- ### Queue Table by Status View Initialization Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes the view component for displaying queue entries filtered by status. Configured with a 60-second refresh interval for real-time updates. ```typescript export const queueTableByStatusView = getAsyncLifecycle( () => import('./views/queue-table-by-status-view.component'), { featureName: 'queue-table-by-status-view', moduleName: '@openmrs/esm-service-queues-app', swrConfig: { refreshInterval: 60000 }, }, ); ``` -------------------------------- ### Run Tests for All Packages Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/README.md Executes all tests across all packages within the monorepo using turbo. This provides a comprehensive test run. ```bash yarn turbo run test ``` -------------------------------- ### Queue Table by Status Menu Initialization Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes the menu component for filtering queue entries by status using async lifecycle. ```typescript export const queueTableByStatusMenu = getAsyncLifecycle( () => import('./queue-table/queue-table-by-status-menu.component'), options, ); ``` -------------------------------- ### homeAppointmentsTile Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md An asynchronous component used as a tile on the home page for the appointments widget. ```APIDOC ## homeAppointmentsTile ### Description Tile component for home page appointments widget. ### Component Type Async Lifecycle Component ``` -------------------------------- ### Initialize Active Visits Module Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/remaining-modules.md Initializes the Active Visits module by defining its configuration schema. This function should be called during application startup. ```typescript export function startupApp() { defineConfigSchema(moduleName, configSchema); } ``` -------------------------------- ### Initialize Ward Module Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/ward.md Initializes the ward module by registering breadcrumbs, configuration schemas, and feature flags. ```typescript export function startupApp() { registerBreadcrumbs([]); defineConfigSchema(moduleName, configSchema); defineExtensionConfigSchema('ward-patient-discharge', dischargeWorkspaceSiderailExtensionConfigSchema); registerFeatureFlag( 'bedmanagement-module', 'Bed management module', 'Enables features related to bed management / assignment. Requires the backend bed management module to be installed.', ); } ``` -------------------------------- ### AppointmentService Interface Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/types.md Defines the configuration for an appointment service, including its name, duration, and operating hours. Used to set up available services. ```typescript interface AppointmentService { appointmentServiceId: number; creatorName: string; description: string; durationMins?: number; endTime: string; initialAppointmentStatus: string; location?: OpenmrsResource; maxAppointmentsLimit: number | null; name: string; specialityUuid?: OpenmrsResource | {}; startTime: string; uuid: string; serviceTypes?: Array; color?: string; startTimeTimeFormat?: amPm; endTimeTimeFormat?: amPm; } ``` -------------------------------- ### Initialize Patient Search Module Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/patient-search.md Initializes the patient search module by defining its configuration schema, setting up offline data handling, and registering dynamic routes for patient data. ```typescript export function startupApp() { defineConfigSchema(moduleName, configSchema); setupDynamicOfflineDataHandler({ id: 'esm-patient-search-app:patient', type: 'patient', displayName: 'Patient search', async isSynced(patientUuid) { const expectedUrls = [`${fhirBaseUrl}/Patient/${patientUuid}`]; const absoluteExpectedUrls = expectedUrls.map((url) => window.origin + makeUrl(url)); const cache = await caches.open('omrs-spa-cache-v1'); const keys = (await cache.keys()).map((key) => key.url); return absoluteExpectedUrls.every((url) => keys.includes(url)); }, async sync(patientUuid) { await messageOmrsServiceWorker({ type: 'registerDynamicRoute', pattern: `${fhirBaseUrl}/Patient/${patientUuid}`, }); await fetchCurrentPatient(patientUuid); }, }); } ``` -------------------------------- ### Home Page Appointments Widget Tile Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md Loads the tile component for the home page appointments widget asynchronously. ```typescript export const homeAppointmentsTile = getAsyncLifecycle( () => import('./homepage-tile/appointments-tile.component'), options, ); ``` -------------------------------- ### root Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md The main application root component for the Appointments module. ```APIDOC ## root ### Description Main application root component. ### Component Type Async Lifecycle Component ``` -------------------------------- ### Outpatient Side Navigation Initialization Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes the side navigation menu component for outpatient services using async lifecycle. ```typescript export const outpatientSideNav = getAsyncLifecycle(() => import('./side-menu/side-menu.component'), options); ``` -------------------------------- ### appointmentsDashboard Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md The main appointments dashboard component, loaded asynchronously. ```APIDOC ## appointmentsDashboard ### Description Main appointments dashboard component. ### Component Type Async Lifecycle Component ``` -------------------------------- ### Move Queue Entry Modal Initialization Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes the async lifecycle component for the modal used to move a patient to a different queue. ```typescript export const moveQueueEntryModal = getAsyncLifecycle( () => import('./modals/move-queue-entry.modal'), { featureName: 'move queue entry', moduleName }, ); ``` -------------------------------- ### Initialize Service Queues Module Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes the service queues module by registering breadcrumbs and defining the configuration schema. Use this function during application startup. ```typescript export function startupApp() { registerBreadcrumbs([]); defineConfigSchema(moduleName, configSchema); } ``` -------------------------------- ### Undo Transition Queue Entry Modal Initialization Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Initializes the async lifecycle component for the modal used to undo a queue entry transition. ```typescript export const undoTransitionQueueEntryModal = getAsyncLifecycle( () => import('./modals/undo-transition-queue-entry.modal'), { featureName: 'undo queue entry transiion of a patient', moduleName }, ); ``` -------------------------------- ### Queue Screen Link Extension Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/service-queues.md Loads the asynchronous lifecycle for an extension that provides a link to the queue display screen. Requires the 'queue-screen-link' feature and the module name. ```typescript export const queueScreenLink = getAsyncLifecycle( () => import('./queue-screen/queue-screen-link.extension'), { featureName: 'queue-screen-link', moduleName }, ); ``` -------------------------------- ### Home App Module Configuration Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/remaining-modules.md Defines the module name and page name for the Home App module, along with options for feature configuration. ```typescript const moduleName = '@openmrs/esm-home-app'; const pageName = 'home'; const options = { featureName: pageName, moduleName, }; ``` -------------------------------- ### Main Appointments Dashboard Component Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/api-reference/appointments.md Loads the main appointments dashboard component asynchronously. ```typescript export const appointmentsDashboard = getAsyncLifecycle(() => import('./appointments.component'), options); ``` -------------------------------- ### Fetch Appointment Services Source: https://github.com/openmrs/openmrs-esm-patient-management/blob/main/_autodocs/endpoints.md Retrieve a list of available appointment services. This includes details like service name, description, operating hours, and duration. ```json { "data": [ { "uuid": "service-uuid", "name": "Service Name", "description": "Service description", "startTime": "08:00", "endTime": "17:00", "maxAppointmentsLimit": 10, "durationMins": 30, "specialityUuid": "speciality-uuid" } ] } ```