# the periodic definition in data structures IM

**URL:** <https://discourse.openehr.org/t/the-periodic-definition-in-data-structures-im/14573>\
**Category:** Technical (archive)\
**Created:** [26 September 2006 11:29 UTC](https://discourse.openehr.org/t/the-periodic-definition-in-data-structures-im/14573 "2006-09-26T11:29:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Patterson](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@Andrew\_Patterson](https://discourse.openehr.org/u/Andrew_Patterson)\
**Post date:** [26 September 2006 11:29 UTC](https://discourse.openehr.org/t/the-periodic-definition-in-data-structures-im/14573/1 "2006-09-26T11:29:00Z")

</div>

The HISTORY IM has a definition for a period which  
is meant to represent the time between contained  
events. However, in the case where this  
period is filled in, the spec makes no restriction on the  
EVENT.time field - i.e. what is the meaning of  
a HISTORY object with a period set, but yet which  
contains EVENTs that are not according to this  
periodic duration? It would be good if the spec  
clarified what the indented behaviour of an openEHR  
system that encounters such data should be.

Andrew

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [26 September 2006 14:33 UTC](https://discourse.openehr.org/t/the-periodic-definition-in-data-structures-im/14573/2 "2006-09-26T14:33:22Z")

</div>

Andrew Patterson wrote:

> The HISTORY IM has a definition for a period which  
> is meant to represent the time between contained  
> events. However, in the case where this  
> period is filled in, the spec makes no restriction on the  
> EVENT.time field - i.e. what is the meaning of  
> a HISTORY object with a period set, but yet which  
> contains EVENTs that are not according to this  
> periodic duration? It would be good if the spec  
> clarified what the indented behaviour of an openEHR  
> system that encounters such data should be.  
> &nbsp;&nbsp;

I have improved the documentation in the class definitions, and added  
the following invariant to History:

period\_consistency: is\_periodic implies events.for\_all (e: EVENT |  
e.offset.to\_seconds.mod(period.to\_seconds) =  
e.offset.to\_seconds/period.to\_seconds)

and added the query to\_seconds: Double to the ISO8601\_DURATION class in  
the Support IM package.

- thomas

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [26 September 2006 14:43 UTC](https://discourse.openehr.org/t/the-periodic-definition-in-data-structures-im/14573/3 "2006-09-26T14:43:23Z")

</div>

Andrew Patterson wrote:

> The HISTORY IM has a definition for a period which  
> is meant to represent the time between contained  
> events. However, in the case where this  
> period is filled in, the spec makes no restriction on the  
> EVENT.time field - i.e. what is the meaning of  
> a HISTORY object with a period set, but yet which  
> contains EVENTs that are not according to this  
> periodic duration? It would be good if the spec  
> clarified what the indented behaviour of an openEHR  
> system that encounters such data should be.
> 
> Andrew  
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> openEHR-technical mailing list  
> openEHR-technical@openehr.org  
> [http://www.chime.ucl.ac.uk/mailman/listinfo/openehr-technical](http://www.chime.ucl.ac.uk/mailman/listinfo/openehr-technical)

this is now CR-000220 -  
[http://coruscant.chime.ucl.ac.uk:8200/openEHR\_Collector/projects/specifications/CR/220](http://coruscant.chime.ucl.ac.uk:8200/openEHR_Collector/projects/specifications/CR/220)

- thomas

---

<div class="post-metadata">

**Author:** ![Mattias\_Forss1](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Mattias\_Forss1](https://discourse.openehr.org/u/Mattias_Forss1)\
**Post date:** [26 September 2006 17:12 UTC](https://discourse.openehr.org/t/the-periodic-definition-in-data-structures-im/14573/4 "2006-09-26T17:12:55Z")

</div>

2006/9/26, Thomas Beale \<[Thomas.Beale@oceaninformatics.biz](mailto:Thomas.Beale@oceaninformatics.biz)\>:

> I have improved the documentation in the class definitions, and added  
> the following invariant to History:
> 
> period\_consistency: is\_periodic implies events.for\_all (e: EVENT |  
> e.offset.to\_seconds.mod(period.to\_seconds) =  
> e.offset.to\_seconds/period.to\_seconds)

Hi Thomas,

With the risk of making a fool of my self, shouldn’t a consistent period mean that all events should have an offset to the original time of starting the observations which is periodic? In that case, doesn’t it mean that the offset modulo the period should be zero and not offset/period? If the offset is evenly dividable with the period, then it should mean that the event is periodic and if all events are periodic then the period for the history is consistent.

Correct me if I’m wrong.

/Mattias

---

<div class="post-metadata">

**Author:** ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)\
**Post date:** [26 September 2006 19:05 UTC](https://discourse.openehr.org/t/the-periodic-definition-in-data-structures-im/14573/5 "2006-09-26T19:05:17Z")

</div>

Mattias Forss wrote:

> 2006/9/26, Thomas Beale \<Thomas.Beale@oceaninformatics.biz  
> \<mailto:Thomas.Beale@oceaninformatics.biz\>\>:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;I have improved the documentation in the class definitions, and added  
> &nbsp;&nbsp;&nbsp;&nbsp;the following invariant to History:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;period\_consistency: is\_periodic implies events.for\_all (e: EVENT |  
> &nbsp;&nbsp;&nbsp;&nbsp;e.offset.to\_seconds.mod(period.to\_seconds) =  
> &nbsp;&nbsp;&nbsp;&nbsp;e.offset.to\_seconds/period.to\_seconds)
> 
> Hi Thomas,
> 
> With the risk of making a fool of my self, shouldn't a consistent  
> period mean that all events should have an offset to the original time  
> of starting the observations which is periodic? In that case, doesn't  
> it mean that the offset modulo the period should be zero and not  
> offset/period? If the offset is evenly dividable with the period, then  
> it should mean that the event is periodic and if all events are  
> periodic then the period for the history is consistent.
> 
> Correct me if I'm wrong.

no you are not wrong; I was messing around with div and mod functions  
trying to think of the easiest formulation, and accidentally left mod  
instead of div. mod(x) = 0 is probably the easiest actually. I must stop  
multi-tasking (they say males can't do it anyway;-)

- thomas
