return patientEntity;
}
private void UploadComments(Key dataEntity, ArrayList<Comment> comments) {
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
for (Comment c: comments) {
Entity commentEntity = new Entity("Comment", dataEntity);
commentEntity.setProperty("Text", c.getContent());
// Author entry consists of user's google account
commentEntity.setProperty("Author", c.getAuthor().getGoogleUser());
commentEntity.setProperty("Timestamp", c.getTimestamp());
commentEntity.setProperty("Title", c.getTitle());
ArrayList<String> keywords = extractKeywords(c.getContent());
datastore.put(commentEntity);
for (String keyword : keywords) {
Entity kwEntity = new Entity("Keyword", commentEntity.getKey());
kwEntity.setProperty("Word", keyword.replaceAll("[^A-Za-z]", "").toUpperCase());
// If this is a chief complaint (first comment), set it as such
if (c.getTitle().equals("Complaint")) {
kwEntity.setProperty("Type", "CC");
}
else if (c.getTitle().equals("Reason")){
kwEntity.setProperty("Type", "RE");
}
else {
kwEntity.setProperty("Type", "KW");
}
datastore.put(kwEntity);
}
}
}