Member since
09-18-2017
6
Posts
0
Kudos Received
0
Solutions
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