Polaris FHIR Implementation Guide
1.9.2 - ci-build

Polaris FHIR Implementation Guide - Local Development build (v1.9.2) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Resource Profile: PolarisCoreClinicalTask - FSH Source

Page standards status: Draft

FSH source of the polaris-core-clinical-task resource profile.

Raw FSH | Download

// =============================================================================
// THIS IS A DRAFT PROPOSAL - NOT YET APPROVED FOR PRODUCTION USE
// =============================================================================
// StructureDefinition-polaris-core-clinical-task.fsh
// Polaris Clinical Task Profile for Clinical Workflow Management
// Version 1.0 - July 23, 2025

Profile: PolarisCoreClinicalTask
Parent: Task
Id: polaris-core-clinical-task
Title:          "Polaris Clinical Task Core"
Description: "A clinical task for healthcare workflow management combining Polaris design principles with MERT standard compatibility"

* ^status = #draft
* ^version = "1.0.0"
* ^date = "2025-07-23"
* ^publisher = "Polaris FHIR Implementation Guide"
* ^contact.telecom.system = #url
* ^contact.telecom.value = "https://fhir.apps.health"
* ^purpose = "Provides a comprehensive FHIR Task profile for clinical workflow management within EMR systems, emphasizing clinical safety through explicit ownership and complete audit trails."
* ^copyright = "Copyright 2025 Polaris FHIR Implementation Guide"

// Polaris identifier invariant - ensure at least one identifier with canonical system
* ^extension[+].url = "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status"
* ^extension[=].valueCode = #draft

// ========== CORE POLARIS REQUIREMENTS (CLINICAL SAFETY) ==========

// Core identifier requirements (Polaris pattern)
* identifier 1..* MS
* identifier ^short = "Unique task identifier following Polaris naming pattern"
* identifier ^definition = "System-assigned unique identifier for task tracking and audit. Must include at least one identifier with a canonical Polaris system URI."
* identifier ^comment = "Each task must have at least one identifier for tracking. Additional identifiers may be used for integration with external systems."

// Polaris identifier invariant
* obeys polaris-task-identifier

// Task lifecycle state machine (from original Polaris design)
* status 1..1 MS
* status ^short = "draft | requested | ready | in-progress | completed | cancelled | failed"
* status from http://hl7.org/fhir/ValueSet/task-status (required)
* status ^definition = """
Task lifecycle states aligned with clinical workflow:
- draft: Task being composed or prepared
- requested/ready: Task requires attention (shown as 'active' in UI)  
- in-progress: Task being actively worked on
- completed: Task finished successfully with outcomes recorded
- cancelled: Task deliberately abandoned but audit trail preserved
- failed: Technical or process failure requiring intervention (shown as 'error' in UI)
"""
* status ^comment = "The status drives workflow and UI presentation. Ready/requested tasks appear in active inboxes."

// Hot potato ownership principle (CORE REQUIREMENT - enhanced vs MERT)
* owner 1..1 MS
* owner only Reference(PolarisCorePractitionerRole)
* owner ^short = "Current task owner - exactly one person/system"
* owner ^definition = """
Implements hot potato principle - always exactly one owner for clear accountability:
- Individual practitioners (standard pattern)
- Group identifiers for work-stream assignment (e.g., NURSING_POOL)  
- External system pseudo-users (e.g., LAB:LifeLabs)
- AI agent pseudo-users for automated processing
- RelatedPerson for patient/family-initiated tasks
NOTE: Polaris requires owner (1..1) vs MERT optional (0..1) for clinical safety
"""
* owner ^comment = "The owner is responsible for the next action on this task. Ownership transfers with each significant action (forward, reply, etc.)."

// Task intent (Polaris constraint for clinical clarity)
* intent 1..1 MS
* intent = #order
* intent ^short = "Always 'order' for clinical tasks requiring action"
* intent ^definition = "Clinical tasks in EMR workflows are always orders requiring action, not proposals or plans."
* intent ^comment = "Fixed to 'order' to ensure clinical tasks have clear actionable intent."

// Clinical priority
* priority 0..1 MS
* priority ^short = "Clinical priority: routine | urgent | asap | stat"
* priority from http://hl7.org/fhir/ValueSet/request-priority (required)
* priority ^definition = "Clinical priority level for workflow triage and routing."
* priority ^comment = "Used for inbox sorting and urgent task highlighting in UI."

