Replies: 2 comments 2 replies
-
That is somewhat of an atypical model. Usually folks extract data as needed into normal tables columns (e.g. mrn goes into column mrn) and if a copy of the message is needed it is stored in its entirety in the database and retrieved and serialized as needed for future needs. What is your use case to do it your way? I'm curious. |
Beta Was this translation helpful? Give feedback.
-
In relation to @pacmano1 's question about your use case, and typically storing the raw hl7 message in its entirety, how does your database model handle subcomponents? Are you eventually reconstructing these hl7 messages or is this just to make the data easier to retrieve by other processes?
I can't tell if this will work without seeing more of your code, but give this a try: segment.replace(currentRepeatingField, resultField) This is assuming that If you are new to e4x, here's a good place to start https://web.archive.org/web/20181120184304/https://wso2.com/project/mashup/0.2/docs/e4xquickstart.html There are also many years worth of good information at the mirth forums, which is always worth a search https://forums.mirthproject.io/ |
Beta Was this translation helpful? Give feedback.
-
I have this database in which I can store incoming HL7 messages. Each table represents a segment, each column represents a field plus component. Unfortunately this design does not allow storing repeating fields, so I came up with the following to provide for that. The segment is first scanned for repeating fields. This is for example in the incoming message (here I have put each field on a separate line to improve readability):
My code then groups the respective values together per component, and to each value a sequence number is concatenated - with # as separator - that indicates the field index in which it occurred (again, the separate lines are done on purpose here to improve readability):
This gives me each field and each component only once; so far, so good. But now I have to replace the original repeating fields in the segment with the modified fields (after this is done I can process the modified segment, and store the fields in the database). This code snippet should do so:
re is the correct regular expression to select all <PV1.9>...</PV1.9> sections in the original segment from the first <PV1.9> to the last </PV1.9>, but even so the segment.replace-line gives an error: "TypeError: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified." I do not see what is wrong and which character is illegal. What am I doing wrong here?
Note:
Since it is apparently a "TypeError", it is quite possible that "segment" is not a string, and that might have something to do with it. After all, if I run this code
I indeed have to specify segment .toString() to have the segment show up in the log: merely segment won't do it. But then: what does segment itself look like, and how do I get original fields in this segment replaced with my modified fields?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions