> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/appertafoundation/openeyes/llms.txt
> Use this file to discover all available pages before exploring further.

# Clinical Workflow

> Understanding episodes, events, and the clinical workflow in OpenEyes

## Overview

OpenEyes uses an **episode-based, event-driven** clinical workflow model. This architecture provides structured clinical documentation while maintaining flexibility for various ophthalmic specialties.

<Info>
  The episode-event model is central to OpenEyes. Understanding this structure is essential for effective clinical documentation.
</Info>

## Episode-Based Architecture

### What is an Episode?

An **episode** represents a continuous period of care for a specific condition in a particular subspecialty.

<CardGroup cols={2}>
  <Card title="Episode Components" icon="puzzle-piece">
    * Patient
    * Subspecialty (e.g., glaucoma, cataract)
    * Firm (clinical team)
    * Principal diagnosis
    * Affected eye(s)
    * Status (active, discharged)
  </Card>

  <Card title="Episode Lifecycle" icon="rotate">
    * Created at first contact
    * Remains open during active care
    * Can be closed and reopened
    * Tracks start and end dates
  </Card>
</CardGroup>

### Episode Types

OpenEyes supports different episode categories:

<Tabs>
  <Tab title="Standard Episodes">
    Regular clinical episodes for subspecialty care:

    * Glaucoma
    * Cataract
    * Medical Retina
    * Oculoplastics
    * Each tied to a specific subspecialty and firm
  </Tab>

  <Tab title="Support Service Episodes">
    Non-clinical support services:

    * Orthoptics
    * Low vision
    * Contact lens services
    * Separate from subspecialty episodes
  </Tab>

  <Tab title="Legacy Episodes">
    Historical episodes:

    * Imported from old systems
    * Read-only data
    * Maintained for continuity
  </Tab>
</Tabs>

### Creating Episodes

<Steps>
  <Step title="Patient Selection">
    Navigate to patient record from search or worklist
  </Step>

  <Step title="Check Existing Episodes">
    System displays all episodes for the patient

    * Active episodes shown in green
    * Closed episodes shown in gray
  </Step>

  <Step title="Add New Episode">
    If no episode exists for current subspecialty:

    1. Click **Add New Episode**
    2. System associates with selected firm
    3. Subspecialty determined by firm
  </Step>

  <Step title="Set Principal Diagnosis">
    1. Select disorder from SNOMED-coded list
    2. Choose affected eye: Right, Left, or Both
    3. Optionally set diagnosis date
    4. Diagnosis becomes episode identifier
  </Step>
</Steps>

<Warning>
  You must have **OprnCreateEpisode** permission to create new episodes. Contact your administrator if this action is unavailable.
</Warning>

### Episode Management

**Viewing Episodes:**

* Patient summary shows all episodes
* Click episode to view details
* See all events within episode
* Review episode timeline

**Editing Episodes:**

1. Navigate to episode view
2. Click **Edit** tab (if permitted)
3. Update principal diagnosis
4. Change episode status
5. Save changes

**Episode Status:**

* **Active**: Ongoing clinical care
* **Closed**: Episode completed
* Episode end date set when closed

## Event-Driven Documentation

### What is an Event?

An **event** is a specific clinical encounter or documentation instance within an episode.

<CardGroup cols={2}>
  <Card title="Event Properties" icon="calendar">
    * Event type (examination, operation, etc.)
    * Event date
    * Associated episode
    * Creating user and firm
    * Custom elements per event type
  </Card>

  <Card title="Event Types" icon="list">
    * Examination
    * Prescription
    * Operation booking
    * Biometry
    * Correspondence
    * Custom module events
  </Card>
</CardGroup>

### Event Lifecycle

```mermaid theme={null}
graph LR
    A[Create Event] --> B[Add Elements]
    B --> C[Save Draft]
    C --> D[Complete & Save]
    D --> E[Event Locked]
    E --> F[View/Print]
    F --> G{Need Changes?}
    G -->|Yes| H[Delete & Recreate]
    G -->|No| F
```

<Info>
  Once saved, events are generally locked for audit purposes. If changes are needed, the event may need to be deleted (soft delete) and recreated.
</Info>

### Creating Events

