HL7v2: Should the empty/blank repeating fields be removed? - hl7

Some segments in HL7v2 can be repeating, but what if one of those repetitions is blank? Should the blank repetition be removed? Or should they remain?
For example, in the below extract PID.13 is a repeating field, but the first repetition is blank. It does not even contain "" (empty string).
PID|||A123456789^^^555^PI||Data^Test^^^Mr||19500101|M|||123 Test Road^Testington^^^AA1 2AA||~07778895566|||M|||||||||||||""|||

The PID-13 field has been deprecated as of v2.7 and should no longer be used. Use PID-40 instead.
PID-13 is a special case because the first occurrence has a special meaning, so if there are multiple field repetitions then you shouldn't remove the first one even if it isn't populated. For other fields which don't have documented special cases, you can safely delete empty field occurrence without changing the meaning of the message.

Please refer to this answer.
There are two things needs to be understood.
First:- Empty/blank/null value is also a value. Blank repetitions should not be removed.
Following is what specifications (2.3.2.4 Repetition Separator) say:
2.3.2.4 Repetition Separator.
The repetition separator is used in some data fields to separate multiple occurrences of a field. It is used only where specifically authorized in the descriptions of the relevant data fields. The character that represents the repetition separator is specified for each message as the second character in the Encoding Characters data field of the MSH segment. Absent other considerations it is recommended that all sending applications use '~' as the repetition separator. However, all applications are required to accept whatever character is included in the Message Header and use it to parse the message.
Yes; it does not clearly say anything about removing or keeping empty sub-components. Yes, it neither specifically say that empty value is also a value nor the opposite. I fail to find it in other parts of specifications as well.
To come to the conclusion, we need to move to second thing.
Second:- The sequence of repetition values may also be important. This sequence will change if empty values are removed. This may also change the meaning of the value.
Let us take an example of PID.13 you mentioned in the question.
This field contains the patient's personal phone numbers. All personal phone numbers for the patient are sent in the following sequence. The first sequence is considered the primary number (for backward compatibility). If the primary number is not sent, then a repeat delimiter is sent in the first sequence.
As you can see above, empty value for first sub component tells you that "there is no primary number available for patient". By removing empty value, you are actually putting "secondary number" in place of primary number which may be wrong depending on your use case or implementation.
Other example of PID.3:
This field contains the list of identifiers (one or more) used by the facility to uniquely identify a patient (e.g., medical record number, billing number, birth registry, national unique individual identifier, etc.).
As you can see, by removing empty values in-between changes the meaning of identifier.
I will still prefer clear reference from specifications, but based on what said above, I will avoid removing empty values.

Related

SAS Join Not Matching Character Variables

I am joining two tables by character fields which contain five digits but I'm matching on only about 20 records out of 6,000.
An example of a non-match is the first table shows a value of '09813' but no match is found; yet manually querying the second table for a value of '09813' yields a result. (This seems to indicate an issue with the value in the first table...) I've also noted some anomalies where '7144' seems to be matching to '7144D' but manually retrieving '7144' in the second table doesn't match, but '07144' retrieved the correct match.
I've tried converting the value in the first table to Hex and there doesn't seem to be any additional characters aside from the empty spaces (20) added to the end due to the length of the hex conversion. I also tried adding strip(compress([Field Name],,'kw')) to the join statement and a few other variations to try to remove line breaks, etc., but haven't had any luck thus far.
Any suggestions would be greatly appreciated!
I had the incorrect join field, thank you for the help!

Google Sheets: Repeat referencing in Formulas

=ArrayFormula(IF(A1:B6<0,0,A1:B6))
The range is referred twice. Is it possible to do this with a singular reference within a formula?
Perhaps something akin to IFERROR like IFCONDITION(range, condition, result_if_condition)
The use case is the range itself are in many cases computed using complex arrangements - so it becomes quite inconvenient/unwieldy when that same complex arrangement needs to be inserted into multiple places.
Sample sheet.
In this particular case, you can use
=ArrayFormula(text(A1:A6,"0;\0"))
so that any negative numbers are displayed as zero.
Since the result is a string, it may need to be coerced to a number for use in further calculations.
This was first suggested to me by #barry houdini - here is an example of it in use (in Excel).
EDIT by OP (as in comment below) ;
Here is the link https://support.google.com/docs/answer/56470 So if you wanted blank cells to be zero, you would set the 4th part to \0 i.e. =ArrayFormula(text(A1:A7,"0;\0;\0;\0")) because a blank cell is not a number.

Force field/tag when inserting data on influxdb

I am just starting with influxdb as a time series database and i was trying to create some measurements, however it seems like influx automatically determines which fields of the measurements are tags and which are fields, is there any way to force one or another at insertion time (first insertion of a measurement)?? or any other way whatsoever?
No, InfluxDB won't automatically determine which are fields and which are tags. Your "insert string" structure "helps InfluxDB in determining which are tags and which are fields.
For example:
cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000
In this string, "cpu_load_short" is the measurment name (observe that there is no = sign to form a key/value pair), followed by semi colon.
host=server01,region=us-west are tags (in key value formats)
Rignt after tags you can see that there is space, which tells following the space are "Fields".
You may refer this documentation for more information.

Google Spreadsheet Re order Columns

I'll explain an example of the situation before I ask the question.
If I have a pile of 5 numbered boxes and I scan them into a spreadsheet in the following order. 4,2,3,5,1
I copy that list into another program which adds more info to each number (which is what I want) but messes up the order. So now it is 3A,4D,1C,2B,5E.
Is there a formula I can use to reorder my new list to the original? I want to keep the original order as I print labels for these boxes and this would keep the order, meaning ordering both numerically won't work.
Thanks,
Graeme
I'd recommend an HLookup. Look for the character in your original list and add "*" which is a wild card for the second character.
Assumptions:
The first character is unique in the set.
Each value is in its own cell.
The original list is retained after intermediate program runs.

Handling commas in data with VarArrayOf

I am using Locate with multiple fields and sometimes I am getting an "Incorrect number of search fields" error and have tracked it down to the data.
tbl.Locate('LName;FName;Stuff',
VarArrayOf([LName+','+FName','+Stuff]),[loCaseInsensitive]);
Sometimes it worked and sometimes it did not and I traced it down to a Comma in the Stuff if it included a Comma in the text.
Stuff = "My dog is gray" would work.
Stuff = "I am at work, but not happy" would not. That extra Comma made it look like four data fields.
Do I have to Parse every string of incoming data for Commas and if any found replace them with what for the Locate to work? The included Comma version will have been stored without Parsing or modifying as I have no idea what they may have entered. "I am at work, but not happy" is a valid input by the user.
Thanks.
Do not concatenate all the search values into a single string. Instead, place them as distinct items in the array, just like the example in the documentation. That is, don't include the commas in the string:
tbl.Locate('LName;FName;Stuff',
VarArrayOf([LName, FName, Stuff]), [loCaseInsensitive]);

Resources