{
  "resourceType": "StructureDefinition",
  "id": "pcm-healthcareservice-instance",
  "url": "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-healthcareservice-instance",
  "version": "0.4.2",
  "name": "PCMHealthcareServiceInstance",
  "title": "PCM HealthcareService Instance",
  "status": "active",
  "description": "Association between a specific Service Provider organization and a specific catalog HealthcareService. Providers can register for an existing active catalog service or submit a full new-service registration request. Returned instances expose the authoritative lifecycle through extension[businessStatus] and PCM-derived active. The owner may submit only the documented business-status transitions; most content is inherited from the catalog entry and is read-only.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "HealthcareService",
  "baseDefinition": "http://fhir.health.gov.il/StructureDefinition/il-core-healthcare-service",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "HealthcareService",
        "path": "HealthcareService",
        "constraint": [
          {
            "key": "pcm-hcs-active-business-status-map",
            "severity": "error",
            "human": "HealthcareService.active is true if and only if the PCM service business status is active.",
            "expression": "(active = true) = (extension.where(url = 'http://pcm.fhir.health.gov.il/StructureDefinition/ext-service-business-status').value.ofType(Coding).code = 'active')",
            "source": "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-healthcareservice-instance"
          },
          {
            "key": "pcm-hcs-information-bucket-code-unique",
            "severity": "error",
            "human": "Each IL HDP information-bucket code may appear at most once in a PCM HealthcareService.",
            "expression": "extension.where(url = 'http://pcm.fhir.health.gov.il/StructureDefinition/ext-information-bucket').extension.where(url = 'bucket').value.ofType(CodeableConcept).coding.where(system = 'http://fhir.health.gov.il/cs/il-hdp-information-buckets').code.isDistinct()",
            "source": "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-healthcareservice-instance"
          }
        ]
      },
      {
        "id": "HealthcareService.id",
        "path": "HealthcareService.id",
        "min": 1
      },
      {
        "id": "HealthcareService.meta",
        "path": "HealthcareService.meta",
        "min": 1
      },
      {
        "id": "HealthcareService.meta.lastUpdated",
        "path": "HealthcareService.meta.lastUpdated",
        "comment": "Server-managed timestamp of the most recent authoritative resource change.",
        "min": 1
      },
      {
        "id": "HealthcareService.meta.profile",
        "path": "HealthcareService.meta.profile",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "comment": "PCM includes the applicable server-return profile URL; additional compatible profile URLs are allowed.",
        "min": 1
      },
      {
        "id": "HealthcareService.meta.profile:pcmProfile",
        "path": "HealthcareService.meta.profile",
        "sliceName": "pcmProfile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-healthcareservice-instance"
      },
      {
        "id": "HealthcareService.meta.tag",
        "path": "HealthcareService.meta.tag",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "comment": "PCM-managed HealthcareService classification tags. The instance tag is required on returned provider registrations; additional tags from other systems are allowed.",
        "min": 1
      },
      {
        "id": "HealthcareService.meta.tag:pcmInstanceTag",
        "path": "HealthcareService.meta.tag",
        "sliceName": "pcmInstanceTag",
        "min": 1,
        "max": "1"
      },
      {
        "id": "HealthcareService.meta.tag:pcmInstanceTag.system",
        "path": "HealthcareService.meta.tag.system",
        "min": 1,
        "fixedUri": "http://pcm.fhir.health.gov.il/cs/pcm-meta-tag"
      },
      {
        "id": "HealthcareService.meta.tag:pcmInstanceTag.code",
        "path": "HealthcareService.meta.tag.code",
        "min": 1,
        "fixedCode": "instance"
      },
      {
        "id": "HealthcareService.extension",
        "path": "HealthcareService.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "min": 7
      },
      {
        "id": "HealthcareService.extension:businessStatus",
        "path": "HealthcareService.extension",
        "sliceName": "businessStatus",
        "comment": "Authoritative lifecycle status. The owning Service Provider may submit active, suspended, or cancelled only through the strict instance business-status update profile and only when the runtime transition matrix permits it. Suspended is reversible; cancelled is terminal.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-service-business-status"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.extension:basedOn",
        "path": "HealthcareService.extension",
        "sliceName": "basedOn",
        "comment": "Points to the live authoritative catalog entry from which the service definition is inherited.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-based-on-canonical-healthcareservice"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.extension:approvalWindow",
        "path": "HealthcareService.extension",
        "sliceName": "approvalWindow",
        "comment": "Managed by PCM to indicate the objection/review period.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-approval-window"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.extension:accessMode",
        "path": "HealthcareService.extension",
        "sliceName": "accessMode",
        "comment": "Inherited requested/default Consent access mode. PCM initializes the proposed Consent from this value; an authorized patient decision, including an assisted or delegated flow, may narrow continuous access to one-time.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-access-mode"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.extension:accessDuration",
        "path": "HealthcareService.extension",
        "sliceName": "accessDuration",
        "comment": "Inherited maximum permitted Consent duration. PCM establishes the approval-anchored Consent period within this ceiling; an authorized patient decision, including an assisted or delegated flow, may approve a shorter period or later shorten it.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-access-duration"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.extension:allowPatientBucketChange",
        "path": "HealthcareService.extension",
        "sliceName": "allowPatientBucketChange",
        "comment": "Inherited from the live canonical service. Patient selection, when allowed, occurs outside the public FHIR API and affects only derived Data Source-access scope.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-allow-patient-bucket-change"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.extension:informationBucket",
        "path": "HealthcareService.extension",
        "sliceName": "informationBucket",
        "comment": "Definition of buckets included in this service. Each IL HDP information-bucket code may occur only once; PCM rejects the complete resource when a code is repeated.",
        "min": 1,
        "max": "*",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-information-bucket"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.extension:exampleQuery",
        "path": "HealthcareService.extension",
        "sliceName": "exampleQuery",
        "comment": "Example FHIR queries inherited from the live canonical service.",
        "min": 1,
        "max": "*",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-example-query"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.identifier",
        "path": "HealthcareService.identifier",
        "comment": "PCM-managed stable business identifier of the provider-specific service registration. It is distinct from the FHIR logical id.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "HealthcareService.identifier.use",
        "path": "HealthcareService.identifier.use",
        "min": 1,
        "fixedCode": "official"
      },
      {
        "id": "HealthcareService.identifier.system",
        "path": "HealthcareService.identifier.system",
        "min": 1,
        "fixedUri": "http://pcm.fhir.health.gov.il/identifier/pcm-healthcareservice-instance-id"
      },
      {
        "id": "HealthcareService.identifier.value",
        "path": "HealthcareService.identifier.value",
        "min": 1
      },
      {
        "id": "HealthcareService.active",
        "path": "HealthcareService.active",
        "comment": "PCM-derived lifecycle flag. It is true if and only if this instance businessStatus is active. Authorization still checks the canonical service, Parent and child Organizations, Consent, and target Endpoint independently.",
        "min": 1
      },
      {
        "id": "HealthcareService.providedBy",
        "path": "HealthcareService.providedBy",
        "comment": "Always filled by the server based on access token/certificate.",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-organization-service-provider"
            ]
          }
        ]
      },
      {
        "id": "HealthcareService.providedBy.reference",
        "path": "HealthcareService.providedBy.reference",
        "min": 1
      },
      {
        "id": "HealthcareService.providedBy.identifier",
        "path": "HealthcareService.providedBy.identifier",
        "max": "0"
      },
      {
        "id": "HealthcareService.category",
        "path": "HealthcareService.category",
        "comment": "At least one category is required. Binding is extensible to allow PCM-specific additions later; currently includes HL7 service-category.",
        "min": 1,
        "binding": {
          "strength": "extensible",
          "valueSet": "http://pcm.fhir.health.gov.il/ValueSet/pcm-healthcareservice-category"
        }
      },
      {
        "id": "HealthcareService.type",
        "path": "HealthcareService.type",
        "comment": "Hardcoded: The service type is information access (INFA).",
        "min": 1,
        "max": "1",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "INFA",
              "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
              "display": "information access"
            }
          ]
        }
      },
      {
        "id": "HealthcareService.specialty",
        "path": "HealthcareService.specialty",
        "max": "0"
      },
      {
        "id": "HealthcareService.location",
        "path": "HealthcareService.location",
        "max": "0"
      },
      {
        "id": "HealthcareService.name",
        "path": "HealthcareService.name",
        "min": 1
      },
      {
        "id": "HealthcareService.comment",
        "path": "HealthcareService.comment",
        "max": "0"
      },
      {
        "id": "HealthcareService.extraDetails",
        "path": "HealthcareService.extraDetails",
        "comment": "Concise patient-facing service description, including why the requested information buckets are needed.",
        "min": 1
      },
      {
        "id": "HealthcareService.photo",
        "path": "HealthcareService.photo",
        "max": "0"
      },
      {
        "id": "HealthcareService.telecom",
        "path": "HealthcareService.telecom",
        "max": "0"
      },
      {
        "id": "HealthcareService.coverageArea",
        "path": "HealthcareService.coverageArea",
        "max": "0"
      },
      {
        "id": "HealthcareService.serviceProvisionCode",
        "path": "HealthcareService.serviceProvisionCode",
        "max": "0"
      },
      {
        "id": "HealthcareService.eligibility",
        "path": "HealthcareService.eligibility",
        "max": "0"
      },
      {
        "id": "HealthcareService.program",
        "path": "HealthcareService.program",
        "max": "0"
      },
      {
        "id": "HealthcareService.characteristic",
        "path": "HealthcareService.characteristic",
        "max": "0"
      },
      {
        "id": "HealthcareService.communication",
        "path": "HealthcareService.communication",
        "max": "0"
      },
      {
        "id": "HealthcareService.referralMethod",
        "path": "HealthcareService.referralMethod",
        "max": "0"
      },
      {
        "id": "HealthcareService.appointmentRequired",
        "path": "HealthcareService.appointmentRequired",
        "max": "0"
      },
      {
        "id": "HealthcareService.availableTime",
        "path": "HealthcareService.availableTime",
        "max": "0"
      },
      {
        "id": "HealthcareService.notAvailable",
        "path": "HealthcareService.notAvailable",
        "max": "0"
      },
      {
        "id": "HealthcareService.availabilityExceptions",
        "path": "HealthcareService.availabilityExceptions",
        "max": "0"
      },
      {
        "id": "HealthcareService.endpoint",
        "path": "HealthcareService.endpoint",
        "max": "0"
      }
    ]
  }
}