帮助在 SQL/NoSQL 混合(Sql 服务器/RavenDB)中对 EAV 进行建模

发布于 2024-10-06 12:04:20 字数 1352 浏览 3 评论 0原文

我正在设计一个健康 SaaS 应用程序,希望在初始建模方面获得一些帮助。我从这个线程开始确认我应该使用EAV - 答案由于临床数据稀疏,答案是肯定的。然后我开始考虑是否可以使用 NoSQL 选项,而不是尝试将其融入 SQL。看来两者结合起来效果最好。我会尽力解释要求和我的想法,并希望得到任何反馈。我正在使用.net。

要求 在最高级别,我们有一个“病人”。对于需要医疗帮助的患者来说,可能会发生一些事情,我们称之为“事件”。对于每个“事件”,可以多次见到“患者”,称为“访问”。所有临床数据(测试/历史/等)均按“访问”存储。因此,我们有:

患者 1 - ∞ 事件 1 - ∞ 就诊 1 - 1 临床数据(许多潜在的键/值对)

解决方案(反馈会很好)

SQL 表

Patient
- PatientID
- other patient info

Incident
- IncidentID
- PatientID
- Other incident info

Visit
- VisitID
- IncidentID
- Datetime

NoSQL DocumentDB(可能是 RavenDB)

{ // Visit document - id: visits/12345
 "Patient": {
   "PatientId": "patients/54321",
   "Name": "John Smith"
 },
 "Incident": {
   "IncidentId": "incidents/55555",
   "Name": "Cardiac Arrest"
 },
 "VisitData": {
   "BP": "110/70",
   "Hypertension": "True"
   "Cardiac Disease": "Angina"
   "Stroke": "False"
   .... (could be tens or hundreds of key/value pairs)
 },

}

这就是我到目前为止所拥有的。除了一般意见(欢迎)之外,我想知道是否有人认为我应该将每位患者的所有事件和就诊放入一份文档中,而不是每次就诊一份文档(这就是上面应该的内容)。我相信文档可能会变得“太大”(不知道太大在基于文档的数据库中意味着什么),并且视图几乎总是基于访问 - 尽管我们也需要显示跨访问的趋势报告。

提前致谢!!

麦克风

I'm designing a health SaaS app and would appreciate some help with the initial modeling. I started with this thread to confirm that I should be using EAV at all - the answer was yes due to the sparsity of clinical data. I then started looking at possibly using a NoSQL option instead of trying to fit it into SQL. It seems a combination of the two would work best. I'll try to explain the requirement and my idea's and would love any feedback. I'm using .net.

Requirement
At the highest level, we have a 'Patient'. For a patient to need some medical help something would have happened, let's call that an "Incident". For each "Incident" a "Patient" can be seen multiple times, called "Visits". All clinical data (tests/history/etc) is stored per "Visit". So we have:

Patient 1 - ∞ Incidents 1 - ∞ Visits 1 - 1 Clinical data (many potential key/value pairs)

Solution (feedback would be great)

SQL Tables

Patient
- PatientID
- other patient info

Incident
- IncidentID
- PatientID
- Other incident info

Visit
- VisitID
- IncidentID
- Datetime

NoSQL DocumentDB (probably RavenDB)

{ // Visit document - id: visits/12345
 "Patient": {
   "PatientId": "patients/54321",
   "Name": "John Smith"
 },
 "Incident": {
   "IncidentId": "incidents/55555",
   "Name": "Cardiac Arrest"
 },
 "VisitData": {
   "BP": "110/70",
   "Hypertension": "True"
   "Cardiac Disease": "Angina"
   "Stroke": "False"
   .... (could be tens or hundreds of key/value pairs)
 },

}

That's what I have so far. Aside from general opinions (all welcome), I was wondering if anyone thinks I should put all Incidents and Visits for each patient in ONE document as opposed to having one document per visit (which is what the above is supposed to be). I believe the documents could get 'too big' (without any idea of what too big means in a document based DB) and also almost always the views are based on a visit - though we'd need to show trending reports across visits as well.

Thanks in advance!!

Mike

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抹茶夏天i‖ 2024-10-13 12:04:20

根据您所说的要求,这看起来很合适。

我认为可能还有其他事情发生,这可能是“情况”,不一定是任何患者事件的一部分。例如,患有高血压的人可能只是因为手指骨折而出现这种情况。

此外,事件可能很难定义 - 它是单个时间点事件还是恶化的渐进持续时间?也许这意味着事件实际上只是访问的一个标记,或者您可能有一个访问访问关联表,可以让您声明一次访问是另一次访问的后续,从而构建患者接受的护理的层次结构或网络。

只是一些想法......第一个

编辑 - 事后思考:我肯定会推荐一个带有正确规范化表的 SQL 数据库......

this looks appropriate according to your stated requirements.

I think there is probably something else going on, which is maybe 'Condition' that is not necessarily part of any patient Incident. For instance a person with Hypertension may simply have that condition when they present for a broken finger.

Also, Incident may be hard to define - is it a single point in time event or is it a progressive duration of deterioration? Maybe this means Incident is really just a marker on a visit, or maybe you have a visit to vist association table that lets you declare that a visit is a followup to another visit, building a hierarchy or netwrok of the care a patient received.

just a couple thoughts off the top.. hth

edit - afterthought: I would for sure recommend a SQL db with properly normalized tables...

日久见人心 2024-10-13 12:04:20

混合使用数据库可能效果最好。现有的方法使用 EAV,但问题在于嵌套事实 - 关于药物相互作用的警报可能是 SQL 表中的主事件,

但警报的严重程度、发送给谁、哪两种药物 - 这些详细信息可以转到基于文档的 noSQL 数据库。

a mix of databases may work best. Existing appraches use EAV but the problem is with nested facts - alert about drug interaction could be master event in a SQL table

but then how severe alert, to whom sent, which 2 drugs - those details can go to a document-based noSQL db.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文