{
  "resourceType": "StructureDefinition",
  "id": "pcm-organization-source",
  "url": "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-organization-source",
  "version": "0.3.2",
  "name": "PCMOrganizationDataSource",
  "title": "PCM Data Source Organization",
  "status": "active",
  "description": "PCM role child that hosts clinical data and, once operational, exposes one registered FHIR REST API Endpoint. PCM may create and identify an inactive child before its Endpoint is registered. The organization may maintain the Endpoint reference and purpose-coded contact overrides through the supported update interaction.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Organization",
  "baseDefinition": "http://fhir.health.gov.il/StructureDefinition/il-core-organization",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Organization",
        "path": "Organization",
        "constraint": [
          {
            "key": "pcm-data-source-active-requires-endpoint",
            "severity": "error",
            "human": "An active Data Source Organization must reference its registered FHIR Endpoint; an inactive partially onboarded Data Source may omit it.",
            "expression": "active = false or endpoint.exists()",
            "source": "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-organization-source"
          }
        ]
      },
      {
        "id": "Organization.id",
        "path": "Organization.id",
        "min": 1
      },
      {
        "id": "Organization.meta",
        "path": "Organization.meta",
        "min": 1
      },
      {
        "id": "Organization.meta.lastUpdated",
        "path": "Organization.meta.lastUpdated",
        "comment": "Server-managed timestamp of the most recent authoritative resource change.",
        "min": 1
      },
      {
        "id": "Organization.meta.profile",
        "path": "Organization.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": "Organization.meta.profile:pcmProfile",
        "path": "Organization.meta.profile",
        "sliceName": "pcmProfile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-organization-source"
      },
      {
        "id": "Organization.extension",
        "path": "Organization.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "Organization.extension:applicableCertificates",
        "path": "Organization.extension",
        "sliceName": "applicableCertificates",
        "comment": "PCM-managed read-only projection of certificate thumbprints explicitly associated with this Data Source. The inventory is not a complete trust-store view, proof of current certificate use, or an authorization decision.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/ext-applicable-certificates"
            ]
          }
        ]
      },
      {
        "id": "Organization.identifier",
        "path": "Organization.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "closed"
        },
        "comment": "The single PCM Organization business identifier is assigned and managed by PCM. Child Organizations do not copy the Parent's MoH identifier.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Organization.identifier:moh-inst-symbol",
        "path": "Organization.identifier",
        "sliceName": "moh-inst-symbol",
        "max": "0"
      },
      {
        "id": "Organization.identifier:legal-entity",
        "path": "Organization.identifier",
        "sliceName": "legal-entity",
        "max": "0"
      },
      {
        "id": "Organization.identifier:moe-inst",
        "path": "Organization.identifier",
        "sliceName": "moe-inst",
        "max": "0"
      },
      {
        "id": "Organization.identifier:moh-hospital-department",
        "path": "Organization.identifier",
        "sliceName": "moh-hospital-department",
        "max": "0"
      },
      {
        "id": "Organization.identifier:paying-entity-moh",
        "path": "Organization.identifier",
        "sliceName": "paying-entity-moh",
        "max": "0"
      },
      {
        "id": "Organization.identifier:pcmOrganizationId",
        "path": "Organization.identifier",
        "sliceName": "pcmOrganizationId",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Organization.identifier:pcmOrganizationId.use",
        "path": "Organization.identifier.use",
        "min": 1,
        "fixedCode": "official"
      },
      {
        "id": "Organization.identifier:pcmOrganizationId.system",
        "path": "Organization.identifier.system",
        "fixedUri": "http://pcm.fhir.health.gov.il/identifier/pcm-organization-id"
      },
      {
        "id": "Organization.active",
        "path": "Organization.active",
        "comment": "MoH/PCM-controlled participation state. The owning organization cannot change it through the client FHIR API. Operational use also requires the Parent Organization to be active and the referenced Endpoint to have status active.",
        "min": 1
      },
      {
        "id": "Organization.type",
        "path": "Organization.type",
        "min": 2
      },
      {
        "id": "Organization.type:pcmOrgType",
        "path": "Organization.type",
        "sliceName": "pcmOrgType",
        "comment": "Marks this Organization as a PCM Data Source.",
        "min": 1,
        "max": "1",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "source",
              "system": "http://pcm.fhir.health.gov.il/cs/pcm-org-type"
            }
          ]
        }
      },
      {
        "id": "Organization.type:pcmOrgType.coding",
        "path": "Organization.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Organization.type:pcmOrgType.coding.system",
        "path": "Organization.type.coding.system",
        "min": 1,
        "fixedUri": "http://pcm.fhir.health.gov.il/cs/pcm-org-type"
      },
      {
        "id": "Organization.type:pcmOrgType.coding.code",
        "path": "Organization.type.coding.code",
        "min": 1,
        "fixedCode": "source"
      },
      {
        "id": "Organization.name",
        "path": "Organization.name",
        "comment": "Authoritative Data Source child name maintained by PCM."
      },
      {
        "id": "Organization.alias",
        "path": "Organization.alias",
        "max": "0"
      },
      {
        "id": "Organization.telecom",
        "path": "Organization.telecom",
        "max": "0"
      },
      {
        "id": "Organization.address",
        "path": "Organization.address",
        "max": "0"
      },
      {
        "id": "Organization.partOf",
        "path": "Organization.partOf",
        "comment": "PCM-managed reference to the Parent Organization. Parent inactive state disables this child for operational use. Policy allows only one Data Source per Parent.",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-organization-parent"
            ],
            "extension": [
              {
                "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-hierarchy",
                "valueBoolean": true
              }
            ]
          }
        ]
      },
      {
        "id": "Organization.partOf.reference",
        "path": "Organization.partOf.reference",
        "min": 1
      },
      {
        "id": "Organization.partOf.identifier",
        "path": "Organization.partOf.identifier",
        "max": "0"
      },
      {
        "id": "Organization.contact",
        "path": "Organization.contact",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "purpose.coding.code"
            }
          ],
          "rules": "open"
        },
        "comment": "Optional purpose-coded contact overrides. A missing purpose falls back to the matching Parent contact. An OPS FHIR/API technical-operations contact SHOULD be supplied."
      },
      {
        "id": "Organization.contact.purpose",
        "path": "Organization.contact.purpose",
        "min": 1,
        "binding": {
          "strength": "extensible",
          "valueSet": "http://pcm.fhir.health.gov.il/ValueSet/pcm-contactentity-type"
        }
      },
      {
        "id": "Organization.contact:operations",
        "path": "Organization.contact",
        "sliceName": "operations",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Organization.contact:operations.purpose.coding",
        "path": "Organization.contact.purpose.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Organization.contact:operations.purpose.coding.system",
        "path": "Organization.contact.purpose.coding.system",
        "min": 1,
        "fixedUri": "http://pcm.fhir.health.gov.il/cs/pcm-contactentity-type"
      },
      {
        "id": "Organization.contact:operations.purpose.coding.code",
        "path": "Organization.contact.purpose.coding.code",
        "min": 1,
        "fixedCode": "OPS"
      },
      {
        "id": "Organization.endpoint",
        "path": "Organization.endpoint",
        "comment": "The registered Endpoint holding the base URL of the organization's FHIR REST API. It may be absent while the Data Source is inactive and partially onboarded; an active Data Source must reference exactly one. The organization may replace the reference with another Endpoint it owns. Organization.active does not express technical availability; operational use additionally requires the referenced Endpoint.status to be active.",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://pcm.fhir.health.gov.il/StructureDefinition/pcm-endpoint"
            ]
          }
        ]
      },
      {
        "id": "Organization.endpoint.reference",
        "path": "Organization.endpoint.reference",
        "min": 1
      },
      {
        "id": "Organization.endpoint.identifier",
        "path": "Organization.endpoint.identifier",
        "max": "0"
      }
    ]
  }
}