// Patient context (REQUIRED for clinical safety - enhanced vs MERT)
* for 1..1 MS
* for only Reference(PolarisCorePatient)
* for ^short = "Patient this task is about"
* for ^definition = "All clinical tasks must have clear patient context for safety and clinical decision-making."
* for ^comment = "Polaris requires patient context (1..1) vs MERT optional (0..1) to prevent clinical errors from missing patient links."

// Clinical encounter context
* encounter 0..1 MS
* encounter only Reference(PolarisCoreEncounter)
* encounter ^short = "Healthcare encounter during which task was created"
* encounter ^definition = "Links the task to the specific clinical encounter that generated it."
* encounter ^comment = "Provides clinical context for task creation and helps with documentation workflow."

// Task creation timestamp (REQUIRED for audit - enhanced vs MERT)
* authoredOn 1..1 MS
* authoredOn ^short = "When task was first created"
* authoredOn ^definition = "Timestamp when the task was initially created for complete audit trail."
* authoredOn ^comment = "Polaris requires creation timestamp (1..1) vs MERT optional (0..1) for audit compliance."

// Task requester (REQUIRED for accountability - enhanced vs MERT)  
* requester 1..1 MS
* requester only Reference(PolarisCorePractitionerRole)
* requester ^short = "Who originally requested this task"
* requester ^definition = "The person, system, or organization that initiated this task."
* requester ^comment = "Polaris requires requester (1..1) vs MERT optional (0..1) for clear accountability chain."

// Original content (REQUIRED for clarity - enhanced vs MERT)
* description 1..1 MS
* description ^short = "Original task content that remains stable throughout lifecycle"
* description ^definition = """
Canonical task description that provides the core content and remains stable throughout the task lifecycle.
May include structured forms (lab requisition, referral, etc.) and supports Markdown formatting for rich content.
"""
* description ^comment = "Polaris requires description (1..1) vs MERT optional (0..1) to prevent ambiguous work items."

// ========== MERT COMPATIBILITY ENHANCEMENTS ==========

// Task type classification (HIGH PRIORITY for MERT)
* code 0..1 MS
* code ^short = "Task type classification"
* code ^definition = "Coding that identifies the type of task being performed for workflow routing and automation."
* code ^comment = "Added for MERT compatibility - enables automated task routing and classification."

// Protocol and authorization references (MERT requirements)
* instantiatesCanonical 0..1 MS
* instantiatesCanonical ^short = "Formal definition of task (canonical)"
* instantiatesCanonical ^definition = "References to formal protocols, guidelines, or ActivityDefinitions that this task follows."
* instantiatesCanonical ^comment = "MERT requirement for protocol-based task execution."

* instantiatesUri 0..1 MS  
* instantiatesUri ^short = "Formal definition of task (URI)"
* instantiatesUri ^definition = "URI references to external protocols, guidelines, or specifications."
* instantiatesUri ^comment = "MERT requirement for external protocol references."

* basedOn 0..* MS
* basedOn only Reference(ServiceRequest or MedicationRequest or CarePlan or SupplyRequest)
* basedOn ^short = "Request fulfilled by this task"
* basedOn ^definition = "The request, order, or authorization that initiated this task."
* basedOn ^comment = "MERT requirement for linking tasks to originating clinical orders."

// Task grouping and business context (MERT requirements)
* groupIdentifier 0..1 MS
* groupIdentifier ^short = "Requisition or grouper identifier"
* groupIdentifier ^definition = "Identifier for grouping related tasks together for batch processing or workflow management."
* groupIdentifier ^comment = "MERT requirement for task batch management."

* businessStatus 0..1 MS
* businessStatus ^short = "Task business status"
* businessStatus ^definition = "Business-specific status information that supplements the standard lifecycle status."
* businessStatus ^comment = "MERT requirement for additional status context beyond standard FHIR states."

* statusReason 0..1 MS
* statusReason ^short = "Reason for current status"
* statusReason ^definition = "Captures why the task is in its current state, particularly for cancelled or failed states."
* statusReason ^comment = "MERT requirement for status change rationale."

