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 - XML Representation

Draft as of 2026-01-09

Raw xml | Download


<ConceptMap xmlns="http://hl7.org/fhir">
  <id value="ConceptMapGetMedicationHistoryTKBToMedicationStatement"/>
  <text>
    <status value="generated"/>
    <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>
  </text>
  <url
       value="https://inera.se/fhir/core/ConceptMap/getmedicationhistory-tkb-to-medicationstatement"/>
  <version value="0.2.0"/>
  <name value="ConceptMapGetMedicationHistoryTKBToMedicationStatement"/>
  <title
         value="ConceptMap GetMedicationHistory TKB to FHIR MedicationStatement"/>
  <status value="draft"/>
  <experimental value="true"/>
  <date value="2026-01-09"/>
  <publisher value="Inera AB"/>
  <contact>
    <name value="Inera AB"/>
    <telecom>
      <system value="url"/>
      <value value="https://www.inera.se"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="info@inera.se"/>
    </telecom>
  </contact>
  <contact>
    <name value="Inera AB"/>
    <telecom>
      <system value="url"/>
      <value value="https://www.inera.se"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="info@inera.se"/>
    </telecom>
  </contact>
  <description
               value="Mapping from GetMedicationHistory v2.0 TKB service to FHIR MedicationStatement and Provenance resources.

**TKB Service**: GetMedicationHistory v2.0  
**TKB Domain**: clinicalprocess:activityprescription:actoutcome v2.0
**Logical Model**: GetMedicationHistoryResponseLM
**FHIR Resources**: MedicationStatement (primary), Medication, Provenance (metadata)

**Mapping Coverage**:
- ✅ Header metadata: 20+ elements (document ID, patient, author, signer, care contact)
- ✅ Prescription data: 15+ elements (prescription ID, type, status, reason, treatment period)
- ✅ Drug information: NPL-ID, ATC codes, strength, pharmaceutical form
- ⚠️ Dosage: High-level mapping (detailed dosage structures in Dosage datatype are complex)

