Closed stefanspiska closed 2 years ago
Good find!
The cause is the following, from DvDuration.java:
@XmlTransient
@Override
@JsonIgnore
public Long getMagnitude() {
return null; //no magnitude defined in spec
}
The problem is, how to calculate the magnitude is not defined in the specification. The javalibs implementation calculated a double value of the number of seconds:
Then of course converting years or months to seconds will need a specification, as the number of seconds in a month or year is not the same for every month or year.
I guess I'll raise a question about how this should be in the specifcation.
See https://github.com/openEHR/archie/pull/383 for the preliminary fix. the specification of converting years and months is defined in https://specifications.openehr.org/releases/BASE/latest/foundation_types.html#_iso8601_duration_class
this leaves whether magnitude of DV_DURATION should be seconds or something else. Once we have that answer, the pull requests can be fixed and merged.
Ah, it was defined after all. Ok, the pull request should be correct as is.
Try to run the following test
This fails with
Exception NullPointerException invoking invariant Normal_range_and_status_consistency on DV_DURATION: Cannot invoke "java.lang.Comparable.compareTo(Object)" because the return value of "com.nedap.archie.rm.datavalues.quantity.DvQuantified.getMagnitude()" is null
I assume this is do to DvDuration not correctly Implementing getMagnitude.