{
  "resourceType": "StructureDefinition",
  "id": "gap-provenance-profile",
  "url": "http://akinox.com/fhir/StructureDefinition/gap-provenance-profile",
  "version": "1.0.0",
  "name": "GapProvenance",
  "title": "GAP Provenance Profile",
  "status": "draft",
  "description": "A FHIR Provenance profile for GAP requests to track who initiated the request. This resource is optional (0..1 cardinality in the Bundle) and used when the source system can provide initiator information.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Provenance",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Provenance",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Provenance",
        "path": "Provenance",
        "constraint": [
          {
            "key": "gap-provenance-agent-author",
            "severity": "error",
            "human": "Agent type must be 'author' to indicate who initiated the request.",
            "expression": "agent.type.coding.where(system='http://terminology.hl7.org/CodeSystem/provenance-participant-type' and code='author').exists()",
            "source": "http://akinox.com/fhir/StructureDefinition/gap-provenance-profile"
          }
        ]
      },
      {
        "id": "Provenance.target",
        "path": "Provenance.target",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Task"
            ]
          }
        ]
      },
      {
        "id": "Provenance.agent",
        "path": "Provenance.agent",
        "max": "1"
      },
      {
        "id": "Provenance.agent.type",
        "path": "Provenance.agent.type",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "http://hl7.org/fhir/ValueSet/provenance-participant-type"
        }
      },
      {
        "id": "Provenance.agent.who",
        "path": "Provenance.agent.who",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient",
              "http://hl7.org/fhir/StructureDefinition/RelatedPerson"
            ]
          }
        ]
      }
    ]
  }
}