> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced Document Features Guide

> Encore Health OS provides advanced document capabilities including enhanced preview, version control, approval workflows, and integrations with external docume…

## Overview

Encore Health OS provides advanced document capabilities including enhanced preview, version control, approval workflows, and integrations with external document services.

## Enhanced Document Preview

### Supported Formats

**Native Preview (In-Browser):**

* **PDF**: High-quality rendering with zoom, pan, search
* **Images**: JPG, PNG, GIF, WebP with zoom and pan
* **Text**: TXT, MD, JSON with syntax highlighting

**External Viewer (Microsoft 365):**

* **Word**: DOCX, DOC
* **Excel**: XLSX, XLS
* **PowerPoint**: PPTX, PPT

**Download Only:**

* All other formats

### PDF Preview Features

#### Navigation

* Page thumbnails sidebar
* Jump to page (input field)
* Next/previous page buttons
* Keyboard shortcuts (arrow keys)

#### Zoom Controls

* Fit to width
* Fit to page
* Custom zoom (50% - 200%)
* Zoom in/out buttons
* Mouse wheel zoom

#### Search

* Full-text search across all pages
* Highlight matches
* Navigate between matches
* Case-sensitive option

#### Tools

* Print document
* Download PDF
* Rotate pages
* Select and copy text

**Example Usage:**

```typescript theme={null}
import { PDFPreview } from '@/platform/documents/components/PDFPreview';

<PDFPreview
  url={documentUrl}
  fileName="contract.pdf"
  onClose={() => setPreviewOpen(false)}
/>
```

### Image Preview Features

#### Viewing

* High-resolution display
* Smooth zoom (25% - 400%)
* Pan with mouse drag
* Fullscreen mode

#### Tools

* Rotate 90° clockwise/counter-clockwise
* Fit to screen
* Actual size (100%)
* Download original

**Example Usage:**

```typescript theme={null}
import { ImagePreview } from '@/platform/documents/components/ImagePreview';

<ImagePreview
  url={imageUrl}
  fileName="floor-plan.png"
  onClose={() => setPreviewOpen(false)}
/>
```

### Office Document Preview

Uses Microsoft Office Online Viewer (requires internet):

* View-only mode (no editing in preview)
* Preserves formatting and layout
* Shows formulas in Excel
* Displays animations in PowerPoint

**Limitations:**

* Requires public internet access
* 10MB file size limit
* No preview for password-protected files

## Document Version Control

### Automatic Versioning

Encore Health OS automatically versions documents when:

* File is replaced with new upload
* Document content is edited (if applicable)
* Document metadata is significantly changed

**Version Numbering:**

* Major versions: 1.0, 2.0, 3.0 (manual major version bump)
* Minor versions: 1.1, 1.2, 1.3 (automatic on replace)

### Version History

View all versions:

1. Open document detail page
2. Navigate to **Versions** tab
3. See list of all versions with:
   * Version number
   * Upload date
   * Uploaded by
   * File size
   * Change note (if provided)

### Comparing Versions

Compare two versions:

1. Select two versions (checkboxes)
2. Click **Compare**
3. View side-by-side differences

**Supported Comparison:**

* Text documents (word-level diff)
* PDF (page-by-page visual diff)
* JSON (structure diff)

### Restoring Previous Version

Revert to an older version:

1. Select version to restore
2. Click **Restore This Version**
3. Confirm action
4. Current version becomes new version with restored content

**Note:** Original current version is preserved as a version.

## Document Approval Workflow

Full approval workflow capabilities:

* Multi-step approval chains
* Approval routing by role or user
* Approval status tracking
* Email notifications to approvers

See [Document Approval Guide](./document-approvals-guide.md) for full details.

## Document Templates

### Creating Document Templates

Org admins can create reusable document templates:

1. Upload a template file (DOCX, XLSX, PDF)
2. Define merge fields (placeholders)
3. Map fields to Encore Health OS data
4. Save as template

**Example Merge Fields:**

* `{{resident.name}}`
* `{{organization.address}}`
* `{{today_date}}`
* `{{staff.signature}}`

### Generating Documents from Templates

Users can generate new documents:

1. Go to **Documents** → **Create from Template**
2. Select template
3. Fill in data fields
4. Click **Generate Document**
5. New document created with data merged

**Use Cases:**

* Admission packets
* Discharge summaries
* Employment contracts
* Monthly reports

## Document OCR (Optical Character Recognition)

### Automatic OCR

Encore Health OS automatically extracts text from:

* Scanned PDFs
* Image files (JPG, PNG)
* Screenshots

**Features:**

* Full-text search on scanned documents
* Copy text from images
* Data extraction (dates, names, amounts)

### Manual OCR Trigger

For older documents without OCR:

1. Open document
2. Click **Extract Text**
3. Wait for processing (30-120 seconds)
4. View extracted text in **Text** tab

**Limitations:**

* Requires clear, high-resolution images
* Handwriting support limited
* Best results with typed documents

## Document Collaboration

### Document Comments

Add comments to documents:

1. Open document preview
2. Select text or area
3. Click **Add Comment**
4. Type comment and **Submit**

**Comment Features:**

* Thread replies
* @mentions to notify users
* Mark as resolved
* Comment notifications

### Document Sharing

Share documents with external users:

1. Open document
2. Click **Share**
3. Enter email addresses
4. Set permissions (view only, comment, download)
5. Set expiration date (optional)
6. Send invitation

**Security:**

* Shared links expire after X days
* Password protection optional
* Track external views
* Revoke access anytime

## Document Metadata

