AllergyIntolerance STU3 CareConnect to R4 UKCore

TODO: Project must be set to a specific FHIR version, therefore there will be issues rendering on or the other profile. Currently set to R4, other rendering issues with the CareConnect resource on top of this issue even when set to STU3 Current both profile tabs have R4 AllergyIntolerance.

TODO: There is an issue with how these StructureMaps need to be loaded to process them with the validator_cli. The cannonical url must match (and file) must match what is used for the base transform. This will be covered in the tooling guideance, so it might be ok at a project level to change the URL of the profile transform to the base one, so both can be displayed.

This page provides:

  • A view of the CareConnect AlleryIntolerance profile (TODO see above)
  • A view of the UKCore AlleryIntolerance profile
  • A StructureMap that will transform a CareConnect AllergyIntolerance resource to a UKCore AllergyIntolerance resource
  • The FML that can be used to generate the CareConnect to UKCore StructureMap for AllergyIntolerance
  • The StructureMap provided for base transforms from STU3 to R4 for AllergyIntolerance
  • The FML that can be used to generate the base STU3 to R4 StructureMap for AllergyIntolerance
  • Resource examples
    • An example STU3 CareConnect AllergyIntolerance input resource
    • The corresponding R4 UKCore AllergyIntolerance output resource

aother speling mistak


a sppelling misstake with a broken link
a sppelling misstake with a broken link
no mistake

idΣ0..1string
metaΣ0..1Meta
implicitRulesΣ ?!0..1uri
language0..1codeBinding
text0..1Narrative
contained0..*Resource
allergyIntoleranceEndI0..1Extension(Complex)
evidenceI0..*Extension(Reference(UK Core DiagnosticReport))
modifierExtension?! I0..*Extension
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
clinicalStatusΣ ?! I0..1CodeableConceptBinding
verificationStatusΣ ?! I0..1CodeableConceptBinding
typeΣ0..1codeBinding
categoryΣ0..*codeBinding
criticalityΣ0..1codeBinding
codeΣ1..1CodeableConceptBinding
id0..1string
extensionI0..*Extension
referenceΣ I0..1string
typeΣ0..1uriBinding
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
displayΣ0..1string
id0..1string
extensionI0..*Extension
referenceΣ I0..1string
typeΣ0..1uriBinding
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
displayΣ0..1string
onsetDateTimedateTime
onsetAgeAge
onsetPeriodPeriod
onsetRangeRange
onsetStringstring
recordedDate0..1dateTime
id0..1string
extensionI0..*Extension
referenceΣ I0..1string
typeΣ0..1uriBinding
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
displayΣ0..1string
id0..1string
extensionI0..*Extension
referenceΣ I0..1string
typeΣ0..1uriBinding
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
displayΣ0..1string
lastOccurrence0..1dateTime
id0..1string
extensionI0..*Extension
authorStringstring
authorReferenceReference(UK Core Practitioner | UK Core Patient | UK Core RelatedPerson | UK Core Organization)
timeΣ0..1dateTime
textΣ1..1markdown
id0..1string
extensionI0..*Extension
modifierExtensionΣ ?! I0..*Extension
substance0..1CodeableConceptBinding
manifestation1..*CodeableConceptBinding
description0..1string
onset0..1dateTime
severity0..1codeBinding
exposureRoute0..1CodeableConceptBinding
id0..1string
extensionI0..*Extension
authorStringstring
authorReferenceReference(UK Core Practitioner | UK Core Patient | UK Core RelatedPerson | UK Core Organization)
timeΣ0..1dateTime
textΣ1..1markdown

