{
  "resourceType": "StructureDefinition",
  "id": "IDMS-Agreement-DocumentReference",
  "url": "https://health.gov.on.ca/idms/fhir/StructureDefinition/IDMS-Agreement-DocumentReference",
  "version": "1.0.0",
  "name": "IDMSDocumentReference",
  "title": "IDMS - Agreement - DocumentReference",
  "status": "active",
  "description": "This is for the Agreement Generated PDFs,Summaries for Legal",
  "fhirVersion": "5.0.0",
  "kind": "resource",
  "abstract": false,
  "type": "DocumentReference",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/DocumentReference",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "DocumentReference.extension",
        "path": "DocumentReference.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        },
        "min": 0
      },
      {
        "id": "DocumentReference.extension:createdUser",
        "path": "DocumentReference.extension",
        "sliceName": "createdUser",
        "definition": "#### **_`IDMS: Link to the user that created the record.`_**",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://health.gov.on.ca/idms/fhir/StructureDefinition/CreatedUser"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.extension:createdDate",
        "path": "DocumentReference.extension",
        "sliceName": "createdDate",
        "definition": "#### **_`IDMS: Date and Time the record was created.`_**",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://health.gov.on.ca/idms/fhir/StructureDefinition/CreatedDate"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.extension:updatedUser",
        "path": "DocumentReference.extension",
        "sliceName": "updatedUser",
        "definition": "#### **_`IDMS: Link to the user that last updated the record.`_**",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://health.gov.on.ca/idms/fhir/StructureDefinition/UpdatedUser"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.extension:updatedDate",
        "path": "DocumentReference.extension",
        "sliceName": "updatedDate",
        "definition": "#### **_`IDMS: Date and Time the record was last updated.`_**",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://health.gov.on.ca/idms/fhir/StructureDefinition/UpdatedDate"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.identifier",
        "path": "DocumentReference.identifier",
        "definition": "#### **_`IDMS: This is a business identifier the given to this document. This is optional`_**",
        "max": "1"
      },
      {
        "id": "DocumentReference.basedOn",
        "path": "DocumentReference.basedOn",
        "definition": "#### **_`IDMS: The Agreement that the document is linked to.`_**",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://health.gov.on.ca/idms/fhir/StructureDefinition/IDMS-Agreement"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.status",
        "path": "DocumentReference.status",
        "definition": "#### **_`IDMS: This is mandatory according to FHIR, it will should always be 'current'.`_**"
      },
      {
        "id": "DocumentReference.docStatus",
        "path": "DocumentReference.docStatus",
        "max": "0"
      },
      {
        "id": "DocumentReference.modality",
        "path": "DocumentReference.modality",
        "max": "0"
      },
      {
        "id": "DocumentReference.type",
        "path": "DocumentReference.type",
        "definition": "#### **_`IDMS: This is the type of document reference. Example 'Summary for Legal'.`_**",
        "min": 1
      },
      {
        "id": "DocumentReference.type.extension",
        "path": "DocumentReference.type.extension",
        "max": "0"
      },
      {
        "id": "DocumentReference.type.coding",
        "path": "DocumentReference.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "DocumentReference.type.coding.extension",
        "path": "DocumentReference.type.coding.extension",
        "max": "0"
      },
      {
        "id": "DocumentReference.type.coding.system",
        "path": "DocumentReference.type.coding.system",
        "min": 1,
        "fixedUri": "https://health.gov.on.ca/idms/fhir/CodeSystem/IDMS-Internal"
      },
      {
        "id": "DocumentReference.type.coding.version",
        "path": "DocumentReference.type.coding.version",
        "max": "0"
      },
      {
        "id": "DocumentReference.type.coding.code",
        "path": "DocumentReference.type.coding.code",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "https://health.gov.on.ca/idms/fhir/ValueSet/IDMS-Agreement-Document-Types"
        }
      },
      {
        "id": "DocumentReference.type.coding.display",
        "path": "DocumentReference.type.coding.display"
      },
      {
        "id": "DocumentReference.type.coding.userSelected",
        "path": "DocumentReference.type.coding.userSelected",
        "max": "0"
      },
      {
        "id": "DocumentReference.type.text",
        "path": "DocumentReference.type.text",
        "max": "0"
      },
      {
        "id": "DocumentReference.category",
        "path": "DocumentReference.category",
        "max": "0"
      },
      {
        "id": "DocumentReference.subject",
        "path": "DocumentReference.subject",
        "max": "0"
      },
      {
        "id": "DocumentReference.context",
        "path": "DocumentReference.context",
        "max": "0"
      },
      {
        "id": "DocumentReference.event",
        "path": "DocumentReference.event",
        "max": "0"
      },
      {
        "id": "DocumentReference.bodySite",
        "path": "DocumentReference.bodySite",
        "max": "0"
      },
      {
        "id": "DocumentReference.facilityType",
        "path": "DocumentReference.facilityType",
        "max": "0"
      },
      {
        "id": "DocumentReference.practiceSetting",
        "path": "DocumentReference.practiceSetting",
        "max": "0"
      },
      {
        "id": "DocumentReference.period",
        "path": "DocumentReference.period",
        "definition": "#### **_`IDMS: For Reports this is the date range.`_**"
      },
      {
        "id": "DocumentReference.date",
        "path": "DocumentReference.date",
        "definition": "#### **_`IDMS: Date from the document`_**"
      },
      {
        "id": "DocumentReference.author",
        "path": "DocumentReference.author",
        "definition": "#### **_`IDMS: The user that generated the PDF..`_**",
        "max": "0",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://health.gov.on.ca/idms/fhir/StructureDefinition/IDMS-PractitionerRole-Employee"
            ]
          }
        ]
      },
      {
        "id": "DocumentReference.attester",
        "path": "DocumentReference.attester",
        "max": "0"
      },
      {
        "id": "DocumentReference.custodian",
        "path": "DocumentReference.custodian",
        "max": "0"
      },
      {
        "id": "DocumentReference.relatesTo",
        "path": "DocumentReference.relatesTo",
        "max": "0"
      },
      {
        "id": "DocumentReference.description",
        "path": "DocumentReference.description",
        "max": "0"
      },
      {
        "id": "DocumentReference.securityLabel",
        "path": "DocumentReference.securityLabel",
        "max": "0"
      },
      {
        "id": "DocumentReference.content",
        "path": "DocumentReference.content",
        "definition": "#### **_`IDMS: For generated letters this the name, mime type and template. `_**",
        "max": "1"
      },
      {
        "id": "DocumentReference.content.extension",
        "path": "DocumentReference.content.extension",
        "max": "0"
      },
      {
        "id": "DocumentReference.content.modifierExtension",
        "path": "DocumentReference.content.modifierExtension",
        "max": "0"
      },
      {
        "id": "DocumentReference.content.attachment",
        "path": "DocumentReference.content.attachment",
        "definition": "#### **_`IDMS: For generated letters attachment.title = the full path of the generated letter; attachment.contentType = 'application/msword' .`_**",
        "max": "1"
      },
      {
        "id": "DocumentReference.content.profile",
        "path": "DocumentReference.content.profile",
        "definition": "#### **_`IDMS: For generated letters the template that was used to generate the letter. The 'valueCoding.display' element is populated with the template name. The valueURI element is populated with the unique identifier of the template.  `_**",
        "max": "2"
      },
      {
        "id": "DocumentReference.content.profile.extension",
        "path": "DocumentReference.content.profile.extension",
        "max": "0"
      },
      {
        "id": "DocumentReference.content.profile.modifierExtension",
        "path": "DocumentReference.content.profile.modifierExtension",
        "max": "0"
      }
    ]
  }
}