{
  "resourceType": "StructureDefinition",
  "url": "https://kvp.kanta.fi/fhir/StructureDefinition/valitys",
  "name": "Valitys",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Communication",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Communication",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Communication.meta",
        "path": "Communication.meta",
        "min": 1
      },
      {
        "id": "Communication.meta.profile",
        "path": "Communication.meta.profile",
        "fixedCanonical": "https://kvp.kanta.fi/fhir/StructureDefinition/valitys"
      },
      {
        "id": "Communication.implicitRules",
        "path": "Communication.implicitRules",
        "max": "0"
      },
      {
        "id": "Communication.identifier",
        "path": "Communication.identifier",
        "max": "0"
      },
      {
        "id": "Communication.instantiatesCanonical",
        "path": "Communication.instantiatesCanonical",
        "max": "0"
      },
      {
        "id": "Communication.instantiatesUri",
        "path": "Communication.instantiatesUri",
        "max": "0"
      },
      {
        "id": "Communication.basedOn",
        "path": "Communication.basedOn",
        "short": "Välityspyynnön tunniste",
        "definition": "Asiakirjan välitystä varten tehdyn välityspyynnön tunniste.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Communication.basedOn.id",
        "path": "Communication.basedOn.id",
        "max": "0"
      },
      {
        "id": "Communication.basedOn.reference",
        "path": "Communication.basedOn.reference",
        "max": "0"
      },
      {
        "id": "Communication.basedOn.type",
        "path": "Communication.basedOn.type",
        "max": "0"
      },
      {
        "id": "Communication.basedOn.identifier",
        "path": "Communication.basedOn.identifier",
        "min": 1
      },
      {
        "id": "Communication.basedOn.identifier.extension",
        "path": "Communication.basedOn.identifier.extension",
        "max": "0"
      },
      {
        "id": "Communication.basedOn.identifier.use",
        "path": "Communication.basedOn.identifier.use",
        "max": "0"
      },
      {
        "id": "Communication.basedOn.identifier.type",
        "path": "Communication.basedOn.identifier.type",
        "max": "0"
      },
      {
        "id": "Communication.basedOn.identifier.system",
        "path": "Communication.basedOn.identifier.system",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "Communication.basedOn.identifier.value",
        "path": "Communication.basedOn.identifier.value",
        "short": "Välityspyynnön tunniste",
        "definition": "UUID-muotoinen välityspyynnön tunniste",
        "min": 1
      },
      {
        "id": "Communication.basedOn.identifier.period",
        "path": "Communication.basedOn.identifier.period",
        "max": "0"
      },
      {
        "id": "Communication.basedOn.identifier.assigner",
        "path": "Communication.basedOn.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Communication.partOf",
        "path": "Communication.partOf",
        "max": "0"
      },
      {
        "id": "Communication.inResponseTo",
        "path": "Communication.inResponseTo",
        "max": "0"
      },
      {
        "id": "Communication.status",
        "path": "Communication.status",
        "definition": "Välityksen tila. \r\nKäytössä ovat seuraavat tilat: \r\nin-progress = välitykseen liittyvä asiakirja on haettu, \r\ncompleted = välitykseen liittyvä asiakirja on haettu ja vastaanottava organisaatio on kuitannut asiakirjan vastaanotetuksi, \r\nstopped = välitykseen liittyvän asiakirjan käsittely on epäonnistunut"
      },
      {
        "id": "Communication.statusReason",
        "path": "Communication.statusReason",
        "short": "Tilan selite",
        "definition": "Lyhyt selite (max 255 merkkiä) välityksen epäonnistumiselle. Asetetaan, kun status = stopped."
      },
      {
        "id": "Communication.statusReason.coding",
        "path": "Communication.statusReason.coding",
        "max": "0"
      },
      {
        "id": "Communication.statusReason.text",
        "path": "Communication.statusReason.text",
        "short": "Selkokielinen syy miksi välitys ei onnistunut.",
        "min": 1,
        "maxLength": 255
      },
      {
        "id": "Communication.category",
        "path": "Communication.category",
        "max": "0"
      },
      {
        "id": "Communication.priority",
        "path": "Communication.priority",
        "max": "0"
      },
      {
        "id": "Communication.medium",
        "path": "Communication.medium",
        "max": "0"
      },
      {
        "id": "Communication.subject",
        "path": "Communication.subject",
        "short": "Asiakkaan tiedot",
        "definition": "Henkilö, jota välitettävä asiakirja koskee.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://kvp.kanta.fi/fhir/StructureDefinition/KVPPatient"
            ],
            "aggregation": [
              "contained"
            ]
          }
        ]
      },
      {
        "id": "Communication.subject.extension",
        "path": "Communication.subject.extension",
        "max": "0"
      },
      {
        "id": "Communication.subject.reference",
        "path": "Communication.subject.reference",
        "min": 1
      },
      {
        "id": "Communication.subject.type",
        "path": "Communication.subject.type",
        "max": "0"
      },
      {
        "id": "Communication.subject.identifier",
        "path": "Communication.subject.identifier",
        "max": "0"
      },
      {
        "id": "Communication.subject.identifier.id",
        "path": "Communication.subject.identifier.id",
        "max": "0"
      },
      {
        "id": "Communication.subject.identifier.extension",
        "path": "Communication.subject.identifier.extension",
        "max": "0"
      },
      {
        "id": "Communication.subject.identifier.use",
        "path": "Communication.subject.identifier.use",
        "max": "0"
      },
      {
        "id": "Communication.subject.identifier.type",
        "path": "Communication.subject.identifier.type",
        "max": "0"
      },
      {
        "id": "Communication.subject.identifier.system",
        "path": "Communication.subject.identifier.system",
        "short": "Henkilötunnuksen nimiavaruus.",
        "definition": "Henkilötunnuksen nimiavaruutena käytetään urn:oid:1.2.246.21.",
        "fixedUri": "urn:oid:1.2.246.21"
      },
      {
        "id": "Communication.subject.identifier.period",
        "path": "Communication.subject.identifier.period",
        "max": "0"
      },
      {
        "id": "Communication.subject.identifier.assigner",
        "path": "Communication.subject.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Communication.subject.display",
        "path": "Communication.subject.display",
        "short": "Asiakkaan nimitiedot",
        "max": "0"
      },
      {
        "id": "Communication.topic",
        "path": "Communication.topic",
        "max": "0"
      },
      {
        "id": "Communication.about",
        "path": "Communication.about",
        "max": "0"
      },
      {
        "id": "Communication.encounter",
        "path": "Communication.encounter",
        "max": "0"
      },
      {
        "id": "Communication.sent",
        "path": "Communication.sent",
        "max": "0"
      },
      {
        "id": "Communication.received",
        "path": "Communication.received",
        "max": "0"
      },
      {
        "id": "Communication.recipient",
        "path": "Communication.recipient",
        "short": "Asiakirjan vastaanottaja",
        "definition": "Asiakirjan vastaanottavan organisaation tunnus",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Communication.recipient.id",
        "path": "Communication.recipient.id",
        "max": "0"
      },
      {
        "id": "Communication.recipient.reference",
        "path": "Communication.recipient.reference",
        "max": "0"
      },
      {
        "id": "Communication.recipient.type",
        "path": "Communication.recipient.type",
        "max": "0"
      },
      {
        "id": "Communication.recipient.identifier",
        "path": "Communication.recipient.identifier",
        "min": 1
      },
      {
        "id": "Communication.recipient.identifier.id",
        "path": "Communication.recipient.identifier.id",
        "max": "0"
      },
      {
        "id": "Communication.recipient.identifier.use",
        "path": "Communication.recipient.identifier.use",
        "max": "0"
      },
      {
        "id": "Communication.recipient.identifier.type",
        "path": "Communication.recipient.identifier.type",
        "max": "0"
      },
      {
        "id": "Communication.recipient.identifier.system",
        "path": "Communication.recipient.identifier.system",
        "short": "Viestinvälitys - Sanoman vastaanottaja",
        "definition": "Viestinvälitys - Sanoman vastaanottaja -koodistoa käytetään Kanta-palveluiden viestinvälityksessä ohjaamaan erilaiset sanomat käsiteltäväksi oikean vastaanottajaorganisaation käsittelyjärjestelmälle.",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "Communication.recipient.identifier.value",
        "path": "Communication.recipient.identifier.value",
        "short": "Asiakirjan vastaanottavan organisaation tunnus",
        "definition": "Asiakirjan vastaanottavan organisaation tunnus",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "https://kvp.kanta.fi/fhir/ValueSet/sanomanvastaanottaja"
        }
      },
      {
        "id": "Communication.recipient.identifier.period",
        "path": "Communication.recipient.identifier.period",
        "max": "0"
      },
      {
        "id": "Communication.recipient.identifier.assigner",
        "path": "Communication.recipient.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Communication.sender",
        "path": "Communication.sender",
        "short": "Välityspyynnön tehneen palvelunantajan tunnus",
        "definition": "Välitykseen liittyvän välityspyynnön tehneen palvelunantajan tunnus",
        "min": 1
      },
      {
        "id": "Communication.sender.id",
        "path": "Communication.sender.id",
        "max": "0"
      },
      {
        "id": "Communication.sender.reference",
        "path": "Communication.sender.reference",
        "max": "0"
      },
      {
        "id": "Communication.sender.type",
        "path": "Communication.sender.type",
        "max": "0"
      },
      {
        "id": "Communication.sender.identifier",
        "path": "Communication.sender.identifier",
        "min": 1
      },
      {
        "id": "Communication.sender.identifier.id",
        "path": "Communication.sender.identifier.id",
        "max": "0"
      },
      {
        "id": "Communication.sender.identifier.extension",
        "path": "Communication.sender.identifier.extension",
        "max": "0"
      },
      {
        "id": "Communication.sender.identifier.use",
        "path": "Communication.sender.identifier.use",
        "max": "0"
      },
      {
        "id": "Communication.sender.identifier.type",
        "path": "Communication.sender.identifier.type",
        "max": "0"
      },
      {
        "id": "Communication.sender.identifier.system",
        "path": "Communication.sender.identifier.system",
        "min": 1,
        "fixedUri": "urn:ietf:rfc:3986"
      },
      {
        "id": "Communication.sender.identifier.value",
        "path": "Communication.sender.identifier.value",
        "short": "Välityspyynnön tehneen palvelunantajan tunnus",
        "definition": "Välitykseen liittyvän välityspyynnön tehneen palvelunantajan tunnus",
        "min": 1
      },
      {
        "id": "Communication.sender.identifier.period",
        "path": "Communication.sender.identifier.period",
        "max": "0"
      },
      {
        "id": "Communication.sender.identifier.assigner",
        "path": "Communication.sender.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Communication.reasonCode",
        "path": "Communication.reasonCode",
        "short": "Välitysperuste",
        "definition": "Koodiston 1.2.246.537.6.40192.2012 mukainen asiakirjan välityksen välitysperuste",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "https://kvp.kanta.fi/fhir/ValueSet/valitysperuste"
        }
      },
      {
        "id": "Communication.reasonCode.id",
        "path": "Communication.reasonCode.id",
        "max": "0"
      },
      {
        "id": "Communication.reasonCode.extension",
        "path": "Communication.reasonCode.extension",
        "max": "0"
      },
      {
        "id": "Communication.reasonCode.coding",
        "path": "Communication.reasonCode.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Communication.reasonCode.coding.id",
        "path": "Communication.reasonCode.coding.id",
        "max": "0"
      },
      {
        "id": "Communication.reasonCode.coding.extension",
        "path": "Communication.reasonCode.coding.extension",
        "max": "0"
      },
      {
        "id": "Communication.reasonCode.coding.system",
        "path": "Communication.reasonCode.coding.system",
        "short": "Välitysperusteen nimiavaruus",
        "definition": "Välitysperusteen tunnisteen nimiavaruutena käytetään 1.2.246.537.6.40192.2012.",
        "min": 1,
        "fixedUri": "urn:oid:1.2.246.537.6.40192.2012"
      },
      {
        "id": "Communication.reasonCode.coding.version",
        "path": "Communication.reasonCode.coding.version",
        "max": "0"
      },
      {
        "id": "Communication.reasonCode.coding.code",
        "path": "Communication.reasonCode.coding.code",
        "short": "Välitysperuste",
        "definition": "Asiakirjan välityksen välitysperuste",
        "min": 1
      },
      {
        "id": "Communication.reasonCode.coding.userSelected",
        "path": "Communication.reasonCode.coding.userSelected",
        "max": "0"
      },
      {
        "id": "Communication.reasonCode.text",
        "path": "Communication.reasonCode.text",
        "max": "0"
      },
      {
        "id": "Communication.reasonReference",
        "path": "Communication.reasonReference",
        "max": "0"
      },
      {
        "id": "Communication.payload",
        "path": "Communication.payload",
        "max": "1"
      },
      {
        "id": "Communication.payload.id",
        "path": "Communication.payload.id",
        "max": "0"
      },
      {
        "id": "Communication.payload.content[x]",
        "path": "Communication.payload.content[x]",
        "type": [
          {
            "code": "Attachment"
          }
        ]
      },
      {
        "id": "Communication.payload.content[x].contentType",
        "path": "Communication.payload.content[x].contentType",
        "fixedCode": "text/xml"
      },
      {
        "id": "Communication.payload.content[x].language",
        "path": "Communication.payload.content[x].language",
        "max": "0"
      },
      {
        "id": "Communication.payload.content[x].data",
        "path": "Communication.payload.content[x].data",
        "short": "Välitettävä asiakirja base64-muodossa",
        "definition": "Välitettävä asiakirja base64-muodossa",
        "min": 1
      },
      {
        "id": "Communication.payload.content[x].url",
        "path": "Communication.payload.content[x].url",
        "max": "0"
      },
      {
        "id": "Communication.payload.content[x].size",
        "path": "Communication.payload.content[x].size",
        "max": "0"
      },
      {
        "id": "Communication.note",
        "path": "Communication.note",
        "max": "0",
        "mustSupport": true
      }
    ]
  }
}