// Task focus and context (MERT requirements)
* focus 0..1 MS
* focus only Reference(Resource)
* focus ^short = "What task is about"
* focus ^definition = "The request being actioned or the resource being manipulated by this task."
* focus ^comment = "MERT requirement for specifying the primary focus of task activity."

* reasonCode 0..1 MS
* reasonCode ^short = "Why task is needed (coded)"
* reasonCode ^definition = "Coded indication of why the task was created."
* reasonCode ^comment = "MERT requirement for coded task rationale."

// Execution and modification tracking (MERT requirements)
* executionPeriod 0..1 MS
* executionPeriod ^short = "Start and end time of execution"
* executionPeriod ^definition = "Expected or actual time period during which the task is to be or was executed."
* executionPeriod ^comment = "MERT requirement for task timing management."

* lastModified 0..1 MS
* lastModified ^short = "Task last modified date"
* lastModified ^definition = "Most recent timestamp when the task was modified."
* lastModified ^comment = "MERT requirement for modification tracking."

// Performer specifications (MERT requirements)
* performerType 0..* MS
* performerType ^short = "Requested performer type"
* performerType ^definition = "The type of performer (person, device, organization) required to complete the task."
* performerType ^comment = "MERT requirement for specifying required performer characteristics."

// Location and administrative context (MERT requirements)
* location 0..1 MS
* location only Reference(PolarisCoreLocation)
* location ^short = "Where task should be performed"
* location ^definition = "Principal physical location where the task is to be performed."
* location ^comment = "MERT requirement for task location specification."

* insurance 0..* MS
* insurance only Reference(Coverage)
* insurance ^short = "Associated insurance coverage"
* insurance ^definition = "Insurance coverage that is relevant to the performance of this task."
* insurance ^comment = "MERT requirement for insurance context."

* relevantHistory 0..* MS
* relevantHistory only Reference(Provenance)
* relevantHistory ^short = "Key events in history of task"
* relevantHistory ^definition = "Links to Provenance resources that document key events in the task lifecycle."
* relevantHistory ^comment = "MERT requirement for historical context."

// Task constraints (MERT requirements)
* restriction 0..1 MS
* restriction ^short = "Constraints on fulfillment tasks"
* restriction ^definition = "Constraints that apply to the fulfillment of the task."
* restriction ^comment = "MERT requirement for task execution constraints."

// ========== POLARIS TASK RELATIONSHIPS ==========

// Task relationships for forking/branching (Polaris workflow feature)
* partOf 0..* MS
* partOf only Reference(PolarisCoreClinicalTask)
* partOf ^short = "Parent task for sub-tasks and branches"
* partOf ^definition = "Reference to parent task when this task is part of a larger workflow or represents a sub-task."
* partOf ^comment = "Supports Polaris workflow branching and task hierarchy."

// Clinical context and reasoning
* reasonReference 0..1 MS
* reasonReference only Reference(Condition or Observation or DiagnosticReport or DocumentReference)
* reasonReference ^short = "Clinical reason for this task"
* reasonReference ^definition = "Reference to clinical condition, observation, or other resource that justifies the task."
* reasonReference ^comment = "Links task to specific clinical findings or conditions."

// Additional context and notes
* note 0..* MS
* note ^short = "Additional task information and context"
* note ^definition = "Free-text notes providing additional context, instructions, or information not captured elsewhere."
* note ^comment = "Supports rich clinical context and special instructions."

// Task input parameters and output results (for structured workflows)
* input 0..* MS
* input ^short = "Task input parameters and data"
* input ^definition = "Structured input data, parameters, or resources required for task execution."
* input ^comment = "Supports structured clinical workflows and forms."

* output 0..* MS
* output ^short = "Task output results and outcomes"
* output ^definition = "Results, outcomes, or deliverables produced by completing this task."
* output ^comment = "Captures structured task outcomes and deliverables."

// ========== INVARIANTS ==========

// Polaris identifier invariant - ensure at least one identifier with canonical system
Invariant: polaris-task-identifier
Description: "Task must have at least one identifier with a Polaris canonical system URI"
Severity: #error
Expression: "identifier.where(system.startsWith('https://fhir.apps.health')).exists()"