I am adding a field to my visit report which is the patient’s Weight divided by Height.
Currently, I have created an ArithmeticOperationConverter that does that (could be PRed if it appears to be a satisfying choice). The way it works is:
- the data definition associated with my “Weight/Height” column returns a list of obs (answers of a given question) for each patient
- the converter takes this list of obs as an input and performs an arithmetic operation, in this case it divides every member of the list
(Q) Is that a correct approach? (Q) Is there something existing already that I should use?
I have chosen to use a converter in this case because I have also created a ObsForVisitDataDefinition (PR to add this to the Reporting module coming soon) useful for other fields of this report. This way, we can just keep using this data definition, and simply apply the converter.
Another possible option I guess would be to simply create a new WeightOnHeightPatientDataDefinition and assign this to my “Weight/Height” report column.
Then I also need to calculate the Weight divided by Age. So in this case I won’t be able to use the ObsForVisitDataDefinition (Age is not an obs). I will have to create a new data definition that returns one obs and the patient’s age, something like ObsAndAgeForVisitDataDefintion, and then apply the ArithmeticOperationConverter. So this starts to be a bit stretched.
Am I better off creating two new data defs?
- WeightOnAgePatientDataDefinition. rather than leveraging on converters for these cases?