idΣ0..1string
metaΣ0..1Meta
implicitRulesΣ ?!0..1uri
language0..1codeBinding
text0..1Narrative
contained0..*Resource
allergyIntoleranceEndI0..1Extension(Complex)
evidenceI0..*Extension(Reference(UK Core DiagnosticReport))
modifierExtension?! I0..*Extension
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
clinicalStatusΣ ?! I0..1CodeableConceptBinding
verificationStatusΣ ?! I0..1CodeableConceptBinding
typeΣ0..1codeBinding
categoryΣ0..*codeBinding
criticalityΣ0..1codeBinding
codeΣ1..1CodeableConceptBinding
id0..1string
extensionI0..*Extension
referenceΣ I0..1string
typeΣ0..1uriBinding
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
displayΣ0..1string
id0..1string
extensionI0..*Extension
referenceΣ I0..1string
typeΣ0..1uriBinding
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
displayΣ0..1string
onsetDateTimedateTime
onsetAgeAge
onsetPeriodPeriod
onsetRangeRange
onsetStringstring
recordedDate0..1dateTime
id0..1string
extensionI0..*Extension
referenceΣ I0..1string
typeΣ0..1uriBinding
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
displayΣ0..1string
id0..1string
extensionI0..*Extension
referenceΣ I0..1string
typeΣ0..1uriBinding
id0..1string
extensionI0..*Extension
useΣ ?!0..1codeBinding
typeΣ0..1CodeableConceptBinding
systemΣ0..1uri
valueΣ0..1string
periodΣ I0..1Period
assignerΣ I0..1Reference(UK Core Organization)
displayΣ0..1string
lastOccurrence0..1dateTime
id0..1string
extensionI0..*Extension
authorStringstring
authorReferenceReference(UK Core Practitioner | UK Core Patient | UK Core RelatedPerson | UK Core Organization)
timeΣ0..1dateTime
textΣ1..1markdown
id0..1string
extensionI0..*Extension
modifierExtensionΣ ?! I0..*Extension
substance0..1CodeableConceptBinding
manifestation1..*CodeableConceptBinding
description0..1string
onset0..1dateTime
severity0..1codeBinding
exposureRoute0..1CodeableConceptBinding
id0..1string
extensionI0..*Extension
authorStringstring
authorReferenceReference(UK Core Practitioner | UK Core Patient | UK Core RelatedPerson | UK Core Organization)
timeΣ0..1dateTime
textΣ1..1markdown

StructureMap

map "http://hl7.org/fhir/StructureMap/AllergyIntolerance3to4" = "Conversions for STU3 CareConnect and R4 UKCore AllergyIntolerance"

uses "http://hl7.org/fhir/3.0/StructureDefinition/AllergyIntolerance" alias AllergyIntoleranceR3 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/AllergyIntolerance" alias AllergyIntolerance as target

imports "http://hl7.org/fhir/StructureMap/*3to4"

group AllergyIntolerance(source src : AllergyIntoleranceR3, target tgt : AllergyIntolerance) extends DomainResource <<type+>> {
  src.extension as ext where $this.url='https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-AllergyIntoleranceEnd-1'
    -> tgt.extension = create('Extension') as tgtext, tgtext.url = 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AllergyIntoleranceEnd' then {
      ext.extension as vs -> tgtext as vt, vt.extension = vs; 
  };
  src.extension as ext where $this.url='http://hl7.org/fhir/StructureDefinition/encounter-associatedEncounter'
    -> tgt.encounter as vt then {
      ext.value: Reference as vs -> vt as vt1, tgt.encounter = vs;
  };
  src.extension as ext where $this.url='https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-Evidence-1'
    -> tgt.extension = create('Extension') as tgtext, tgtext.url = 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-Evidence' then {
      ext.value: Reference as vs -> tgtext.value = create('Reference') as vt, tgtext.value = vs;
  };

  src.identifier -> tgt.identifier;
  src.clinicalStatus as vs ->  tgt.clinicalStatus as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical',  c.code = vs;
  src.verificationStatus as vs ->  tgt.verificationStatus as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification',  c.code = vs;
  src.type -> tgt.type;
  src.category -> tgt.category;
  src.criticality -> tgt.criticality;

  src.code : CodeableConcept as vs -> tgt.code = create('CodeableConcept') as vt then CodeableConceptAllergyIntolerance(vs, vt);

  src.patient -> tgt.patient;
  src.onset : dateTime as vs -> tgt.onset = create('dateTime') as vt then dateTime(vs, vt);
  src.onset : Age as vs -> tgt.onset = create('Age') as vt then Age(vs, vt);
  src.onset : Period as vs -> tgt.onset = create('Period') as vt then Period(vs, vt);
  src.onset : Range as vs -> tgt.onset = create('Range') as vt then Range(vs, vt);
  src.onset : string as vs -> tgt.onset = create('string') as vt then string(vs, vt);
  src.assertedDate -> tgt.recordedDate "recordedDate";
  src.recorder -> tgt.recorder;
  src.asserter -> tgt.asserter;
  src.lastOccurrence -> tgt.lastOccurrence;
  src.note -> tgt.note;
  src.reaction as vs0 -> tgt.reaction as vt0 then {
    vs0.substance : CodeableConcept as vs1 -> vt0.substance = create('CodeableConcept') as vt1 then CodeableConceptAllergyIntolerance(vs1, vt1);
    vs0.manifestation : CodeableConcept as vs1 -> vt0.manifestation = create('CodeableConcept') as vt1 then CodeableConceptAllergyIntolerance(vs1, vt1);
    vs0.description -> vt0.description;
    vs0.onset -> vt0.onset;
    vs0.severity -> vt0.severity;
    vs0.exposureRoute : CodeableConcept as vs1 -> vt0.exposureRoute = create('CodeableConcept') as vt1 then CodeableConceptAllergyIntolerance(vs1, vt1);
    vs0.note -> vt0.note;
  };
}

