{
  "resourceType": "StructureDefinition",
  "id": "specialty-rx-task-smart-launch",
  "meta": {
    "lastUpdated": "2020-10-02T00:00:00+00:00"
  },
  "url": "http://hl7.org/fhir/us/specialty-rx/StructureDefinition/specialty-rx-task-smart-launch",
  "version": "0.1.00",
  "name": "SpecialtyRxTaskSmartLaunch",
  "title": "Specialty Rx Task - SMART Launch",
  "status": "active",
  "experimental": false,
  "date": "2020-10-02",
  "publisher": "HL7 International - Pharmacy",
  "description": "This profile defines Task content enabling a pharmacy or other external party to prompt clinic staff to launch a SMART app and answer prescription-related questions.",
  "jurisdiction": [
    {
      "coding": [
        {
          "system": "urn:iso:std:iso:3166",
          "code": "US",
          "display": "United States of America"
        }
      ]
    }
  ],
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Task",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Task",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Task",
        "path": "Task"
      },
      {
        "id": "Task.id",
        "path": "Task.id",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Task.identifier",
        "path": "Task.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "comment": "MAY contain multiple task identifiers, but one MUST be an application context ID to be passed in the appContext parameter while launching the SMART app specified in this Task.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Task.identifier:appContext",
        "path": "Task.identifier",
        "sliceName": "appContext",
        "short": "SMART App Context ID",
        "min": 1,
        "max": "1",
        "patternIdentifier": {
          "type": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/us/specialty-rx/CodeSystem/specialty-rx-task-identifier-type",
                "code": "app-context"
              }
            ]
          }
        },
        "mustSupport": true
      },
      {
        "id": "Task.identifier.type",
        "path": "Task.identifier.type",
        "comment": "At least one identifier must be a SMART application contenxt identifier",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Task.identifier.system",
        "path": "Task.identifier.system",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "uri"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.identifier.value",
        "path": "Task.identifier.value",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.intent",
        "path": "Task.intent",
        "min": 1,
        "fixedCode": "plan",
        "mustSupport": true
      },
      {
        "id": "Task.code",
        "path": "Task.code",
        "label": "SMART App Task Type",
        "definition": "A particular SMART app task type, e.g., complete-app-questionnaire",
        "comment": "A code specifying the requested user action to be performed using the referenced SMART app. E.g., complete-app-questionnaire",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "extensible",
          "description": "Task types used in the Specialty Rx workflow",
          "valueSet": "http://hl7.org/fhir/us/specialty-rx/ValueSet/specialty-rx-task-type"
        }
      },
      {
        "id": "Task.description",
        "path": "Task.description",
        "definition": "Human-readable description of the task to be performed by the user.",
        "comment": "SHOULD include the user-recognizable name of the SMART application to launch to perform the task. SHALL state the action to be performed in the app once it's been launched.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Task.focus",
        "path": "Task.focus",
        "label": "Related Prescription",
        "short": "Related Prescription",
        "definition": "Related prescription order",
        "comment": "The prescription to which the task pertains. Either a reference to a MedicationRequest resource or the prescription identifier set by the prescribing system MAY be present.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/MedicationRequest"
            ]
          }
        ],
        "constraint": [
          {
            "key": "srx-1",
            "severity": "warning",
            "human": "If Task.focus is present, either reference or identifier SHOULD be present. If focus.identifier is present, SHOULD be the placer order ID",
            "expression": "reference.exists() or identifier.exists()"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.focus.reference",
        "path": "Task.focus.reference",
        "label": "Prescription Reference",
        "short": "Prescription Reference",
        "definition": "Reference to the related MedicationRequest resource",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.focus.identifier",
        "path": "Task.focus.identifier",
        "label": "Placer Order Number",
        "short": "Placer Order Number",
        "definition": "The prescription order number established by the ordering system",
        "comment": "Referred to as the Placer Order Number in HL7 v2 and Prescriber Order Number in NCPDP SCRIPT",
        "min": 0,
        "max": "1",
        "patternIdentifier": {
          "type": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                "code": "PLAC"
              }
            ]
          }
        },
        "mustSupport": true
      },
      {
        "id": "Task.focus.display",
        "path": "Task.focus.display",
        "definition": "A human-readable description of the related prescription order",
        "comment": "A human-readable prescription description SHOULD be present. SHOULD contain the medication name and MAY contain the date written. MAY contain strength, dose form, or other specifics.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Task.for",
        "path": "Task.for",
        "label": "Related Patient",
        "short": "Related Patient",
        "definition": "The patient for whom the related prescription was written",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.for.reference",
        "path": "Task.for.reference",
        "label": "Patient Reference",
        "short": "Patient Reference",
        "definition": "Reference to a Patient resource",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.authoredOn",
        "path": "Task.authoredOn",
        "label": "Prescription Written Date",
        "short": "Prescription Written Date",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.requester",
        "path": "Task.requester",
        "comment": "The organization requesting that this task be performed",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization"
            ]
          }
        ],
        "constraint": [
          {
            "key": "srx-2",
            "severity": "error",
            "human": "Either requester.reference or requester.identifier MUST be present",
            "expression": "reference.exists() or identifier.exists()"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.requester.reference",
        "path": "Task.requester.reference",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.requester.identifier",
        "path": "Task.requester.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "definition": "An identifier of the party reqesting that the task be performed.",
        "comment": "If the requester is a pharmacy, the identifier SHOULD be an NCPDP Provider Identifier, otherwise if the requester possesses an NPI, an NPI SHOULD be used.",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.requester.identifier:pharmacyNcpdpId",
        "path": "Task.requester.identifier",
        "sliceName": "pharmacyNcpdpId",
        "short": "The pharmacy's NCPDP Provider ID",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Identifier"
          }
        ],
        "patternIdentifier": {
          "system": "http://terminology.hl7.org/CodeSystem/NCPDP/ProviderIdentificationNumber"
        },
        "mustSupport": true
      },
      {
        "id": "Task.requester.identifier:NPI",
        "path": "Task.requester.identifier",
        "sliceName": "NPI",
        "short": "National Provider Identifier (NPI)",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Identifier"
          }
        ],
        "patternIdentifier": {
          "system": "http://hl7.org/fhir/sid/us-npi"
        },
        "mustSupport": true
      },
      {
        "id": "Task.owner",
        "path": "Task.owner",
        "label": "Prescriber",
        "short": "Prescriber",
        "comment": "The practitioner that prescribed the related medication",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Practitioner"
            ]
          }
        ],
        "constraint": [
          {
            "key": "srx-3",
            "severity": "error",
            "human": "Either owner.reference or owner.identifier MUST be present",
            "expression": "reference.exists() or identifier.exists()"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.owner.reference",
        "path": "Task.owner.reference",
        "label": "Prescriber Reference",
        "short": "Prescriber Reference",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.owner.identifier",
        "path": "Task.owner.identifier",
        "definition": "The prescriber's individual NPI",
        "min": 0,
        "max": "1",
        "patternIdentifier": {
          "system": "http://hl7.org/fhir/sid/us-npi"
        },
        "mustSupport": true
      },
      {
        "id": "Task.input",
        "path": "Task.input",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "type"
            }
          ],
          "description": "The Task SHALL contain an input containing the URL for the SMART app to be launched to complete the task",
          "rules": "open"
        },
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Task.input:SmartUrl",
        "path": "Task.input",
        "sliceName": "SmartLaunchUrl",
        "label": "Smart App Launch URL",
        "short": "Smart App URL",
        "definition": "The launch URL of the SMART application to be used to complete this task",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.input:SmartURL.type",
        "path": "Task.input.type",
        "min": 1,
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/us/specialty-rx/CodeSystem/specialty-rx-task-input-type",
              "code": "smart-app-launch-url",
              "display": "SMART Application Launch URL"
            }
          ]
        },
        "mustSupport": true
      },
      {
        "id": "Task.input:SmartUrl.valueUrl",
        "path": "Task.input.valueUrl",
        "label": "SMART application launch URL",
        "short": "SMART launch URL",
        "min": 1,
        "type": [
          {
            "code": "url"
          }
        ],
        "mustSupport": true
      }
    ]
  }
}