Sidebar

Pulling out data

0 votes
316 views
asked Jun 12, 2017 by jeremy-r-2799 (140 points)
Greetings,

I was wondering what the best way of extracting data from a file. I'll post a bit of what I have and then ask the question.

~  05/01/2017 8:38 AM, ABD HERNIAS: no hernias ~  05/01/2017 8:38 AM, ABDOM INSP: soft, non-tender, no masses, bowel sounds normal ~  05/01/2017 8:38 AM, AFFCT-MOOD: no depression, anxiety, or agitation ~  05/01/2017 8:38 AM, AUSCUL HEART:  S1, S2, no murmur, rub, or gallop,regular rate and rhythm ~  05/01/2017 8:38 AM, AUSCUL LUNGS: no rales, rhonchi, or wheezes ~  05/01/2017 8:38 AM, AXILLARY NOD: no axillary adenopathy ~  05/01/2017 8:38 AM, BLADDER PALP: no cystocele ~  05/01/2017 8:38 AM, BMI: 22.14 kg/m2~  05/01/2017 8:38 AM, BP CUFF SIZE: regular ~  05/01/2017 8:38 AM, BP DIASTOLIC: 60 mmHg~  05/01/2017 8:38 AM, BP SYSTOLIC: 110 mmHg~  

What I'm looking to do is get all the data between each ~ ; that is the date, time and everything after that as a seperate entry. I feel like StringUtils.splitByWholeSeparator is probably a good choice but I'm not the most familiar with the program. Would setting up a loop and using that utility the best means of going about this? Thanks much.

1 Answer

0 votes

Here is some sample code on how to get the different elements:

var entries = StringUtils.splitByWholeSeparator(message.getNode('/'), '~');
for (var i = 0; i < entries.length; i++) {
   if (StringUtils.isNotBlank(entries[i])) {
      var parts = StringUtils.splitByWholeSeparator(StringUtils.trim(entries[i]), ' ');
      for (var j = 0; j < parts.length; j++) {
         qie.debug('part ' + j + ': ' + parts[j]);
      }
   }
}
 

answered Jun 13, 2017 by brandon-w-8204 (33,270 points)
...