简体   繁体   English

如何屏蔽HL7中的特定元素?

[英]How to mask specific elements in HL7?

Currently I am learning how to work with HL7 and how to parse it in python. 目前,我正在学习如何使用HL7以及如何在python中解析它。 Now I was wondering what happens if a value in a HL7 segment contains a pipe sign, eg '|'. 现在,我想知道如果HL7段中的值包含管道符号(例如'|')会发生什么情况。 How is this sign handled? 该标志如何处理? If there is no masking, it would lead to a crash of the HL7 parser. 如果没有屏蔽,则将导致HL7解析器崩溃。 Is there a masking possibility? 有掩盖的可能吗?

\\F\\ \\F\\

You should read the relevant sections of chapter 2 of the version 2 standard about how escaping works in version 2. 您应该阅读版本2标准第2章的相关部分,以了解版本2中转义的工作方式。

The HL7 structure has defined escape sequences for the separators like | HL7结构为分隔符(例如|定义了转义序列。 . When you look at a HL7 message, the used five delimiters are right after the MSH: 当您查看HL7消息时,使用的五个定界符就在MSH之后:

MSH|^~\&
  • | | is the Field separator F 是字段分隔符F
  • ^ the component separator S ^成分分离器S
  • ~ is the repetition separator (for the second level elements) R 〜是重复分隔符(对于第二级元素) R
  • \\ is the escape character E \\是转义字符 E
  • & is the sub-component separator T &是子成分分隔符T

So to escape one of the special characters like | 因此,要逃避特殊字符之一,例如| , you have to take the escape character and then add the defined letter (F,S, etc.) ,您必须先使用转义符,然后添加定义的字母(F,S等)

So in above case, to escape the | 因此,在上述情况下,要逃避| you would have to put \\F\\ . 您必须输入\\F\\ Or escaping the escape character is \\E\\ . 或转义转义字符为\\E\\

If you like you can also change the delimiters after the MSH completely, but I don't recommend that. 如果您愿意,也可以在MSH之后完全更改定界符,但我不建议这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM