{
  "resourceType": "StructureDefinition",
  "url": "http://apiframework.dedalus.eu/fhir/StructureDefinition/DocumentReference",
  "name": "DocumentReference",
  "status": "active",
  "description": "Core API Framework FHIR Profile for DocumentReference Resource",
  "fhirVersion": "3.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "DocumentReference",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DocumentReference",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "DocumentReference.id",
        "path": "DocumentReference.id",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.meta",
        "path": "DocumentReference.meta",
        "type": [
          {
            "code": "Meta",
            "profile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Meta-ForCommonConformance"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.meta.tag",
        "path": "DocumentReference.meta.tag",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "DocumentReference.text",
        "path": "DocumentReference.text",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.masterIdentifier",
        "path": "DocumentReference.masterIdentifier",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "DocumentReference.identifier",
        "path": "DocumentReference.identifier",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.status",
        "path": "DocumentReference.status",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.type",
        "path": "DocumentReference.type",
        "short": "Kind of document",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "description": "D4 Affinity Domain Type Codes",
          "valueSetReference": {
            "reference": "http://apiframework.dedalus.eu/fhir/ValueSet/AffinityDomainTypeCodes"
          }
        }
      },
      {
        "id": "DocumentReference.class",
        "path": "DocumentReference.class",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "description": "D4 Affinity Domain Class Codes",
          "valueSetReference": {
            "reference": "http://apiframework.dedalus.eu/fhir/ValueSet/AffinityDomainClassCodes"
          }
        }
      },
      {
        "id": "DocumentReference.subject",
        "path": "DocumentReference.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/Patient"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.indexed",
        "path": "DocumentReference.indexed",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.author",
        "path": "DocumentReference.author",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/Practitioner"
          },
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/Organization"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "DocumentReference.relatesTo",
        "path": "DocumentReference.relatesTo",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "code"
            }
          ],
          "rules": "open"
        },
        "mustSupport": true
      },
      {
        "id": "DocumentReference.relatesTo:replacesDocument",
        "path": "DocumentReference.relatesTo",
        "sliceName": "replacesDocument",
        "requirements": "To be used in case the current document reference replaces a previous one",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.relatesTo:replacesDocument.code",
        "path": "DocumentReference.relatesTo.code",
        "fixedCode": "replaces"
      },
      {
        "id": "DocumentReference.relatesTo:replacesDocument.target.reference",
        "path": "DocumentReference.relatesTo.target.reference",
        "min": 1
      },
      {
        "id": "DocumentReference.relatesTo:appendsToDocument",
        "path": "DocumentReference.relatesTo",
        "sliceName": "appendsToDocument",
        "requirements": "To be used in case the current document appends new content to an existing (and still valid) document"
      },
      {
        "id": "DocumentReference.relatesTo:appendsToDocument.code",
        "path": "DocumentReference.relatesTo.code",
        "fixedCode": "appends"
      },
      {
        "id": "DocumentReference.relatesTo:appendsToDocument.target.reference",
        "path": "DocumentReference.relatesTo.target.reference",
        "min": 1
      },
      {
        "id": "DocumentReference.securityLabel",
        "path": "DocumentReference.securityLabel",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "description": "D4 Affinity Domain Confidentiality Codes",
          "valueSetReference": {
            "reference": "http://apiframework.dedalus.eu/fhir/ValueSet/AffinityDomainConfidentialityCodes"
          }
        }
      },
      {
        "id": "DocumentReference.content",
        "path": "DocumentReference.content",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment",
        "path": "DocumentReference.content.attachment",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.contentType",
        "path": "DocumentReference.content.attachment.contentType",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "description": "D4 Affinity Domain MIME Types",
          "valueSetUri": "http://apiframework.dedalus.eu/fhir/ValueSet/AffinityDomainMimeTypes"
        }
      },
      {
        "id": "DocumentReference.content.attachment.url",
        "path": "DocumentReference.content.attachment.url",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.size",
        "path": "DocumentReference.content.attachment.size",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.attachment.hash",
        "path": "DocumentReference.content.attachment.hash",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.content.format",
        "path": "DocumentReference.content.format",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "description": "D4 Affinity Domain Format Codes",
          "valueSetReference": {
            "reference": "http://apiframework.dedalus.eu/fhir/ValueSet/AffinityDomainFormatCodes"
          }
        }
      },
      {
        "id": "DocumentReference.context",
        "path": "DocumentReference.context",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.event",
        "path": "DocumentReference.context.event",
        "binding": {
          "strength": "required",
          "description": "D4 Affinity Domain Event Code List",
          "valueSetReference": {
            "reference": "http://apiframework.dedalus.eu/fhir/ValueSet/AffinityDomainEventCodeList"
          }
        }
      },
      {
        "id": "DocumentReference.context.period",
        "path": "DocumentReference.context.period",
        "mustSupport": false
      },
      {
        "id": "DocumentReference.context.facilityType",
        "path": "DocumentReference.context.facilityType",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "description": "D4 Affinity Domain Healthcare Facility Type Codes",
          "valueSetReference": {
            "reference": "http://apiframework.dedalus.eu/fhir/ValueSet/AffinityDomainHealthcareFacilityTypeCodes"
          }
        }
      },
      {
        "id": "DocumentReference.context.practiceSetting",
        "path": "DocumentReference.context.practiceSetting",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "description": "D4 Affinity Domain Practice Setting Codes",
          "valueSetReference": {
            "reference": "http://apiframework.dedalus.eu/fhir/ValueSet/AffinityDomainPracticeSettingCodes"
          }
        }
      },
      {
        "id": "DocumentReference.context.sourcePatientInfo",
        "path": "DocumentReference.context.sourcePatientInfo",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.related",
        "path": "DocumentReference.context.related",
        "requirements": "Use to reference other resources such as the Specimen this document is about",
        "mustSupport": true
      },
      {
        "id": "DocumentReference.context.related.identifier",
        "path": "DocumentReference.context.related.identifier",
        "comment": "See ITI TF-2x: Appendix E.3.1 on CXi mapping to FHIR Identifier"
      },
      {
        "id": "DocumentReference.context.related.ref",
        "path": "DocumentReference.context.related.ref",
        "comment": "May be filled with URL pointers to Resources found in referenceIdList",
        "mustSupport": true
      }
    ]
  }
}