Member since
09-18-2017
6
Posts
0
Kudos Received
0
Solutions
09-22-2017
06:19 AM
@anarasimham Thanks for the great answer. I've used AttributesToJSON to convert it to JSON format. But i wasn't able to manipulate it to desired structure(when i used JoltTransformJSON). You can view my another question related to that in this link (https://community.hortonworks.com/questions/138833/need-to-format-values-fromin-attributestojson-proc.html?childToView=138061#answer-138061) In between if you can share the knowledge on how to use a kafka and HDFS in NiFi, it would be really helpful.
... View more
09-19-2017
09:24 AM
Hi @Matt Burgess I'm relatively new to NiFi. As of now i have parsed a hl7 file using ExtractHL7Attributes and extracted required attributes using AttributesToJSON processor. From here i want to convert it into FHIR format with the use of attributes and its values from AttributesToJSON. The attributes from AttributesToJSON will look something like this, {"PID.PatientName.FamilyName":"Patient","PID.PatientName.GivenName":"Test", etc. } I've a java class like to convert it into FHIR format, package routines; import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.dstu3.model.Identifier;
import ca.uhn.fhir.context.FhirContext;
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem;
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse;
import org.hl7.fhir.dstu3.model.Reference; public class MapFhirPatient { public static String getFhirPatient(String firstName, String lastName, String middleName, String phoneHome, String phoneWork) { String result = "";
try{
Patient testPatient = new Patient(); Reference reference = new Reference(); reference.setDisplay("HealthCare Org"); testPatient.addIdentifier().setUse(Identifier.IdentifierUse.OFFICIAL).setSystem("urn:fake:mrns").setValue("800001").setAssigner(reference); testPatient.addName().setFamily(lastName).addGiven(firstName).addGiven(middleName); if(phoneHome != null)
{
testPatient.addTelecom().setSystem(ContactPointSystem.PHONE).setUse(ContactPointUse.HOME).setValue(phoneHome);
} if(phoneWork != null)
{
testPatient.addTelecom().setSystem(ContactPointSystem.PHONE).setUse(ContactPointUse.WORK).setValue(phoneWork);
} FhirContext context = FhirContext.forDstu3(); result = context.newJsonParser().encodeResourceToString(testPatient); } catch(Exception e){
result = "Error occured in mapping.";
}
return result; }
} How can i execute this code using the Module Directory property of ExecuteScript or InvokeScriptedProcessor by passing necessary parameters. And how can i get the returned data from java class and store it in a text file. similar question raised by me to format JSON data - https://community.hortonworks.com/questions/138833/need-to-format-values-fromin-attributestojson-proc.html?childToView=138890#answer-138890 The end result will look something like this, which is FHIR standard for patient details. {"resourceType":"Patient","identifier":[{"use":"official","system":"urn:fake:mrns","value":"800001","assigner":{"display":"HealthCare Org"}}],"name":[{"family":"Patient","given":"Test12"}],"telecom":[{"system":"phone","value":"111-111-1111","use":"home"}]}
... View more
09-19-2017
08:21 AM
Hi @jfrazee Thanks for the response. I played around with JoltTransformJSON and was able to transform it from this, {
"PID.PatientName.FamilyName": "Patient",
"PID.PatientName.GivenName": "Test"
} to this, {
"family": "Patient",
"given": "Test"
} The JOLT specification i used was, [{ "operation": "shift", "spec": { "PID.PatientName.FamilyName": "family",
"PID.PatientName.GivenName": "given" }
}] However i wasn't able to include the part "name" in the json which was end result expected, "name":[{"family":"Patient","given":"Test"}] Can you advice of what should be done in JOLT spec to get the desired result ? @Yolanda M. Davis @Yash With input attributes like, { "PID.PatientName.FamilyName": "Patient", "PID.PatientName.GivenName": "Test", "PID.PhoneNumber.Home": "(123)456789"} The final JSON formatted output will be looking something like the one below, {"resourceType":"Patient","identifier":[{"use":"official","system":"urn:fake:mrns","value":"800001","assigner":{"display":"HealthCare Org"}}],"name":[{"family":"Patient","given":"Test12"}],"telecom":[{"system":"phone","value":"111-111-1111","use":"home"}]}
... View more
09-18-2017
02:20 PM
@jfrazee @Artem Ervits @Pierre Villard @Vladimir Zlatkin
... View more
09-18-2017
02:17 PM
My AttributesToJSON outputs values this way from a hl7 file after going through ExtractHL7Attributes, {"PID.PatientName.FamilyName":"Patient","PID.PatientName.GivenName":"Test"} I want to format the above in this fashion, "name":[{"family":"Patient","given":"Test"}] Can it be achieved by using RegEx in properties or through any other processor. Please provide any sample case. Thanks in advance.
... View more
Labels:
- Labels:
-
Apache Hive
-
Apache NiFi
09-18-2017
10:49 AM
Here's how i configured the ExtractHL7Attributes processor, hl7parse.png The attributes after parsing a sample hl7 file seen from data provenance of ExtractHL7Attributes processor, dataprovenancehl7.png How can i get these attribute values and process it ? Do i need to add another processor, use expression language in properties of a processor ?
... View more
Labels:
- Labels:
-
Apache Hive
-
Apache NiFi