group CodeableConceptAllergyIntolerance(source src : CodeableConcept, target tgt : CodeableConcept) {
  src.coding as vs -> tgt.coding = create('Coding') as vt then SctCoding(vs, vt);
  src.text as text -> tgt.text = text;
}

group SctCoding(source src : Coding, target tgt : Coding) {
  src.system as system -> tgt.system = system;
  src.version as version -> tgt.version = version;
  src.code as code -> tgt.code = code;
  src.display as display -> tgt.display = display;
  src.userSelected as userSelected -> tgt.userSelected = userSelected;

  src.extension as vs where $this.url='https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid' or 
                            $this.url='https://fhir.nhs.uk/STU3/StructureDefinition/Extension-coding-sctdescid' ->
    tgt.extension = create('Extension') as vt, vt.url = 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId' then {

      vs.extension as vsx where $this.url='descriptionId' -> vt.extension = create('Extension') as vtx, vtx.url = 'descriptionId' then {
        vsx.value: id as vsv -> vtx.value = create('Identifier') as vtv, 
          vtv.system='http://snomed.info/sct',
          vtv.value = vsv;
      };

      vs.extension as vsx where $this.url='descriptionDisplay' -> vt.extension = create('Extension') as vtx, vt.extension = vsx;
    };
}


StructureMap

map "http://hl7.org/fhir/StructureMap/AllergyIntolerance3to4" = "R3 to R4 Conversions for AllergyIntolerance"

uses "http://hl7.org/fhir/3.0/StructureDefinition/AllergyIntolerance" alias AllergyIntoleranceR3 as source
uses "http://hl7.org/fhir/StructureDefinition/AllergyIntolerance" alias AllergyIntolerance as target

imports "http://hl7.org/fhir/StructureMap/*3to4"

group AllergyIntolerance(source src : AllergyIntoleranceR3, target tgt : AllergyIntolerance) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.clinicalStatus as vs ->  tgt.clinicalStatus as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical',  c.code = vs;
  src.verificationStatus as vs ->  tgt.verificationStatus as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification',  c.code = vs;
  src.type -> tgt.type;
  src.category -> tgt.category;
  src.criticality -> tgt.criticality;
  src.code -> tgt.code;
  src.patient -> tgt.patient;
  src.onset : dateTime as vs -> tgt.onset = create('dateTime') as vt then dateTime(vs, vt);
  src.onset : Age as vs -> tgt.onset = create('Age') as vt then Age(vs, vt);
  src.onset : Period as vs -> tgt.onset = create('Period') as vt then Period(vs, vt);
  src.onset : Range as vs -> tgt.onset = create('Range') as vt then Range(vs, vt);
  src.onset : string as vs -> tgt.onset = create('string') as vt then string(vs, vt);
  src.assertedDate -> tgt.recordedDate "recordedDate";
  src.recorder -> tgt.recorder;
  src.asserter -> tgt.asserter;
  src.lastOccurrence -> tgt.lastOccurrence;
  src.note -> tgt.note;
  src.reaction as vs0 -> tgt.reaction as vt0 then {
    vs0.substance -> vt0.substance;
    vs0.manifestation -> vt0.manifestation;
    vs0.description -> vt0.description;
    vs0.onset -> vt0.onset;
    vs0.severity -> vt0.severity;
    vs0.exposureRoute -> vt0.exposureRoute;
    vs0.note -> vt0.note;
  };
}


