public Map handleRequest()

in src/com/amazonaws/lab/FHIRDataHandler.java [34:67]


	public Map<String, String> handleRequest(Map<String, String> map, Context context) {
		// check file type - HL7 or FHIR
		String fileType = map.get("DataType");
		
		String s3Bucket = map.get("S3Bucket");
		
		String fileKey = map.get("InputFile");
		// Get S3 object as string, then process it
		String fhirInput = s3Client.getObjectAsString(s3Bucket, fileKey);
		DocumentReference docRef = fhirContext.newJsonParser().parseResource(DocumentReference.class, fhirInput);
		String patientRef = docRef.getSubject().getReference();
		
		ArrayList<String> notesList = this.getNotesFromDocument(docRef);
		
		PatientInfo patInfo = new PatientInfo();
		patInfo.setPatientId(patientRef);

	
		patInfo.setNotes(notesList);
		
		String json = new Gson().toJson(patInfo);
		
		putS3ObjectContentAsString(map.get("S3Bucket"), "processing/unstructuredtext/" + map.get("FileName"),
				json.toString());
		
		// Create our output response back to the state machine
		Map<String, String> output = new HashMap<>();
		output.put("S3Bucket", map.get("S3Bucket"));
		output.put("FileName", map.get("FileName"));
		output.put("InputFile", map.get("InputFile"));
		output.put("DataType", map.get("DataType"));
		output.put("UnstructuredText", "processing/unstructuredtext/" + map.get("FileName"));
		return output;
	}