找回密码
 欢迎注册
搜索
热搜: 活动 交友 discuz
查看: 2937|回复: 10

HL7V3DT初解

[复制链接]
发表于 2003-4-8 11:07:40 | 显示全部楼层 |阅读模式
我们对Cache中实现V3DT已经研究几个方面内容了,并有了一些总体的想法了,接下来要仔细研究一下HL7V3DT到底是如保定义这些数据类型的,这些定义可以的Cache中全部实现吗?我将再次把我的研究过程记录下来,希望对大家有些启发,还望大家帮助!
 楼主| 发表于 2003-4-8 11:59:21 | 显示全部楼层

HL7V3DT初解

[这个贴子最后由sbf2000在 2003/04/08 01:24pm 第 1 次编辑]

首先我们看一下DataValue(ANY)的定义:
abstract type DataValue alias ANY {
    TYPE  dataType"
    BN  nonNull"
    CS  nullFlavor"
    BN  isNull"
    BL  notApplicable"
    BL  unknown"
    BL  other"
    BL  equal(ANY x)"
}"
1.ANY定义了所有数据值的最基本性质,它是所有数据类型的祖宗,是一个抽象类。
2.ANY的定义说明,每个数据类型都有一个类型Type,类型有长名和短名。Cache ObjectScript是一种无类型的语言,也就是不用为一个变量和数据值定义数据类型,系统自动会进行转换,好象也没有获得数据类型的函数或方法。因些我们可能要为数据型定义一个固定值的参数(就象XSDTYPE那样)和使用一个方法,来反映这个数据的类型。但也可以不定义,而直接使用XSDTYPE、CLIENTTYPE、ODBCTYPE和SQLCATEGORY来反应数据类型。
3.ANY还定义了空值的一些情况,Cache中变量为空值时是不会有那么多的语意的。我准备定义一个参数nullFlavor和方法getnullFlavor来实现空值的语意。
4.ANY数据类型需不需要在Cache中定义,也是值得考虑的,因为Cache中,classtype=datatype的类就指有的是数据类型。对空值的定义直接加到每个类的定义中就行了。
5.最后,V3DT中定义了每个数据值都有的运算是“等于”,这个定义我想不用再去实现了,Cache系统本身就默认有的。
 楼主| 发表于 2003-4-8 13:54:53 | 显示全部楼层

HL7V3DT初解

