Inera Core Implementation Guide
0.2.0 - ci-build Sweden

Inera Core Implementation Guide - Local Development build (v0.2.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

: ConceptMap GetMedicationHistory TKB to FHIR MedicationStatement - JSON Representation

Draft as of 2026-01-09

Raw json | Download

{
  "resourceType" : "ConceptMap",
  "id" : "ConceptMapGetMedicationHistoryTKBToMedicationStatement",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: ConceptMap ConceptMapGetMedicationHistoryTKBToMedicationStatement</b></p><a name=\"ConceptMapGetMedicationHistoryTKBToMedicationStatement\"> </a><a name=\"hcConceptMapGetMedicationHistoryTKBToMedicationStatement\"> </a><p>Mapping from https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2 to <a href=\"http://hl7.org/fhir/R4/medicationstatement.html\">MedicationStatement</a></p><br/><p><b>Group 1 </b>Mapping from <code>https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2</code> to <a href=\"http://hl7.org/fhir/R4/bundle.html\">Bundle</a></p><table class=\"grid\"><tr><td><b>Source Code</b></td><td><b>Relationship</b></td><td><b>Target Code</b></td><td><b>Comment</b></td></tr><tr><td>patientId (Patient ID (personnummer/samordningsnummer))</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">Query parameter: GET /MedicationStatement?subject=Patient/191212121212</td></tr><tr><td>careUnitHSAId</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">Query parameter: GET /MedicationStatement?context.custodian=Organization/{hsaid}</td></tr><tr><td>datePeriod (Date period for medication)</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">Query parameter: GET /MedicationStatement?effective=ge2024-01-01&amp;effective=le2024-12-31</td></tr><tr><td>prescriptionChainId</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">Custom query parameter or filter by identifier</td></tr><tr><td>prescriptionStatus (Prescription status (Active/Inactive))</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">Query parameter: GET /MedicationStatement?status=active</td></tr></table><hr/><p><b>Group 2 </b>Mapping from <code>https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2</code> to <a href=\"http://hl7.org/fhir/R4/medicationstatement.html\">MedicationStatement</a></p><table class=\"grid\"><tr><td><b>Source Code</b></td><td><b>Relationship</b></td><td><b>Target Code</b></td><td><b>Comment</b></td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.documentId (Document ID (ordinations-id))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>identifier</td><td>Unique identifier for medication record. Maps to MedicationStatement.identifier</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.patientId (Patient ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>subject</td><td>Reference to Patient resource with Swedish national identifier</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.careContactId (Care contact ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>context</td><td>Reference to Encounter that prompted the medication record</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionId (Prescription ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>identifier</td><td>Unique identifier for prescription. Often same as documentId</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.typeOfPrescription (Type of prescription (I=Insättning, U=Utsättning))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#relatedto\" title=\"relatedto\">is related to</a></td><td>extension</td><td>Use extension for prescription type. I=start, U=stop. Map to status and statusReason</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionStatus (Prescription status (Active/Inactive))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>status</td><td>MedicationStatement status: active | completed | entered-in-error | intended | stopped | on-hold | unknown | not-taken</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionNote (Prescription note)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>note.text</td><td>Free text describing the prescription, why started or changed</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.principalPrescriptionReason.reason (Principal prescription reason (NKOO code))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>reasonCode</td><td>Primary reason for prescription. Use Socialstyrelsens NKOO CodeSystem</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.treatmentPurpose (Treatment purpose)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#wider\" title=\"wider\">maps to wider concept</a></td><td>note.text</td><td>Free text describing treatment purpose (e.g., 'For high blood pressure'). Add to note</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionChainId (Prescription chain ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#relatedto\" title=\"relatedto\">is related to</a></td><td>partOf</td><td>Links prescriptions in same chain. Use partOf to reference previous MedicationStatement or custom extension</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.startOfTreatment (Start of treatment)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>effectivePeriod.start</td><td>Date when patient should start taking medication</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.endOfTreatment (End of treatment)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>effectivePeriod.end</td><td>Date when patient should stop taking medication</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.endOfTreatmentReason (End of treatment reason)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>statusReason</td><td>Reason for stopping medication. Use when status=stopped</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.selfMedication (Self medication (patient-prescribed))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#relatedto\" title=\"relatedto\">is related to</a></td><td>informationSource</td><td>If true, informationSource references the Patient. If false, references Practitioner/prescriber</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.nplId (NPL product ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>medicationCodeableConcept.coding.code</td><td>Medication coded with NPL (Nationellt Produktregister för Läkemedel). CodeSystem: 1.2.752.129.2.1.5.1</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.atcCode (ATC code)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>medicationCodeableConcept.coding.code</td><td>ATC classification code. CodeSystem: http://www.whocc.no/atc</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.pharmaceuticalForm (Pharmaceutical form (tablett, kapsel, etc.))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>medicationReference.form</td><td>Form of medication. Reference Medication resource with form element using SIL codes</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.strength (Medication strength)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>medicationReference.ingredient.strength</td><td>Strength of medication (e.g., 20.0 mg). Reference Medication resource with ingredient details</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.routeOfAdministration (Route of administration)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>dosage.route</td><td>How medication is administered (oral, intravenous, etc.). Use SNOMED CT</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.dosageInstruction (Dosage instruction (patient-facing text))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>dosage.text</td><td>Free text instructions for patient</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.unitDose (Unit dose (tablett, ml, etc.))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>dosage.doseAndRate.doseQuantity.unit</td><td>Unit for dosage (e.g., tablett, ml). Use UCUM codes</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.shortNotation (Short dosage notation (e.g., 1x2))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#wider\" title=\"wider\">maps to wider concept</a></td><td>dosage.patientInstruction</td><td>Abbreviated dosage description. Add to dosage.text or patientInstruction</td></tr></table><hr/><p><b>Group 3 </b>Mapping from <code>https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2</code> to <a href=\"http://hl7.org/fhir/R4/provenance.html\">Provenance</a></p><table class=\"grid\"><tr><td><b>Source Code</b></td><td><b>Relationship</b></td><td><b>Target Code</b></td><td><b>Comment</b></td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.sourceSystemHSAId (Source system HSA-ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>entity.what</td><td>Provenance.entity.what references Device with HSA-ID. Provenance.entity.role = source</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.authorTime (Author time (documentation time))</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>recorded</td><td>When information was documented/updated in source system</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalHSAId (Documenting practitioner HSA-ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>agent.who</td><td>Provenance.agent (type=author) references Practitioner who documented</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalcareUnitHSAId (Care unit HSA-ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>agent.onBehalfOf</td><td>Provenance.agent.onBehalfOf references Organization (care unit)</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalcareGiverHSAId (Care giver HSA-ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#relatedto\" title=\"relatedto\">is related to</a></td><td>entity.what</td><td>Care giver organization. Create nested Provenance.entity for organizational hierarchy</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.legalAuthenticator.signatureTime (Signature time)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>signature.when</td><td>Provenance.signature.when for legal signature</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.legalAuthenticator.legalAuthenticatorHSAId (Signer HSA-ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>signature.who</td><td>Provenance.signature.who references Practitioner who signed</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriber.authorTime (Prescriber decision time)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>occurredDateTime</td><td>When prescription decision was made. Use separate Provenance for prescriber role</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriber.healthcareProfessionalHSAId (Prescriber HSA-ID)</td><td><a href=\"http://hl7.org/fhir/R5/codesystem-concept-map-relationship.html#equivalent\" title=\"equivalent\">is equivalent to</a></td><td>agent.who</td><td>Provenance.agent (type=prescriber or role=doctor) references Practitioner. Note: Different from documenter</td></tr></table><hr/><p><b>Group 4 </b>Mapping from <code>https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2</code> to <a href=\"http://hl7.org/fhir/R4/bundle.html\">Bundle</a></p><table class=\"grid\"><tr><td><b>Source Code</b></td><td><b>Relationship</b></td><td><b>Target Code</b></td><td><b>Comment</b></td></tr><tr><td>result.resultCode (Result code (OK/INFO/ERROR))</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">Query result metadata. Use Bundle.entry.response for errors or OperationOutcome</td></tr><tr><td>result.errorCode (Error code)</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">Error details in OperationOutcome if resultCode=ERROR</td></tr><tr><td>result.logId (Log ID (UUID for troubleshooting))</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">Tracing ID. Can be included in OperationOutcome.issue.diagnostics</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.nullified (Nullified flag)</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">If true, MedicationStatement should be marked entered-in-error or not included in results</td></tr><tr><td>medicationMedicalRecord.medicationMedicalRecordHeader.approvedForPatient (Approved for patient access)</td><td colspan=\"2\" style=\"background-color: #efefef\">(not mapped)</td><td style=\"background-color: #efefef\">PDL/GDPR consent flag. Handle in access control layer, not in resource data</td></tr></table></div>"
  },
  "url" : "https://inera.se/fhir/core/ConceptMap/getmedicationhistory-tkb-to-medicationstatement",
  "version" : "0.2.0",
  "name" : "ConceptMapGetMedicationHistoryTKBToMedicationStatement",
  "title" : "ConceptMap GetMedicationHistory TKB to FHIR MedicationStatement",
  "status" : "draft",
  "experimental" : true,
  "date" : "2026-01-09",
  "publisher" : "Inera AB",
  "contact" : [
    {
      "name" : "Inera AB",
      "telecom" : [
        {
          "system" : "url",
          "value" : "https://www.inera.se"
        },
        {
          "system" : "email",
          "value" : "info@inera.se"
        }
      ]
    },
    {
      "name" : "Inera AB",
      "telecom" : [
        {
          "system" : "url",
          "value" : "https://www.inera.se"
        },
        {
          "system" : "email",
          "value" : "info@inera.se"
        }
      ]
    }
  ],
  "description" : "Mapping from GetMedicationHistory v2.0 TKB service to FHIR MedicationStatement and Provenance resources.\n\n**TKB Service**: GetMedicationHistory v2.0  \n**TKB Domain**: clinicalprocess:activityprescription:actoutcome v2.0\n**Logical Model**: GetMedicationHistoryResponseLM\n**FHIR Resources**: MedicationStatement (primary), Medication, Provenance (metadata)\n\n**Mapping Coverage**:\n- ✅ Header metadata: 20+ elements (document ID, patient, author, signer, care contact)\n- ✅ Prescription data: 15+ elements (prescription ID, type, status, reason, treatment period)\n- ✅ Drug information: NPL-ID, ATC codes, strength, pharmaceutical form\n- ⚠️ Dosage: High-level mapping (detailed dosage structures in Dosage datatype are complex)\n\n**Note**: Dosage mappings cover core structures (setDosage, conditionalDosage, rampedDosage) but \ndetailed sub-elements require careful transformation according to FHIR Dosage datatype specification.",
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "urn:iso:std:iso:3166",
          "code" : "SE",
          "display" : "Sweden"
        }
      ]
    }
  ],
  "sourceUri" : "https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2",
  "targetCanonical" : "http://hl7.org/fhir/StructureDefinition/MedicationStatement",
  "group" : [
    {
      "source" : "https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2",
      "target" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "element" : [
        {
          "code" : "patientId",
          "display" : "Patient ID (personnummer/samordningsnummer)",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "Query parameter: GET /MedicationStatement?subject=Patient/191212121212"
            }
          ]
        },
        {
          "code" : "careUnitHSAId",
          "display" : "Care unit HSA-ID",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "Query parameter: GET /MedicationStatement?context.custodian=Organization/{hsaid}"
            }
          ]
        },
        {
          "code" : "datePeriod",
          "display" : "Date period for medication",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "Query parameter: GET /MedicationStatement?effective=ge2024-01-01&effective=le2024-12-31"
            }
          ]
        },
        {
          "code" : "prescriptionChainId",
          "display" : "Prescription chain ID",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "Custom query parameter or filter by identifier"
            }
          ]
        },
        {
          "code" : "prescriptionStatus",
          "display" : "Prescription status (Active/Inactive)",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "Query parameter: GET /MedicationStatement?status=active"
            }
          ]
        }
      ]
    },
    {
      "source" : "https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2",
      "target" : "http://hl7.org/fhir/StructureDefinition/MedicationStatement",
      "element" : [
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.documentId",
          "display" : "Document ID (ordinations-id)",
          "target" : [
            {
              "code" : "identifier",
              "equivalence" : "equivalent",
              "comment" : "Unique identifier for medication record. Maps to MedicationStatement.identifier"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.patientId",
          "display" : "Patient ID",
          "target" : [
            {
              "code" : "subject",
              "equivalence" : "equivalent",
              "comment" : "Reference to Patient resource with Swedish national identifier"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.careContactId",
          "display" : "Care contact ID",
          "target" : [
            {
              "code" : "context",
              "equivalence" : "equivalent",
              "comment" : "Reference to Encounter that prompted the medication record"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionId",
          "display" : "Prescription ID",
          "target" : [
            {
              "code" : "identifier",
              "equivalence" : "equivalent",
              "comment" : "Unique identifier for prescription. Often same as documentId"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.typeOfPrescription",
          "display" : "Type of prescription (I=Insättning, U=Utsättning)",
          "target" : [
            {
              "code" : "extension",
              "equivalence" : "relatedto",
              "comment" : "Use extension for prescription type. I=start, U=stop. Map to status and statusReason"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionStatus",
          "display" : "Prescription status (Active/Inactive)",
          "target" : [
            {
              "code" : "status",
              "equivalence" : "equivalent",
              "comment" : "MedicationStatement status: active | completed | entered-in-error | intended | stopped | on-hold | unknown | not-taken"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionNote",
          "display" : "Prescription note",
          "target" : [
            {
              "code" : "note.text",
              "equivalence" : "equivalent",
              "comment" : "Free text describing the prescription, why started or changed"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.principalPrescriptionReason.reason",
          "display" : "Principal prescription reason (NKOO code)",
          "target" : [
            {
              "code" : "reasonCode",
              "equivalence" : "equivalent",
              "comment" : "Primary reason for prescription. Use Socialstyrelsens NKOO CodeSystem"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.treatmentPurpose",
          "display" : "Treatment purpose",
          "target" : [
            {
              "code" : "note.text",
              "equivalence" : "wider",
              "comment" : "Free text describing treatment purpose (e.g., 'For high blood pressure'). Add to note"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionChainId",
          "display" : "Prescription chain ID",
          "target" : [
            {
              "code" : "partOf",
              "equivalence" : "relatedto",
              "comment" : "Links prescriptions in same chain. Use partOf to reference previous MedicationStatement or custom extension"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.startOfTreatment",
          "display" : "Start of treatment",
          "target" : [
            {
              "code" : "effectivePeriod.start",
              "equivalence" : "equivalent",
              "comment" : "Date when patient should start taking medication"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.endOfTreatment",
          "display" : "End of treatment",
          "target" : [
            {
              "code" : "effectivePeriod.end",
              "equivalence" : "equivalent",
              "comment" : "Date when patient should stop taking medication"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.endOfTreatmentReason",
          "display" : "End of treatment reason",
          "target" : [
            {
              "code" : "statusReason",
              "equivalence" : "equivalent",
              "comment" : "Reason for stopping medication. Use when status=stopped"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.selfMedication",
          "display" : "Self medication (patient-prescribed)",
          "target" : [
            {
              "code" : "informationSource",
              "equivalence" : "relatedto",
              "comment" : "If true, informationSource references the Patient. If false, references Practitioner/prescriber"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.nplId",
          "display" : "NPL product ID",
          "target" : [
            {
              "code" : "medicationCodeableConcept.coding.code",
              "equivalence" : "equivalent",
              "comment" : "Medication coded with NPL (Nationellt Produktregister för Läkemedel). CodeSystem: 1.2.752.129.2.1.5.1"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.atcCode",
          "display" : "ATC code",
          "target" : [
            {
              "code" : "medicationCodeableConcept.coding.code",
              "equivalence" : "equivalent",
              "comment" : "ATC classification code. CodeSystem: http://www.whocc.no/atc"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.pharmaceuticalForm",
          "display" : "Pharmaceutical form (tablett, kapsel, etc.)",
          "target" : [
            {
              "code" : "medicationReference.form",
              "equivalence" : "equivalent",
              "comment" : "Form of medication. Reference Medication resource with form element using SIL codes"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.strength",
          "display" : "Medication strength",
          "target" : [
            {
              "code" : "medicationReference.ingredient.strength",
              "equivalence" : "equivalent",
              "comment" : "Strength of medication (e.g., 20.0 mg). Reference Medication resource with ingredient details"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.routeOfAdministration",
          "display" : "Route of administration",
          "target" : [
            {
              "code" : "dosage.route",
              "equivalence" : "equivalent",
              "comment" : "How medication is administered (oral, intravenous, etc.). Use SNOMED CT"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.dosageInstruction",
          "display" : "Dosage instruction (patient-facing text)",
          "target" : [
            {
              "code" : "dosage.text",
              "equivalence" : "equivalent",
              "comment" : "Free text instructions for patient"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.unitDose",
          "display" : "Unit dose (tablett, ml, etc.)",
          "target" : [
            {
              "code" : "dosage.doseAndRate.doseQuantity.unit",
              "equivalence" : "equivalent",
              "comment" : "Unit for dosage (e.g., tablett, ml). Use UCUM codes"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.shortNotation",
          "display" : "Short dosage notation (e.g., 1x2)",
          "target" : [
            {
              "code" : "dosage.patientInstruction",
              "equivalence" : "wider",
              "comment" : "Abbreviated dosage description. Add to dosage.text or patientInstruction"
            }
          ]
        }
      ]
    },
    {
      "source" : "https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2",
      "target" : "http://hl7.org/fhir/StructureDefinition/Provenance",
      "element" : [
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.sourceSystemHSAId",
          "display" : "Source system HSA-ID",
          "target" : [
            {
              "code" : "entity.what",
              "equivalence" : "equivalent",
              "comment" : "Provenance.entity.what references Device with HSA-ID. Provenance.entity.role = source"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.authorTime",
          "display" : "Author time (documentation time)",
          "target" : [
            {
              "code" : "recorded",
              "equivalence" : "equivalent",
              "comment" : "When information was documented/updated in source system"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalHSAId",
          "display" : "Documenting practitioner HSA-ID",
          "target" : [
            {
              "code" : "agent.who",
              "equivalence" : "equivalent",
              "comment" : "Provenance.agent (type=author) references Practitioner who documented"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalcareUnitHSAId",
          "display" : "Care unit HSA-ID",
          "target" : [
            {
              "code" : "agent.onBehalfOf",
              "equivalence" : "equivalent",
              "comment" : "Provenance.agent.onBehalfOf references Organization (care unit)"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalcareGiverHSAId",
          "display" : "Care giver HSA-ID",
          "target" : [
            {
              "code" : "entity.what",
              "equivalence" : "relatedto",
              "comment" : "Care giver organization. Create nested Provenance.entity for organizational hierarchy"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.legalAuthenticator.signatureTime",
          "display" : "Signature time",
          "target" : [
            {
              "code" : "signature.when",
              "equivalence" : "equivalent",
              "comment" : "Provenance.signature.when for legal signature"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.legalAuthenticator.legalAuthenticatorHSAId",
          "display" : "Signer HSA-ID",
          "target" : [
            {
              "code" : "signature.who",
              "equivalence" : "equivalent",
              "comment" : "Provenance.signature.who references Practitioner who signed"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriber.authorTime",
          "display" : "Prescriber decision time",
          "target" : [
            {
              "code" : "occurredDateTime",
              "equivalence" : "equivalent",
              "comment" : "When prescription decision was made. Use separate Provenance for prescriber role"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriber.healthcareProfessionalHSAId",
          "display" : "Prescriber HSA-ID",
          "target" : [
            {
              "code" : "agent.who",
              "equivalence" : "equivalent",
              "comment" : "Provenance.agent (type=prescriber or role=doctor) references Practitioner. Note: Different from documenter"
            }
          ]
        }
      ]
    },
    {
      "source" : "https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2",
      "target" : "http://hl7.org/fhir/StructureDefinition/Bundle",
      "element" : [
        {
          "code" : "result.resultCode",
          "display" : "Result code (OK/INFO/ERROR)",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "Query result metadata. Use Bundle.entry.response for errors or OperationOutcome"
            }
          ]
        },
        {
          "code" : "result.errorCode",
          "display" : "Error code",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "Error details in OperationOutcome if resultCode=ERROR"
            }
          ]
        },
        {
          "code" : "result.logId",
          "display" : "Log ID (UUID for troubleshooting)",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "Tracing ID. Can be included in OperationOutcome.issue.diagnostics"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.nullified",
          "display" : "Nullified flag",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "If true, MedicationStatement should be marked entered-in-error or not included in results"
            }
          ]
        },
        {
          "code" : "medicationMedicalRecord.medicationMedicalRecordHeader.approvedForPatient",
          "display" : "Approved for patient access",
          "target" : [
            {
              "equivalence" : "unmatched",
              "comment" : "PDL/GDPR consent flag. Handle in access control layer, not in resource data"
            }
          ]
        }
      ]
    }
  ]
}