Closed jniles closed 9 years ago
Thanks because you did your best to be clear. First of all, the * debitor_group table* doesn't store conventions for the first impression, it is storing debtor group. A debtor group can be a convention (enterprise) that why we have a flag is_convention.
In BHIMA, we are writting only the sale uuid in the inv_po_id column so that we are able to know what debtor was concerned by the bill.
In your schema, you are considering the convention at the same level then a patient, in other word, an enterprise at the same level then a patient. We have a convention for Moral person and a conventioned patient for physical person, This design destroy the group character of convention and make a convention a physical person as patient and employee. A convention contains debtors so it is a debtor group by definition and those debtors are different because there are supposed to not pay for their bill. We have an other procedure called subsidy where a whatever debtor group can support whatever patient group but the obligation character is not required. So I am less easy when you are employing the word supporting to reference the main relation between a debtor and a convention even if I have not an other word but supporting is the best word to characterize the subsidy.
@DedrickEnc thanks for the feedback. I guess if conventions are not entities, than my proposal makes no sense. I thought for sure they had a debtor representation, but maybe I'm misremembering.
I'm still not satisfied with defining location ids, emails, and other metadata dependent on the is_convention
field. That doesn't seem like good database creation. However, my proposal is too drastic a change to simply address that one issue. I'll close this issue as won't fix.
This proposal restructures the way bhima handles conventions, debtors, and debtor groups.
Why change anything?
The debitor_group database table currently stores conventions, and I will argue that this is not appropriate. The reasons are given in the list below:
I think we can do better.
Proposal: Treat Conventions like Patients and Employees
I propose change our database schema to reflect the following diagram:
In this model, a convention is an entity with a debtor representation, a debtor group, and a linked account. Getting all conventions is as easy as querying a
SELECT * FROM convention
. We also now have a clear debtor to debit when a convention agrees to support a patient. Finally, we remove everything but the financial details from the debitor_group database table.For this to work properly, we require the following rules:
Advantages:
Disadvantages:
cc @IMA-WorldHealth/remote-contributors @IMA-WorldHealth/owners