空值的一些语意:
1.NI 是最常用的,代表没有任何信息(No information whatsoever can be inferred from this exceptional value. This is the most general exceptional value. It is also the default exceptional value.)  
2.NA 代表没有可用值,如:男性的月经期(No proper value is applicable in this context (e.g., last menstrual period for a male.) )
3.UNK 应该有适当的值的,但不知道(A proper value is applicable, but not known. )。
4.NASK 没有询问,如:患者病情没有被询问(This information has not been sought (e.g., patient was not asked) )
5.ASKU 询问了,但不知道,如:向患者询问过病情,但答案是不知道(Information was sought but not found (e.g., patient was asked but didn\'t know) )
6.NAV 现在值不存在,但将来会有的(Information is not available at this time but it is expected that it will be available later. )
7.OTH 值不是适当的值,如:概念没在代码表中存在(The actual value is not an element in the value domain of a variable. (e.g., concept not provided by required code system.) )
8.PINF 数值正无穷大(Positive infinity of numbers. )
9.NINF 数值负无穷大( Negative infinity of numbers. )
10.MSK 虽然这里原来是有值的,但为了安全等原因,发送者没有发送过来,主要目的是说明这里的数据是存在的。(There is information on this item available but it has not been provided by the sender due to security, privacy or other reasons. There may be an alternate mechanism for gaining access to this information. Note: using this null flavor does provide information that may be a breach of confidentiality. Its primary purpose is for those circumstances where it is necessary to inform the receiver that the information does exist. )
11.NP 值在消息中没有被表现出来,这只用在消息中,不用于应用系统。所有消息中没有表现出来的值,在应用系统中都需要用NI或其它值代替。(Value is not present in a message. This is only defined in messages, never in application data! All values not present in the message must be replaced by the applicable default, or no-information (NI) as the default of all defaults.  )
12.从上面的这些定义看,V3DT给一个空值的数据定义了丰富的更明确的语意!
 楼主| 发表于 2003-4-8 14:18:48 | 显示全部楼层

HL7V3DT初解

Boolean (BL) :
type Boolean alias BL specializes ANY
    values(true, false)
{
            BL  and(BL x)"
            BL  not"
  literal   ST"
            BL  or(BL x)"
            BL  xor(BL x)"
            BL  implies(BL x)"
}"
1.BL与系统的Boolean类型是完全一致的。如果不考虑nullFlavor,直接就可以用系统的定义。(nullFlavor在V3DT中说明了并不一定要全完实现)
 楼主| 发表于 2003-4-8 14:22:50 | 显示全部楼层

HL7V3DT初解

BooleanNonNull(BN)
type BooleanNonNull alias BN specializes BL"
}"
1.BN是特殊的BL,不能有空值。
2.我们可以参照%Library.Boolean的定义实现BN。或从BL继承。
 楼主| 发表于 2003-4-8 14:49:31 | 显示全部楼层

HL7V3DT初解

Sequence (LIST),是比较重要的数据类型,它的定义是:
template<ANY T>
type Sequence<T> alias LIST<T> specializes ANY {
            T         head"
            LIST<T>   tail"
            BL        isEmpty"
            BL        nonEmpty"
    T         item(INT index)"
            BL        contains(T item)"
            INT       length"
  literal   ST"
  promotion LIST<T>   (T x)"
}"
1.LIST是含一序列其它类型数据元素的数据类型,它包含的数据元素可以是空值。
2.Cache有%List数据类型,它们的定义之间稍有差别,%List定义了一个分隔符号,但LIST没有定义。
3.LIST主要是用来实现其它一些复杂的数据类型,在Cache中,定义类的属性时,可以用
Property NewProperty1 As %Boolean [ Collection = list ]"的形式来定义复杂数据类型的属性。也就是%Boolean [ Collection = list ]也就相当于V3DT中的BIN。所以,是否有些V3DT不用实现了,直接用Datatype [Collection = list ]形式就可以了?
 楼主| 发表于 2003-4-8 15:06:58 | 显示全部楼层

HL7V3DT初解

GeneratedSequence (GLIST)
type GeneratedSequence<QTY T> alias GLIST specializes LIST<T> {
        T       head"
        QTY     increment"
        INT     period"
        INT     denominator"
}"
1.GLIST是一个特殊的LIST,它的每个元素符合下面公式:Xi=X0 + Δx × (i/d) mod p
这里GLIST.denominator=d,GLIST.increment=Δx,GLIST.head=p
2.GLIST用来表示一些有规律的数据序列,Cache中没有现成的实现。
 楼主| 发表于 2003-4-8 15:07:30 | 显示全部楼层

HL7V3DT初解

[这个贴子最后由sbf2000在 2003/04/08 03:15pm 第 1 次编辑]

SampledSequence (SLIST)
type SampledSequence<QTY T> alias SLIST specializes LIST<T> {
  T         origin"
  QTY       scale"
  LIST<INT> digits"
}"
1.SLIST的每个元素符合下在公式:xi = xo + s × di,这里:SLIST.digits=di,SLIST.scale=s,SLIST.origin=xo
2.SLIST的元素序列是在一个序列的基础上按上面公式计算所得的另一列序列。它主要用来表达一些特殊的生物信号。
 楼主| 发表于 2003-4-8 15:22:07 | 显示全部楼层

HL7V3DT初解

[这个贴子最后由sbf2000在 2003/04/08 03:23pm 第 1 次编辑]

Bag (BAG)
invariant(BAG<T> bag" T item)
     where bag.nonNull.and(item.nonNull) {
  bag.contains(item).nonNegative"
  bag.isEmpty.equal(bag.contains(item).isZero)"
}"
1.BAG跟LIST的区别是元素是无序的,在Cache中,Collection = array有类似的表达效果。
2.BAG用于包含系统列统计数据比较有效。
 楼主| 发表于 2003-4-8 15:29:09 | 显示全部楼层

HL7V3DT初解

Set (SET)
template<ANY T>
type Set<T> alias SET<T> specializes ANY {
            BL      contains(T element)"
            BL      isEmpty"
            BL      nonEmpty"
            BL      contains(SET<T> subset)"
            INT     cardinality"
            SET<T>  union(SET<T> otherset)"
            SET<T>  union(T element)"
            SET<T>  except(T element)"
            SET<T>  except(SET<T> otherset)"
            SET<T>  intersection(SET<T> otherset)"
  literal   ST"
  promotion SET<T>  (T x)"
            IVL<T>  hull"
}"
1.SET是包含一系统无序的不同的其它值的数据值。BAG中的元素是可以重复的,SET中的值是不可以重复的。
 楼主| 发表于 2003-4-8 16:57:06 | 显示全部楼层

HL7V3DT初解

Interval (IVL)
template<QTY T>
type Interval<T> alias IVL<T> specializes SET<T> {
            T       low"
            BL      lowClosed"
            T       high"
            BL      highClosed"
            QTY     width"
            T       center"
            IVL<T>  hull"
            IVL<T>  hull(IVL<T> x)"
  literal   ST"
  promotion IVL<T>  (T x)"
  demotion  T"
}"
1.IVL用来表示一个有序系列值的间隔系列,这个有序系列可以是离散的,也可以是联续的。
2.这是一个比较复杂的数据类型。
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

快速回复 返回顶部 返回列表