HBASE版本:0.94.10
NOSQL设计初级保健系统数据模型的新手。我有标准化的样本数据库关系模型,例如HBASE-0.94.0
Patient table:
============
1) Patient_id - PK
2) Added_BY
3) Gender
4) Usual_GP
,
Patient Name table: [One to many relationship with patient [One] Name[Many]]
1) Name_id
2) Patient_id - FK
3) Name_type
4) First name
5) Last Name
6) Middle name
,
Patient address table: [One to many relationship with patient [One] address[Many]]
1) Address_id
2) Patient_id - FK
3) Address_type
4) Line1
5) Line2
6) Line 3
7) Line 4
8) Line 5
,
Patient Phone table: [One to many relationship with patient [One] Phone[Many]]
1) Phone_id
2) Patient_id - FK
3) PhoneType
4) Phoneno
5) ext
,
Medication and other details
1)Entry_id
2)Patient_id - FK [One to many relationship with patient [One] Medication[Many]]
3)Start_date
4)End_date
5)Code
6)Medicine description
7)Dosage details
8) Number of authorised
9) Number issued
对于上面的规范化数据模型,我在下面创建了样本NoSQL数据模型,i Hope数据模型适用于Document base NOSQL。需要将下面的数据模型转换为基于HBASE列的数据模型,请帮帮我。
Patient :{Patient_id:22,
Added_by:Doctor1,
Gender:Male,
UsualGP: Doctor2,
PatName:[
{NameType:Usual, FirstName:Hari, LastName:prasad,Middlename:' '},
{NameType:Other, FirstName:John,LastName:prasad,Middlename:kenndy}
]
PatAddr:[
{AddType:Usual, Line1:2, Line2:Harrington road, Line3: near central, Line4:Newyork,Line5:NY008},
{AddType:Tmp, Line1:2, Line2:Mylapore road, Line3: near Zoo, Line4:WashingtonDC,Line5:WA00098}
]
PatPhone:[
{PhoneType:Usual, Phoneno:4453443344, ext:099},
{PhoneType:Tmp, Phoneno:9198332342343, ext:}
]
PatMedication:[
{MedStardate:'01/01/2013', MedEndDate:'', Code:'Snomode', MedDesc:'Paracetmol', DosDet:'Take 2 daily', Noauth: 5, Issue: 3},
{MedStardate:'01/05/2013', MedEndDate:'01/05/2013', Code:'readcode', MedDesc:'Avil', DosDet:'Take 1 daily', Noauth: 3, Issue: 1},
{MedStardate:'01/10/2013', MedEndDate:'24/10/13', Code:'readcode', MedDesc:'Metacin', DosDet:'Take 2 daily', Noauth: 5, Issue: 3},
]
}
答案 0 :(得分:1)
如评论中所述,HBase用于非关系数据。但是,您仍然可以将其用于此目的。首先,您应该定义列族。不需要列名称,因为它是柱状形式。
将这些列放在同一列族中会提高性能。因此,一个列族就会很好。除此之外,列和列族名称短也是另一个性能问题。如果可以,请用一个或两个字母命名这些列和列变量。
但是,您不能按原样使用外键。我的意思是,您可以将另一个表的id存储在一列中,但不能直接检查它是否存在。相反,您应该转到此表并手动检查它。
我希望这个解释会对你有所帮助。查看this了解详情。