How would you model this?

29 views
Skip to first unread message

Matthias De Ridder

unread,
Jul 28, 2015, 7:50:36 AM7/28/15
to RavenDB - 2nd generation document database
We are working on an application that will be used by hospitals to bill their patients. The hospital will register every treatment for a patient in our application. 

The government has released a set of numbers that identify the treatments that can be provided. For instance, number 111111 could mean treating a broken leg, while 222222 could be hearth surgery. As you can imagine, there are a lot of these numbers. The government has organized these numbers in a tree structure with chapters, sections, paragraphs, ... The leaves are the actual numbers.

We have stored this tree structure in our database so we can show it to our users and they can search a number in the same way as they would in the documentation provided by the government. Every time the hospital uses one of these numbers, we have a document which contains this number identifying the treatment, when it was done and extra information to correctly bill it.

Since there are a lot of these numbers, hospitals want to categorize these numbers so they can easily search all numbers related to each other. These categories can be different for each hospital. We want to allow hospitals to add a category to a tree node. This will allow them for example to categorize all numbers under chapter 1, section 4, paragraph 3, ... as blood related.

This is easily done, but as long as these categories are not present in the documents representing an actual treatment, users will not be able to search them. We are looking for a way to avoid this though, since these categories are subject to change. A hospital may decide to remove categories, add new ones or replace existing ones. We want to avoid to have to synchronize all documents when that happens.

Do you have any suggestions/ideas how we could store this in Raven without saving the category in the treatment document?

Oren Eini (Ayende Rahien)

unread,
Jul 28, 2015, 7:55:49 AM7/28/15
to ravendb
How many numbers do you have, total?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthias De Ridder

unread,
Jul 28, 2015, 8:11:06 AM7/28/15
to RavenDB - 2nd generation document database, aye...@ayende.com
It depends on the tree, but the biggest tree at this moment has 44,236 numbers.

Op dinsdag 28 juli 2015 13:55:49 UTC+2 schreef Oren Eini:

Oren Eini (Ayende Rahien)

unread,
Jul 28, 2015, 8:14:12 AM7/28/15
to Matthias De Ridder, RavenDB - 2nd generation document database
That is small enough, and probably important enough, that you can put it all in a single document, if it fits a config doc definition

Does this match?

Matthias De Ridder

unread,
Jul 28, 2015, 8:22:39 AM7/28/15
to RavenDB - 2nd generation document database, aye...@ayende.com
Yes, I guess this is a solution. I'm just figuring how to best include such a document in an index.

We have an index on treatments. Is a LoadDocument in the index the only solution if we want to allow users to query the category too?

Op dinsdag 28 juli 2015 14:14:12 UTC+2 schreef Oren Eini:

Oren Eini (Ayende Rahien)

unread,
Jul 28, 2015, 8:29:15 AM7/28/15
to Matthias De Ridder, RavenDB - 2nd generation document database
You are assuming that this all have to be in a single place, why?
You have the information twice, once for reference, for for clarity

Chris Marisic

unread,
Jul 28, 2015, 9:28:45 AM7/28/15
to RavenDB - 2nd generation document database, orcr...@gmail.com
I would index this with hierarchical keys 

/billing-codes/chapter/1/section/2/paragraphs/1/code/111111
/billing-codes/chapter/7/section/4/paragraphs/5/code/222222

Then things could be loaded as needed with LoadStartingWith

If i was really only added category and perhaps 1 or 2 other properties iwould consider adding them tothe metadata and allow queries to touch metadata. If i wanted to add alot of search data i would do

{
x:1
y:2
z:3

GovernmentData: { }

}

Giving my scope the entire outer shell to own and then insert the government data in a frozen property.
Reply all
Reply to author
Forward
0 new messages