open_ehr 0.6.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/Gemfile +10 -2
  2. data/Gemfile.lock +58 -18
  3. data/Guardfile +2 -1
  4. data/History.txt +10 -3
  5. data/Manifest.txt +3 -5
  6. data/README.rdoc +36 -32
  7. data/Rakefile +1 -1
  8. data/VERSION +1 -1
  9. data/bin/adl_validator.rb +84 -0
  10. data/lib/open_ehr/am/archetype/constraint_model/primitive.rb +11 -7
  11. data/lib/open_ehr/am/archetype/constraint_model.rb +4 -16
  12. data/lib/open_ehr/am/archetype/ontology.rb +37 -6
  13. data/lib/open_ehr/am/archetype.rb +6 -7
  14. data/lib/open_ehr/am/open_ehr_profile/data_types/text.rb +5 -2
  15. data/lib/open_ehr/parser/adl.rb +19 -0
  16. data/lib/open_ehr/parser/adl_grammar.tt +155 -0
  17. data/lib/open_ehr/parser/adl_parser.rb +48 -0
  18. data/lib/open_ehr/parser/cadl_grammar.tt +803 -0
  19. data/lib/open_ehr/parser/dadl.rb +13 -0
  20. data/lib/open_ehr/parser/dadl_grammar.tt +358 -0
  21. data/lib/open_ehr/parser/exception.rb +68 -0
  22. data/lib/open_ehr/parser/scanner/adl_scanner.rb +819 -0
  23. data/lib/open_ehr/parser/shared_token_grammar.tt +1200 -0
  24. data/lib/open_ehr/parser/validator.rb +20 -0
  25. data/lib/open_ehr/parser.rb +16 -12
  26. data/lib/open_ehr.rb +1 -0
  27. data/open_ehr.gemspec +364 -0
  28. data/spec/lib/open_ehr/am/archetype/archetype_spec.rb +7 -2
  29. data/spec/lib/open_ehr/am/archetype/constraint_model/c_multiple_attribute_spec.rb +0 -6
  30. data/spec/lib/open_ehr/am/archetype/constraint_model/c_object_spec.rb +10 -10
  31. data/spec/lib/open_ehr/am/archetype/constraint_model/c_single_attribute_spec.rb +0 -6
  32. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_boolean_spec.rb +5 -0
  33. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_time_spec.rb +5 -0
  34. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_duration_spec.rb +5 -0
  35. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_integer_spec.rb +5 -0
  36. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_primitive_spec.rb +8 -6
  37. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_real_spec.rb +7 -2
  38. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_string_spec.rb +5 -0
  39. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_time_spec.rb +5 -0
  40. data/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb +27 -7
  41. data/spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb +3 -3
  42. data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.assumed_types.v1.adl +88 -0
  43. data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.basic_types.v1.adl +143 -0
  44. data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.basic_types_fail.v1.adl +50 -0
  45. data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.most_minimal.v1.adl +27 -0
  46. data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.structure_test1.v1.adl +46 -0
  47. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ACTION.imaging.v1.adl +275 -0
  48. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ACTION.referral.v1.adl +351 -0
  49. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl +765 -0
  50. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl +217 -0
  51. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl +134 -0
  52. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl +241 -0
  53. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl +321 -0
  54. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl +379 -0
  55. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl +577 -0
  56. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl +146 -0
  57. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl +176 -0
  58. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl +221 -0
  59. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl +139 -0
  60. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl +116 -0
  61. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl +420 -0
  62. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-uterus.v1.adl +293 -0
  63. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl +53 -0
  64. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl +45 -0
  65. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-EVALUATION.adverse.v1.adl +411 -0
  66. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl +88 -0
  67. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl +84 -0
  68. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl +492 -0
  69. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.follow_up.v1draft.adl +94 -0
  70. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.imaging.v1.adl +127 -0
  71. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.medication-formulation.v1.adl +457 -0
  72. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.medication.v1.adl +869 -0
  73. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.referral.v1.adl +494 -0
  74. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl +545 -0
  75. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-OBSERVATION.blood_pressure.v1.adl +673 -0
  76. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl +166 -0
  77. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-SECTION.findings.v1.adl +47 -0
  78. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl +51 -0
  79. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-SECTION.summary.v1.adl +52 -0
  80. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-SECTION.vital_signs.v1.adl +54 -0
  81. data/spec/lib/open_ehr/parser/adl/openEHR-EHR-cadl_sample.v1.adl +9 -0
  82. data/spec/lib/open_ehr/parser/adl_parser_spec.rb +210 -0
  83. data/spec/lib/open_ehr/parser/base_spec.rb +19 -0
  84. data/spec/spec.opts +2 -1
  85. data/spec/spec_helper.rb +3 -0
  86. metadata +166 -52
  87. data/doc/README_rdoc.html +0 -148
  88. data/doc/created.rid +0 -2
  89. data/doc/images/brick.png +0 -0
  90. data/doc/images/brick_link.png +0 -0
  91. data/doc/images/bug.png +0 -0
  92. data/doc/images/bullet_black.png +0 -0
  93. data/doc/images/bullet_toggle_minus.png +0 -0
  94. data/doc/images/bullet_toggle_plus.png +0 -0
  95. data/doc/images/date.png +0 -0
  96. data/doc/images/find.png +0 -0
  97. data/doc/images/loadingAnimation.gif +0 -0
  98. data/doc/images/macFFBgHack.png +0 -0
  99. data/doc/images/package.png +0 -0
  100. data/doc/images/page_green.png +0 -0
  101. data/doc/images/page_white_text.png +0 -0
  102. data/doc/images/page_white_width.png +0 -0
  103. data/doc/images/plugin.png +0 -0
  104. data/doc/images/ruby.png +0 -0
  105. data/doc/images/tag_green.png +0 -0
  106. data/doc/images/wrench.png +0 -0
  107. data/doc/images/wrench_orange.png +0 -0
  108. data/doc/images/zoom.png +0 -0
  109. data/doc/index.html +0 -54
  110. data/doc/js/darkfish.js +0 -116
  111. data/doc/js/jquery.js +0 -32
  112. data/doc/js/quicksearch.js +0 -114
  113. data/doc/js/thickbox-compressed.js +0 -10
  114. data/doc/rdoc.css +0 -706
  115. data/lib/#open_ehr.rb# +0 -11
