{% assign compositionResource = bundle.entry | where: "resource.resourceType", "Composition" | first %} {% assign composition = compositionResource.resource %}
{% if composition.category[0].coding[0].code == "F" %} {% endif %} Composition category: {{ composition.category[0].coding[0].display }}
{% if composition.status %} Composition status: {{ composition.status }}{% endif %}
{% if composition.type.coding[0].display %} Composition type: {{ composition.type.coding[0].display }}{% endif %}

Narrative Text


{% for sec in composition.section %}

{{ sec.title }}

{{ sec.text.div }}

{% if sec.section %} {% for sec2 in sec.section %}

{{ sec2.title }}

{{ sec2.text.div }}

{% endfor %} {% endif %} {% endfor %}

Product Information

{% assign mpdr = bundle.entry | where: "resource.resourceType", "MedicinalProductDefinition" | first %} {% assign mpd = mpdr.resource %}
{% comment %}print the name - current name[0], should be all names{% endcomment %}

{{ mpd.name[0].productName }}

{% comment %}and name parts{% endcomment %} {% for namepart in mpd.name[0].namePart %}

{{ namepart.type.coding[0].display }}: {{ namepart.part }}

{% endfor %} {% comment %}and MPD identifiers{% endcomment %} {% for pid in mpd.identifier %} {{ pid.system | split: '/' | last | upcase }}: {{ pid.value }} {% endfor %} {% comment %}for each name (currently [0] but should be all) print the languages{% endcomment %} {% comment %}FIX{% endcomment %} {% if mpd.name[0].countryLanguage %}
{% for lang in mpd.name[0].countryLanguage %}

Country: {{ lang.country.coding[0].display }}

Language: {{ lang.language.coding[0].display }}

{% endfor %}
{% endif %} {% comment %}print status and domain{% endcomment %}

status: {{ mpd.status.coding[0].display }}

Domain: {{ mpd.domain.coding[0].display }}

{% comment %}print combined dose form - if there's many, this should be adjusted{% endcomment %}

Combined pharmaceutical dose form: {{ mpd.combinedPharmaceuticalDoseForm.coding[0].display }}

Legal Status of Supply: {{ mpd.legalStatusOfSupply.coding[0].display }}

{% for classif in mpd.classification %} {% for class in classif.coding %} {{ class.display }} ({{ class.code }})
{% endfor %} {% endfor %} {% comment %}Get all RAs (RegAuthorization) from the Bundle{% endcomment %} {% assign ras = bundle.entry | where: "resource.resourceType", "RegulatedAuthorization" %} {% for rar in ras %} {% comment %}get the RA resource{% endcomment %} {% assign ra = rar.resource %} {% comment %}mpdtid = mpd prepended ID - will be "MedicinalProductDefinition/" identifiers{% endcomment %} {% assign mpdtid = mpd.id | prepend: 'MedicinalProductDefinition/' %} {% comment %}if the current looped RA points to the MPD as subject{% endcomment %} {% if ra.subject[0].reference == mpdtid %}

Authorisation {{ forloop.index }} of {{ ras | size }}

Auth id: {% for raid in ra.identifier %} {{ raid.value | join: ", " }} {% endfor %}

Region: {% for rareg in ra.region %} {{ rareg.coding[0].display }} {% endfor %}

Type: {{ ra.type.coding[0].display }}

{% assign holderorg = ra.holder.reference | split: '/' | last %}

{% comment %}Get Orgs from Bundle {% endcomment %} {% assign orgentries = bundle.entry | where: "resource.resourceType", "Organization" %} {% for orgentry in orgentries %} {% assign org = orgentry.resource %} {% assign orgid = org.id %} {% assign orgrefid = org.id | prepend: 'Organization/' %} {% comment %}See which of the Orgs is referenced from the RA{% endcomment %} {% if ra.holder.reference == orgrefid %}

