{
  "resourceType": "StructureDefinition",
  "id": "mp-ReplyProposalMedicationAgreement",
  "url": "http://nictiz.nl/fhir/StructureDefinition/mp-ReplyProposalMedicationAgreement",
  "version": "2.0.0-rc.7",
  "name": "MpReplyProposalMedicationAgreement",
  "title": "mp ReplyProposalMedicationAgreement",
  "status": "active",
  "publisher": "Nictiz",
  "contact": [
    {
      "name": "Nictiz",
      "telecom": [
        {
          "system": "url",
          "value": "https://www.nictiz.nl",
          "use": "work"
        }
      ]
    }
  ],
  "description": "The response proposal medication agreement is a response from the prescriber to the proposal medication agreement. In this response, the prescriber indicates whether they agree (after which an (adjusted) medication agreement will follow) or disagree (and the reason for this).",
  "purpose": "To define the reply proposal medication agreement as stated in the information standard Medication Process.",
  "copyright": "Copyright and related rights waived via CC0, https://creativecommons.org/publicdomain/zero/1.0/. This does not apply to information from third parties, for example a medical terminology system. The implementer alone is responsible for identifying and obtaining any necessary licenses or authorizations to utilize third party IP in connection with the specification or otherwise.",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "mp-dataset-mp9-300-rc1-20250522",
      "uri": "https://decor.nictiz.nl/pub/medicatieproces/mp-html-20250522T132618/ds-2.16.840.1.113883.2.4.3.11.60.20.77.1.4-2022-06-30T000000.html",
      "name": "ART-DECOR Dataset MP9 3.0.0-rc.1 20250522"
    },
    {
      "identity": "mp-dataset-mp9-300-rc2-20260213",
      "uri": "https://decor.nictiz.nl/pub/medicatieproces/mp-html-20260213T112547/ds-2.16.840.1.113883.2.4.3.11.60.20.77.1.4-2022-06-30T000000.html",
      "name": "ART-DECOR Dataset MP9 3.0.0-rc.2 20260213"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Communication",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Communication",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Communication",
        "path": "Communication",
        "short": "Response",
        "definition": "Response to the proposal medication agreement.",
        "alias": [
          "Antwoord"
        ],
        "constraint": [
          {
            "key": "mp-2033-ma-1",
            "severity": "error",
            "human": "If the decision is 'accepted' (11) or 'accepted with changes' (12), the relation to the new MedicationAgreement SHALL be present; otherwise it SHALL be absent.",
            "expression": "(payload.content.extension.value.ofType(CodeableConcept).coding.code.intersect({'11','12'}).exists()) = extension.where(url='http://nictiz.nl/fhir/StructureDefinition/ext-Communication.RelationToNewMedicationAgreement').exists()"
          }
        ],
        "mapping": [
          {
            "identity": "mp-dataset-mp9-300-rc1-20250522",
            "map": "mp-dataelement9x-539",
            "comment": "Response"
          },
          {
            "identity": "mp-dataset-mp9-300-rc2-20260213",
            "map": "mp-dataelement9x-539",
            "comment": "Response"
          }
        ]
      },
      {
        "id": "Communication.meta",
        "path": "Communication.meta"
      },
      {
        "id": "Communication.meta.tag",
        "path": "Communication.meta.tag",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Communication.meta.tag:actionable",
        "path": "Communication.meta.tag",
        "sliceName": "actionable",
        "min": 1,
        "max": "1",
        "patternCoding": {
          "system": "http://terminology.hl7.org/CodeSystem/common-tags",
          "code": "actionable"
        }
      },
      {
        "id": "Communication.identifier",
        "path": "Communication.identifier",
        "short": "Identification",
        "definition": "The identification of the response to the proposal. This identification is generated by the system of the person who registers the response and is globally unique and eternally persistent.",
        "comment": "Leading business identifier for the response.",
        "alias": [
          "Identificatie"
        ],
        "min": 1,
        "max": "1",
        "mapping": [
          {
            "identity": "mp-dataset-mp9-300-rc1-20250522",
            "map": "mp-dataelement9x-540",
            "comment": "Identification"
          },
          {
            "identity": "mp-dataset-mp9-300-rc2-20260213",
            "map": "mp-dataelement9x-540",
            "comment": "Identification"
          }
        ]
      },
      {
        "id": "Communication.basedOn",
        "path": "Communication.basedOn",
        "short": "RelationToProposalData",
        "definition": "Relation to proposal data.",
        "comment": "Preferred: reference the proposal transaction (Bundle) using an identifier-based reference that matches Proposal Bundle.identifier. Backwards compatibility: a direct reference to the proposed mp-MedicationAgreement MAY be used during transition.",
        "alias": [
          "RelatieVoorstelGegevens"
        ],
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Resource",
              "http://nictiz.nl/fhir/StructureDefinition/mp-ProposalMedicationAgreement-Bundle",
              "http://nictiz.nl/fhir/StructureDefinition/mp-MedicationAgreement"
            ]
          }
        ],
        "mapping": [
          {
            "identity": "mp-dataset-mp9-300-rc1-20250522",
            "map": "mp-dataelement9x-544",
            "comment": "RelationToProposalData"
          },
          {
            "identity": "mp-dataset-mp9-300-rc2-20260213",
            "map": "mp-dataelement9x-544",
            "comment": "RelationToProposalData"
          }
        ]
      },
      {
        "id": "Communication.subject",
        "path": "Communication.subject",
        "short": "Patient",
        "alias": [
          "Patient"
        ],
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient",
              "http://hl7.org/fhir/StructureDefinition/Group",
              "http://nictiz.nl/fhir/StructureDefinition/nl-core-Patient"
            ]
          }
        ],
        "mapping": [
          {
            "identity": "mp-dataset-mp9-300-rc1-20250522",
            "map": "mp-dataelement9x-1",
            "comment": "Patient"
          },
          {
            "identity": "mp-dataset-mp9-300-rc2-20260213",
            "map": "mp-dataelement9x-1",
            "comment": "Patient"
          }
        ]
      },
      {
        "id": "Communication.sent",
        "path": "Communication.sent",
        "short": "ResponseDate",
        "definition": "Date of the response to the proposal.",
        "alias": [
          "AntwoordDatum"
        ],
        "min": 1,
        "mapping": [
          {
            "identity": "mp-dataset-mp9-300-rc1-20250522",
            "map": "mp-dataelement9x-541",
            "comment": "ResponseDate"
          },
          {
            "identity": "mp-dataset-mp9-300-rc2-20260213",
            "map": "mp-dataelement9x-541",
            "comment": "ResponseDate"
          }
        ]
      },
      {
        "id": "Communication.sender",
        "path": "Communication.sender",
        "short": "Author",
        "definition": "Author of the response to the proposal.",
        "alias": [
          "Auteur"
        ],
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "profile": [
              "http://nictiz.nl/fhir/StructureDefinition/pattern-NlCoreHealthProfessionalReference"
            ],
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Device",
              "http://hl7.org/fhir/StructureDefinition/Organization",
              "http://hl7.org/fhir/StructureDefinition/Patient",
              "http://hl7.org/fhir/StructureDefinition/Practitioner",
              "http://hl7.org/fhir/StructureDefinition/PractitionerRole",
              "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
              "http://hl7.org/fhir/StructureDefinition/HealthcareService",
              "http://nictiz.nl/fhir/StructureDefinition/nl-core-HealthProfessional-PractitionerRole"
            ]
          }
        ],
        "mapping": [
          {
            "identity": "mp-dataset-mp9-300-rc1-20250522",
            "map": "mp-dataelement9x-542",
            "comment": "Author"
          },
          {
            "identity": "mp-dataset-mp9-300-rc2-20260213",
            "map": "mp-dataelement9x-542",
            "comment": "Author"
          }
        ]
      },
      {
        "id": "Communication.extension",
        "path": "Communication.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Communication.extension:relationToNewMedicationAgreement",
        "path": "Communication.extension",
        "sliceName": "relationToNewMedicationAgreement",
        "short": "RelationToNewMedicationAgreement",
        "definition": "Relation from this reply to the new medication agreement building block that is accepted (possibly with changes).",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension"
          }
        ]
      },
      {
        "id": "Communication.extension:relationToNewMedicationAgreement.url",
        "path": "Communication.extension.url",
        "fixedUri": "http://nictiz.nl/fhir/StructureDefinition/ext-Communication.RelationToNewMedicationAgreement"
      },
      {
        "id": "Communication.extension:relationToNewMedicationAgreement.value[x]",
        "path": "Communication.extension.value[x]",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://nictiz.nl/fhir/StructureDefinition/mp-MedicationAgreement"
            ]
          }
        ]
      },
      {
        "id": "Communication.payload",
        "path": "Communication.payload",
        "min": 1
      },
      {
        "id": "Communication.payload.content[x]",
        "path": "Communication.payload.content[x]",
        "short": "ResponseMedicationAgreementExplanation",
        "definition": "Explanation (free text) for the response to the proposed medication agreement.",
        "alias": [
          "AntwoordMedicatieafspraakToelichting"
        ],
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "Communication.payload.content[x].extension",
        "path": "Communication.payload.content[x].extension",
        "min": 1
      },
      {
        "id": "Communication.payload.content[x].extension:contentCodeableConcept",
        "path": "Communication.payload.content[x].extension",
        "sliceName": "contentCodeableConcept",
        "comment": "This is a pre-adopt of R5 in which the string data type of `.payload.content` is changed to a CodeableConcept.",
        "min": 1,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://nictiz.nl/fhir/StructureDefinition/ext-Communication.Payload.ContentCodeableConcept"
            ]
          }
        ]
      },
      {
        "id": "Communication.payload.content[x].extension:contentCodeableConcept.value[x]",
        "path": "Communication.payload.content[x].extension.value[x]",
        "short": "ResponseMedicationAgreementDecision",
        "definition": "Decision for the response to the proposed medication agreement.",
        "alias": [
          "AntwoordMedicatieafspraakBesluit"
        ],
        "min": 1,
        "binding": {
          "strength": "required",
          "description": "Decision for the response to the proposed medication agreement.",
          "valueSet": "http://decor.nictiz.nl/fhir/ValueSet/2.16.840.1.113883.2.4.3.11.60.20.77.11.44--20251217150448"
        },
        "mapping": [
          {
            "identity": "mp-dataset-mp9-300-rc1-20250522",
            "map": "mp-dataelement9x-1364",
            "comment": "ResponseMedicationAgreement"
          },
          {
            "identity": "mp-dataset-mp9-300-rc2-20260213",
            "map": "mp-dataelement9x-1364",
            "comment": "ResponseMedicationAgreement"
          }
        ]
      }
    ]
  }
}