{
  "resourceType": "StructureDefinition",
  "id": "profile-Provenance",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Provenance",
  "name": "Provenance",
  "title": "Provenance Profile",
  "status": "active",
  "experimental": false,
  "description": "Allows information about who is responsible for creating, updating, and/or marking as 'inactive' a given version of a record.",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    },
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Provenance",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Provenance",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Provenance.id",
        "path": "Provenance.id",
        "comment": "This should be a simple integer (typically just '1' unless a recipient has multiple actions (e.g. update + inactivate)",
        "mustSupport": true
      },
      {
        "id": "Provenance.target",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/designNote",
            "valueMarkdown": "These create recusion problems when generating snapshot, and aren't technically necessary.         targetProfile https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search         targetProfile https://bpcs.exchange/fhir/StructureDefinition/profile-Group-search   targetProfile https://bpcs.exchange/fhir/StructureDefinition/profile-Coverage-family"
          }
        ],
        "path": "Provenance.target",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "aggregation": [
              "contained"
            ],
            "versioning": "specific"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Provenance.target.reference",
        "path": "Provenance.target.reference",
        "comment": "Point to the containing record",
        "patternString": "#"
      },
      {
        "id": "Provenance.occurred[x]",
        "path": "Provenance.occurred[x]",
        "short": "effModDt/recEffDate",
        "definition": "This date is the first day that the data on the record is in effect.",
        "comment": "This could represent when the 1st (i.e. CREATE) record was added or any subsequent (i.e. UPDATE) records that were added.",
        "type": [
          {
            "code": "dateTime"
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "recCreateTimestamp, recUpdateTimestamp, or recInactiveTimestamp (or CustomTimestamps - whichever is present)"
          }
        ]
      },
      {
        "id": "Provenance.activity",
        "path": "Provenance.activity",
        "comment": "Inactivate maps to DELETE",
        "min": 1,
        "type": [
          {
            "code": "CodeableConcept",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-CodeableConcept-simple"
            ]
          }
        ],
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-history-record-activity"
        }
      },
      {
        "id": "Provenance.agent",
        "path": "Provenance.agent",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Provenance.agent.who",
        "path": "Provenance.agent.who",
        "short": "Creating/Updating user",
        "mustSupport": true
      },
      {
        "id": "Provenance.agent.who.identifier",
        "path": "Provenance.agent.who.identifier",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Provenance.agent.who.identifier.system",
        "path": "Provenance.agent.who.identifier.system",
        "min": 1,
        "patternUri": "https://bpcs.exchange/fhir/NamingSystem/userids",
        "mustSupport": true
      },
      {
        "id": "Provenance.agent.who.identifier.value",
        "path": "Provenance.agent.who.identifier.value",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "recCreateUserId, recUpdateUserId, or recInactiveUserId"
          }
        ]
      }
    ]
  }
}