Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ArchetypeEditor/ADL_Classes/ADL_Archetype.vb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ Namespace ArchetypeEditor.ADL_Classes
Case ConstraintKind.Multiple
BuildChoice(attribute, CType(c, Constraint_Choice))

Case ConstraintKind.Interval_Count, ConstraintKind.Interval_Quantity, ConstraintKind.Interval_DateTime
Case ConstraintKind.Interval_Count, ConstraintKind.Interval_Quantity, ConstraintKind.Interval_DateTime, ConstraintKind.Interval_Duration
BuildInterval(attribute, c)

Case ConstraintKind.MultiMedia
Expand Down
36 changes: 32 additions & 4 deletions ArchetypeEditor/ADL_Classes/ADL_RmElement.vb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,34 @@ Namespace ArchetypeEditor.ADL_Classes
MessageBox.Show(AE_Constants.Instance.Incorrect_format & " " & ObjNode.node_id.to_cil & ": " & ex.Message, AE_Constants.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

Return cic
Case "dv_interval<dv_duration>", "dv_interval<duration>", "interval<duration>"
Dim cic As New Constraint_Interval_Duration

Try
' Get the upper value
If ObjNode.has_attribute(Eiffel.String("upper")) Then
a = ObjNode.c_attribute_at_path(Eiffel.String("upper"))

If a.has_children Then
cic.UpperLimit = CType(ProcessValue(CType(a.children.first, openehr.openehr.am.archetype.constraint_model.C_OBJECT), fileManager), Constraint_Duration)
End If
End If

' Get the lower value
If ObjNode.has_attribute(Eiffel.String("lower")) Then
a = ObjNode.c_attribute_at_path(Eiffel.String("lower"))

If a.has_children Then
cic.LowerLimit = CType(ProcessValue(CType(a.children.first, openehr.openehr.am.archetype.constraint_model.C_OBJECT), fileManager), Constraint_Duration)
End If
End If
Catch ex As Exception
MessageBox.Show(AE_Constants.Instance.Incorrect_format & " " & ObjNode.node_id.to_cil & ": " & ex.Message, AE_Constants.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

Return cic

Case "interval_quantity"
Dim ciq As New Constraint_Interval_Quantity
Dim quantLimits As New Constraint_Quantity
Expand Down Expand Up @@ -356,10 +383,11 @@ Namespace ArchetypeEditor.ADL_Classes
result = ProcessCount(CType(node, openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT))
Case "interval_count", "interval_quantity" 'OBSOLETE
result = ProcessInterval(CType(node, openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT), fileManager)
Case "dv_interval<dv_count>", "dv_interval<count>", "interval<count>", _
"dv_interval<dv_quantity>", "dv_interval<quantity>", "interval<quantity>", _
"dv_interval<dv_date_time>", "dv_interval<date_time>", "interval<date_time>", _
"dv_interval<dv_date>", "dv_interval<dv_time>"
Case "dv_interval<dv_count>", "dv_interval<count>", "interval<count>",
"dv_interval<dv_quantity>", "dv_interval<quantity>", "interval<quantity>",
"dv_interval<dv_date_time>", "dv_interval<date_time>", "interval<date_time>",
"dv_interval<dv_date>", "dv_interval<dv_time>",
"dv_interval<dv_duration>", "dv_interval<duration>", "interval<duration>"
result = ProcessInterval(CType(node, openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT), fileManager)
Case "dv_multimedia", "multimedia", "multi_media"
result = ProcessMultiMedia(CType(node, openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT))
Expand Down
1 change: 1 addition & 0 deletions ArchetypeEditor/ArchetypeEditor.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
<Compile Include="DataConstraints\ChoiceConstraint.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="DataConstraints\IntervalOfDurationConstraint.vb" />
<Compile Include="DataConstraints\ClusterConstraint.vb" />
<Compile Include="DataConstraints\CollectionOfSlots.vb">
<SubType>Code</SubType>
Expand Down
2 changes: 2 additions & 0 deletions ArchetypeEditor/BusinessLogic/ReferenceModel.vb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ Public Class ReferenceModel
kindOfInterval = ConstraintKind.Quantity
Case ConstraintKind.Interval_DateTime
kindOfInterval = ConstraintKind.DateTime
Case ConstraintKind.Interval_Duration
kindOfInterval = ConstraintKind.Duration
End Select

If kindOfInterval <> ConstraintKind.Any Then
Expand Down
10 changes: 7 additions & 3 deletions ArchetypeEditor/DataConstraints/Constraint.vb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Public Enum ConstraintKind
Parsable = 19
QuantityUnit = 20
Real = 21
Interval_Duration = 22

End Enum

Public Class Constraint
Expand All @@ -52,13 +54,15 @@ Public Class Constraint
Public Overridable Function Copy() As Constraint
Return New Constraint
End Function

Public Const SelectedImageOffset As Integer = 40
' IMCN 30 Sep 2015 �ffsets into image stream adjusted to support addition of Interval of Duration AEPR-40
Public Const SelectedImageOffset As Integer = 46

Public Function ImageIndexForConstraintKind(ByVal isReference As Boolean, ByVal isSelected As Boolean) As Integer
Dim result As Integer = CType(Kind, Integer)
' IMCN 30 Sep 2015 �ffsets into image stream adjusted to support addition of Interval of Duration AEPR-40
'needed to add some dummy filler images to keep image offsets in line with enumerations

If isReference Then result += 20
If isReference Then result += 23

If isSelected Then result += SelectedImageOffset

Expand Down
50 changes: 28 additions & 22 deletions ArchetypeEditor/DataConstraints/GUI/ConstraintContextMenu.vb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,28 @@ Public Class ConstraintContextMenu
Private mFileManager As FileManagerLocal

Private _
HeaderMenuItem, _
SpacerMenuItem, _
TextMenuItem, _
QuantityMenuItem, _
CountMenuItem, _
DateTimeMenuItem, _
OrdinalMenuItem, _
BooleanMenuItem, _
AnyMenuItem, _
MultipleMenuItem, _
SlotMenuItem, _
ProportionMenuItem, _
IntervalMenuItem, _
IntervalOfQuantityMenuItem, _
IntervalOfCountMenuItem, _
IntervalOfDateTimeMenuItem, _
DurationMenuItem, _
MultiMediaMenuItem, _
UriMenuItem, _
IdentifierMenuItem, _
ParsableMenuItem, _
HeaderMenuItem,
SpacerMenuItem,
TextMenuItem,
QuantityMenuItem,
CountMenuItem,
DateTimeMenuItem,
OrdinalMenuItem,
BooleanMenuItem,
AnyMenuItem,
MultipleMenuItem,
SlotMenuItem,
ProportionMenuItem,
IntervalMenuItem,
IntervalOfQuantityMenuItem,
IntervalOfCountMenuItem,
IntervalOfDateTimeMenuItem,
IntervalOfDurationMenuItem,
DurationMenuItem,
MultiMediaMenuItem,
UriMenuItem,
IdentifierMenuItem,
ParsableMenuItem,
CurrencyMenuItem As MenuItem

Public Sub ShowHeader(ByVal headerText As String)
Expand Down Expand Up @@ -77,6 +78,8 @@ Public Class ConstraintContextMenu
IntervalOfQuantityMenuItem.Visible = isVisible
Case ConstraintKind.Interval_DateTime
IntervalOfDateTimeMenuItem.Visible = isVisible
Case ConstraintKind.Interval_Duration
IntervalOfDurationMenuItem.Visible = isVisible
Case ConstraintKind.MultiMedia
MultiMediaMenuItem.Visible = isVisible
Case ConstraintKind.URI
Expand All @@ -89,7 +92,7 @@ Public Class ConstraintContextMenu
ParsableMenuItem.Visible = isVisible
End Select

IntervalMenuItem.Visible = IntervalOfCountMenuItem.Visible Or IntervalOfQuantityMenuItem.Visible Or IntervalOfDateTimeMenuItem.Visible
IntervalMenuItem.Visible = IntervalOfCountMenuItem.Visible Or IntervalOfQuantityMenuItem.Visible Or IntervalOfDateTimeMenuItem.Visible Or IntervalOfDurationMenuItem.Visible
End Sub

Protected Sub DoClick(ByVal sender As Object, ByVal e As EventArgs)
Expand Down Expand Up @@ -124,6 +127,8 @@ Public Class ConstraintContextMenu
onClick(New Constraint_Interval_Quantity)
ElseIf sender Is IntervalOfDateTimeMenuItem Then
onClick(New Constraint_Interval_DateTime)
ElseIf sender Is IntervalOfDurationMenuItem Then
onClick(New Constraint_Interval_Duration)
ElseIf sender Is MultiMediaMenuItem Then
onClick(New Constraint_MultiMedia)
ElseIf sender Is UriMenuItem Then
Expand Down Expand Up @@ -173,6 +178,7 @@ Public Class ConstraintContextMenu
IntervalOfCountMenuItem = NewMenuItem(IntervalMenuItem, AE_Constants.Instance.IntervalCount)
IntervalOfQuantityMenuItem = NewMenuItem(IntervalMenuItem, AE_Constants.Instance.IntervalQuantity)
IntervalOfDateTimeMenuItem = NewMenuItem(IntervalMenuItem, AE_Constants.Instance.IntervalDateTime)
IntervalOfDurationMenuItem = NewMenuItem(IntervalMenuItem, AE_Constants.Instance.IntervalDuration)
AnyMenuItem = NewMenuItem(Me, AE_Constants.Instance.Any)
MultipleMenuItem = NewMenuItem(Me, AE_Constants.Instance.Multiple)
MultiMediaMenuItem = NewMenuItem(Me, AE_Constants.Instance.MultiMedia)
Expand Down
4 changes: 3 additions & 1 deletion ArchetypeEditor/DataConstraints/GUI/ConstraintControl.vb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ Public Class ConstraintControl
HelpProviderConstraint.SetHelpKeyword(Me, "HowTo/Editing/Data constraints/set_constraints_interval.html")
Case ConstraintKind.Interval_Quantity
HelpProviderConstraint.SetHelpKeyword(Me, "HowTo/Editing/Data constraints/set_constraints_interval.html")
Case ConstraintKind.Interval_Duration
HelpProviderConstraint.SetHelpKeyword(Me, "HowTo/Editing/Data constraints/set_constraints_interval.html")
Case ConstraintKind.Multiple
HelpProviderConstraint.SetHelpKeyword(Me, "HowTo/Editing/Data constraints/set_constraints_interval.html")
Case ConstraintKind.Ordinal
Expand Down Expand Up @@ -153,7 +155,7 @@ Public Class ConstraintControl
Case ConstraintKind.Slot
Return New SlotConstraintControl(a_file_manager)

Case ConstraintKind.Interval_Count, ConstraintKind.Interval_Quantity, ConstraintKind.Interval_DateTime
Case ConstraintKind.Interval_Count, ConstraintKind.Interval_Quantity, ConstraintKind.Interval_DateTime, ConstraintKind.Interval_Duration
Return New IntervalConstraintControl(a_file_manager)

Case ConstraintKind.MultiMedia
Expand Down
90 changes: 90 additions & 0 deletions ArchetypeEditor/DataConstraints/IntervalOfDurationConstraint.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
'
' component: "openEHR Archetype Project"
' description: "Constraint on intervals of counts (integers)"
' keywords: "Archetype, Clinical, Editor"
' author: "Sam Heard"
' support: https://openehr.atlassian.net/browse/AEPR
' copyright: "Copyright (c) 2005 Ocean Informatics Pty Ltd"
' license: "See notice at bottom of class"
'

Option Strict On

Class Constraint_Interval_Duration
Inherits Constraint_Interval

Private mLower As New Constraint_Duration
Private mUpper As New Constraint_Duration

Public Overrides Function Copy() As Constraint
Dim result As New Constraint_Interval_Duration
result.mLower = CType(mLower.Copy, Constraint_Duration)
result.mUpper = CType(mUpper.Copy, Constraint_Duration)
Return result
End Function

Public Overrides ReadOnly Property Kind() As ConstraintKind
Get
Return ConstraintKind.Interval_Duration
End Get
End Property

Overrides Property UpperLimit() As Constraint
Get
Return mUpper
End Get
Set(ByVal Value As Constraint)
Debug.Assert(TypeOf Value Is Constraint_Duration)
mUpper = CType(Value, Constraint_Duration)
End Set
End Property


Overrides Property LowerLimit() As Constraint
Get
Return mLower
End Get
Set(ByVal Value As Constraint)
Debug.Assert(TypeOf Value Is Constraint_Duration)
mLower = CType(Value, Constraint_Duration)
End Set
End Property
End Class

'
'***** BEGIN LICENSE BLOCK *****
'Version: MPL 1.1/GPL 2.0/LGPL 2.1
'
'The contents of this file are subject to the Mozilla Public License Version
'1.1 (the "License"); you may not use this file except in compliance with
'the License. You may obtain a copy of the License at
'http://www.mozilla.org/MPL/
'
'Software distributed under the License is distributed on an "AS IS" basis,
'WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
'for the specific language governing rights and limitations under the
'License.
'
'The Original Code is IntervalOfCountConstraint.vb.
'
'The Initial Developer of the Original Code is
'Sam Heard, Ocean Informatics (www.oceaninformatics.biz).
'Portions created by the Initial Developer are Copyright (C) 2004
'the Initial Developer. All Rights Reserved.
'
'Contributor(s):
' Heath Frankel
'
'Alternatively, the contents of this file may be used under the terms of
'either the GNU General Public License Version 2 or later (the "GPL"), or
'the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
'in which case the provisions of the GPL or the LGPL are applicable instead
'of those above. If you wish to allow use of your version of this file only
'under the terms of either the GPL or the LGPL, and not to allow others to
'use your version of this file under the terms of the MPL, indicate your
'decision by deleting the provisions above and replace them with the notice
'and other provisions required by the GPL or the LGPL. If you do not delete
'the provisions above, a recipient may use your version of this file under
'the terms of any one of the MPL, the GPL or the LGPL.
'
'***** END LICENSE BLOCK *****
6 changes: 6 additions & 0 deletions ArchetypeEditor/DataConstraintsView/IntervalViewControl.vb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ Public Class IntervalViewControl : Inherits ElementViewControl
mLower = New DateTimeViewControl(c.LowerLimit, mFileManager)
mUpper = New DateTimeViewControl(c.UpperLimit, mFileManager)

ElseIf aConstraint.Kind = ConstraintKind.Interval_Duration Then
Dim c As Constraint_Interval_Duration = CType(aConstraint, Constraint_Interval_Duration)

mLower = New DurationViewControl(c.LowerLimit, mFileManager)
mUpper = New DurationViewControl(c.UpperLimit, mFileManager)

End If

Dim width As Integer
Expand Down
20 changes: 20 additions & 0 deletions ArchetypeEditor/GUI_Archetype/ArchetypeElement.vb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ Public Class ArchetypeElement : Inherits ArchetypeNodeAbstract
result &= DateTimeConstraintToRichText(CType(cidt.LowerLimit, Constraint_DateTime))
result &= "\par"

Case ConstraintKind.Interval_Duration
Dim cidt As Constraint_Interval_Duration = CType(constraint, Constraint_Interval_Duration)
result &= Environment.NewLine & Space(3 * level) & AE_Constants.Instance.Upper & ": "
result &= DurationConstraintToRichText(CType(cidt.UpperLimit, Constraint_Duration))
result &= ", " & AE_Constants.Instance.Lower & ": "
result &= DurationConstraintToRichText(CType(cidt.LowerLimit, Constraint_Duration))
result &= "\par"

Case ConstraintKind.Interval_Quantity
Dim ciq As Constraint_Interval_Count = CType(constraint, Constraint_Interval_Quantity)
result &= Environment.NewLine & Space(3 * level) & AE_Constants.Instance.Upper & ": \par"
Expand Down Expand Up @@ -471,6 +479,14 @@ Public Class ArchetypeElement : Inherits ArchetypeNodeAbstract
Return result
End Function

Private Function IntervalDurationToHTML(ByVal constraint As Constraint_Interval_Duration) As String
Dim result As String = AE_Constants.Instance.Upper & ": "
result += DurationConstraintToRichText(CType(constraint.UpperLimit, Constraint_Duration))
result += ", " & AE_Constants.Instance.Lower & ": "
result += DurationConstraintToRichText(CType(constraint.LowerLimit, Constraint_Duration))
Return result
End Function

Private Function SlotToHTML(ByVal constraint As Constraint_Slot) As String
Dim result As String = ""

Expand Down Expand Up @@ -600,6 +616,10 @@ Public Class ArchetypeElement : Inherits ArchetypeNodeAbstract
result.HTML = Environment.NewLine & IntervalDateTimeToHTML(CType(constraint, Constraint_Interval_DateTime))
result.ImageSource = "Images/interval.gif"

Case ConstraintKind.Interval_Duration
result.HTML = Environment.NewLine & IntervalDurationToHTML(CType(constraint, Constraint_Interval_Duration))
result.ImageSource = "Images/interval.gif"

Case ConstraintKind.MultiMedia
result.HTML = ""
result.ImageSource = "Images/multimedia.gif"
Expand Down
Loading