Chinaunix首页 | 论坛 | 博客
  • 博客访问: 207647
  • 博文数量: 91
  • 博客积分: 3428
  • 博客等级: 中校
  • 技术积分: 902
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-21 13:41
文章分类

全部博文(91)

文章存档

2012年(2)

2011年(25)

2010年(64)

分类:

2010-11-10 22:00:14

RIM DB 
打算翻译这段话,看了一下,部分翻译初稿如下,仅供参考 如有问题 请指证

这部分讨论一些将RIM对象映射到关系型数据库中的应用的最优方法。

读者提示:假设读者了解对象数据模型的特性,了解ER entity-relationship (数据模型和EAV entity-attribute-value数据模型

 这篇文章旨在描述HL7 RIM转换成LDMPDM的过程,HL7RIM是一种由HL7组织创建和维护的业务模型,作为HL7部分标准的数据内容来源。因为它是业务数据模型,RIM不能很好的被用于设计关系型数据的schemaRIM包含抽象类,复杂数据类型和需要加以解决和LDM协调的通用的业务规则,对于MYSQLOracle数据库,LDM可以通过Hibernate或者映射工具被映射成PDM

RIMLDM的转换需要一系列的精细化的步骤,这同样对设计数据库架构有很大的用处。这些步骤的目的是产生一个拥有规范化数据结构和具体业务规则的域抽象模型,由此产生的LDM是非常适合用于数据库的设计活动中的,LDM在技术上是独立的,在一定程度上,和应用也无关。当开始设计应用的时候,LDM被当作输入。然后进一步的转换成PDM ,PDM会考虑数据库架构涉及的技术,包括目标数据库的容量,三百个并发终端用户登录时的典型OLTP应用的调节能力。

HL7RIM中的类和数据类型被分成不同的逻辑包。RIM中有六个核心包,其他包仅仅是用于行政和模型管理的目的。Entitiesrolesacts包含了各自的entity role act 继承类和独立类。Datatypes包包含了所有V3定义的数据类型。Structured Documents and Message Control结构化文档和消息控制包包含了一些类,它们代表HL7消息以及临床文档架构标准的一些制品。我们的例子仅包含了在Actsdatatypeentitiesroles包范围内的一些子集。

To keep this paper simple, let's select only the relevant attributes:

为了让文章简洁,我们只选择一些相关的属性

这些数据类型在javasigorg.hl7.types.impl包里面。相关的java的包装类在org.hl7.hibernate包里。

原文地址:


This section discusses some of the best practices for those applications that map RIM objects to an E-R database structure. 
Note to readers: the reader is assumed to be aware of the characteristics of the object data model, the entity-relationship (ER) data model and the entity-attribute-value (EAV) data model. 


See ORM for references. 

Specific References 

Introduction 

The purpose of this white paper is to describe a process for transforming the Health Level Seven (HL7) Reference Information Model (RIM) into a Logical Data Model (LDM) and a Physical Data Model (PDM). The HL7 RIM is a conceptual data model built and maintained by HL7 to be used as a source of the data content portion of HL7 standards. Because it is a conceptual data model, the RIM is not well suited to be used as the design of a relational database schema. The RIM contains abstract classes, complex datatypes, and generic business rules that need to be resolved and reconciled to form a LDM. LDM can be mapped to its PDM via Hibernate o-r mapping tool for the target databases MySQL and Oracle. 

A series of refinement steps is required to transform the RIM into a LDM that would be useful as input to design of a database schema. The steps are designed to render a less abstract model with normalized data structures and realm specific business rules. The resulting LDM is well suited for use in database design activities. The LDM is technology independent and to some extent application independent. As application design begins the LDM will be used as input and further transformed into a PDM. The PDM will consider the technological implications of the database schema including items such as the capabilities of the target database management system (DBMS), tuned for a typical OLTP application with 300 concurrent end users logged in. 

Scope 

The classes and datatypes in the HL7 RIM are grouped into logical packages. There are six core packages in the RIM, other packages are used for administrative and model management purposes only. The Entities, Roles, and Acts packages contain the respective entity, role, and act generalization hierarchies and dependent classes. The Datatypes package contains all of the defined version 3.0 datatypes. The Structured Documents and Message Control packages contain classes that represent artifacts peculiar to HL7 messaging and clinical document architecture standards. For the purpose of our example model only a subset of classes of Acts, Datatype, Entities, and Roles packages will be considered within scope of the paper. Image:Acimg1.GIF 

To keep this paper simple, let's select only the relevant attributes: 

Image:Acimg2.GIF 

Resolving Generic Datatypes 

These Data Types are included into the JavaSIG package: org.hl7.types.impl The relative java wrappers (WrappingBagAccessor, WrappingSetAccessor, WrappingListAccessor) are included into the package: org.hl7.hibernate 

“IVL”, “EIVL” or “PIVL” Datatype 
Entity.existence_time : IVL  
Entity.existence_start_time : TS 
Entity/existence_end_time : TS 
Manufactured_material.stability_time : IVL  
Manufactured_material.stability_time_start : TS 
Manufactured_material.stability_time_stop : TS 
Act.repeat_number : IVL 
Act.repeat_number_start : TS 
Act.repeat_number_stop : TS 
Supply.expected_use_time : IVL 
Supply.expected_use_time_start : TS 
Supply.expected_use_time_stop : TS 
SubstanceAdmnistration.rate_qty: IVL 
SubstanceAdmnistration.rate_qty_start : PQ 
SubstanceAdmnistration.rate_qty_stop : PQ 
SubstanceAdmnistration.dose_qty: IVL 
SubstanceAdmnistration.dose_qty_start : PQ 
SubstanceAdmnistration.dose_qty_stop : PQ 
Account.allowed_balance_qty: IVL 
Account.allowed_balance_qty_start: MO 
Account.allowed_balance_qty_stop: MO 
RoleLink.effective_time: IVL 
RoleLink.effective_time_start: TS 
RoleLink.effective_time_stop: TS 
Role.effective_time: IVL 
Role.effective_time_start: TS 
Role.effective_time_stop: TS 
Participation.time:IVL 
Participation.time_start: TS 
Participation.time_stop: TS 

“SET”, “DSET”, “QSET” or “List” Datatypes 
Entity.id : SET ==> Enity_Identifier. 
Entity.status_cd : SET ==> Entity.status_cd : CS 
Person.ethnic_group_cd : SET ==> Person.ethnic_group_cd : CE 
Person.race_cd : SET ==> Person_Race. 
Entity.qty : SET ==> Entity.qty PQ 
Person.religious_affiliation : SET ==> Person.religious_affiliation : CE 
Act.id: SET ==> Act_Identifier 
Act.priority: SET ==> Act_Priority 
Act.confidentiality_cd: SET ==> Act_Confidentiality 
Act.reason_cd: SET ==> Act_Reason 
PatientEncounter.special_courtesies_cd: SET ==> PatientEncounter_Courtesies 
PatientEncounter.special_arrangement_cd: SET ==> PatientEncounter_Arrangement 
Procedure.method_cd: SET ==> Procedure_method 
Procedure.approach_site_cd: SET ==> Procedure_approach_site 
Procedure.target_site_cd: SET ==> Procedure_target_site 
Observation.interpretation_cd: SET ==> Observation_interpretation 
Observation.method_cd: SET ==> Observation_method 
Observation.target_site_cd: SET ==> Observation_target 
SubstanceAdministration.approach_site_cd: SET ==> SubstanceAdministration_approach_site 
SubstanceAdministration.dose_check_qty: SET ==> SubstanceAdministration_dose_check 
SubstanceAdministration.max_dose_qty: SET ==> SubstanceAdministration_max_dose 
SubstanceAdministration.method_cd: SET ==> SubstanceAdministration_method 
InvoiceElement.modifier_cd: SET ==> InvoiceElement_modifier 
DeviceTask.parameter_value: LIST ==> DeviceTask_parameters 
Role.id: SET ==> Role_identifier 
Role.confidentiality_cd: SET ==> Role_confidentiality 
Role.position_number: LIST ==> Role_position 
ManagedParticipation.id: SET ==> ManagedParticipation_identifier 
Document.bibliographic_designation_txt: SET ==> Document_Designation 


Note: SET type for Entity.status_cd has been simplified to a single CS value (except Person.race_cd). 

“BAG” Datatypes 
Entity.nm : BAG ==> Enity_Name. 
Entity.telecom : BAG ==> Entity_Telecom_Address. 
Organization.addr : BAG ==> Organization_Address. 
Person.addr : BAG ==> Person_Address. 
Role.name BAG ==> Role_name 
Role.addr: BAG ==> Role_address 

Image:Acimg3.GIF 

Add Association Attributes 
Entity_identifier./identified_entity : ENTITY 
Entity_name./named_entity : ENTITY 
Entity_telcom_address./addressed_entity : ENTITY 
Organization_address./addressed_organization : ORGANIZATION 
Person_address./addressed_person : PERSON 
Person_race./attributed_person : PERSON 
Act_reason.act: Act 
Act_Confidentiality: Act 
Act_Priority: Act 
Act_identifier: Act 
PatientEncounter_Courtesies.pencounter: PatientEncounter 
PatientEncounter_Arragement.pencounter: PatientEncounter 
Procedure_method.procedure: Procedure 
Procedure_approach_site.procedure: Procedure 
Procedure_target_site.procedure: Procedure 
Observation_interpretation.observation: Observation 
Observation_target.observation: Observation 
Observation_method.observation: Observation 
SubstanceAdministration_approach_site.sub_admin: SubstanceAdministration 
SubstanceAdministration_dose_check.sub_admin: SubstanceAdministration 
SubstanceAdministration_method.sub_admin: SubstanceAdministration 
SubstanceAdministration_max_dose.sub_admin: SubstanceAdministration 
Role_identifier. identified_role : Role 
Role_confidentiality.confidentiality_role : Role 
Role_position. positioned_role : Role 
Role_name.named_role: Role 
Role_address.addressed_role: Role 
Role_telcom.addressed_role: Role 
ManagedParticipation.identified_mparticipation: ManagedParticipation 
Document_Designation.document: Document 

Image:Acimg4.GIF 

Delete Generalization Relationships 
Entity § Living_subject 
Entity § Organization 
Entity § Place 
Entity § Material 
Entity § Group 
Living_subject § Person 
Living_subject § Non_Person_Living_subject 
Material § Manufactured_material 
Manufactured_material § Container 
Manufactured_material § Device 
Device § Imaging_modality 
Act § PatientEncounter 
Act § ControlAct 
Act § Supply 
Act § WorkingList 
Act § Procedure 
Act § Observation 
Act § DeviceTask 
Act § SubstanceAdministration 
Act § FinancialContract 
Act § Account 
Act § FinancialTransaction 
Act § InvoiceElement 
Diet § Supply 
Observation § PublicHealthCase 
Observation § DiagnosticImage 
Role § Employee 
Role § Access 
Role § QualifiedEntity 
Role § LicensedEntity 
Role § Patient 
Participation § ManagedParticipation 
ContextStructure § Document 

Image:Acimg5.GIF 

Propagate Inherited Attributes 

Image:Acimg6.GIF 

Propagate Inherited Associations 

Image:Acimg7.GIF 

Simplify datatypes 
Person.nm: EN ==> PN 
Organization.nm: EN ==> ON 
All attributes of type CE ==> CV 

Image:Acimg8.GIF 

Datatype expansion 

Image:Acimg9.GIF 

All classes with composed attributes are expanded in the composing parts. The types interested in this process are PN, ON, EN, AD, TEL, II, PQ. 


EN 


Every attribute of type EN is expanded as the following schema. 

This schema models the compositional nature of the attribute EN expanding in a container relationship. 

Tables that have a EN attribute, create a table of name tablename_Name_Part table then this table refers the Entity_Name table. 


Image:Acimg10.GIF 


ON and EN 


ON (Organization Name) and PN (Person Name) are specializations of EN that doesn’t add any attribute, so they are expanded in the same way as EN. 


AD 


AD represents the concept of address and defines it in terms of parts and subparts. It is expanded like in the in schema: 


Image:Acimg11.GIF 


The Person entity then refer the Person_Person_Address. 


TEL 


The TEL datatypes represents a set of telephone reference, so it is modeled as a multipart relation that expands in a schema like the following, in this case is showed the relation applied to an Organization entity: 


Image:Acimg12.GIF 


II 

All attributes of type II are expanded in the three compositing sub attributes: 
root: UID 
extension: ST 
authority: ST 


PQ 


This type of attribute specify a physical quantity, and has many sub attributes as shows in the following schema: 


Image:Acimg13.GIF 


Every table with a PQ attribute has reference to the table PhysicalQuantity. 


Datatype Promotion 

In this phase the CV (Coded Value) and CS (Coded Simple Value) data types are expanded in the corresponding UML class schema, so the all attributes of this types implicitly refers to this inserted element. 

Image:Acimg14.GIF 


LDM-2-PDM 

Given a clean LDM, this guide assumes that Hibernate is used to generate the PDM. Hibernate offers 3 different O-R strategies. 

We have chosen: 
table per hierarchy for the 6 foundation classes (and relative sub-classes) and code values: Act, Entity, Role,Participation,ActRelationship & CodeValue. 
table per concrete class for all other related classes 
There is a group of 5 tables dedicated to Vocabolaries and DataTypes 


 if you are going to use JavaSIG to persist RIM data into the PDM mind that you will have to adapt the wrappers.



PDM 4 MySQL 


DATATYPE Mapping 


REAL = DECIMANL(9,3) 
ST = VARCHAR(5000) 
UID = INT(11) 
ED = VARCHAR(5000) 
GTS = DATETIME 
TS = TIMESTAMP 
BL = BIT(1) 
INT = INT(11) 


PDM 4 ORACLE 11gR1 


DATATYPE Mapping 


REAL = NUMBER 
ST = VARCHAR(5000) 
UID = NUMBER 
ED = VARCHAR(5000) 
GTS = DATE 
TS = DATE 
BL = BOOLEAN 
INT = NUMBER 


WARNINGS 


Object names cannot be longer than 30 characters, thus some table and index names have to be shorten. 
"auto increment" capabilities are implemented via the creation of SEQUENCES, incremented by PRE-INSERT db triggers. 
CHARACTER SET AL32UTF8;
NATIONAL CHARACTER SET AL16UTF16;

ORACLE ENVIRONMENT 
Oracle environment sul server Linux:
EDITOR=vi
export EDITOR
ORACLE_SID=phidb
export ORACLE_SID
ORACLE_BASE=/oracle/app
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORACLE_HOME
ORA_CRS_HOME=$ORACLE_BASE/product/11.1.0/crs_1
export ORA_CRS_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
PATH=$ORACLE_BASE/admin/rman/bin:$ORACLE_HOME/bin:
$ORA_CRS_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:.
export PATH
umask 022
Place all DATAFILES in $ORACLE_BASE/oradata/phidb
Place ".bash_profile" and ".oracle_profile" into /home/oracle
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then . ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
if [ -f ~/.oracle_profile ]; then . ~/.oracle_profile
fi
.oracle_profile
PS1="`/bin/hostname `-> "
export PS1
EDITOR=vi
export EDITOR
ORACLE_SID=phidb
export ORACLE_SID
ORACLE_BASE=/oracle/app
export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1
export ORACLE_HOME
ORA_CRS_HOME=$ORACLE_BASE/product/11.1.0/crs_1
export ORA_CRS_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH PATH=$ORACLE_BASE/admin/rman/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:.
export PATH
umask 022
$ORACLE_BASE/admin has the following structure:
phidb
|-- adump
|-- ddl
| |-- arrdb.sql
| |-- dropall.sql
| |-- jbpm.sql
| |-- mkall.log
| |-- mkall.sql
| |-- mktablespaces.sql
| |-- mkusers.sql
| |-- qrtz.sql
| `-- rimpdm2.sql
|-- dpdump
| `-- dp.log
|-- pfile
| |-- crspfile.sql
| `-- init.ora
`-- scripts
|-- CreateDB.sql
|-- CreateDBCatalog.sql
|-- CreateDBFiles.sql
|-- JServer.sql
|-- apex.sql
|-- context.sql
|-- cwmlite.sql
|-- emRepository.sql
| -- init.ora
|-- interMedia.sql
|-- lockAccount.sql
|-- ordinst.sql
|-- owb.sql
|-- phidb.sh
|-- phidb.sql
|-- postDBCreation.sql
|-- spatial.sql
|-- ultraSearch.sql
|-- ultraSearchCfg.sql
`-- xdb_protocol.sql
阅读(1049) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~