Sidebar

How to convert CSV file to JSON using CUSTOM SCRIPT?

0 votes
447 views
asked Apr 21, 2021 by deepthi-a-5184 (240 points)
commented Apr 22, 2021 by deepthi-a-5184 (240 points)
i still have trouble creating the script though, can you please help.

Here is my sample csv:
Patient ID,Patient First Name,Patient Last Name,Patient DOB,Patient Gender,Patient Address Line1,Patient Address Line2,Patient City,Patient State,Patient Zip Code,Patient Home Phone,Patient Email Address,Primary Insurance Policy Company Name,Primary Insurance Policy Number,Primary Insurance Policy Group Number
1,test,abc,19800819,F,flat 1 road no A,xyz colony,Hyderabad,Telangana,500097,987-889-5858,test.abc@cognizant.com,,,
commented Apr 22, 2021 by deepthi-a-5184 (240 points)
I was able to resolve it. Thank you for the support.

1 Answer

0 votes
 
Best answer

If you are using a CSV with a header row as your source message type, you can use a JSON template (see here https://www.qvera.com/kb/index.php/1862/how-can-i-use-a-json-template-with-evaluatetemplate?show=1862#q1862).  Rather than use messageCache to populate the JSON template as in that example, you would use the source message using /*{testValue}*/, where 'testValue' is the column name from the header row.

While not specifically related to your situation, we have an HL7 <-> JSON sandbox that may give you some examples of how to populate a JSON message from a different source type; you'll have to adapt the information contained in the sandbox to your specific scenario, but it should give you some examples of populating JSON messages.

The JSON ‹–› HL7 Sandbox

answered Apr 21, 2021 by jon-t-7005 (7,590 points)
selected Apr 22, 2021 by deepthi-a-5184
...