### Standard Metadata

All documents include:

* File name
* File type (MIME type)
* File size
* Upload date/time
* Uploaded by
* Category
* Tags
* Description

### Custom Metadata

Org admins can define custom fields:

1. Go to **Settings** → **Documents** → **Custom Fields**
2. Add fields:
   * Text
   * Number
   * Date
   * Dropdown (predefined values)
   * Checkbox

**Example Custom Fields:**

* Contract Number (text)
* Contract Value (number)
* Expiration Date (date)
* Renewal Status (dropdown: Pending, Approved, Expired)

## Document Search

### Advanced Search

Search documents by:

* **Content**: Full-text search inside documents
* **Metadata**: File name, tags, category
* **Custom Fields**: Any custom field value
* **Date Range**: Upload date, modified date
* **File Type**: PDF, DOCX, images, etc.
* **Owner**: Uploaded by specific user
* **Site**: Documents at specific site

**Search Operators:**

* `"exact phrase"` - Search for exact phrase
* `field:value` - Search specific field
* `field:>value` - Greater than (numbers, dates)
* `field:<value` - Less than
* `-term` - Exclude term

**Example Searches:**

* `contract "renewal clause"` - Contracts mentioning renewal clause
* `category:HR hire_date:>2025-01-01` - HR docs for hires after Jan 1
* `type:pdf size:>5MB` - Large PDF files

### Saved Searches

Save frequently-used searches:

1. Perform search
2. Click **Save Search**
3. Name the search
4. Access from **Saved Searches** dropdown

## Document Analytics

### Document Metrics

Track document usage:

* View count
* Download count
* Unique viewers
* Average view duration
* Last accessed date

**Access:** Document detail page → **Analytics** tab

### Organization-Wide Analytics

Org admins can view:

* Most viewed documents
* Storage usage by category
* Document growth over time
* User upload activity
* Search trends

**Access:** Settings → Documents → Analytics

## Bulk Operations

### Bulk Upload

Upload multiple documents at once:

1. Go to **Documents** → **Upload**
2. Drag and drop multiple files
3. Set common metadata (category, tags)
4. Upload all

**Limits:**

* Max 50 files per batch
* Max 500MB total per batch

### Bulk Metadata Update

Update metadata for multiple documents:

1. Select documents (checkboxes)
2. Click **Bulk Actions** → **Update Metadata**
3. Choose fields to update
4. Apply changes to all selected

### Bulk Download

Download multiple documents as ZIP:

1. Select documents
2. Click **Download Selected**
3. ZIP file generated and downloaded

**Note:** Large selections may take time to prepare.

## Document Expiration

### Setting Expiration Dates

Set expiration for time-sensitive documents:

1. Edit document metadata
2. Set **Expiration Date**
3. Choose expiration action:
   * **Notify Only**: Send notification to owner
   * **Archive**: Move to archive folder
   * **Delete**: Permanently delete (with 30-day recovery)

### Expiration Notifications

Automatic notifications sent:

* **30 days before** expiration
* **7 days before** expiration
* **On expiration date**
* **7 days after** (if still active)

## Integration with External Services

### Microsoft OneDrive / SharePoint

Connect Encore Health OS to OneDrive:

1. Go to **Settings** → **Integrations** → **OneDrive**
2. Click **Connect**
3. Authorize Encore Health OS access
4. Select folders to sync

**Features:**

* Two-way sync
* Edit documents in Office 365
* Changes sync back to Encore Health OS

### Google Drive

Similar integration for Google Drive:

* Connect Google account
* Select folders to sync
* Edit in Google Docs/Sheets
* Automatic sync

### Dropbox

Link Dropbox account:

* Sync specific folders
* Upload to Dropbox from Encore Health OS
* Download from Dropbox to Encore Health OS

## Mobile Document Access

### Mobile App Features

Encore Health OS mobile app includes:

* Document list and search
* Quick preview (PDF, images)
* Download for offline access
* Upload from camera or files
* Approval actions

### Offline Access

Download documents for offline use:

1. Open document
2. Tap **Make Available Offline**
3. Access anytime (even without internet)

**Automatic Sync:**

* Changes sync when back online
* Conflict resolution if edited offline

## Best Practices

1. **Organize with Categories**: Use consistent category structure
2. **Tag Everything**: Tags improve searchability
3. **Use Descriptive Names**: Avoid generic names like "document1.pdf"
4. **Set Expiration Dates**: For time-sensitive documents
5. **Add Descriptions**: Brief summary of document content
6. **Version Control**: Don't delete old versions
7. **Regular Cleanup**: Archive or delete outdated documents
8. **Leverage OCR**: Extract text from scanned documents
9. **Use Templates**: For repetitive document creation
10. **Monitor Storage**: Review storage usage monthly

## Troubleshooting

### Document Won't Preview

**Check:**

* File size under 50MB
* File format supported
* Browser has pop-ups enabled
* Clear browser cache

### Slow Upload

**Check:**

* Internet connection speed
* File size (compress large files)
* Multiple users uploading simultaneously
* Server load

### OCR Not Working

**Check:**

* Image quality (minimum 200 DPI)
* Document is not password-protected
* File size under 20MB
* Clear, typed text (not handwritten)

### Search Not Finding Document

**Check:**

* Document finished uploading
* OCR completed (for scanned docs)
* Search permissions (RLS)
* Document not archived

## Related Documentation

* [Document Management](./document-management-guide.md)
* [Document Approval Workflow](./document-approvals-guide.md)

***

**Version:** 1.0.0\
**Last Updated:** 2025-11-29