Input Example


AllergyIntolerance.text[0].status[0]generated
AllergyIntolerance.text[0].div[0]<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Some text to transform</b></p></div>
AllergyIntolerance.extension[0].url[0]http://hl7.org/fhir/StructureDefinition/encounter-associatedEncounter
AllergyIntolerance.extension[0].value[0].reference[0]Encounter/Base-STU3--Encounter--00001
AllergyIntolerance.extension[1].extension[0].url[0]endDate
AllergyIntolerance.extension[1].extension[0].value[0]2022-01-15
AllergyIntolerance.extension[1].extension[1].url[0]reasonEnded
AllergyIntolerance.extension[1].extension[1].value[0]Allergy resolved by prescribed medication
AllergyIntolerance.extension[1].url[0]https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-AllergyIntoleranceEnd-1
AllergyIntolerance.extension[2].url[0]https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-Evidence-1
AllergyIntolerance.extension[2].value[0].reference[0]DiagnosticReport/Base-STU3--DiagnosticReport--00001
AllergyIntolerance.identifier[0].system[0]http://acme.com/ids/patients/risks
AllergyIntolerance.identifier[0].value[0]49476534
AllergyIntolerance.identifier[0].assigner[0].reference[0]Organization/NHSD-STU3--CareConnect-Organisation-1--00001
AllergyIntolerance.type[0]allergy
AllergyIntolerance.category[0]medication
AllergyIntolerance.criticality[0]high
AllergyIntolerance.code[0].coding[0].extension[0].extension[0].url[0]descriptionId
AllergyIntolerance.code[0].coding[0].extension[0].extension[0].value[0]614975019
AllergyIntolerance.code[0].coding[0].extension[0].extension[1].url[0]descriptionDisplay
AllergyIntolerance.code[0].coding[0].extension[0].extension[1].value[0]Cashew nuts (substance)
AllergyIntolerance.code[0].coding[0].extension[0].url[0]https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid
AllergyIntolerance.code[0].coding[0].system[0]http://snomed.info/sct
AllergyIntolerance.code[0].coding[0].code[0]227493005
AllergyIntolerance.code[0].coding[0].display[0]Cashew nut
AllergyIntolerance.code[0].text[0]Cashew nuts
AllergyIntolerance.patient[0].reference[0]Patient/example
AllergyIntolerance.onset[0]2004
AllergyIntolerance.recorder[0].reference[0]Practitioner/example
AllergyIntolerance.asserter[0].reference[0]Patient/example
AllergyIntolerance.lastOccurrence[0]2012-06
AllergyIntolerance.note[0].text[0]The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract.
AllergyIntolerance.reaction[0].substance[0].coding[0].system[0]http://www.nlm.nih.gov/research/umls/rxnorm
AllergyIntolerance.reaction[0].substance[0].coding[0].code[0]1160593
AllergyIntolerance.reaction[0].substance[0].coding[0].display[0]cashew nut allergenic extract Injectable Product
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[0].url[0]descriptionId
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[0].value[0]1462228014
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[1].url[0]descriptionDisplay
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[1].value[0]Anacardium occidentale specific immunoglobulin E (substance)
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].url[0]https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid
AllergyIntolerance.reaction[0].substance[0].coding[1].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].substance[0].coding[1].code[0]388050007
AllergyIntolerance.reaction[0].substance[0].coding[1].display[0]Cashew nut specific IgE
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[0].url[0]descriptionId
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[0].value[0]776058010
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[1].url[0]descriptionDisplay
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[1].value[0]Anaphylaxis (disorder)
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].url[0]https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid
AllergyIntolerance.reaction[0].manifestation[0].coding[0].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].manifestation[0].coding[0].code[0]39579001
AllergyIntolerance.reaction[0].manifestation[0].coding[0].display[0]Anaphylactic reaction
AllergyIntolerance.reaction[0].description[0]Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered
AllergyIntolerance.reaction[0].onset[0]2012-06-12
AllergyIntolerance.reaction[0].severity[0]severe
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[0].url[0]descriptionId
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[0].value[0]765702016
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[1].url[0]descriptionDisplay
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[1].value[0]Subcutaneous route (qualifier value)
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].url[0]https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].code[0]34206005
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].display[0]Subcutaneous route
AllergyIntolerance.reaction[0].note[0].author[0].reference[0]Practitioner/NHSD-STU3--CareConnect-Practitioner-1--00001
AllergyIntolerance.reaction[0].note[0].text[0]The patient reports that the onset of urticaria was within 15 minutes of eating cashews.

