{
  "resourceType": "StructureDefinition",
  "url": "https://gen.kanta.fi/fhir/StructureDefinition/MitatointiProvenanceV2",
  "version": "1.0.0",
  "name": "MitatointiProvenanceV2",
  "status": "draft",
  "date": "2026-03-18",
  "publisher": "Kela",
  "description": "Kanta-palveluissa käytettävä Provenance-profiili. Profiilia käytetään resurssin mitätöimisessä.",
  "purpose": "Kanta-palveluissa käytettävä Provenance-profiili. Profiilia käytetään resurssin mitätöimisessä.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Provenance",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Provenance",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Provenance.meta",
        "path": "Provenance.meta"
      },
      {
        "id": "Provenance.meta.profile",
        "path": "Provenance.meta.profile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "https://gen.kanta.fi/fhir/StructureDefinition/MitatointiProvenanceV2"
      },
      {
        "id": "Provenance.implicitRules",
        "path": "Provenance.implicitRules",
        "max": "0"
      },
      {
        "id": "Provenance.text",
        "path": "Provenance.text",
        "max": "0"
      },
      {
        "id": "Provenance.target",
        "path": "Provenance.target",
        "max": "1"
      },
      {
        "id": "Provenance.target.reference",
        "path": "Provenance.target.reference",
        "short": "Mitätöitävän pääresurssi-instanssin looginen id",
        "min": 1
      },
      {
        "id": "Provenance.target.display",
        "path": "Provenance.target.display",
        "short": "Nimeke",
        "definition": "Mitätöitävän resurssin nimeke."
      },
      {
        "id": "Provenance.occurred[x]",
        "path": "Provenance.occurred[x]",
        "max": "0"
      },
      {
        "id": "Provenance.recorded",
        "path": "Provenance.recorded",
        "short": "Laatimis-/tallennusaika",
        "definition": "Mitätöinnissä käytettävän Provenenance-resurssin laatimis-/tallennusaika."
      },
      {
        "id": "Provenance.policy",
        "path": "Provenance.policy",
        "max": "0"
      },
      {
        "id": "Provenance.location",
        "path": "Provenance.location",
        "max": "0"
      },
      {
        "id": "Provenance.reason",
        "path": "Provenance.reason",
        "max": "0"
      },
      {
        "id": "Provenance.activity",
        "path": "Provenance.activity",
        "short": "Mitätöinnin syy",
        "definition": "Rakenteessa ilmoitetaan syy miksi resurssi mitätöidään."
      },
      {
        "id": "Provenance.activity.coding",
        "path": "Provenance.activity.coding",
        "short": "Mitätöinnin syy",
        "definition": "Mitätöinnin syy koodiarvolla ilmoitettuna.",
        "max": "1"
      },
      {
        "id": "Provenance.activity.coding.system",
        "path": "Provenance.activity.coding.system",
        "short": "Käytettävä koodisto",
        "definition": "Sosiaalihuollossa käytetään koodistoa Sosiaalihuolto - Asiakirjan mitätöinnin syy (1.2.246.537.6.1278.20170).\r\nTerveydenhuollossa ja Tahdonilmaisupalvelussa käytetään koodistoa  eArkisto - Asiakirjan korvauksen syy (1.2.246.537.5.40178.2008)."
      },
      {
        "id": "Provenance.activity.coding.code",
        "path": "Provenance.activity.coding.code",
        "short": "Mitätöinnin syyn koodiarvo",
        "definition": "Annetun koodiston mukainen koodiarvo.\r\n"
      },
      {
        "id": "Provenance.activity.coding.display",
        "path": "Provenance.activity.coding.display",
        "short": "Mitätöinnin syy",
        "definition": "Annetun koodiston koodiarvoa vastaava mitätöinnin syy."
      },
      {
        "id": "Provenance.activity.text",
        "path": "Provenance.activity.text",
        "short": "Mitätöinnin syy",
        "definition": "Resurssin mitätöinnin syy vapaatekstinä. \r\n"
      },
      {
        "id": "Provenance.agent",
        "path": "Provenance.agent",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "role.coding.code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Provenance.agent.role",
        "path": "Provenance.agent.role",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://gen.kanta.fi/ValueSet/figen-vs-provenancerolecategory"
        }
      },
      {
        "id": "Provenance.agent.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://gen.kanta.fi/fhir/StructureDefinition/KantaPractitionerV2",
              "https://gen.kanta.fi/fhir/StructureDefinition/KantaPatientV2",
              "https://gen.kanta.fi/fhir/StructureDefinition/KantaPatientOfficialID",
              "https://gen.kanta.fi/fhir/StructureDefinition/KantaDevice"
            ]
          }
        ]
      },
      {
        "id": "Provenance.agent:Patient",
        "path": "Provenance.agent",
        "sliceName": "Patient",
        "short": "Asiakas tai potilas",
        "definition": "Sen asiakkaan tai potilaan tiedot, johon liittyvä resurssi mitätöidään.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:Patient.role",
        "path": "Provenance.agent.role",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://gen.kanta.fi/ValueSet/figen-vs-provenancerolecategory"
        }
      },
      {
        "id": "Provenance.agent:Patient.role.coding",
        "path": "Provenance.agent.role.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:Patient.role.coding.system",
        "path": "Provenance.agent.role.coding.system",
        "min": 1,
        "fixedUri": "http://gen.kanta.fi/figen-cs-provenancerolecategory"
      },
      {
        "id": "Provenance.agent:Patient.role.coding.code",
        "path": "Provenance.agent.role.coding.code",
        "min": 1,
        "fixedCode": "3"
      },
      {
        "id": "Provenance.agent:Patient.role.coding.display",
        "path": "Provenance.agent.role.coding.display",
        "min": 1
      },
      {
        "id": "Provenance.agent:Patient.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://gen.kanta.fi/fhir/StructureDefinition/KantaPatientV2",
              "https://gen.kanta.fi/fhir/StructureDefinition/KantaPatientOfficialID"
            ]
          }
        ]
      },
      {
        "id": "Provenance.agent:Patient.who.reference",
        "path": "Provenance.agent.who.reference",
        "min": 1
      },
      {
        "id": "Provenance.agent:Practitioner",
        "path": "Provenance.agent",
        "sliceName": "Practitioner",
        "short": "Mitätöinnin tekijä",
        "definition": "Sen sosiaali- ja terveydenhuollon ammattihenkilön tai arkistonhoitajan tiedot, joka mitätöi resurssin.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:Practitioner.role",
        "path": "Provenance.agent.role",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://gen.kanta.fi/ValueSet/figen-vs-provenancerolecategory"
        }
      },
      {
        "id": "Provenance.agent:Practitioner.role.coding",
        "path": "Provenance.agent.role.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:Practitioner.role.coding.system",
        "path": "Provenance.agent.role.coding.system",
        "min": 1,
        "fixedUri": "http://gen.kanta.fi/figen-cs-provenancerolecategory"
      },
      {
        "id": "Provenance.agent:Practitioner.role.coding.code",
        "path": "Provenance.agent.role.coding.code",
        "min": 1,
        "fixedCode": "2"
      },
      {
        "id": "Provenance.agent:Practitioner.role.coding.display",
        "path": "Provenance.agent.role.coding.display",
        "min": 1
      },
      {
        "id": "Provenance.agent:Practitioner.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://gen.kanta.fi/fhir/StructureDefinition/KantaPractitionerV2"
            ]
          }
        ]
      },
      {
        "id": "Provenance.agent:Practitioner.who.reference",
        "path": "Provenance.agent.who.reference",
        "short": "Viittaus käytettävään resurssiin",
        "min": 1
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit",
        "path": "Provenance.agent",
        "sliceName": "PractitionerOrganizationUnit",
        "short": "Palveluyksikkö",
        "definition": "Resurssin mitätöivän sosiaali- tai terveydenhuollon ammattihenkilön palveluyksikön tiedot. ",
        "max": "1"
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit.role",
        "path": "Provenance.agent.role",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://gen.kanta.fi/ValueSet/figen-vs-provenancerolecategory"
        }
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit.role.coding",
        "path": "Provenance.agent.role.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit.role.coding.system",
        "path": "Provenance.agent.role.coding.system",
        "min": 1,
        "fixedUri": "http://gen.kanta.fi/figen-cs-provenancerolecategory"
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit.role.coding.code",
        "path": "Provenance.agent.role.coding.code",
        "min": 1,
        "fixedCode": "7"
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit.role.coding.display",
        "path": "Provenance.agent.role.coding.display",
        "min": 1
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization"
            ]
          }
        ]
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit.who.identifier",
        "path": "Provenance.agent.who.identifier",
        "min": 1
      },
      {
        "id": "Provenance.agent:PractitionerOrganizationUnit.who.identifier.system",
        "path": "Provenance.agent.who.identifier.system",
        "min": 1
      },
      {
        "id": "Provenance.agent:Device",
        "path": "Provenance.agent",
        "sliceName": "Device",
        "short": "Mitätöinnissä käytetty ohjelmisto",
        "definition": "Ohjelmisto, jossa mitätöinti on tehty",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:Device.role",
        "path": "Provenance.agent.role",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://gen.kanta.fi/ValueSet/figen-vs-provenancerolecategory"
        }
      },
      {
        "id": "Provenance.agent:Device.role.coding",
        "path": "Provenance.agent.role.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:Device.role.coding.system",
        "path": "Provenance.agent.role.coding.system",
        "min": 1,
        "fixedUri": "http://gen.kanta.fi/figen-cs-provenancerolecategory"
      },
      {
        "id": "Provenance.agent:Device.role.coding.code",
        "path": "Provenance.agent.role.coding.code",
        "min": 1,
        "fixedCode": "4"
      },
      {
        "id": "Provenance.agent:Device.role.coding.display",
        "path": "Provenance.agent.role.coding.display",
        "min": 1
      },
      {
        "id": "Provenance.agent:Device.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://gen.kanta.fi/fhir/StructureDefinition/KantaDevice"
            ]
          }
        ]
      },
      {
        "id": "Provenance.agent:Device.who.reference",
        "path": "Provenance.agent.who.reference",
        "short": "Viittaus käytettävään resurssiin",
        "min": 1
      },
      {
        "id": "Provenance.agent:Custodian",
        "path": "Provenance.agent",
        "sliceName": "Custodian",
        "short": "Rekisterinpitäjä",
        "definition": "Mitätöitävän resurssin rekisterinpitäjän tiedot. Rekisterinpitäjän tiedot ovat pakollisia, kun mitätöidään Sosiaalihuollon asiakastietovarantoon tallennettu resurssi. ",
        "max": "1"
      },
      {
        "id": "Provenance.agent:Custodian.role",
        "path": "Provenance.agent.role",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://gen.kanta.fi/ValueSet/figen-vs-provenancerolecategory"
        }
      },
      {
        "id": "Provenance.agent:Custodian.role.coding",
        "path": "Provenance.agent.role.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:Custodian.role.coding.system",
        "path": "Provenance.agent.role.coding.system",
        "min": 1,
        "fixedUri": "http://gen.kanta.fi/figen-cs-provenancerolecategory"
      },
      {
        "id": "Provenance.agent:Custodian.role.coding.code",
        "path": "Provenance.agent.role.coding.code",
        "min": 1,
        "fixedCode": "1"
      },
      {
        "id": "Provenance.agent:Custodian.role.coding.display",
        "path": "Provenance.agent.role.coding.display",
        "min": 1
      },
      {
        "id": "Provenance.agent:Custodian.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization"
            ]
          }
        ]
      },
      {
        "id": "Provenance.agent:ServiceProvider",
        "path": "Provenance.agent",
        "sliceName": "ServiceProvider",
        "short": "Palveluntuottaja",
        "definition": "Palveluntuottaja, joka mitätöi resurssin.\r\n\r\nSosiaalihuollon asiakastietovarannossa tieto on pakollinen, jos sen pääresurssin, joka mitätöidään palveluprosessi on palveluntoteutus tai jos mitätöitävän pääresurssin sosiaalipalvelu on turvakotipalvelu.",
        "max": "1"
      },
      {
        "id": "Provenance.agent:ServiceProvider.role",
        "path": "Provenance.agent.role",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://gen.kanta.fi/ValueSet/figen-vs-provenancerolecategory"
        }
      },
      {
        "id": "Provenance.agent:ServiceProvider.role.coding",
        "path": "Provenance.agent.role.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:ServiceProvider.role.coding.system",
        "path": "Provenance.agent.role.coding.system",
        "min": 1,
        "fixedUri": "http://gen.kanta.fi/figen-cs-provenancerolecategory"
      },
      {
        "id": "Provenance.agent:ServiceProvider.role.coding.code",
        "path": "Provenance.agent.role.coding.code",
        "min": 1,
        "fixedCode": "13"
      },
      {
        "id": "Provenance.agent:ServiceProvider.role.coding.display",
        "path": "Provenance.agent.role.coding.display",
        "min": 1
      },
      {
        "id": "Provenance.agent:ServiceProvider.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization"
            ]
          }
        ]
      },
      {
        "id": "Provenance.agent:ServiceDeliverer",
        "path": "Provenance.agent",
        "sliceName": "ServiceDeliverer",
        "short": "Alihankkijana toimiva palveluntuottaja",
        "definition": "Alihankkijana toimiva palveluntuottaja, joka mitätöi resurssin.\r\n\r\nSosiaalihuollon asiakastietovarannossa tieto on pakollinen, jos sen pääresurssin, joka mitätöidään palveluprosessi on palveluntoteutus tai jos mitätöitävän pääresurssin sosiaalipalvelu on turvakotipalvelu ja jos resurssin edellisen versio on tallentanut alihankkijana toimiva palveluntuottaja. ",
        "max": "1"
      },
      {
        "id": "Provenance.agent:ServiceDeliverer.role",
        "path": "Provenance.agent.role",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://gen.kanta.fi/ValueSet/figen-vs-provenancerolecategory"
        }
      },
      {
        "id": "Provenance.agent:ServiceDeliverer.role.coding",
        "path": "Provenance.agent.role.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.agent:ServiceDeliverer.role.coding.system",
        "path": "Provenance.agent.role.coding.system",
        "min": 1,
        "fixedUri": "http://gen.kanta.fi/figen-cs-provenancerolecategory"
      },
      {
        "id": "Provenance.agent:ServiceDeliverer.role.coding.code",
        "path": "Provenance.agent.role.coding.code",
        "min": 1,
        "fixedCode": "15"
      },
      {
        "id": "Provenance.agent:ServiceDeliverer.role.coding.display",
        "path": "Provenance.agent.role.coding.display",
        "min": 1
      },
      {
        "id": "Provenance.agent:ServiceDeliverer.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization"
            ]
          }
        ]
      },
      {
        "id": "Provenance.entity",
        "path": "Provenance.entity",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Provenance.entity.role",
        "path": "Provenance.entity.role",
        "fixedCode": "removal"
      },
      {
        "id": "Provenance.entity.what.reference",
        "path": "Provenance.entity.what.reference",
        "short": "Mitätöitävän resurssi-instanssin looginen id",
        "definition": "Sen resurssi-instanssin looginen id, joka mitätöidään.",
        "min": 1
      },
      {
        "id": "Provenance.signature",
        "path": "Provenance.signature",
        "max": "0"
      }
    ]
  }
}