kardianos / hl7

HL7 Marshal Unmarshal fo Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors seem to be occurring on A02s and A11s messages.

MihaiSandor opened this issue · comments

commented

@kardianos When I try to parse this message with v2.5 I got this error: invalid characters in date: "10005218^^^default^default"

MSH|^~\&|PATIENTPING_ADT|272605^Regional Medical CPID|1|p-d507c951-96f3-11ed-96e0-39b4d2a37a61^^^PP^PP|10005218^^^default^default||JOE^DOE^||19541129|F|||31 MOZFA|272605|UNC Regional Medical|HOS|300 W 27th St^^Hometown^NC^28358|1790152668210992.

Did you have any idea why on messages A02s and A11s is a problem?

commented

Here is the Go Playground example: https://go.dev/play/p/7b-xGO9A9Xo

The issue is that the TS data type should technically be a struct where the first field is a time stamp, but I've simplified it to type TS = time.Time. Thus it is attempting to parse the entire field of 10005218^^^default^default as a time, not just the first part. An easy fix would be for the parser to first use `strings.Cut(field, "^") and take the first part of the message. I'll see if I can update that logic.

The date provided "10005218" is not a valid date. However, when providing a valid date, it now parses it correctly. I'm assuming for now the date is invalid because you modified the message to remove any PHI or PII. Look at v1.0.8 . Let me know if that fixes it.

commented

I think not it is ok, but the date was not changed by myself, it is exactly how I got it from Bamboo. I will check with Bamboo this problem. But seems to parse it now correctly.