{
    "resourceType": "AllergyIntolerance",
    "text": {
        "status": "generated",
        --- We have skipped the narrative for better readability of the resource ---
    },
    "extension":  [
        {
            "url": "http://hl7.org/fhir/StructureDefinition/encounter-associatedEncounter",
            "valueReference": {
                "reference": "Encounter/Base-STU3--Encounter--00001"
            }
        },
        {
            "url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-AllergyIntoleranceEnd-1",
            "extension":  [
                {
                    "url": "endDate",
                    "valueDateTime": "2022-01-15"
                },
                {
                    "url": "reasonEnded",
                    "valueString": "Allergy resolved by prescribed medication"
                }
            ]
        },
        {
            "url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-Evidence-1",
            "valueReference": {
                "reference": "DiagnosticReport/Base-STU3--DiagnosticReport--00001"
            }
        }
    ],
    "identifier":  [
        {
            "system": "http://acme.com/ids/patients/risks",
            "value": "49476534",
            "assigner": {
                "reference": "Organization/NHSD-STU3--CareConnect-Organisation-1--00001"
            }
        }
    ],
    "clinicalStatus": "active",
    "verificationStatus": "confirmed",
    "type": "allergy",
    "category":  [
        "medication"
    ],
    "criticality": "high",
    "code": {
        "coding":  [
            {
                "extension":  [
                    {
                        "url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid",
                        "extension":  [
                            {
                                "url": "descriptionId",
                                "valueId": "614975019"
                            },
                            {
                                "url": "descriptionDisplay",
                                "valueString": "Cashew nuts (substance)"
                            }
                        ]
                    }
                ],
                "system": "http://snomed.info/sct",
                "code": "227493005",
                "display": "Cashew nut"
            }
        ],
        "text": "Cashew nuts"
    },
    "patient": {
        "reference": "Patient/example"
    },
    "onsetDateTime": "2004",
    "assertedDate": "2014-10-09T14:58:00+11:00",
    "recorder": {
        "reference": "Practitioner/example"
    },
    "asserter": {
        "reference": "Patient/example"
    },
    "lastOccurrence": "2012-06",
    "note":  [
        {
            "text": "The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract."
        }
    ],
    "reaction":  [
        {
            "substance": {
                "coding":  [
                    {
                        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
                        "code": "1160593",
                        "display": "cashew nut allergenic extract Injectable Product"
                    },
                    {
                        "extension":  [
                            {
                                "url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid",
                                "extension":  [
                                    {
                                        "url": "descriptionId",
                                        "valueId": "1462228014"
                                    },
                                    {
                                        "url": "descriptionDisplay",
                                        "valueString": "Anacardium occidentale specific immunoglobulin E (substance)"
                                    }
                                ]
                            }
                        ],
                        "system": "http://snomed.info/sct",
                        "code": "388050007",
                        "display": "Cashew nut specific IgE"
                    }
                ]
            },
            "manifestation":  [
                {
                    "coding":  [
                        {
                            "extension":  [
                                {
                                    "url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid",
                                    "extension":  [
                                        {
                                            "url": "descriptionId",
                                            "valueId": "776058010"
                                        },
                                        {
                                            "url": "descriptionDisplay",
                                            "valueString": "Anaphylaxis (disorder)"
                                        }
                                    ]
                                }
                            ],
                            "system": "http://snomed.info/sct",
                            "code": "39579001",
                            "display": "Anaphylactic reaction"
                        }
                    ]
                }
            ],
            "description": "Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered",
            "onset": "2012-06-12",
            "severity": "severe",
            "exposureRoute": {
                "coding":  [
                    {
                        "extension":  [
                            {
                                "url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-coding-sctdescid",
                                "extension":  [
                                    {
                                        "url": "descriptionId",
                                        "valueId": "765702016"
                                    },
                                    {
                                        "url": "descriptionDisplay",
                                        "valueString": "Subcutaneous route (qualifier value)"
                                    }
                                ]
                            }
                        ],
                        "system": "http://snomed.info/sct",
                        "code": "34206005",
                        "display": "Subcutaneous route"
                    }
                ]
            },
            "note":  [
                {
                    "authorReference": {
                        "reference": "Practitioner/NHSD-STU3--CareConnect-Practitioner-1--00001"
                    },
                    "text": "The patient reports that the onset of urticaria was within 15 minutes of eating cashews."
                }
            ]
        }
    ]
}

