简体   繁体   English

HL7编码/分隔符

[英]HL7 Encoding/Separator Characters

In regards to HL7 pipe-delimited data, how exactly do the encoding characters (|^~\\&) work? 关于HL7管道分隔的数据,编码字符(| ^〜\\&)到底如何工作?

Is the following example of fields, field repetitions, components and their sub-components correct when parsing raw HL7 data? 解析原始HL7数据时,以下字段,字段重复项,组件及其子组件的示例是否正确?

PID|1||||||||||||1234567890^somedata&moredata^TESTEMAIL@GMAIL.COM~0987654321

Field (|): 
PID13 = 1234567890^somedata&moredata^TESTEMAIL@GMAIL.COM~0987654321

Field repetition (~): 
PID13~1 = 1234567890^somedata&moredata^TESTEMAIL@GMAIL.COM
PID13~2 = 0987654321 

Component (^):
PID13.1 = 1234567890
PID13.2 = somedata&moredata
PID13.3 = TESTEMAIL@GMAIL.COM

Sub-component (&):
PID13.2.1 = somedata
PID13.2.2 = moredata
PID13.3.1 = TESTEMAIL@GMAIL.COM
PID13.3.2 = 

Without understanding the left-hand side structure you're trying to assign stuff to, it's impossible to tell you if you're doing it right. 如果不了解要分配内容的左侧结构,就无法告诉您是否做得正确。

There is however one right way to parse the segment/field in question. 但是,有一种正确的方法可以解析所讨论的段/字段。

Here's a link to the specs I reference here 这是我在此处引用的规格的链接

From section 2.5.3 of the HL7v2.7 Standard: 根据HL7v2.7标准的2.5.3节:

Each field is assigned a data type that defines the value domain of the field – the possible values that it may take. 每个字段都分配有一种数据类型,该数据类型定义该字段的值域-它可能采用的值。

If you pull up section 3.4.2.13 (PID-13) you'll see a breakdown of each component and subcomponent. 如果拉起第3.4.2.13节(PID-13),您将看到每个组件和子组件的细分。 Technically, the meaning of subcomponents and components can vary by field, but mostly they just vary by data type. 从技术上讲,子组件和组件的含义可以随字段而变化,但是大多数情况下,它们仅随数据类型而变化。

In your example, you don't treat the repetitions as separate instances of XTN data types. 在您的示例中,您不会将重复视为XTN数据类型的单独实例。 I would re-write using array syntax as so: 我会这样使用数组语法进行重写:

Field repetition (~): 
PID13[0] = 1234567890^somedata&moredata^TESTEMAIL@GMAIL.COM
PID13[1] = 0987654321 

Component (^):
PID13[0].1 = 1234567890
PID13[0].2 = somedata&moredata
PID13[0].3 = TESTEMAIL@GMAIL.COM

Sub-component (&):
PID13[0].2.1 = somedata
PID13[0].2.2 = moredata

The psuedo-code in the same specification section 2.6.1 may be helpful as well 同一规范第2.6.1节中的伪代码也可能会有所帮助

foreach occurrence in ( occurrences_of( field ) ) {
  construct_occurrence( occurrence );
  if not last ( populated occurrence ) insert repetition_separator;
    /* e.g., ~ */
}

It's important to remember that those different subcomponents have different meaning because PID-13 is a XTN type. 重要的是要记住,这些不同的子组件具有不同的含义,因为PID-13是XTN类型。

PID-13 is a problematic example because historically, the order of PID-13 mattered. PID-13是一个有问题的示例,因为从历史上看,PID-13的顺序很重要。 The first repetition was "primary". 第一次重复是“主要”。 Over time the field has also become the landing place for e-mail addresses, pager numbers, etc. So good luck trying to make sense out of real-world data. 随着时间的流逝,该字段也已成为电子邮件地址,传呼机号码等的着陆点。祝您好运,以使您能从真实世界的数据中弄清楚。

This is not the correct usage of the repetition character. 这不是重复字符的正确用法。 You have it in the main component field name, if you are going to use it it would be used within the message shown in my example below: 您可以在主要组件字段名称中使用它,如果要使用它,它将在以下示例中显示的消息中使用:

Field repetition (~): 
PID.9 = TEST@WOW.COM~TESTEMAIL@GMAIL.COM
PID.9.1 = TEST@WOW.COM
PID.9.2 = TESTEMAIL@GMAIL.COM 

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

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