Holder: {{ org.name }} ({{ org.identifier[0].value }})

{% endif %} {% endfor %}

Status: {{ ra.status.coding[0].display }} ({{ ra.statusDate }})

{% endif %} {% endfor %} {% comment %} Generic way to iterate a linked structure {% assign ras = entry | where: "resource.resourceType","RegulatedAuthorization"%} {% assign rasf = ras | where: "subject[0].reference", mpd.id | prepend: 'MedicinalProductDefinition/' %} {% for rar in rasf %} {% assign ra = rar.resource %} {% endfor %} {% endcomment %} {% comment %}Get PPDs from Bundle {% endcomment %} {% assign ppds = bundle.entry | where: "resource.resourceType", "PackagedProductDefinition" %}
{% for ppdr in ppds %} {% assign ppd = ppdr.resource %} {% comment %}Get PPDs that link to MPD, via packagefor[0] {% endcomment %} {% comment %}SHOULD FIX: Currently only packageFor[0], but should be any package {% endcomment %}

Package {{ forloop.index }} of {{ ppds | size }}

{% assign mpdtid = mpd.id | prepend: 'MedicinalProductDefinition/' %} {% comment %}FIX{% endcomment %} {% if ppd.packageFor[0].reference == mpdtid %}
{% for ppid in ppd.identifier %} {{ ppid.system | split: '/' | last | upcase }}: {{ ppid.value }} {% endfor %}

Description: {{ ppd.description }}

Marketing Status: {{ ppd.status.coding[0].code }}

Contained Quantity:

    {% for quant in ppd.containedItemQuantity %}
  • {{ quant.value }} {{ quant.code | pluralize: quant.code }}
  • {% endfor %}

{% assign pckg = ppd.packaging %} {% if pckg.quantity % %}

Package: {{ pckg.quantity }} {{ pckg.type.coding[0].display }} [{{ pckg.material[0].coding[0].display }}]

{% endif %}

{% endif %} {% endfor %}
{% comment %} {% assign ppds = entry | where: "resource.resourceType","PackagedProductDefinition"%} {% for ppdr in ppds %} {% assign ppd = ppdr.resource %} Package {{forloop.index}} of {{ ppds | size }} {% assign mpdfullid= mpd.id | prepend: 'MedicinalProductDefinition/' %} {% if ppd.packageFor[0].reference == mpdfullid %}
{% endif %} {% endfor %} {% endcomment %}{% comment %}Get AdminProdDefs from Bundle {% endcomment %} {% assign apds = bundle.entry | where: "resource.resourceType", "AdministrableProductDefinition" %} {% if apds %}
{% for apdr in apds %} {% assign apd = apdr.resource %} {% assign mpdtid = mpd.id | prepend: 'MedicinalProductDefinition/' %} {% comment %}Do this only if the APD-formOf links to the MPD {% endcomment %} {% comment %}FIX - currently only [0], should be any{% endcomment %} {% if apd.formOf[0].reference == mpdtid %}

Administrable Product ({{ forloop.index }} of {{ apds | size }})

Dose form: {{ apd.administrableDoseForm.coding[0].display }}

Presentation unit: {{ apd.unitOfPresentation.coding[0].display }}