TODO (STU3 resource won't render as project is R4)


Output Example


AllergyIntolerance.text[0].status[0]generated
AllergyIntolerance.text[0].div[0]<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Some text to transform</b></p></div>
AllergyIntolerance.extension[0].url[0]http://hl7.org/fhir/StructureDefinition/encounter-associatedEncounter
AllergyIntolerance.extension[0].value[0].reference[0]Encounter/Base-STU3--Encounter--00001
AllergyIntolerance.extension[1].extension[0].url[0]endDate
AllergyIntolerance.extension[1].extension[0].value[0]2022-01-15
AllergyIntolerance.extension[1].extension[1].url[0]reasonEnded
AllergyIntolerance.extension[1].extension[1].value[0]Allergy resolved by prescribed medication
AllergyIntolerance.extension[1].url[0]https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-AllergyIntoleranceEnd-1
AllergyIntolerance.extension[2].url[0]https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-Evidence-1
AllergyIntolerance.extension[2].value[0].reference[0]DiagnosticReport/Base-STU3--DiagnosticReport--00001
AllergyIntolerance.extension[3].extension[0].url[0]endDate
AllergyIntolerance.extension[3].extension[0].value[0]2022-01-15
AllergyIntolerance.extension[3].extension[1].url[0]reasonEnded
AllergyIntolerance.extension[3].extension[1].value[0]Allergy resolved by prescribed medication
AllergyIntolerance.extension[3].url[0]https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AllergyIntoleranceEnd
AllergyIntolerance.extension[4].url[0]https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-Evidence
AllergyIntolerance.extension[4].value[0].reference[0]DiagnosticReport/Base-STU3--DiagnosticReport--00001
AllergyIntolerance.identifier[0].system[0]http://acme.com/ids/patients/risks
AllergyIntolerance.identifier[0].value[0]49476534
AllergyIntolerance.identifier[0].assigner[0].reference[0]Organization/NHSD-STU3--CareConnect-Organisation-1--00001
AllergyIntolerance.clinicalStatus[0].coding[0].system[0]http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical
AllergyIntolerance.clinicalStatus[0].coding[0].code[0]active
AllergyIntolerance.verificationStatus[0].coding[0].system[0]http://terminology.hl7.org/CodeSystem/allergyintolerance-verification
AllergyIntolerance.verificationStatus[0].coding[0].code[0]confirmed
AllergyIntolerance.type[0]allergy
AllergyIntolerance.category[0]medication
AllergyIntolerance.criticality[0]high
AllergyIntolerance.code[0].coding[0].extension[0].extension[0].url[0]descriptionId
AllergyIntolerance.code[0].coding[0].extension[0].extension[0].value[0].system[0]http://snomed.info/sct
AllergyIntolerance.code[0].coding[0].extension[0].extension[0].value[0].value[0]614975019
AllergyIntolerance.code[0].coding[0].extension[0].extension[1].url[0]descriptionDisplay
AllergyIntolerance.code[0].coding[0].extension[0].extension[1].value[0]Cashew nuts (substance)
AllergyIntolerance.code[0].coding[0].extension[0].url[0]https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId
AllergyIntolerance.code[0].coding[0].system[0]http://snomed.info/sct
AllergyIntolerance.code[0].coding[0].code[0]227493005
AllergyIntolerance.code[0].coding[0].display[0]Cashew nut
AllergyIntolerance.code[0].text[0]Cashew nuts
AllergyIntolerance.patient[0].reference[0]Patient/example
AllergyIntolerance.encounter[0].reference[0]Encounter/Base-STU3--Encounter--00001
AllergyIntolerance.onset[0]2004
AllergyIntolerance.recordedDate[0]2014-10-09T14:58:00+11:00
AllergyIntolerance.recorder[0].reference[0]Practitioner/example
AllergyIntolerance.asserter[0].reference[0]Patient/example
AllergyIntolerance.lastOccurrence[0]2012-06
AllergyIntolerance.note[0].text[0]The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract.
AllergyIntolerance.reaction[0].substance[0].coding[0].system[0]http://www.nlm.nih.gov/research/umls/rxnorm
AllergyIntolerance.reaction[0].substance[0].coding[0].code[0]1160593
AllergyIntolerance.reaction[0].substance[0].coding[0].display[0]cashew nut allergenic extract Injectable Product
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[0].url[0]descriptionId
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[0].value[0].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[0].value[0].value[0]1462228014
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[1].url[0]descriptionDisplay
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].extension[1].value[0]Anacardium occidentale specific immunoglobulin E (substance)
AllergyIntolerance.reaction[0].substance[0].coding[1].extension[0].url[0]https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId
AllergyIntolerance.reaction[0].substance[0].coding[1].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].substance[0].coding[1].code[0]388050007
AllergyIntolerance.reaction[0].substance[0].coding[1].display[0]Cashew nut specific IgE
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[0].url[0]descriptionId
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[0].value[0].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[0].value[0].value[0]776058010
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[1].url[0]descriptionDisplay
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].extension[1].value[0]Anaphylaxis (disorder)
AllergyIntolerance.reaction[0].manifestation[0].coding[0].extension[0].url[0]https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId
AllergyIntolerance.reaction[0].manifestation[0].coding[0].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].manifestation[0].coding[0].code[0]39579001
AllergyIntolerance.reaction[0].manifestation[0].coding[0].display[0]Anaphylactic reaction
AllergyIntolerance.reaction[0].description[0]Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered
AllergyIntolerance.reaction[0].onset[0]2012-06-12
AllergyIntolerance.reaction[0].severity[0]severe
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[0].url[0]descriptionId
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[0].value[0].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[0].value[0].value[0]765702016
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[1].url[0]descriptionDisplay
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].extension[1].value[0]Subcutaneous route (qualifier value)
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].extension[0].url[0]https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].system[0]http://snomed.info/sct
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].code[0]34206005
AllergyIntolerance.reaction[0].exposureRoute[0].coding[0].display[0]Subcutaneous route
AllergyIntolerance.reaction[0].note[0].author[0].reference[0]Practitioner/NHSD-STU3--CareConnect-Practitioner-1--00001
AllergyIntolerance.reaction[0].note[0].text[0]The patient reports that the onset of urticaria was within 15 minutes of eating cashews.

