smart-classic / smart-issues

2 stars 0 forks source link

Allergy and AllergyCategory #19

Closed arjunsanyal closed 12 years ago

arjunsanyal commented 12 years ago
p2 commented 12 years ago

I don't quite understand why the Allergy model has the fields drugAllergen, drugClassAllergen and foodAllergen. Are these intended to describe the allergen? If so, why not make one allergen field that can hold an Allergen object that can describe any allergen, also venoms or pollen and not only drugs and food?

arjunsanyal commented 12 years ago

Josh is always saying it's not our cleanest model :)

foodAllergen is misnamed: it's for all possible allergens that are not drugs or drug classes. The coding system is UNII.

And since drugAllergen, drugClassAllergen, and foodAllergen all use different coding systems so we would have to have 3 distinct objects below a generic top-level allergen object anyway.

p2 commented 12 years ago

Oh, now I see, drugAllergen uses RxNorm, drugClassAllergen uses NDFRT and all the other use UNII.

Technically, SMART could just have an allergen CodedValue and require the use of RxNorm, NDFRT or UNII, depending on the type of the allergen, right? Maybe this would convert the model to one that's considered one of the cleaner ones. ;)

It's however complicating things if you're writing an app dealing with drug allergies. For allergies in general you currently have to check which of the three fields is filled instead of checking the code of one field, so I think in those cases it's not complicating things, just changing the way you work with it.

arjunsanyal commented 12 years ago

I don't see a case where a CodedValue is not scoped to single coding system or a homegrown mini-system. I think being able to rely on that fact consistently clearly helps developers have less to think about. Maybe we could go further and consider this a (currently implicit) general principle of the data model.

Josh: thoughts?

In this case maybe cleaner is worse! We all know that worse is better anyway :)

jmandel commented 12 years ago

The principle here was indeed to know, up-front, in a prespecified way, which coding system will be used for each CodedValue. That's why we have an explosion of predicates in the Allergy model. I'm still not certain this is a good principle... but I've hesitated to violate it.

p2 commented 12 years ago

It's hard for me to judge, good points for both solutions, renaming foodAllergen to otherAllergen makes things much more clear so maybe it should stay this way.