**Note**: Dosage mappings cover core structures (setDosage, conditionalDosage, rampedDosage) but 
detailed sub-elements require careful transformation according to FHIR Dosage datatype specification."/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="SE"/>
      <display value="Sweden"/>
    </coding>
  </jurisdiction>
  <sourceUri
             value="https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2"/>
  <targetCanonical
                   value="http://hl7.org/fhir/StructureDefinition/MedicationStatement"/>
  <group>
    <source
            value="https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2"/>
    <target value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
    <element>
      <code value="patientId"/>
      <display value="Patient ID (personnummer/samordningsnummer)"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="Query parameter: GET /MedicationStatement?subject=Patient/191212121212"/>
      </target>
    </element>
    <element>
      <code value="careUnitHSAId"/>
      <display value="Care unit HSA-ID"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="Query parameter: GET /MedicationStatement?context.custodian=Organization/{hsaid}"/>
      </target>
    </element>
    <element>
      <code value="datePeriod"/>
      <display value="Date period for medication"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="Query parameter: GET /MedicationStatement?effective=ge2024-01-01&amp;effective=le2024-12-31"/>
      </target>
    </element>
    <element>
      <code value="prescriptionChainId"/>
      <display value="Prescription chain ID"/>
      <target>
        <equivalence value="unmatched"/>
        <comment value="Custom query parameter or filter by identifier"/>
      </target>
    </element>
    <element>
      <code value="prescriptionStatus"/>
      <display value="Prescription status (Active/Inactive)"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="Query parameter: GET /MedicationStatement?status=active"/>
      </target>
    </element>
  </group>
  <group>
    <source
            value="https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2"/>
    <target
            value="http://hl7.org/fhir/StructureDefinition/MedicationStatement"/>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.documentId"/>
      <display value="Document ID (ordinations-id)"/>
      <target>
        <code value="identifier"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Unique identifier for medication record. Maps to MedicationStatement.identifier"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.patientId"/>
      <display value="Patient ID"/>
      <target>
        <code value="subject"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Reference to Patient resource with Swedish national identifier"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.careContactId"/>
      <display value="Care contact ID"/>
      <target>
        <code value="context"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Reference to Encounter that prompted the medication record"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionId"/>
      <display value="Prescription ID"/>
      <target>
        <code value="identifier"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Unique identifier for prescription. Often same as documentId"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.typeOfPrescription"/>
      <display value="Type of prescription (I=Insättning, U=Utsättning)"/>
      <target>
        <code value="extension"/>
        <equivalence value="relatedto"/>
        <comment
                 value="Use extension for prescription type. I=start, U=stop. Map to status and statusReason"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionStatus"/>
      <display value="Prescription status (Active/Inactive)"/>
      <target>
        <code value="status"/>
        <equivalence value="equivalent"/>
        <comment
                 value="MedicationStatement status: active | completed | entered-in-error | intended | stopped | on-hold | unknown | not-taken"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionNote"/>
      <display value="Prescription note"/>
      <target>
        <code value="note.text"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Free text describing the prescription, why started or changed"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.principalPrescriptionReason.reason"/>
      <display value="Principal prescription reason (NKOO code)"/>
      <target>
        <code value="reasonCode"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Primary reason for prescription. Use Socialstyrelsens NKOO CodeSystem"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.treatmentPurpose"/>
      <display value="Treatment purpose"/>
      <target>
        <code value="note.text"/>
        <equivalence value="wider"/>
        <comment
                 value="Free text describing treatment purpose (e.g., 'For high blood pressure'). Add to note"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriptionChainId"/>
      <display value="Prescription chain ID"/>
      <target>
        <code value="partOf"/>
        <equivalence value="relatedto"/>
        <comment
                 value="Links prescriptions in same chain. Use partOf to reference previous MedicationStatement or custom extension"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.startOfTreatment"/>
      <display value="Start of treatment"/>
      <target>
        <code value="effectivePeriod.start"/>
        <equivalence value="equivalent"/>
        <comment value="Date when patient should start taking medication"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.endOfTreatment"/>
      <display value="End of treatment"/>
      <target>
        <code value="effectivePeriod.end"/>
        <equivalence value="equivalent"/>
        <comment value="Date when patient should stop taking medication"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.endOfTreatmentReason"/>
      <display value="End of treatment reason"/>
      <target>
        <code value="statusReason"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Reason for stopping medication. Use when status=stopped"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.selfMedication"/>
      <display value="Self medication (patient-prescribed)"/>
      <target>
        <code value="informationSource"/>
        <equivalence value="relatedto"/>
        <comment
                 value="If true, informationSource references the Patient. If false, references Practitioner/prescriber"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.nplId"/>
      <display value="NPL product ID"/>
      <target>
        <code value="medicationCodeableConcept.coding.code"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Medication coded with NPL (Nationellt Produktregister för Läkemedel). CodeSystem: 1.2.752.129.2.1.5.1"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.atcCode"/>
      <display value="ATC code"/>
      <target>
        <code value="medicationCodeableConcept.coding.code"/>
        <equivalence value="equivalent"/>
        <comment
                 value="ATC classification code. CodeSystem: http://www.whocc.no/atc"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.pharmaceuticalForm"/>
      <display value="Pharmaceutical form (tablett, kapsel, etc.)"/>
      <target>
        <code value="medicationReference.form"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Form of medication. Reference Medication resource with form element using SIL codes"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.strength"/>
      <display value="Medication strength"/>
      <target>
        <code value="medicationReference.ingredient.strength"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Strength of medication (e.g., 20.0 mg). Reference Medication resource with ingredient details"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.drug.routeOfAdministration"/>
      <display value="Route of administration"/>
      <target>
        <code value="dosage.route"/>
        <equivalence value="equivalent"/>
        <comment
                 value="How medication is administered (oral, intravenous, etc.). Use SNOMED CT"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.dosageInstruction"/>
      <display value="Dosage instruction (patient-facing text)"/>
      <target>
        <code value="dosage.text"/>
        <equivalence value="equivalent"/>
        <comment value="Free text instructions for patient"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.unitDose"/>
      <display value="Unit dose (tablett, ml, etc.)"/>
      <target>
        <code value="dosage.doseAndRate.doseQuantity.unit"/>
        <equivalence value="equivalent"/>
        <comment value="Unit for dosage (e.g., tablett, ml). Use UCUM codes"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.drug.dosage.shortNotation"/>
      <display value="Short dosage notation (e.g., 1x2)"/>
      <target>
        <code value="dosage.patientInstruction"/>
        <equivalence value="wider"/>
        <comment
                 value="Abbreviated dosage description. Add to dosage.text or patientInstruction"/>
      </target>
    </element>
  </group>
  <group>
    <source
            value="https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2"/>
    <target value="http://hl7.org/fhir/StructureDefinition/Provenance"/>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.sourceSystemHSAId"/>
      <display value="Source system HSA-ID"/>
      <target>
        <code value="entity.what"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Provenance.entity.what references Device with HSA-ID. Provenance.entity.role = source"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.authorTime"/>
      <display value="Author time (documentation time)"/>
      <target>
        <code value="recorded"/>
        <equivalence value="equivalent"/>
        <comment
                 value="When information was documented/updated in source system"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalHSAId"/>
      <display value="Documenting practitioner HSA-ID"/>
      <target>
        <code value="agent.who"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Provenance.agent (type=author) references Practitioner who documented"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalcareUnitHSAId"/>
      <display value="Care unit HSA-ID"/>
      <target>
        <code value="agent.onBehalfOf"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Provenance.agent.onBehalfOf references Organization (care unit)"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.accountableHealthcareProfessional.healthcareProfessionalcareGiverHSAId"/>
      <display value="Care giver HSA-ID"/>
      <target>
        <code value="entity.what"/>
        <equivalence value="relatedto"/>
        <comment
                 value="Care giver organization. Create nested Provenance.entity for organizational hierarchy"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.legalAuthenticator.signatureTime"/>
      <display value="Signature time"/>
      <target>
        <code value="signature.when"/>
        <equivalence value="equivalent"/>
        <comment value="Provenance.signature.when for legal signature"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.legalAuthenticator.legalAuthenticatorHSAId"/>
      <display value="Signer HSA-ID"/>
      <target>
        <code value="signature.who"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Provenance.signature.who references Practitioner who signed"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriber.authorTime"/>
      <display value="Prescriber decision time"/>
      <target>
        <code value="occurredDateTime"/>
        <equivalence value="equivalent"/>
        <comment
                 value="When prescription decision was made. Use separate Provenance for prescriber role"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordBody.medicationPrescription.prescriber.healthcareProfessionalHSAId"/>
      <display value="Prescriber HSA-ID"/>
      <target>
        <code value="agent.who"/>
        <equivalence value="equivalent"/>
        <comment
                 value="Provenance.agent (type=prescriber or role=doctor) references Practitioner. Note: Different from documenter"/>
      </target>
    </element>
  </group>
  <group>
    <source
            value="https://rivta.se/domains/clinicalprocess/activityprescription/actoutcome/GetMedicationHistoryResponder/2"/>
    <target value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
    <element>
      <code value="result.resultCode"/>
      <display value="Result code (OK/INFO/ERROR)"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="Query result metadata. Use Bundle.entry.response for errors or OperationOutcome"/>
      </target>
    </element>
    <element>
      <code value="result.errorCode"/>
      <display value="Error code"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="Error details in OperationOutcome if resultCode=ERROR"/>
      </target>
    </element>
    <element>
      <code value="result.logId"/>
      <display value="Log ID (UUID for troubleshooting)"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="Tracing ID. Can be included in OperationOutcome.issue.diagnostics"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.nullified"/>
      <display value="Nullified flag"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="If true, MedicationStatement should be marked entered-in-error or not included in results"/>
      </target>
    </element>
    <element>
      <code
            value="medicationMedicalRecord.medicationMedicalRecordHeader.approvedForPatient"/>
      <display value="Approved for patient access"/>
      <target>
        <equivalence value="unmatched"/>
        <comment
                 value="PDL/GDPR consent flag. Handle in access control layer, not in resource data"/>
      </target>
    </element>
  </group>
</ConceptMap>