<Steps>
  <Step title="Navigate to Patient">
    Find patient record via search or worklist
  </Step>

  <Step title="Select/Create Episode">
    Ensure appropriate episode exists for event
  </Step>

  <Step title="Add Event">
    1. Click **Add Event** button
    2. Select event type from dropdown
    3. System creates event in current episode
  </Step>

  <Step title="Complete Event Elements">
    Each event type has specific elements:

    * Examination: VA, IOP, anterior segment, etc.
    * Prescription: Medications, dosage, instructions
    * Operation: Procedure, laterality, booking details
  </Step>

  <Step title="Save Event">
    * **Save Draft**: Work in progress (can edit later)
    * **Save & Exit**: Complete event (locked)
    * Event appears in patient timeline
  </Step>
</Steps>

### Event Elements

Each event type contains multiple elements:

<Accordion title="Examination Event Elements">
  * **History**: Presenting complaint, history of presenting complaint
  * **Visual Acuity**: Aided/unaided, right/left/both eyes
  * **Refraction**: Sphere, cylinder, axis for each eye
  * **Intraocular Pressure**: IOP readings and method
  * **Anterior Segment**: Slit lamp findings with EyeDraw
  * **Posterior Segment**: Fundus findings with EyeDraw
  * **Diagnoses**: Update or confirm diagnoses
  * **Management**: Clinical plan and follow-up
  * **Conclusions**: Summary and next steps
</Accordion>

<Accordion title="Prescription Event Elements">
  * **Drug Selection**: Search formulary
  * **Dose & Frequency**: Standard or custom
  * **Route**: Topical, oral, injection
  * **Laterality**: Right eye, left eye, both, or systemic
  * **Duration**: Treatment period
  * **Instructions**: Patient directions
  * **Prescriber Details**: Regulatory information
</Accordion>

<Accordion title="Operation Event Elements">
  * **Procedure**: SNOMED-coded operation
  * **Laterality**: Eye to be operated
  * **Surgeon**: Operating consultant
  * **Anaesthetic**: Local, general, or sedation
  * **Priority**: Routine, urgent, emergency
  * **Booking Details**: Date, time, location
  * **Consent**: Documentation reference
</Accordion>

### Event Drafts

Drafts allow work-in-progress:

* **Save Draft**: Preserves partial work
* **Resume Draft**: Continue from where you left off
* **Draft List**: View all pending drafts
* **Auto-save**: Periodic saving (if enabled)
* **Draft Age**: System tracks how long drafts are pending

<Warning>
  Drafts are not part of the clinical record until finalized. Complete drafts promptly to maintain accurate patient timelines.
</Warning>

## Clinical Pathways Integration

Events can be linked to clinical pathways:

### Pathway Steps

Events can fulfill pathway steps:

* Check-in
* Pre-assessment
* Examination
* Procedure
* Follow-up

### Worklist Integration

Events created from worklists:

* Automatically link to worklist patient
* Update pathway status
* Track wait times
* Measure clinic efficiency

<Info>
  See the [Worklists guide](/user-guide/worklists) for detailed information on pathway-based workflows.
</Info>

## Event Validation

### Date Validation

Event dates must:

* Not be in the future (unless allowed by configuration)
* Be logical in sequence (generally after episode start)
* Be after patient date of birth
* Be before date of death (if deceased)

### Required Elements

Each event type has mandatory elements:

* Cannot save without completing required fields
* System highlights missing elements
* Validation messages guide completion

### Business Rules

Events follow clinical rules:

* Prescription requires valid prescriber
* Operation must have laterality specified
* Examination requires at least one finding
* Correspondence must have recipient

## Event Hierarchy and Relationships

### Parent-Child Events

Events can have hierarchical relationships:

* **Parent Event**: Original event (e.g., operation booking)
* **Child Events**: Follow-up events (e.g., post-op review)
* Navigation between related events
* Maintains clinical context

### Event Groups

Events can be grouped:

* Same-day events
* Related procedures
* Linked correspondence
* Grouped viewing and printing

## Viewing Events

### Timeline View

Patient summary displays events chronologically:

* Most recent events first
* Color-coded by event type
* Quick view of event date and type
* Click to open full event

### Episode View

View events within an episode:

* Filtered by episode
* Shows progression of care
* Track diagnosis changes
* Review management over time

### Lightning Viewer

Quick access to document events:

* Grouped by type (letters, reports, etc.)
* Organized by year
* Side-by-side comparison
* Print-friendly view

<Note>
  Lightning Viewer is useful for quickly reviewing correspondence, biometry reports, and other documents without navigating through full events.
</Note>

## Event Deletion and Modification

### Soft Delete

Events can be soft-deleted:

1. Open event view
2. Click **Delete** (if permitted)
3. Enter deletion reason
4. Event marked as deleted (not removed)
5. Audit trail maintained

