I am evaluating Talend for the purpose of migrating medical data. One of our requirements is to be able to generate FHIR XML data from existing product databases. For example, we need to create a FHIR Organisation record from the surgery data in our database.
The surgery data has four fields for telephone1, telephone1_type, telephone2, telephone2_type. These will be manifested in the Organisation data as:
<?xml version="1.0" encoding="UTF-8"?> <Organization xmlns="http://hl7.org.fhir"> <name value="Slave system"/> <telecom> <system value="phone"> <value value="01254879658"/> <use value="voice"/> </telecom> <telecom> <system value="phone"> <value value=""/> <use value=""/> </telecom> </Organization>
There are a number of issues with this translation. The telephone number, telephone2, is not present so the second <telecom> tag should be omitted entirely.
The telephone1_type field has a value of "voice" but this is not a valid FHIR value for the <use> tag. I need to map the enumerated values in the database to the correct FHIR equivalents and, where the database telephoneX_type fields have the value "Unknown" or NULL I need to omit the <use> tag.
The only way I can see to remap the enumeration is a messy expression with many nested StringHandling.CHANGE() calls but I can't help thinking that there must be a better way.
With regard to the conditional tags, I am also aware that tXMLMap has a conditional expression on its outputs but this seems to filter records, not parts of records.
I have since found the setting that omits null elements but this doesn't eliminate the empty telecom tag because of the literal attribute value "phone". I then thought of replacing the literal value with the expression below. This works but its rather "hacky" and not really a generic solution. Is there a better way to do this?
(Relational.ISNULL(row1.telephone1) || 0 == StringHandling.LEN(StringHandling.TRIM(row1.telephone1))) ? null : "phone"
Introduction to Talend Open Studio for Data Integration.
Practical steps to developing your data integration strategy.
Create systems and workflow to manage clean data ingestion and data transformation.