PackagesCanonicalsLogsProblems
    Packages
    rs/de.gematik.erp.t@prescription-0.1.0-rc1
    https://gematik.de/fhir/erp-t-prescription/StructureMap/ERP-TPrescription-StructureMap-CarbonCopy
{
  "description": "Maps resources to BfArM T-Prescription CarbonCopy format. Detailed information can be found in [This page](./t-mapping.html)",
  "_filename": "StructureMap-ERP-TPrescription-StructureMap-CarbonCopy.json",
  "package_name": "rs/de.gematik.erp.t",
  "date": "2025-07-01",
  "group": [ {
    "name": "erpTPrescriptionCarbonCopy",
    "rule": [ {
      "name": "tgtMeta",
      "rule": [ {
        "name": "tgtMetaProfile",
        "source": [ {
          "context": "bundle"
        } ],
        "target": [ {
          "context": "erpTCarbonCopyMeta",
          "element": "profile",
          "parameter": [ {
            "valueString": "https://gematik.de/fhir/erp-t-prescription/StructureDefinition/erp-tprescription-carbon-copy"
          } ],
          "transform": "copy",
          "contextType": "variable"
        } ]
      } ],
      "source": [ {
        "context": "bundle"
      } ],
      "target": [ {
        "context": "erpTCarbonCopy",
        "element": "meta",
        "variable": "erpTCarbonCopyMeta",
        "contextType": "variable"
      } ],
      "documentation": "TODO"
    }, {
      "name": "rxPrescriptionRule",
      "rule": [ {
        "name": "bundleEntries",
        "rule": [ {
          "name": "rxPrescriptionParameter",
          "rule": [ {
            "name": "parameterrXPrescriptionPart",
            "rule": [ {
              "name": "parameterrXPrescriptionPartIdentifier",
              "source": [ {
                "context": "srcEntryTaskVar"
              } ],
              "dependent": [ {
                "name": "erpTTaskMapping",
                "variable": [ "srcEntryTaskVar", "newIdentifier" ]
              } ]
            } ],
            "source": [ {
              "context": "srcEntryResourceVar",
              "variable": "srcEntryTaskVar",
              "condition": "ofType(Task)"
            } ],
            "target": [ {
              "context": "tgtRxPrescriptionPartId",
              "element": "name",
              "parameter": [ {
                "valueString": "prescriptionId"
              } ],
              "transform": "copy",
              "contextType": "variable"
            }, {
              "context": "tgtRxPrescriptionPartId",
              "element": "value",
              "variable": "newIdentifier",
              "parameter": [ {
                "valueString": "Identifier"
              } ],
              "transform": "create",
              "contextType": "variable"
            } ]
          }, {
            "name": "entryMedicationRequest",
            "rule": [ {
              "name": "entryMedicationRequestPart",
              "rule": [ {
                "name": "entryMedicationRequestPartResourceSet",
                "source": [ {
                  "context": "srcEntryBundleMRVar"
                } ],
                "dependent": [ {
                  "name": "erpTRequestMapping",
                  "variable": [ "srcEntryBundleMRVar", "newMedicationRequest" ]
                } ]
              } ],
              "source": [ {
                "context": "srcEntryBundleMRVar"
              } ],
              "target": [ {
                "context": "tgtRxPrescriptionPartMR",
                "element": "resource",
                "variable": "newMedicationRequest",
                "parameter": [ {
                  "valueString": "MedicationRequest"
                } ],
                "transform": "create",
                "contextType": "variable"
              } ]
            } ],
            "source": [ {
              "context": "srcEntryResourceVar",
              "variable": "srcEntryBundleMRVar",
              "condition": "ofType(MedicationRequest)"
            } ],
            "target": [ {
              "context": "tgtRxPrescriptionPartMR",
              "element": "name",
              "parameter": [ {
                "valueString": "medicationRequest"
              } ],
              "transform": "copy",
              "contextType": "variable"
            } ]
          }, {
            "name": "entryMedicationRequestMedication",
            "rule": [ {
              "name": "prepMedication",
              "rule": [ {
                "name": "entryMedicationPrescriptionMedicationPart",
                "rule": [ {
                  "name": "entryMedicationPrescriptionMedicationPartResourceSet",
                  "source": [ {
                    "context": "srcEntryBundleMRMedIdVar",
                    "element": "resource",
                    "variable": "srcEntryBundleMRMedIdVarRes"
                  } ],
                  "dependent": [ {
                    "name": "erpTMedicationMapping",
                    "variable": [ "srcEntryBundleMRMedIdVarRes", "newMedicationPrescriptionMedication" ]
                  } ]
                } ],
                "source": [ {
                  "context": "srcEntryVar2",
                  "variable": "srcEntryBundleMRMedIdVar",
                  "condition": "resource.ofType(Medication).where(id=%srcMedicationRequestId.resource.medication.reference.replace('Medication/', '').toString())"
                } ],
                "target": [ {
                  "context": "tgtRxPrescriptionPartMed",
                  "element": "resource",
                  "variable": "newMedicationPrescriptionMedication",
                  "parameter": [ {
                    "valueString": "Medication"
                  } ],
                  "transform": "create",
                  "contextType": "variable"
                } ]
              } ],
              "source": [ {
                "context": "bundle",
                "element": "entry",
                "variable": "srcEntryVar2"
              } ]
            } ],
            "source": [ {
              "context": "srcEntryVar",
              "variable": "srcMedicationRequestId",
              "condition": "resource.ofType(MedicationRequest)"
            } ],
            "target": [ {
              "context": "tgtRxPrescriptionPartMed",
              "element": "name",
              "parameter": [ {
                "valueString": "medication"
              } ],
              "transform": "copy",
              "contextType": "variable"
            } ]
          } ],
          "source": [ {
            "context": "srcEntryVar",
            "element": "resource",
            "variable": "srcEntryResourceVar"
          } ]
        } ],
        "source": [ {
          "context": "bundle",
          "element": "entry",
          "variable": "srcEntryVar"
        } ]
      } ],
      "source": [ {
        "context": "bundle"
      } ],
      "target": [ {
        "context": "erpTCarbonCopy",
        "element": "parameter",
        "variable": "tgtRxPrescription",
        "contextType": "variable"
      }, {
        "context": "tgtRxPrescription",
        "element": "part",
        "variable": "tgtRxPrescriptionPartId",
        "contextType": "variable"
      }, {
        "context": "tgtRxPrescription",
        "element": "part",
        "variable": "tgtRxPrescriptionPartMR",
        "contextType": "variable"
      }, {
        "context": "tgtRxPrescription",
        "element": "part",
        "variable": "tgtRxPrescriptionPartMed",
        "contextType": "variable"
      }, {
        "context": "tgtRxPrescription",
        "element": "name",
        "parameter": [ {
          "valueString": "rxPrescription"
        } ],
        "transform": "copy",
        "contextType": "variable"
      } ]
    }, {
      "name": "MedicationDispenseFromBundle",
      "rule": [ {
        "name": "bundleEntries",
        "rule": [ {
          "name": "rxDispensationParameter",
          "rule": [ {
            "name": "entryVZDSearchSet",
            "rule": [ {
              "name": "entryOrganizationPart",
              "rule": [ {
                "name": "entryOrganizationPartResourceSet",
                "source": [ {
                  "context": "srcEntryBundleOrgVar"
                } ],
                "dependent": [ {
                  "name": "erpTOrganizationMapping",
                  "variable": [ "srcEntryBundleOrgVar", "newOrganization" ]
                } ]
              } ],
              "source": [ {
                "context": "srcEntryBundleOrgVar"
              } ],
              "target": [ {
                "context": "tgtRxDispensationPartOrg",
                "element": "resource",
                "variable": "newOrganization",
                "parameter": [ {
                  "valueString": "Organization"
                } ],
                "transform": "create",
                "contextType": "variable"
              } ]
            } ],
            "source": [ {
              "context": "srcEntryResourceVar",
              "variable": "srcEntryBundleOrgVar",
              "condition": "ofType(Bundle).where(entry.first().fullUrl.contains('fhir-directory'))"
            } ],
            "target": [ {
              "context": "tgtRxDispensationPartOrg",
              "element": "name",
              "parameter": [ {
                "valueString": "organization"
              } ],
              "transform": "copy",
              "contextType": "variable"
            } ]
          }, {
            "name": "entryMedicationDispense",
            "rule": [ {
              "name": "entryMedicationDispensePart",
              "rule": [ {
                "name": "entryMedicationDispensePartResourceSet",
                "source": [ {
                  "context": "srcEntryBundleMDVar"
                } ],
                "dependent": [ {
                  "name": "erpTDispenseMapping",
                  "variable": [ "srcEntryBundleMDVar", "newMedicationDispense" ]
                } ]
              } ],
              "source": [ {
                "context": "srcEntryBundleMDVar"
              } ],
              "target": [ {
                "context": "tgtRxDispensationPartMD",
                "element": "name",
                "parameter": [ {
                  "valueString": "medicationDispense"
                } ],
                "transform": "copy",
                "contextType": "variable"
              }, {
                "context": "tgtRxDispensationPartMD",
                "element": "resource",
                "variable": "newMedicationDispense",
                "parameter": [ {
                  "valueString": "MedicationDispense"
                } ],
                "transform": "create",
                "contextType": "variable"
              } ]
            } ],
            "source": [ {
              "context": "srcEntryResourceVar",
              "variable": "srcEntryBundleMDVar",
              "condition": "ofType(MedicationDispense)"
            } ],
            "target": [ {
              "context": "tgtRxDispensation",
              "element": "part",
              "variable": "tgtRxDispensationPartMD",
              "contextType": "variable"
            } ]
          }, {
            "name": "entryMedicationDispenseMedication",
            "rule": [ {
              "name": "prepMedication",
              "rule": [ {
                "name": "entryMedicationDispensationMedicationPart",
                "rule": [ {
                  "name": "entryMedicationDispensationMedicationPartResourceSet",
                  "source": [ {
                    "context": "srcEntryBundleMDMedIdVar",
                    "element": "resource",
                    "variable": "srcEntryBundleMDMedIdVarRes"
                  } ],
                  "dependent": [ {
                    "name": "erpTMedicationMapping",
                    "variable": [ "srcEntryBundleMDMedIdVarRes", "newMedicationDispensationMedication" ]
                  } ]
                } ],
                "source": [ {
                  "context": "srcEntryVar2",
                  "variable": "srcEntryBundleMDMedIdVar",
                  "condition": "resource.ofType(Medication).where(id=%srcMedicationDispenseId.resource.medication.reference.replace('Medication/', '').toString())"
                } ],
                "target": [ {
                  "context": "tgtRxDispensationPartDispMed",
                  "element": "resource",
                  "variable": "newMedicationDispensationMedication",
                  "parameter": [ {
                    "valueString": "Medication"
                  } ],
                  "transform": "create",
                  "contextType": "variable"
                } ]
              } ],
              "source": [ {
                "context": "bundle",
                "element": "entry",
                "variable": "srcEntryVar2"
              } ]
            } ],
            "source": [ {
              "context": "srcEntryVar",
              "variable": "srcMedicationDispenseId",
              "condition": "resource.ofType(MedicationDispense)"
            } ],
            "target": [ {
              "context": "tgtRxDispensation",
              "element": "part",
              "variable": "tgtRxDispensationPartDispMed",
              "contextType": "variable"
            }, {
              "context": "tgtRxDispensationPartDispMed",
              "element": "name",
              "parameter": [ {
                "valueString": "medication"
              } ],
              "transform": "copy",
              "contextType": "variable"
            } ]
          } ],
          "source": [ {
            "context": "srcEntryVar",
            "element": "resource",
            "variable": "srcEntryResourceVar"
          } ]
        } ],
        "source": [ {
          "context": "bundle",
          "element": "entry",
          "variable": "srcEntryVar"
        } ]
      } ],
      "source": [ {
        "context": "bundle"
      } ],
      "target": [ {
        "context": "erpTCarbonCopy",
        "element": "parameter",
        "variable": "tgtRxDispensation",
        "contextType": "variable"
      }, {
        "context": "tgtRxDispensation",
        "element": "part",
        "variable": "tgtRxDispensationPartOrg",
        "contextType": "variable"
      }, {
        "context": "tgtRxDispensation",
        "element": "name",
        "parameter": [ {
          "valueString": "rxDispensation"
        } ],
        "transform": "copy",
        "contextType": "variable"
      } ]
    } ],
    "input": [ {
      "mode": "source",
      "name": "bundle",
      "type": "bundle"
    }, {
      "mode": "target",
      "name": "erpTCarbonCopy",
      "type": "erpTCarbonCopy"
    } ],
    "typeMode": "none",
    "documentation": "Mapping group for Bundle to CarbonCopy for rxDispensation"
  } ],
  "publisher": "gematik GmbH",
  "jurisdiction": [ {
    "coding": [ {
      "code": "DE",
      "system": "urn:iso:std:iso:3166",
      "display": "Germany"
    } ]
  } ],
  "name": "ERP-TPrescription-StructureMap-CarbonCopy",
  "type": null,
  "experimental": "false",
  "resourceType": "StructureMap",
  "title": "E-T-Rezept Structure Map for CarbonCopy",
  "package_version": "prescription-0.1.0-rc1",
  "structure": [ {
    "url": "http://hl7.org/fhir/StructureDefinition/Bundle",
    "mode": "source",
    "alias": "bundle"
  }, {
    "url": "https://gematik.de/fhir/erp-t-prescription/StructureDefinition/erp-tprescription-carbon-copy",
    "mode": "target",
    "alias": "erpTCarbonCopy"
  } ],
  "status": "draft",
  "id": "8d7a1b30-646f-48f2-bca1-408c80e6402a",
  "kind": null,
  "url": "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERP-TPrescription-StructureMap-CarbonCopy",
  "version": "0.1.0",
  "import": [ "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERP-TPrescription-StructureMap-MedicationDispense", "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERP-TPrescription-StructureMap-MedicationRequest", "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERP-TPrescription-StructureMap-Organization", "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERP-TPrescription-StructureMap-Task", "https://gematik.de/fhir/erp-t-prescription/StructureMap/ERP-TPrescription-StructureMap-Medication" ],
  "contact": [ {
    "name": "gematik GmbH",
    "telecom": [ {
      "value": "https://gematik.de",
      "system": "url"
    } ]
  } ]
}