Representing microseconds in DateTime

Hi,

I have a requirement to capture timeseries data which happens at 250 microseconds – that is 0.000250 seconds.

While many programming languages, and the ISO8601 spec, supports this openEHR RM seems to be constrained to milliseconds:

hh:mm:ss[,sss][Z | ±hh[mm]]

Any particular reason we dump microseconds? If not can we add this capability – I think it won’t break any existing code (I hope!)

Cheers,

-koray

Probably we should be faithful to ISO8601 and allow this, I don't see
any reason why we shouldn't.

Just for the record, which medical requirement makes measuring micro-seconds necessary?

By the way, ISO allows one or more digits to represent a decimal fraction of a second.

I don't have the original standard at hand, but Wikipedia says:
https://en.wikipedia.org/wiki/ISO_8601
There is no limit on the number of decimal places for the decimal fraction.

Bert

Hi Bert, I was saying ISO8601 do support this – it is openEHR that constrains to milliseconds.

In my case it is action potential measurement from myocytes

You are right, you do say that. I don’t know if your code supports this, because the ISO-time-string will be converted to a Time-class and must have the same value when converted back. The Java 8 LocalTime class supports until 9 decimals. Sounds interesting, I asked because it is rare to measure microseconds in medical applications. regards Bert

Hi Bert, yes it is an extreme case – most clinical measurements will not go in this range.

Python’s DateTime library (which I’m using at the moment) supports 6 digits after decimal point which gives resolution of 1 microseconds.

And I just noted, Ocean’s Archetype Editor does allow for microseconds but when you select and save it cannot save it. So it is a bug.

It looks definitely a deficiency of the openEHR RM.

I don’t think there is any assumption that [,sss] means there are no microseconds. The field is just called ‘fractional_second’ and it’s a Real (i.e. a float). We just used ‘sss’ as an arbitrary indicator of fractional seconds (how many ‘s’ do you want :wink:

  • thomas

Hi Tom, I’ve been experimenting to save to Ehrscape and it seems the implementation is truncating (not rounding off) beyond 3digits. So whatever I include after 3rd digit is not saved.

“encounter/body_weight:0/any_event:1/time”: “2016-02-01T01:04:09.907123Z” > I get: “encounter/body_weight:0/any_event:1/time”: “2016-02-01T01:04:09.907Z”

To be honest the spec as it reads now seems ambiguous with 3 digits.

Well, we can change the spec if people find it confusing, but as far as I can see, it doesn’t say anything about milliseconds or limiting fractional seconds to 3 places.

But if you want to propose a wording change, feel free to raise a PR, we can address it in the next minor release.

  • thomas