This wiki has undergone a migration to Confluence found Here

# Datatypes R2 Issue 6

## Introduction

Add a frequency property to Periodic Interval. This is needed to handle circumstances when the interval is properly expressed as a number of repetitions per time-period rather than a time-period width (period). For example, a frequency of 7 times/day is not cleanly expressible as a period. Furthermore, specifying it as a period is misleading.

Backwards compatibility: Any implementation expecting period and not knowing how to handle frequency will not be able to translate to extract the data.

## Discussion

Proposed changes to abstract:

Periodic Interval of Time (PIVL) specializes SET

Definition: An interval of time that recurs periodically. Periodic intervals have two properties, phase and period/frequency. The phase specifies the "interval prototype" that is repeated every period.

 Name Type Description Frequency RTO The number of repetitions to occur within a specified time-period. displayFrequencyInd BL If true, indicates that frequency takes priority over period for display purposes
```template<TS T>protected type PeriodicInterval<T> alias PIVL<T> specializes SET<T> {
QTY      period;
RTO<INT,PQ>  frequency;
BL      frequencyDominates;
IVL<T>  phase;
CS      alignment;
BL      institutionSpecifiedTime;
BL      contains(TS);
literal   ST;
};

```

Frequency (frequency : RTO<INT,PQ>)

Definition: The number of times the periodic interval repeats (numerator) within a specified time-period (denominator). The denominator is a physical quantity in the dimension of time (TS.diffType.) For an uncertain periodic interval the numerator is a probability distribution.

``` invariant(PIVL<T> x) where x.nonNull {
x.frequency.nonNull;
};
```
``` invariant(PIVL x) {
x.period.dataType.implies(PQ);
};
```
``` invariant(PIVL<T> x) where x.nonNull {
x.period.equals(x.frequency.denominator.inverted.times(x.frequency.numerator);
};
```

Display Frequency Indicator (displayFrequencyInd : BL)

Definition: If true, indicates that frequency takes priority over period for display purposes While mathematically frequency and period are interchangeable, reliable human communication requires differentiation. For example “4 times per day” and “Every 6 hours” are mathematically equivalent. However, good clinical practice requires distinguishing which form was originally expressed as this conveys something of the intent.<May want to indicate something here about how the fuzziness often associated with frequencies relates to IST>

XML

```<x
nullFlavor = {nullFlavor}
operator = "I"|"E"|"A"|"H"|"P"
alignment = {alignment}
institutionSpecified = {institutionSpecified}
>
</x>
```

schema:

```<gsd:templatename="PIVL">
<gsd:paramname="T" type="TS" />
<xsd:complexType>
<xsd:complexContent>
<xsd:extension>
<gsd:templateas="base" name="SXCM">
<gsd:withParamname="T">
<gsd:attributename="type" type="T" />
</gsd:withParam>
</gsd:template>
<xsd:sequence>
<xsd:elementname="phase" ... />
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:elementname="period" ... />
<xsd:element name="frequency" … />
</xsd:choice>
</xsd:sequence>
<xsd:attributename="alignment" type="cs_CalendarCycle" ... />
<xsd:attributename="institutionSpecified" type="bl" ... />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</gsd:template>
```

Frequency : RTO<INT, T.DIFF>

``` <xsd:elementname="frequency" minOccurs="0" maxOccurs="1">
<gsd:templateas="type" name="RTO">
<gsd:withParamname="N">
<gsd:attribute name="type" type="INT" />
</gsd:withParam>
<gsd:withParamname="D">
<gsd:attribute name="type" type="T" prop="diff" />
</gsd:withParam>
</gsd:template>
</xsd:element>
```

Display Frequency Indicator: BL The value of displayFrequencyInd is communicated by the choice of whether period or frequency is sent in the instance. If displayFrequencyInd is true, then frequency is sent. Otherwise, period is sent.

## Discussion:

Tom DeJong: You have RTO<INT, T.DIFF> as the data type for the frequency, but further on it seems like you switch to Integer

Lloyd Actually, I started out with INT, then changed it to INT, thinking that clinicians might actually want to say "2.5 times/day". I recognize that saying it doesn't make a lot of sense, but wasn't sure we wanted to prevent it. If consensus is that INT is sufficient, I'm happy with that.