Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Talend Open Studio for Big Data: How to handle multiple one-to-many relationships within one JSON file

As a follow-up to a previous question, and still as a rookie, having tried to figure out this myself trying and researching a lot, I need to ask for help once more.

I have a patient that has multiple cases, and those multiple cases each have multiple targets which have multiple results, of which there are multiple evidence, of which each consists of multiple vaccinations and multiple medications.
Something like this:

patient - result 1 -target 1 - evidence 1 - vaccination 1
                                                             - medication 1
                                                           - medication 2
                                         - evidence 2 - vaccination 1
                                                           - vaccination 2
                          - target 2 - evidence 1 - vaccination 1
                                                              - medication 1
                                                                - medication 2

I am able to isolate patient - to - evidence and show the multiple evidence one at a time. I don't see in the path loop expression where I could build for every multiple occurrence (see pic).0683p000009M5zH.jpg

 

 

What I'm able to do (one property at a time0683p000009MACn.png 

0683p000009M5zR.jpg

 

I would like to be able to display in my output the full file, the patient to targets, to results, to evidence, to vaccinations, and to medication.
Basically, display it just as I receive it (it is going into a different format but same basic structure.)

 

Thank you so much for any help you can give me.

Monica

Thank you very much!!!

Labels (2)
3 Replies
nfz11
Creator III
Creator III

Can you please provide some complete sample records in JSON and the exact expected output?  Then I can try to help you out.

Anonymous
Not applicable
Author

Thank you for trying to help. These are the 3 json files (all .txt for attaching). forum is the file that has the schema I was talking about, then I'm joining it with a patient data file (and others) to produce something like the forumoutput file that I'm attaching.


forum.txt
forumoutput.txt
TestPatient.txt
nfz11
Creator III
Creator III

Thanks for providing the JSON samples, they are very helpful.

 

Do you know that you can pass a whole JSON node through as a string in the tFileInputJSON component?  If you select Xpath as the 'Read by' option, you can check 'Get nodes' for the the column you are interested in and that whole node and its sub-nodes will be passed through as a string instead of getting parsed.  See screenshot below of tFileInputJSON.

 

It seems this would come in handy for you because you want to pass the whole 'result' node through untouched from your input to your output.  You also want to pass the 'patient' node the same way from the patients file.

0683p000009M5vG.png

It seems the general plan for your job would be:

Read result data with tFileInputJSON-> Parse patient id to Long and 'result' node as string with 'Get nodes' -> use as main input row to the tMap

Read patient data with tFileInputJSON-> Parse patient id to Long and 'patient' node as string with 'Get nodes' -> use as the lookup row to the tMap

Join data on patient id in tMap -> Output your JSON as the patient node string followed by the result node string