Data type ED in FHIR

How the components of data type ED (Encapsulated Data) become FHIR R4 elements, from the HL7 Version 2 to FHIR guide.

HL7 v2 definition
Definition of ED in HL7 v2 2.8
Maps
AttachmentDocumentReference

To Attachment4 rows

HL7 v2 sourcev2 typeFHIR elementFHIR typeConditions and notes
ED.2Type Of Data
IDextension[1].urluri
If IF ED.3 NOT VALUEDValue "https://hl7.org/fhir/StructureDefinition/alternate-codes"
ED.2Type Of Data
IDextension[1].valueCodeableConceptCodeableConcept
If IF ED.3 NOT VALUED
ED.3Data Subtype
IDcontentTypecode
ED.5Data
TXdatabase64Binary
Value /convert from A or HEX to binary64/

To DocumentReference4 rows

HL7 v2 sourcev2 typeFHIR elementFHIR typeConditions and notes
ED.2Type Of Data
IDcontent.attachment.extension[1].urluri
If IF ED.3 NOT VALUEDValue "https://hl7.org/fhir/StructureDefinition/alternate-codes"
ED.2Type Of Data
IDcontent.attachment.extension[1].valueCodeableConceptCodeableConcept
If IF ED.3 NOT VALUED
ED.3Data Subtype
IDcontent.attachment.contentTypecode
ED.5Data
TXcontent.attachment.database64Binary
Value /convert from A or HEX to binary64/