Open-Systems-Pharmacology / PK-Sim

PK-Sim® is a comprehensive software tool for whole-body physiologically based pharmacokinetic modeling
Other
103 stars 50 forks source link

PK-Sim database: unnecessary foreign key? #2856

Open Yuri05 opened 8 months ago

Yuri05 commented 8 months ago

In the PK-Sim database we have the FK relationship between tab_event_changed_XXX and tab_event_conditions which includes the calculation_method: grafik

While other columns in this FK-relationship make perfectly sense for me: I don't see why the calculation method should be the same. (with the current FK: "the calculation method of the new assigned formula must be the same as the calculation method of the event condition formula").

Because of this, we need to duplicate some formulas (e.g. when resetting a parameter to the original (fasted state) formula after a meal: we cannot reuse the old formula, because it has a different calculation method ("Lumen_PKSim") and must redefine the formula with the calculation method "Events" grafik

So I suggest to remove the calculation_method column from this FK

Yuri05 commented 8 months ago

@msevestre Any concerns?

msevestre commented 8 months ago

nope. It's probably just because we always create foreign key based on name and we did not think about it

Yuri05 commented 8 months ago

Note for self: need to add unique index in tab_event_conditions on (event_id, event_container_type, event_name) for that.