{
    "resourceType": "AllergyIntolerance",
    "text": {
        "status": "generated",
        --- We have skipped the narrative for better readability of the resource ---
    },
    "extension":  [
        {
            "url": "http://hl7.org/fhir/StructureDefinition/encounter-associatedEncounter",
            "valueReference": {
                "reference": "Encounter/Base-STU3--Encounter--00001"
            }
        },
        {
            "extension":  [
                {
                    "url": "endDate",
                    "valueDateTime": "2022-01-15"
                },
                {
                    "url": "reasonEnded",
                    "valueString": "Allergy resolved by prescribed medication"
                }
            ],
            "url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-AllergyIntoleranceEnd-1"
        },
        {
            "url": "https://fhir.hl7.org.uk/STU3/StructureDefinition/Extension-CareConnect-Evidence-1",
            "valueReference": {
                "reference": "DiagnosticReport/Base-STU3--DiagnosticReport--00001"
            }
        },
        {
            "extension":  [
                {
                    "url": "endDate",
                    "valueDateTime": "2022-01-15"
                },
                {
                    "url": "reasonEnded",
                    "valueString": "Allergy resolved by prescribed medication"
                }
            ],
            "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AllergyIntoleranceEnd"
        },
        {
            "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-Evidence",
            "valueReference": {
                "reference": "DiagnosticReport/Base-STU3--DiagnosticReport--00001"
            }
        }
    ],
    "encounter": {
        "reference": "Encounter/Base-STU3--Encounter--00001"
    },
    "identifier":  [
        {
            "system": "http://acme.com/ids/patients/risks",
            "value": "49476534",
            "assigner": {
                "reference": "Organization/NHSD-STU3--CareConnect-Organisation-1--00001"
            }
        }
    ],
    "clinicalStatus": {
        "coding":  [
            {
                "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
                "code": "active"
            }
        ]
    },
    "verificationStatus": {
        "coding":  [
            {
                "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
                "code": "confirmed"
            }
        ]
    },
    "type": "allergy",
    "category":  [
        "medication"
    ],
    "criticality": "high",
    "code": {
        "coding":  [
            {
                "extension":  [
                    {
                        "extension":  [
                            {
                                "url": "descriptionId",
                                "valueIdentifier": {
                                    "system": "http://snomed.info/sct",
                                    "value": "614975019"
                                }
                            },
                            {
                                "url": "descriptionDisplay",
                                "valueString": "Cashew nuts (substance)"
                            }
                        ],
                        "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId"
                    }
                ],
                "system": "http://snomed.info/sct",
                "code": "227493005",
                "display": "Cashew nut"
            }
        ],
        "text": "Cashew nuts"
    },
    "patient": {
        "reference": "Patient/example"
    },
    "recordedDate": "2014-10-09T14:58:00+11:00",
    "recorder": {
        "reference": "Practitioner/example"
    },
    "asserter": {
        "reference": "Patient/example"
    },
    "lastOccurrence": "2012-06",
    "note":  [
        {
            "text": "The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract."
        }
    ],
    "onsetDateTime": "2004",
    "reaction":  [
        {
            "substance": {
                "coding":  [
                    {
                        "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
                        "code": "1160593",
                        "display": "cashew nut allergenic extract Injectable Product"
                    },
                    {
                        "extension":  [
                            {
                                "extension":  [
                                    {
                                        "url": "descriptionId",
                                        "valueIdentifier": {
                                            "system": "http://snomed.info/sct",
                                            "value": "1462228014"
                                        }
                                    },
                                    {
                                        "url": "descriptionDisplay",
                                        "valueString": "Anacardium occidentale specific immunoglobulin E (substance)"
                                    }
                                ],
                                "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId"
                            }
                        ],
                        "system": "http://snomed.info/sct",
                        "code": "388050007",
                        "display": "Cashew nut specific IgE"
                    }
                ]
            },
            "manifestation":  [
                {
                    "coding":  [
                        {
                            "extension":  [
                                {
                                    "extension":  [
                                        {
                                            "url": "descriptionId",
                                            "valueIdentifier": {
                                                "system": "http://snomed.info/sct",
                                                "value": "776058010"
                                            }
                                        },
                                        {
                                            "url": "descriptionDisplay",
                                            "valueString": "Anaphylaxis (disorder)"
                                        }
                                    ],
                                    "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId"
                                }
                            ],
                            "system": "http://snomed.info/sct",
                            "code": "39579001",
                            "display": "Anaphylactic reaction"
                        }
                    ]
                }
            ],
            "description": "Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered",
            "onset": "2012-06-12",
            "severity": "severe",
            "exposureRoute": {
                "coding":  [
                    {
                        "extension":  [
                            {
                                "extension":  [
                                    {
                                        "url": "descriptionId",
                                        "valueIdentifier": {
                                            "system": "http://snomed.info/sct",
                                            "value": "765702016"
                                        }
                                    },
                                    {
                                        "url": "descriptionDisplay",
                                        "valueString": "Subcutaneous route (qualifier value)"
                                    }
                                ],
                                "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescId"
                            }
                        ],
                        "system": "http://snomed.info/sct",
                        "code": "34206005",
                        "display": "Subcutaneous route"
                    }
                ]
            },
            "note":  [
                {
                    "authorReference": {
                        "reference": "Practitioner/NHSD-STU3--CareConnect-Practitioner-1--00001"
                    },
                    "text": "The patient reports that the onset of urticaria was within 15 minutes of eating cashews."
                }
            ]
        }
    ]
}