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.
This guide covers administrative setup and configuration of Preventive Maintenance (PM) in the Facilities Management module.
Overview
As an FM administrator, you are responsible for:
- Creating and managing PM templates
- Setting up PM schedules for sites and assets
- Configuring automation settings
- Monitoring compliance and performance
- Troubleshooting PM issues
Initial Setup
- Navigate to FM → Settings
- Select the Maintenance tab
- Configure PM-specific settings:
| Setting | Description | Recommended Value |
|---|
| PM Schedule Lookahead (Days) | Days before due date to generate work orders | 7-14 days |
| Auto-Generate PM Work Orders | Automatically create work orders when due | Enabled |
- Click Save Settings
Verify Cron Job Setup
PM automation requires scheduled jobs to run:
| Job | Schedule | Purpose |
|---|
generate-pm-work-orders | Daily at 6:00 AM UTC | Creates work orders for upcoming PMs |
check-overdue-pms | Daily at 7:00 AM UTC | Identifies and alerts on overdue PMs |
Contact your system administrator to verify these are configured.
Creating PM Templates
PM templates define the maintenance tasks that will be scheduled.
Step-by-Step Template Creation
- Navigate to FM → PM Templates
- Click New Template
- Fill in template details:
Basic Information
- Name: Descriptive name (e.g., “HVAC Filter Replacement - Monthly”)
- Description: Detailed explanation of the maintenance
- Asset Type: Select from picklist (HVAC, plumbing, electrical, etc.)
- Frequency: How often (daily, weekly, monthly, quarterly, semi-annual, annual)
- Estimated Duration: Expected completion time in minutes
Assignment
- Default Assignee: Technician to assign by default (optional)
- Default Vendor: External vendor if outsourced (optional)
Compliance
- Compliance Required: Toggle if regulatory requirement
- Compliance Category: Type of compliance (safety, regulatory, insurance)
- Click Save to create the template
Adding Checklist Items
After creating a template, add step-by-step tasks:
- Open the template detail page
- Navigate to Checklist Items tab
- Click Add Item
- For each item, specify:
- Description: What to check or do
- Pass Criteria: How to determine pass/fail (optional)
- Required: Whether completion is mandatory
- Display Order: Sequence in the checklist
- Repeat for all checklist items
Example Checklist for HVAC Filter Replacement:
- Turn off HVAC system
- Remove access panel
- Remove old filter and inspect
- Install new filter with correct orientation
- Replace access panel
- Turn on HVAC system and verify operation
Adding Required Materials
Specify materials needed from inventory:
- Open the template detail page
- Navigate to Materials tab
- Click Add Material
- Select the inventory item
- Enter the quantity needed
- Add notes if applicable
- Repeat for all materials
Managing PM Schedules
PM schedules link templates to specific sites for recurring maintenance.
Creating a Schedule
- Navigate to FM → PM Schedules
- Click New Schedule
- Configure the schedule:
| Field | Description |
|---|
| Template | Select the PM template to use |
| Site | Select the site for maintenance |
| Start Date | When the schedule begins |
| Notes | Additional schedule-specific notes |
- Click Save
The Next Due Date is automatically calculated based on the template frequency.
Pausing and Activating Schedules
To Pause a Schedule:
- Open the schedule detail page
- Click Pause Schedule
- Confirm the action
Paused schedules will not generate work orders.
To Reactivate:
- Open the paused schedule
- Click Activate Schedule
- The next due date will be recalculated
Understanding Due Date Calculation
Due dates are calculated based on frequency:
| Frequency | Calculation |
|---|
| Daily | Add 1 day |
| Weekly | Add 7 days |
| Monthly | Add 1 month (same day) |
| Quarterly | Add 3 months |
| Semi-Annual | Add 6 months |
| Annual | Add 1 year |
Edge Cases:
- January 31 + 1 month = February 28/29
- Leap years are handled correctly
Work Order Integration
Automatic Work Order Generation
When Auto-Generate PM Work Orders is enabled:
- Daily at 6:00 AM UTC, the system checks all active schedules
- Schedules with
next_due_date within the lookahead window are processed
- Work orders are created with:
- Type:
preventive_maintenance
- Priority:
high for compliance PMs, medium otherwise
- Due Date: The PM schedule’s due date
- Linked Schedule: Reference to the PM schedule
- Checklist Items: Copied from template
- Materials: Suggested from template
Manual Work Order Generation
To manually trigger work order creation:
- Open the PM schedule
- Click Generate Work Order
- The work order is created immediately
Duplicate Prevention
The system prevents duplicate work orders:
- Only one work order per schedule per due date
- Existing open work orders block new generation
- Completed work orders update the schedule before next generation
Compliance Tracking
Compliance Dashboard
Monitor PM compliance from the FM Dashboard:
| Metric | Calculation |
|---|
| Compliance Rate | (Completed on time / Total due) × 100% |
| Overdue Count | Active schedules past due date |
| Critical Overdue | Overdue compliance-required PMs |
Overdue Alerts
The check-overdue-pms job runs daily to:
- Identify schedules past their due date
- Calculate days overdue
- Categorize severity:
- Warning: 1-3 days overdue
- Critical: 4-7 days overdue
- Severe: 7+ days overdue
- Publish
pm_overdue events for notification
Compliance Reporting
For compliance audits, generate reports showing:
- PM completion history by schedule
- On-time completion rates
- Failure documentation
- Material usage
Cron Job Setup
PM automation requires two scheduled jobs.
Work Order Generation Job
Schedule: Daily at 6:00 AM UTC
SELECT cron.schedule(
'generate-pm-work-orders-daily',
'0 6 * * *',
$$
SELECT net.http_post(
url := 'https://<project-ref>.supabase.co/functions/v1/generate-pm-work-orders',
headers := '{"Authorization": "Bearer <anon-key>", "Content-Type": "application/json"}'::jsonb,
body := '{}'::jsonb
);
$$
);
Overdue Check Job
Schedule: Daily at 7:00 AM UTC
SELECT cron.schedule(
'check-overdue-pms-daily',
'0 7 * * *',
$$
SELECT net.http_post(
url := 'https://<project-ref>.supabase.co/functions/v1/check-overdue-pms',
headers := '{"Authorization": "Bearer <anon-key>", "Content-Type": "application/json"}'::jsonb,
body := '{}'::jsonb
);
$$
);
Verifying Cron Jobs
Check if jobs are scheduled:
Check job execution history:
SELECT * FROM cron.job_run_details
WHERE jobname LIKE '%pm%'
ORDER BY start_time DESC
LIMIT 10;
Troubleshooting
Work Orders Not Generating
Symptoms: PM schedules are due but no work orders created
Checklist:
- Verify Auto-Generate PM Work Orders is enabled in FM Settings
- Check if schedule is Active (not Paused)
- Verify schedule’s
next_due_date is within lookahead window
- Check for existing open work order for this schedule
- Verify cron job is scheduled and running
Resolution:
- Manually generate work order from schedule page
- Check edge function logs for errors
- Verify RLS policies allow work order creation
Due Dates Not Calculating Correctly
Symptoms: Next due date is wrong after completion
Checklist:
- Verify template frequency is set correctly
- Check that work order is linked to PM schedule
- Ensure work order status is “completed”
Resolution:
- Manually update schedule’s next_due_date
- Verify the
fm_update_pm_schedule_on_completion trigger is enabled
Completion Not Updating Schedule
Symptoms: Work order completed but schedule not updated
Checklist:
- Verify work order has
pm_schedule_id set
- Check database trigger is active
- Look for errors in database logs
Resolution:
- Manually update schedule’s last_completed_date and next_due_date
- Contact administrator to check trigger function
Best Practices
Template Design
-
Clear Naming: Use descriptive names with asset type and frequency
- Good: “HVAC Filter Change - Monthly”
- Bad: “Monthly Maintenance”
-
Detailed Checklists: Include specific, actionable steps
- Good: “Inspect belt tension, tighten if deflection > 1/2 inch”
- Bad: “Check belt”
-
Pass Criteria: Define clear pass/fail conditions for compliance PMs
-
Material Accuracy: Keep material lists current with correct quantities
Frequency Selection
| Maintenance Type | Recommended Frequency |
|---|
| Filter changes | Monthly |
| Safety inspections | Monthly or Quarterly |
| Full equipment service | Quarterly or Semi-Annual |
| Annual certifications | Annual |
Compliance Priority
- Mark all regulatory, safety, and insurance-required PMs as Compliance Required
- These get High priority work orders
- Monitor compliance PMs separately from routine maintenance
Schedule Organization
- Create separate schedules per site, even for same template
- Use consistent start dates for easier planning
- Review and clean up unused schedules quarterly