<Warning>
  **Event deletion requires appropriate permissions:**

  * Should only be used for errors or duplicates
  * Deleted events remain in audit log
  * Cannot be restored without database access
  * Consider creating corrective event instead
</Warning>

### Audit Trail

All event actions are logged:

* Creation timestamp and user
* Modifications (if allowed)
* Views and prints
* Deletion with reason
* Complete audit trail for governance

## Multi-Specialty Workflow

### Multiple Episodes

Patients can have concurrent episodes:

* Different subspecialties
* Different clinical teams
* Independent management plans
* Shared patient context

### Episode Switching

Switch between episodes:

1. View patient summary
2. See all active episodes
3. Click episode to set context
4. New events added to selected episode

### Cross-Episode View

Some views show all episodes:

* Complete patient timeline
* All visual acuity measurements
* All prescriptions
* Comprehensive clinical picture

## Firm-Based Workflow

### Firm Context

Clinical work is firm-specific:

* Select firm at session start
* Events created under selected firm
* Episodes associated with firm
* Worklists filtered by firm

### Multi-Firm Access

Clinicians can belong to multiple firms:

* Switch firms in header
* View changes to show current firm's patients
* Maintain separate worklists per firm
* Cross-firm patient access maintained

## Advanced Workflows

### Automated Events

Some events can be automated:

* Imported from devices (biometry, OCT)
* Auto-generated from pathways
* Scheduled follow-ups
* System-triggered notifications

**Automated Source Tracking:**

* Events marked with `is_automated` flag
* Source system recorded in JSON
* Different validation rules
* Audit trail includes automation details

### Template-Based Events

Use templates for efficiency:

* Pre-populate common findings
* Standard letters
* Routine examinations
* Custom templates per firm/user

### Event Attachments

Attach files to events:

* Imaging results
* External reports
* Correspondence received
* Supporting documents

<Info>
  Attachments are grouped by event for easy access. Supported formats include PDF, images, and medical imaging standards.
</Info>

## Best Practices

<CardGroup cols={2}>
  <Card title="Episode per Subspecialty" icon="folder">
    Create separate episodes for each subspecialty to maintain clear clinical focus
  </Card>

  <Card title="Complete Events Promptly" icon="clock">
    Finalize event documentation during or immediately after the clinical encounter
  </Card>

  <Card title="Accurate Event Dates" icon="calendar">
    Ensure event date reflects actual clinical encounter, not documentation date
  </Card>

  <Card title="Meaningful Diagnoses" icon="stethoscope">
    Set principal diagnosis that best represents the episode's clinical focus
  </Card>
</CardGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Cannot create episode" icon="circle-xmark">
    **Possible causes:**

    * No firm selected
    * Insufficient permissions (need OprnCreateEpisode)
    * Patient record issues

    **Solutions:**

    * Select firm from header dropdown
    * Contact administrator for permission review
    * Verify patient record is valid and not deleted
  </Accordion>

  <Accordion title="Event won't save" icon="floppy-disk">
    **Common issues:**

    * Missing required elements
    * Invalid date (future date not allowed)
    * Validation errors in element data

    **Solutions:**

    * Review red error messages
    * Complete all required fields (marked with \*)
    * Check date is not in future
    * Verify eye-specific data is logical
  </Accordion>

  <Accordion title="Cannot see events" icon="eye-slash">
    **Possible reasons:**

    * Wrong episode selected
    * Insufficient view permissions
    * Events exist but are drafts
    * Deleted events (need special view)

    **Check:**

    * Verify correct episode is active
    * Review user permissions with admin
    * Look in drafts section
    * Check if OprnViewClinical permission granted
  </Accordion>

  <Accordion title="Episode shows wrong diagnosis" icon="notes-medical">
    **To update:**

    * Navigate to episode view
    * Click Edit tab (need OprnEditEpisode permission)
    * Update principal diagnosis
    * Select correct affected eye
    * Optionally update diagnosis date
    * Save changes

    Note: Diagnosis changes are audited
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Clinical Modules" icon="stethoscope" href="/modules/overview">
    Explore specific event types and clinical modules
  </Card>

  <Card title="Examination Module" icon="eye" href="/modules/examination">
    Learn detailed examination documentation
  </Card>

  <Card title="Prescriptions" icon="prescription" href="/modules/prescriptions">
    Master prescription creation and management
  </Card>

  <Card title="Operations" icon="scissors" href="/modules/operations">
    Understand operation booking and management
  </Card>
</CardGroup>
