open_ehr 0.9.4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. data/History.txt +3 -0
  2. data/README.rdoc +3 -3
  3. data/VERSION +1 -1
  4. data/lib/open_ehr/am/archetype/constraint_model/primitive.rb +61 -34
  5. data/lib/open_ehr/am/openehr_profile/data_types/basic.rb +27 -0
  6. data/lib/open_ehr/am/openehr_profile/data_types/quantity.rb +18 -0
  7. data/lib/open_ehr/am/openehr_profile/data_types/text.rb +22 -0
  8. data/lib/open_ehr/am/openehr_profile/data_types.rb +12 -0
  9. data/lib/open_ehr/am/openehr_profile.rb +10 -0
  10. data/lib/open_ehr/am.rb +2 -0
  11. data/lib/open_ehr/assumed_library_types.rb +30 -25
  12. data/lib/open_ehr/parser/cadl_grammar.tt +479 -163
  13. data/lib/open_ehr/parser/shared_token_grammar.tt +63 -43
  14. data/lib/open_ehr/rm/data_types/quantity/date_time.rb +27 -14
  15. data/lib/open_ehr.rb +1 -1
  16. data/open_ehr.gemspec +17 -6
  17. data/spec/lib/open_ehr/am/archetype/assertion/operator_kind_spec.rb +4 -0
  18. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_spec.rb +20 -48
  19. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_time_spec.rb +33 -8
  20. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_duration_spec.rb +19 -52
  21. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_string_spec.rb +2 -3
  22. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_time_spec.rb +27 -7
  23. data/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb +0 -1
  24. data/spec/lib/open_ehr/am/openehr_profile/data_types/text/c_code_phrase_spec.rb +35 -0
  25. data/spec/lib/open_ehr/parser/adl14/adl-test-SOME_TYPE.generic_type_basic.draft.adl +1 -1
  26. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_slot.test.adl +1 -1
  27. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_slot.test2.adl +1 -1
  28. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.basic_types.test.adl +3 -3
  29. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_code_phrase.test.adl +1 -1
  30. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.datetime.test.adl +1 -1
  31. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.durations.test.adl +2 -4
  32. data/spec/lib/open_ehr/parser/adl_archetype_internal_ref_with_generics_spec.rb +6 -6
  33. data/spec/lib/open_ehr/parser/adl_archetype_slot_cluster_spec.rb +101 -0
  34. data/spec/lib/open_ehr/parser/adl_archetype_slot_spec.rb +193 -0
  35. data/spec/lib/open_ehr/parser/adl_archetype_uncommon_term_keys_spec.rb +25 -0
  36. data/spec/lib/open_ehr/parser/adl_parser_spec.rb +6 -6
  37. data/spec/lib/open_ehr/parser/basic_generic_type_spec.rb +18 -0
  38. data/spec/lib/open_ehr/parser/basic_type_spec.rb +2922 -0
  39. data/spec/lib/open_ehr/parser/code_phrase_spec.rb +91 -0
  40. data/spec/lib/open_ehr/parser/date_time_spec.rb +1953 -0
  41. data/spec/lib/open_ehr/parser/duration_spec.rb +475 -0
  42. data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_duration_spec.rb +44 -0
  43. data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_time_spec.rb +6 -2
  44. data/spec/spec_helper.rb +3 -2
  45. metadata +52 -41
  46. data/lib/open_ehr/am/archetype/archetype_description/archetype_description.rb +0 -21
  47. data/lib/open_ehr/am/open_ehr_profile/data_types/basic.rb +0 -29
  48. data/lib/open_ehr/am/open_ehr_profile/data_types/quantity.rb +0 -19
  49. data/lib/open_ehr/am/open_ehr_profile/data_types/text.rb +0 -15
@@ -0,0 +1,91 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+ require File.dirname(__FILE__) + '/parser_spec_helper'
3
+
4
+ # ticket 171
5
+
6
+ describe ADLParser do
7
+ context 'CodePhase type' do
8
+ before(:all) do
9
+ archetype = adl14_archetype('adl-test-entry.c_code_phrase.test.adl')
10
+ @attributes = archetype.definition.attributes
11
+ end
12
+
13
+ def attr(index)
14
+ @attributes[0].children[0].attributes[0].children[index-1].attributes[0].children[0]
15
+ end
16
+
17
+ context '1st constraint is icd10::F43.00,F43.01,F32.02' do
18
+ before(:all) do
19
+ @at = attr(1)
20
+ end
21
+
22
+ it 'terminology id is icd10' do
23
+ @at.terminology_id.value.should == 'icd10'
24
+ end
25
+
26
+ it 'code_list is F43.00,F43.01,F32.02' do
27
+ @at.code_list.should == ['F43.00','F43.01','F32.02']
28
+ end
29
+ end
30
+
31
+ context '2nd constraint is local::at1311,at1312,at1313,at1314,at1315' do
32
+ before(:all) do
33
+ @at = attr(2)
34
+ end
35
+
36
+ it 'terminology id is local' do
37
+ @at.terminology_id.value.should == 'local'
38
+ end
39
+
40
+ it 'code_list is at1311,at1312,at1313,at1314,at1315' do
41
+ @at.code_list.should == ['at1311','at1312','at1313','at1314','at1315']
42
+ end
43
+ end
44
+
45
+ context '3rd constraint is icd10::' do
46
+ before(:all) do
47
+ @at = attr(3)
48
+ end
49
+
50
+ it 'terminology id is icd10' do
51
+ @at.terminology_id.value.should == 'icd10'
52
+ end
53
+
54
+ it 'code_list is empty' do
55
+ @at.code_list.should == []
56
+ end
57
+ end
58
+
59
+ context '4th constraint is icd10::F43.00,F43.01,F32.02;F43.00' do
60
+ before(:all) do
61
+ @at = attr(4)
62
+ end
63
+
64
+ it 'terminology id is icd10' do
65
+ @at.terminology_id.value.should == 'icd10'
66
+ end
67
+
68
+ it 'code_list is F43.00,F43.01,F32.02' do
69
+ @at.code_list.should == ['F43.00','F43.01','F32.02']
70
+ end
71
+
72
+ it 'assumed value is F43.00' do
73
+ @at.assumed_value.should == 'F43.00'
74
+ end
75
+ end
76
+
77
+ context '5th constraint is openehr::431' do
78
+ before(:all) do
79
+ @at = attr(5)
80
+ end
81
+
82
+ it 'terminology is openehr' do
83
+ @at.terminology_id.value.should == 'openehr'
84
+ end
85
+
86
+ it 'code_list is 431' do
87
+ @at.code_list.should == ['431']
88
+ end
89
+ end
90
+ end
91
+ end