~oship-dev/oshippy/trunk

« back to all changes in this revision

Viewing changes to src/mlhim/oship/rm/structures/tests/datastructure.txt

  • Committer: Tim Cook
  • Date: 2011-02-06 12:08:13 UTC
  • Revision ID: timothywayne.cook@gmail.com-20110206120813-qwmawxoaocsrbjtq
Created the overall structure of the Reference Model. Added images and other content to start the Welcome to OSHIHP demo app.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
:Test-Layer: unit
 
2
 
 
3
>>> from mlhim.oship.rm.data_structures.item_structure.representation import Element
 
4
>>> from mlhim.oship.rm.data_structures import DataStructure
 
5
>>> from mlhim.oship.rm.data_structures.item_structure import *
 
6
>>> from mlhim.oship.rm.data_structures.item_structure.interfaces import *
 
7
>>> from mlhim.oship.rm.data_structures.history import IntervalEvent, PointEvent
 
8
>>> from mlhim.oship.rm.data_structures.item_structure.representation import (Item,
 
9
...                                                                  Cluster)
 
10
>>> from mlhim.oship.rm.data_structures.item_structure.representation.interfaces import IItem
 
11
>>> from mlhim.oship.rm.data_structures.history.interfaces import IIntervalEvent
 
12
>>> from mlhim.oship.rm.data_structures.interfaces import IDataStructure
 
13
>>> from mlhim.oship.rm.support.identification import TerminologyId, Uid
 
14
>>> from mlhim.oship.rm.datatypes.text import DvText, CodePhrase, TermMapping
 
15
>>> from mlhim.oship.rm.datatypes.uri import DvUri
 
16
>>> from mlhim.oship.rm.datatypes.quantity.datetime import DvDateTime, DvTime
 
17
>>> from mlhim.oship.rm.datatypes.quantity import DvAmount
 
18
 
 
19
 
 
20
>>> tid1 = TerminologyId(u"SNOMED-CT(2003)")
 
21
>>> tid2 = TerminologyId(u"ISO_639-1")
 
22
>>> tid3 = TerminologyId(u"10646-1:1993")
 
23
>>> tid4 = TerminologyId(u"ISO_8601")
 
24
>>> cpm1 = CodePhrase(tid1, u"abc123")
 
25
>>> tm1 = TermMapping(cpm1, u"=",None)
 
26
>>> cplang1 = CodePhrase(tid2, u"en")
 
27
>>> cpenc1 = CodePhrase(tid3, u"utf-8")
 
28
>>> uri1 = DvUri(u"http://www.oship.org")
 
29
>>> elementValue1 = DvText(u"abc123", [tm1,], u"font-family:Arial", uri1, cplang1, cpenc1)
 
30
>>> element1 = Element(elementValue1, None, u"at0001", None, None, None, None, None, None)
 
31
>>> txt1 = DvText(u"Some really interesting ReferenceRange.", [tm1,], u"font-family:Arial", uri1, cplang1, cpenc1)
 
32
>>> archNodeId1 = CodePhrase(tid1, u"at0042")
 
33
>>> uid1 = Uid(u"HL7v3_uid_data")
 
34
>>> time1 = DvTime(u"T19:20:30", None, None, None, None, None)
 
35
>>> time2 = DvDateTime(u"9999/01/01T19:20:30", None, None, None, None, None)
 
36
>>> amount1 = DvAmount(None, None, None, None, None, None)
 
37
>>> data1 = u"some data"
 
38
>>> name1 = u"some name"
 
39
 
 
40
>>> ds1 = DataStructure(uid1, archNodeId1, None, None, None, uri1, None)
 
41
>>> ds1.uid.value 
 
42
u'HL7v3_uid_data'
 
43
>>> ds1.archetypeNodeId.codeString 
 
44
u'at0042'
 
45
>>> ds1.links.value 
 
46
u'http://www.oship.org'
 
47
>>> IDataStructure.providedBy(ds1)
 
48
True
 
49
 
 
50
>>> item1 = ItemStructure(uid1, archNodeId1, name1, None, None, uri1, None)
 
51
>>> item1.uid.value 
 
52
u'HL7v3_uid_data'
 
53
>>> IItemStructure.providedBy(item1)
 
54
True
 
55
 
 
56
>>> ie1 = IntervalEvent(amount1, u"y = 3*x", None)
 
57
>>> ie1.mathFunction 
 
58
u'y = 3*x'
 
59
>>> IIntervalEvent.providedBy(ie1)
 
60
True
 
61
 
 
62
>>> point1 = PointEvent(time1, data1, None, None, None, None, None, None, None)
 
63
>>> point1.data 
 
64
u'some data'
 
65
 
 
66
>>> item2 = Item(uid1, archNodeId1, name1, None, None, uri1, item1)
 
67
>>> item2.name
 
68
u'some name'
 
69
>>> IItem.providedBy(item2)
 
70
True
 
71
 
 
72
>>> il1 = ItemList(uid1, archNodeId1, name1, None, None, uri1, None, [element1, element1])
 
73
>>> IItemList.providedBy(il1)
 
74
True
 
75
 
 
76
>>> item3 = ItemSingle(uid1, archNodeId1, name1, None, None, uri1, None, element1)
 
77
>>> IItemSingle.providedBy(item3)
 
78
True
 
79
 
 
80
>>> itable1 = ItemTable(uid1, archNodeId1, name1, None, None, uri1, None, [element1, element1])
 
81
>>> IItemTable.providedBy(itable1)
 
82
True
 
83
 
 
84
>>> itree1 = ItemTree(None, u"at0066", None, None, None, None, [element1], None)
 
85
>>> IItemTree.providedBy(itree1)
 
86
True
 
87
 
 
88
>>> cluster1 = Cluster(uid1, archNodeId1, name1, None, None, uri1, [element1, element1], None)
 
89
>>> ICluster.providedBy(cluster1)
 
90
True
 
91
 
 
92
>>> element1 = Element(None, None, archNodeId1, uid1, name1, None, None, uri1, None)
 
93
>>> IElement.providedBy(element1)
 
94
True