@@ -0,0 +1,166 @@
1
+ archetype (adl_version=1.4)
2
+ openEHR-EHR-OBSERVATION.body_mass_index.v1
3
+
4
+ concept
5
+ [at0000] -- Body mass index
6
+ language
7
+ original_language = <[ISO_639-1::en]>
8
+ description
9
+ original_author = <
10
+ ["name"] = <"Sam Heard">
11
+ ["organisation"] = <"Ocean Informatics">
12
+ ["email"] = <"sam.heard@oceaninformatics.com">
13
+ ["date"] = <"22/03/2006">
14
+ >
15
+ details = <
16
+ ["en"] = <
17
+ language = <[ISO_639-1::en]>
18
+ purpose = <"To record the Body Mass Index (BMI) of a person.
19
+ Body Mass Index is a calculated ratio describing how an individual's body weight relates to the weight that is regarded as normal, or desirable, for the individual's height. ">
20
+ use = <"Use to record the Body Mass Index of both adults and children.
21
+ Use to enter the Body Mass Index either manually (ie calculated and directly entered by the clinician), or automatically (ie calculation and entry is done automatically by a software application, based on separate height and weight measurements).
22
+ Formulas: Body Mass Index is commonly calculated as weight (kg) / [height (m) squared]. This is the assumed formula unless otherwise specified in the Formula element within Protocol. Alternatively estimate Body Mass Index using pounds and inches: weight (lb) / [height (in) squared] x 703 (with ounces (oz) and fractions changed to decimal values).
23
+ In some situations the Body Mass Index formula is corrected eg for use in amputees - this specific formula can be recorded as part of the protocol. Alternatively the common Body Mass Index calculation can be used with amputees and similar injuries or disabilities if using adjusted height and/or adjusted weight, as appropriate, rather than actual height and weight. See openEHR-EHR-OBSERVATION.height-adjusted and openEHR-EHR-OBSERVATION.body_weight-adjusted.
24
+ See WHO reference re adjusting height/length for Body Mass Index in paediatrics.
25
+ In children and teens, BMI needs to be assessed using age-related reference charts.
26
+ ">
27
+ keywords = <"obesity", "index", "body mass", "BMI", "anorexia", "Quetelet", "malnutrition", "failure to thrive", "bulimia">
28
+ misuse = <"Not intended to record information regarding Body Mass Index percentiles - these will be recorded in separate archetypes.">
29
+ copyright = <"copyright (c) 2009 openEHR Foundation">
30
+ >
31
+ >
32
+ lifecycle_state = <"Initial">
33
+ other_contributors = <"Marja Buur, Medisch Centrum Alkmaar, Netherlands", "Rong Chen, Cambio Healthcare Systems, Sweden", "Angela de Zwart, Orion Health, New Zealand", "Paul Donaldson, Nursing Informatics Australia, Australia", "Sebastian Garde, Ocean Informatics, Germany", "Heather Grain, Llewelyn Grain Informatics, Australia", "Anne Harbison, CPCER, Australia", "Sam Heard, Ocean Informatics, Australia", "Andrew James, University of Toronto, Canada", "Shinji Kobayashi, Ehime University, Japan", "Heather Leslie, Ocean Informatics, Australia (Editor)", "Rikard Lovstrom, Swedish Medical Association, Sweden", "Ian McNicoll, Ocean Informatics, United Kingdom">
34
+ other_details = <
35
+ ["MD5-CAM-1.0.1"] = <"1605E211E9BFB4093A72CCE7A9792FF9">
36
+ ["references"] = <"Clinical Guidelines on the Identification, Evaluation, and Treatment of Overweight and Obesity in Adults: The Evidence Report [Internet]. Bethesda (MD): National Heart, Lung, and Blood Institute; NIH Publication No. 98-4083, Sep 1998, [cited 2009 July 02]. Available from: http://www.nhlbi.nih.gov/guidelines/obesity/
37
+
38
+ About BMI for Children and Teens [Internet]. Atlanta (GA): Division of Nutrition, Physical Activity and Obesity, Centers for Disease Control and Prevention; 2009 Jan 27 [cited 2009 Jul 28 ]. Available from: http://www.cdc.gov/healthyweight/assessing/bmi/childrens_BMI/about_childrens_BMI.html
39
+
40
+ WHO Child Growth Standards: Length/height-for-age, weight-for-age, weight-for-length, weight-for-height and body mass index-for-age: Methods and development. [Internet] Geneva, Switzerland: WHO Multicentre Growth Reference Study Group, World Health Organization; 2006 [cited 2009 July 02]. Chapter 6, BMI-for-age standards. Available from: http://www.who.int/childgrowth/standards/Chap_6.pdf.
41
+
42
+ Obesity: Preventing and Managing the Global Epidemic: Report of a WHO Consultation [Internet]. Geneva, Switzerland: World Health Organisation; 2000 [cited 2009 Jul 28]. Available from: http://www.who.int/nutrition/publications/obesity/WHO_TRS_894/en/index.html
43
+
44
+ Tzamaloukas AH, Patron A, Malhotra D. Body Mass Index in Amputees. Journal of Parenteral and Enteral Nutrition [Internet]. 1994 [cited 2009 Jul 28]; 18 (4): 355. Available from: http://pen.sagepub.com/cgi/content/abstract/18/4/355
45
+
46
+
47
+
48
+ ">
49
+ >
50
+
51
+ definition
52
+ OBSERVATION[at0000] matches { -- Body mass index
53
+ data matches {
54
+ HISTORY[at0001] matches { -- history
55
+ events cardinality matches {1..*; unordered} matches {
56
+ EVENT[at0002] occurrences matches {1..*} matches { -- Any event
57
+ data matches {
58
+ ITEM_TREE[at0003] matches { -- Single
59
+ items cardinality matches {1..*; unordered} matches {
60
+ ELEMENT[at0004] matches { -- Body Mass Index
61
+ value matches {
62
+ C_DV_QUANTITY <
63
+ property = <[openehr::349]>
64
+ list = <
65
+ ["1"] = <
66
+ units = <"kg/m2">
67
+ magnitude = <|0.0..<1000.0|>
68
+ precision = <|1|>
69
+ >
70
+ ["2"] = <
71
+ units = <"lb/in2">
72
+ magnitude = <|0.0..<1000.0|>
73
+ precision = <|1|>
74
+ >
75
+ >
76
+ >
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ protocol matches {
87
+ ITEM_LIST[at0005] matches { -- List
88
+ items cardinality matches {0..*; ordered} matches {
89
+ ELEMENT[at0006] occurrences matches {0..1} matches { -- Method
90
+ value matches {
91
+ DV_CODED_TEXT matches {
92
+ defining_code matches {
93
+ [local::
94
+ at0007, -- Automatic entry
95
+ at0008] -- Direct entry
96
+ }
97
+ }
98
+ }
99
+ }
100
+ ELEMENT[at0010] occurrences matches {0..1} matches { -- Formula
101
+ value matches {
102
+ DV_TEXT matches {*}
103
+ }
104
+ }
105
+ ELEMENT[at0011] occurrences matches {0..1} matches { -- Comment
106
+ value matches {
107
+ DV_TEXT matches {*}
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+
115
+
116
+ ontology
117
+ term_definitions = <
118
+ ["en"] = <
119
+ items = <
120
+ ["at0000"] = <
121
+ text = <"Body mass index">
122
+ description = <"Calculated measurement which compares a person's weight and height.">
123
+ >
124
+ ["at0001"] = <
125
+ text = <"history">
126
+ description = <"@ internal @">
127
+ >
128
+ ["at0002"] = <
129
+ text = <"Any event">
130
+ description = <"Any timed recording of Body Mass Index.">
131
+ >
132
+ ["at0003"] = <
133
+ text = <"Single">
134
+ description = <"@ internal @">
135
+ >
136
+ ["at0004"] = <
137
+ text = <"Body Mass Index">
138
+ description = <"Index describing ratio of weight to height.">
139
+ >
140
+ ["at0005"] = <
141
+ text = <"List">
142
+ description = <"@ internal @">
143
+ >
144
+ ["at0006"] = <
145
+ text = <"Method">
146
+ description = <"The method of entering the Body Mass Index.">
147
+ >
148
+ ["at0007"] = <
149
+ text = <"Automatic entry">
150
+ description = <"Body Mass Index calculated and entered automatically without user intervention.">
151
+ >
152
+ ["at0008"] = <
153
+ text = <"Direct entry">
154
+ description = <"Body Mass Index calculated and entered directly by user.">
155
+ >
156
+ ["at0010"] = <
157
+ text = <"Formula">
158
+ description = <"Formula used to derive the Body Mass Index.">
159
+ >
160
+ ["at0011"] = <
161
+ text = <"Comment">
162
+ description = <"Comment about the Body Mass Index measurement eg noting that the measurements used were adjusted weight/height.">
163
+ >
164
+ >
165
+ >
166
+ >
@@ -0,0 +1,47 @@
1
+ archetype (adl_version=1.4)
2
+ openEHR-EHR-SECTION.findings.v1
3
+
4
+ concept
5
+ [at0000] -- Clinical findings
6
+ language
7
+ original_language = <[ISO_639-1::en]>
8
+ description
9
+ original_author = <
10
+ ["name"] = <"Sam Heard">
11
+ ["organisation"] = <"Ocean Informatics">
12
+ ["date"] = <"9/01/2007">
13
+ ["email"] = <"sam.heard@oceaninformatics.biz">
14
+ >
15
+ details = <
16
+ ["en"] = <
17
+ language = <[ISO_639-1::en]>
18
+ purpose = <"A heading to contain clinical findings">
19
+ use = <"A section which only contains observations">
20
+ keywords = <"findings", ...>
21
+ misuse = <"">
22
+ >
23
+ >
24
+ lifecycle_state = <"Initial">
25
+ other_contributors = <>
26
+
27
+ definition
28
+ SECTION[at0000] matches { -- Clinical findings
29
+ items cardinality matches {0..*; unordered} matches {
30
+ allow_archetype OBSERVATION occurrences matches {0..1} matches {
31
+ include
32
+ archetype_id/value matches {/.*/}
33
+ }
34
+ }
35
+ }
36
+
37
+ ontology
38
+ term_definitions = <
39
+ ["en"] = <
40
+ items = <
41
+ ["at0000"] = <
42
+ description = <"The findings at this contact">
43
+ text = <"Clinical findings">
44
+ >
45
+ >
46
+ >
47
+ >
@@ -0,0 +1,51 @@
1
+ archetype (adl_version=1.4)
2
+ openEHR-EHR-SECTION.reason_for_encounter.v1
3
+
4
+ concept
5
+ [at0000] -- Reason for encounter
6
+ language
7
+ original_language = <[ISO_639-1::en]>
8
+ description
9
+ original_author = <
10
+ ["name"] = <"Sam Heard">
11
+ ["organisation"] = <"Ocean Informatics">
12
+ ["date"] = <"9/01/2007">
13
+ ["email"] = <"sam.heard@oceaninformatics.biz">
14
+ >
15
+ details = <
16
+ ["en"] = <
17
+ language = <[ISO_639-1::en]>
18
+ purpose = <"A heading to display the reason for encounter">
19
+ use = <"To record a symptom, problem or other reason for encounter">
20
+ keywords = <"rfe", "reason">
21
+ misuse = <"">
22
+ >
23
+ >
24
+ lifecycle_state = <"Initial">
25
+ other_contributors = <>
26
+
27
+ definition
28
+ SECTION[at0000] matches { -- Reason for encounter
29
+ items cardinality matches {0..*; unordered} matches {
30
+ allow_archetype OBSERVATION occurrences matches {1..*} matches {
31
+ include
32
+ archetype_id/value matches {/.*/}
33
+ }
34
+ allow_archetype EVALUATION occurrences matches {0..1} matches {
35
+ include
36
+ archetype_id/value matches {/.*/}
37
+ }
38
+ }
39
+ }
40
+
41
+ ontology
42
+ term_definitions = <
43
+ ["en"] = <
44
+ items = <
45
+ ["at0000"] = <
46
+ description = <"The reason(s) for this particular encounter">
47
+ text = <"Reason for encounter">
48
+ >
49
+ >
50
+ >
51
+ >
@@ -0,0 +1,52 @@
1
+ archetype (adl_version=1.4)
2
+ openEHR-EHR-SECTION.summary.v1
3
+
4
+ concept
5
+ [at0000] -- Summary
6
+ language
7
+ original_language = <[ISO_639-1::en]>
8
+ description
9
+ original_author = <
10
+ ["name"] = <"Sam Heard">
11
+ ["organisation"] = <"Ocean Informatics">
12
+ ["date"] = <"9/01/2007">
13
+ ["email"] = <"sam.heard@oceaninformatics.biz">
14
+ >
15
+ details = <
16
+ ["en"] = <
17
+ language = <[ISO_639-1::en]>
18
+ purpose = <"A heading containing summary information based on particular evaluation entries">
19
+ use = <"A heading for organising clinical data under a heading of summary">
20
+ keywords = <"review", "conclusions", "risk">
21
+ misuse = <"">
22
+ >
23
+ >
24
+ lifecycle_state = <"Initial">
25
+ other_contributors = <>
26
+
27
+ definition
28
+ SECTION[at0000] matches { -- Summary
29
+ items cardinality matches {0..*; unordered} matches {
30
+ allow_archetype EVALUATION occurrences matches {0..1} matches {
31
+ include
32
+ archetype_id/value matches {/clinical_synopsis\.v1/}
33
+ archetype_id/value matches {/problem\.v1/}
34
+ archetype_id/value matches {/problem-diagnosis\.v1/}
35
+ archetype_id/value matches {/problem-diagnosis-histological\.v1/}
36
+ archetype_id/value matches {/problem-genetic\.v1/}
37
+ archetype_id/value matches {/risk\.v1/}
38
+ }
39
+ }
40
+ }
41
+
42
+ ontology
43
+ term_definitions = <
44
+ ["en"] = <
45
+ items = <
46
+ ["at0000"] = <
47
+ description = <"A heading for conclusions and other evaluations">
48
+ text = <"Summary">
49
+ >
50
+ >
51
+ >
52
+ >
@@ -0,0 +1,54 @@
1
+ archetype (adl_version=1.4)
2
+ openEHR-EHR-SECTION.vital_signs.v1
3
+
4
+ concept
5
+ [at0000] -- Vital signs
6
+ language
7
+ original_language = <[ISO_639-1::en]>
8
+ description
9
+ original_author = <
10
+ ["name"] = <"Sam Heard">
11
+ ["organisation"] = <"Ocean Informatics">
12
+ ["date"] = <"14/03/2006">
13
+ ["email"] = <"sam.heard@oceaninformatics.biz">
14
+ >
15
+ details = <
16
+ ["en"] = <
17
+ language = <[ISO_639-1::en]>
18
+ purpose = <"A heading or section which can only contain observations considered to be vital signs. This group of observations is a common set in medicine, and while these often occur separately in health records, when they are measured together this is a significant assessment of wellbeing.">
19
+ use = <"An organisational heading for vital signs">
20
+ keywords = <"blood pressure", "temperature", "pulse", "oxygen saturation", "respirations", "observations", "vital", "signs">
21
+ misuse = <"Does not need to be used to record these entries separately">
22
+ >
23
+ >
24
+ lifecycle_state = <"AuthorDraft">
25
+ other_contributors = <>
26
+
27
+ definition
28
+ SECTION[at0000] matches { -- Vital signs
29
+ items cardinality matches {0..*; unordered} matches {
30
+ allow_archetype OBSERVATION occurrences matches {1..5} matches {
31
+ include
32
+ archetype_id/value matches {/blood_pressure\.v1/}
33
+ archetype_id/value matches {/heart_rate-pulse\.v1/}
34
+ archetype_id/value matches {/respiration\.v1/}
35
+ archetype_id/value matches {/body_temperature\.v1/}
36
+ archetype_id/value matches {/oximetry\.v1/}
37
+ archetype_id/value matches {/heart_rate\.v1/}
38
+ exclude
39
+ archetype_id/value matches {/.*/}
40
+ }
41
+ }
42
+ }
43
+
44
+ ontology
45
+ term_definitions = <
46
+ ["en"] = <
47
+ items = <
48
+ ["at0000"] = <
49
+ description = <"A group of observations that are recorded at the same time and record the blood pressure, pulse, temperature and other readings">
50
+ text = <"Vital signs">
51
+ >
52
+ >
53
+ >
54
+ >
@@ -0,0 +1,9 @@
1
+ SECTION[at0000] matches { -- Summary
2
+ items cardinality matches {0..*; unordered} matches {
3
+ allow_archetype EVALUATION occurrences matches {0..1} matches {
4
+ include
5
+ archetype_id/value matches {/clinical_synopsis\.v1/} archetype_id/value matches {/problem\.v1/} archetype_id/value matches {/problem-diagnosis\.v1/}
6
+ archetype_id/value matches {/problem-diagnosis-histological\.v1/}
7
+ archetype_id/value matches {/problem-genetic\.v1/}
8
+ }
9
+ }
@@ -0,0 +1,210 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+ include OpenEHR::Parser
3
+ include OpenEHR::AM::Archetype::ConstraintModel
4
+ include OpenEHR::AM::Archetype::Assertion
5
+
6
+ describe ADLParser do
7
+
8
+ before (:all) do
9
+ @adl_dir = File.dirname(__FILE__) + '/adl/'
10
+ end
11
+
12
+ context 'openEHR-EHR-SECTION-summary.v1.adl' do
13
+ before(:all) do
14
+ @ap = OpenEHR::Parser::ADLParser.new(@adl_dir + 'openEHR-EHR-SECTION.summary.v1.adl')
15
+ end
16
+
17
+ it 'is an instance fo ADLParser' do
18
+ @ap.should be_an_instance_of ADLParser
19
+ end
20
+
21
+ context 'openEHR-EHR-SECTION.summary.v1 parse' do
22
+ context 'ADL parser generates archetype from ADL' do
23
+ before(:all) do
24
+ @archetype = @ap.parse
25
+ end
26
+
27
+ it 'archetype_id should be openEHR-EHR-SECTION-summary' do
28
+ @archetype.archetype_id.should == 'openEHR-EHR-SECTION.summary.v1'
29
+ end
30
+
31
+ it 'adl_version should be 1.4' do
32
+ @archetype.adl_version.should == '1.4'
33
+ end
34
+
35
+ it 'concept should be at0000]' do
36
+ @archetype.concept.should == 'at0000'
37
+ end
38
+
39
+ it 'original language is ISO_639-1::en' do
40
+ @archetype.original_language.should == 'ISO_639-1::en'
41
+ end
42
+
43
+ context 'description' do
44
+ before(:all) do
45
+ @description = @archetype.description
46
+ end
47
+
48
+ context 'original author' do
49
+ before(:all) do
50
+ @original_author = @description[:original_author]
51
+ end
52
+
53
+ it 'name is Sam Heard' do
54
+ @original_author[:name].should == 'Sam Heard'
55
+ end
56
+
57
+ it 'organisation is Ocean Informatics' do
58
+ @original_author[:organisation].should == 'Ocean Informatics'
59
+ end
60
+
61
+ it 'date is 9/01/2007' do
62
+ @original_author[:date].should == '9/01/2007'
63
+ end
64
+
65
+ it 'email is sam.heard@oceaninformatics.biz' do
66
+ @original_author[:email].should == 'sam.heard@oceaninformatics.biz'
67
+ end
68
+ end
69
+
70
+ context 'details' do
71
+ before(:all) do
72
+ @details = @description[:details]
73
+ end
74
+
75
+ context 'en details' do
76
+ before(:all) do
77
+ @en = @details[:en]
78
+ end
79
+
80
+ it 'language is ISO_639-1::en' do
81
+ @en[:language].should == 'ISO_639-1::en'
82
+ end
83
+
84
+ it 'purpose is A heading...' do
85
+ @en[:purpose].should == "A heading containing summary information based on particular evaluation entries"
86
+ end
87
+
88
+ it 'use is A heading for...' do
89
+ @en[:use].should == "A heading for organising clinical data under a heading of summary"
90
+ end
91
+
92
+ it 'keywords are review, conclusions, risk' do
93
+ @en[:keywords].should == ['review', 'conclusions', 'risk']
94
+ end
95
+
96
+ it 'misuse should empty' do
97
+ @en[:misuse].should == ''
98
+ end
99
+ end
100
+
101
+ it 'lifecycle_state is Initial' do
102
+ @description[:lifecycle_state].should == 'Initial'
103
+ end
104
+
105
+ it 'other_contributors is nil' do
106
+ @description[:other_contributors].should be_nil
107
+ end
108
+ end # of details
109
+ end # of description
110
+
111
+ context 'definition section' do
112
+ before(:all) do
113
+ @definition = @archetype.definition
114
+ end
115
+
116
+ it 'rm_type is SECTION' do
117
+ @definition.rm_type_name.should == 'SECTION'
118
+ end
119
+
120
+ it 'node_id is at0000' do
121
+ @definition.node_id.should == 'at0000'
122
+ end
123
+
124
+ it 'root path is /' do
125
+ @definition.path.should == '/'
126
+ end
127
+
128
+ it 'not any allowed' do
129
+ @definition.any_allowed?.should == false
130
+ end
131
+
132
+ context 'c_attribute specs' do
133
+ before(:all) do
134
+ @attribute = @definition.attributes[0]
135
+ end
136
+
137
+ it 'attribute is instance of CMultipleAttribute' do
138
+ @attribute.should be_an_instance_of CMultipleAttribute
139
+ end
140
+
141
+ it 'rm_attribute_name is items' do
142
+ @attribute.rm_attribute_name.should == 'items'
143
+ end
144
+
145
+ it 'path is /items' do
146
+ @attribute.path.should == '/items'
147
+ end
148
+
149
+ it 'cardinarity is unorderd' do
150
+ @attribute.cardinality.should_not be_ordered
151
+ end
152
+
153
+ it 'lower interval of cardinality is 0' do
154
+ @attribute.cardinality.interval.lower.should be 0
155
+ end
156
+
157
+ it 'interval of cardinality is upper unbounded' do
158
+ @attribute.cardinality.interval.should be_upper_unbounded
159
+ end
160
+ context 'children archetype slot specs' do
161
+ before(:all) do
162
+ @archetype_slot = @attribute.children[0]
163
+ end
164
+
165
+ it 'is an instance of ArchetypeSlot' do
166
+ @archetype_slot.should be_an_instance_of ArchetypeSlot
167
+ end
168
+
169
+ it 's rm type name is EVALUATION' do
170
+ @archetype_slot.rm_type_name.should == 'EVALUATION'
171
+ end
172
+
173
+ it 's lower of occurrences should be 0' do
174
+ @archetype_slot.occurrences.lower.should be 0
175
+ end
176
+
177
+ it 's upper of occurrences should be 1' do
178
+ @archetype_slot.occurrences.upper.should be 1
179
+ end
180
+
181
+ context 'assertions' do
182
+ before(:all) do
183
+ @includes = @archetype_slot.includes
184
+ end
185
+
186
+ context '1st assertion' do
187
+ before(:all) do
188
+ @assertion0 = @includes[0]
189
+ end
190
+
191
+ it 'assertion0 should be an instance of assertion' do
192
+ @assertion0.should be_an_instance_of Assertion
193
+ end
194
+
195
+ it 'expression type of assertion0 is Boolean' do
196
+ @assertion0.expression.type.should == 'Boolean'
197
+ end
198
+
199
+ it 'expression value of assertion0 is /clinical_synopsis\.v1/' do
200
+ @assertion0.expression.item.pattern.should == '/clinical_synopsis\.v1/'
201
+ end
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end #definition
207
+ end
208
+ end
209
+ end
210
+ end
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+ include OpenEHR::Parser
3
+
4
+ describe Base do
5
+ context 'create an instance' do
6
+ before do
7
+ adl_dir = File.dirname(__FILE__)+'/adl/'
8
+ @bp = Base.new(adl_dir + 'openEHR-EHR-SECTION.summary.v1.adl')
9
+ end
10
+
11
+ it 'creates an instance' do
12
+ @bp.should be_an_instance_of Base
13
+ end
14
+
15
+ it 'returns filename' do
16
+ @bp.filename.should match /openEHR-EHR-SECTION.summary.v1.adl$/
17
+ end
18
+ end
19
+ end
data/spec/spec.opts CHANGED
@@ -1,5 +1,6 @@
1
1
  --drm
2
2
  --colour
3
3
  --format specdoc
4
- --loadby mtime
5
4
  --reverse
5
+
6
+ #--loadby mtime
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  require 'rubygems'
2
2
  require 'spork'
3
+ require 'simplecov'
4
+
5
+ SimpleCov.start
3
6
 
4
7
  Spork.prefork do
5
8
  # Loading more in this block will cause your tests to run faster. However,