Extracting Data from HL7 Files in Talend - talend

I am trying to read data from HL7 files using Talend.
The component that I am using is tHl7Input component.
Job :
The sample file that I am using is below:
MSH|^~\&|CERNER||PriorityHealth||||ORU^R01|Q479004375T431430612|P|2.3|
PID|||001677980||SMITH^CURTIS||19680219|M||||||||||929645156318|123456789|
PD1||||1234567890^LAST^FIRST^M^^^^^NPI|
OBR|1|341856649^HNAM_ORDERID|000002006326002362|648088^Basic Metabolic Panel|||20061122151600|||||||||1620^Hooker^Robert^L||||||20061122154733|||F|||||||||||20061122140000|
Hl7 Component Configuration:
But I am not able to extract the data from it.
Output which I am getting with null values:
I have read the forum of Talend to read the Hl7 files, but i not not able to extract the same.
https://help.talend.com/display/TalendComponentsReferenceGuide61EN/tHL7Input
Any inputs on this would be helpfull.

I have never use Talend. This is based on the screenshots you have given.
Your mappings are off by +1.
MSH.1 should hardcode to | (pipe).
MSH.2 should map to newColumn4.
MSH.3 should map to Name1, and output shall be Cerner.
MSH.4 should map to Name3, and output will be null as there is nothing in the message.
So on and so forth.
You need to change your data map to use accurate hl7 component names - Encoding characters, Sending Application etc. Otherwise, at the end of assignment you will end up confused.

Related

Conversion from XML to Json removes 0 in Azure Data Factory copy activity

I am converting XML files to Json(gzip compression) using Azure Data Factory copy activity.
However , I observe that in the XML file I have the values stored as 0123456789. However , when this is converted to Json it is saved as "value" : 123456789. Without 0.
I would like to keep the Json values as-is from the XML . Please provide suggestions for the same.
PS: I can't use data flow and I can't modifiy the xml file.
The solution was to uncheck the detect data type in the copy activity

tExtractRegexField unable to act as lookup to tMap in Talend DI

I have a tExtractRegexField which extracts a date from a string of text coming from a ExcelFileInput and will output the dates to tLogRow but I can't connect the same output as a lookup column to a tMap with a 2nd ExcelFileInput as its main input.
If I connect the ExtractRegexField to tMap first I can't then connect the 2nd ExcelFileInput and vis versa
I'm using Talend 6.3.1 and for testing I am able to connect 2 x ExcelFileInput to a tMap so I dont think its a problem with my system setup.
I have also tried tJoin instead of tMap but I encounter the same issue (can't connect both inputs together but can connect "A" or "B" first)
Overview of Process
Problem Area
The tExcelFileInput uses globalMap to get the path to the excel file from the preceding tFlowToIterate
Based on discussions on the talend forum the issue may have been down to a desire by taland DI to avoid circular references
An alternative solution is to extract the regexfield from the header row and store them in a global variable using a tJavaRow and globalMap.put("MyVal", row.Data); and then OnComponentOk read the remaining data from the body rows and in the tMap recall the global variable MyVal and include it as needed in your tMap Output

Talend component that takes multiple rows as input and returns one row as output?

I have an XML file (tFileInputXML) as the start point of my job, from that XML, i'd like to "combine" all its rows in a java List/Array/Whatever and get that List as output.
Is there a component in Talend that offers such mechanism ?
NB : I've already tried the TJavaFlex component but it still output many rows.
Thank you in advance.
You need to read the file, map its fields using tXMLMap and then process them in a java component :

How to get jsonpathquery or Xpathquery for columns in talend?

tFileInputJson--> component --> Basic settings--> Mapping
How can we get jsonpathquery or Xpathquery for columns in talend:
you will have to declare a JSON metadata for input file (Repository>Metadata>Json File). There, based on an existing jsonfile, you'll be able to get json query for all the fields.
See talend help : https://help.talend.com/display/TalendOpenStudioforDataIntegrationUserGuide62EN/7.11.1+Setting+up+JSON+metadata+for+an+input+file

Generate a CSV file with combination of unique field and XML using spark dataframe

I am reading an XML into a spark Dataframe using com.databricks.spark.xml and trying to generate a csv file as output.
My Input is like below
<id>1234</id>
<dtl>
<name>harish</name>
<age>21</age>
<class>II</class>
</dtl>
My output should be a csv file with the combination of id and remaining whole XML tag like
id, xml
1234,<dtl><name>harish</name><age>21</age><class>II</class></dtl>
Is there a way to achieve the output in the above format.
your help is very much appreciated.
Create a plain RDD to load xml as text file using sc.textFile() without parsing.
Extract id manually with the help of regex/xpath and also try to slice RDD string using string slicing from start of your tag to end of your tag.
Once it's done you will have your data into map like (id,"xml").
I hope this tactical solution will help you...