Contents (Manuf. Items):
    {% assign mids = bundle.entry | where: "resource.resourceType", "ManufacturedItemDefinition" %} {% for midr in mids %} {% assign mid = midr.resource %} {% assign midtid = midr.resource.id | prepend: 'ManufacturedItemDefinition/' %} {% if apd.producedFrom[0].reference == midtid %}
    {{ mid.id }}

    Dose form: {{ mid.manufacturedDoseForm.coding[0].display }}

    Presentation unit: {{ mid.unitOfPresentation.coding[0].display }}

    Manufactured Dose Form: {{ mid.manufacturedDoseForm.coding[0].display }}

    Ingredients:
      {% assign midings = bundle.entry | where: "resource.resourceType", "Ingredient" %} {% for midingr in midings %} {% assign miding = midingr.resource %} {% assign midting = mid.id | prepend: 'ManufacturedItemDefinition/' %} {% if miding.for[0].reference == midting %}
      {{ miding.id }}

      Status: {{ miding.status | capitalize }}

      Role: {{ miding.role.coding[0].display }}

      Substance: {{ miding.substance.code.concept.coding[0].display }}

      {% for strn in miding.substance.strength %} {% if strn.concentrationRatio %}

      Concentration strength: {{ strn.concentrationRatio.numerator.value }}{{ strn.concentrationRatio.numerator.unit }} / {{ strn.concentrationRatio.denominator.value }}{{ strn.concentrationRatio.denominator.unit }}

      {% endif %} {% endfor %} {% for strn in miding.substance.strength %} {% if strn.presentationRatio %}

      Presentation strength: {{ strn.presentationRatio.numerator.value }} {{ strn.presentationRatio.numerator.unit }} / {{ strn.presentationRatio.denominator.value }} {{ strn.presentationRatio.denominator.unit }}

      {% endif %} {% endfor %}
      {% endif %} {% endfor %}
    {% endif %} {% endfor %}
{% comment %}Get Ings from Bundle {% endcomment %} {% assign apdings = resource.entry | where: "resource.resourceType", "Ingredient" %} {% for apdingr in apdings %} {% assign apding = apdingr.resource %} > {% assign apdingtid = apding.id | prepend: 'AdministrableProductDefinition/' %} {% assign apdtid = apd.id | prepend: 'AdministrableProductDefinition/' %} {% comment %}if the ingredient's SECOND (TO FIX) .for is the current APD, {% endcomment %} {% if apding.for[2].reference == apdtid %}
Ingredients: {{ apding.id }}

Status: {{ apding.status | capitalize }}

Role: {{ apding.role.coding[0].display }}

Substance: {{ apding.substance.code.concept.coding[0].display }}

{% for strn in apding.substance.strength %} {% if strn.concentrationRatio %}

Concentration strength: {{ strn.concentrationRatio.numerator.value }}{{ strn.concentrationRatio.numerator.unit }} / {{ strn.concentrationRatio.denominator.value }}{{ strn.concentrationRatio.denominator.unit }}

{% endif %} {% endfor %} {% for strn in apding.substance.strength %} {% if strn.presentationRatio %}

Presentation strength: {{ strn.presentationRatio.numerator.value }} {{ strn.presentationRatio.numerator.unit }} / {{ strn.presentationRatio.denominator.value }} {{ strn.presentationRatio.denominator.unit }}

{% endif %} {% endfor %}
{% endif %} {% endfor %} Route of administration:
    {% for roas in apd.routeOfAdministration %}
  • {{ roas.code.coding[0].display }}
  • {% endfor %}
{% endif %} {% endfor %}
{% assign cudings = bundle.entry | where: "resource.resourceType", "ClinicalUseDefinition" %}

Clinical Information

{% for cudingr in cudings %} {% assign cuding = cudingr.resource %} {% if cuding %} {% if cuding.indication %}

Indication: {{ cuding.indication.diseaseSymptomProcedure.concept.coding[0].display }}

{% endif %} {% if cuding.contraindication %}

Contraindication: {{ cuding.contraindication.diseaseSymptomProcedure.concept.coding[0].display }}

{% endif %} {% if cuding.interaction %}

Interaction: {{ cuding.interaction.interactant[0].itemCodeableConcept.coding[0].display }}

{% endif %} {% if cuding.undesirableEffect %}

Undesirable Effect: {{ cuding.undesirableEffect.symptomConditionEffect.concept.coding[0].display }}

{% endif %} {% if cuding.warning %}

Warning: {{ cuding.warning.description }}

{% endif %} {% endif %} {% endfor %}
{% endif %}