open_ehr 0.6.1 → 0.9.0
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.
- data/Gemfile +10 -2
- data/Gemfile.lock +58 -18
- data/Guardfile +2 -1
- data/History.txt +10 -3
- data/Manifest.txt +3 -5
- data/README.rdoc +36 -32
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/adl_validator.rb +84 -0
- data/lib/open_ehr/am/archetype/constraint_model/primitive.rb +11 -7
- data/lib/open_ehr/am/archetype/constraint_model.rb +4 -16
- data/lib/open_ehr/am/archetype/ontology.rb +37 -6
- data/lib/open_ehr/am/archetype.rb +6 -7
- data/lib/open_ehr/am/open_ehr_profile/data_types/text.rb +5 -2
- data/lib/open_ehr/parser/adl.rb +19 -0
- data/lib/open_ehr/parser/adl_grammar.tt +155 -0
- data/lib/open_ehr/parser/adl_parser.rb +48 -0
- data/lib/open_ehr/parser/cadl_grammar.tt +803 -0
- data/lib/open_ehr/parser/dadl.rb +13 -0
- data/lib/open_ehr/parser/dadl_grammar.tt +358 -0
- data/lib/open_ehr/parser/exception.rb +68 -0
- data/lib/open_ehr/parser/scanner/adl_scanner.rb +819 -0
- data/lib/open_ehr/parser/shared_token_grammar.tt +1200 -0
- data/lib/open_ehr/parser/validator.rb +20 -0
- data/lib/open_ehr/parser.rb +16 -12
- data/lib/open_ehr.rb +1 -0
- data/open_ehr.gemspec +364 -0
- data/spec/lib/open_ehr/am/archetype/archetype_spec.rb +7 -2
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_multiple_attribute_spec.rb +0 -6
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_object_spec.rb +10 -10
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_single_attribute_spec.rb +0 -6
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_boolean_spec.rb +5 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_time_spec.rb +5 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_duration_spec.rb +5 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_integer_spec.rb +5 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_primitive_spec.rb +8 -6
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_real_spec.rb +7 -2
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_string_spec.rb +5 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_time_spec.rb +5 -0
- data/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb +27 -7
- data/spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb +3 -3
- data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.assumed_types.v1.adl +88 -0
- data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.basic_types.v1.adl +143 -0
- data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.basic_types_fail.v1.adl +50 -0
- data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.most_minimal.v1.adl +27 -0
- data/spec/lib/open_ehr/parser/adl/adl-test-ENTRY.structure_test1.v1.adl +46 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ACTION.imaging.v1.adl +275 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ACTION.referral.v1.adl +351 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl +765 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.auscultation.v1.adl +217 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl +134 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.dimensions.v1.adl +241 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl +321 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-chest.v1.adl +379 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-fetus.v1.adl +577 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl +146 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl +176 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl +221 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-generic.v1.adl +139 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl +116 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl +420 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-CLUSTER.exam-uterus.v1.adl +293 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-COMPOSITION.discharge.v1draft.adl +53 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-COMPOSITION.encounter.v1draft.adl +45 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-EVALUATION.adverse.v1.adl +411 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-INSTRUCTION.medication.v1.adl +88 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-INSTRUCTION.referral.v1.adl +84 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl +492 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.follow_up.v1draft.adl +94 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.imaging.v1.adl +127 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.medication-formulation.v1.adl +457 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.medication.v1.adl +869 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-ITEM_TREE.referral.v1.adl +494 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-OBSERVATION.apgar.v1.adl +545 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-OBSERVATION.blood_pressure.v1.adl +673 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-OBSERVATION.body_mass_index.v1.adl +166 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-SECTION.findings.v1.adl +47 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-SECTION.reason_for_encounter.v1.adl +51 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-SECTION.summary.v1.adl +52 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-SECTION.vital_signs.v1.adl +54 -0
- data/spec/lib/open_ehr/parser/adl/openEHR-EHR-cadl_sample.v1.adl +9 -0
- data/spec/lib/open_ehr/parser/adl_parser_spec.rb +210 -0
- data/spec/lib/open_ehr/parser/base_spec.rb +19 -0
- data/spec/spec.opts +2 -1
- data/spec/spec_helper.rb +3 -0
- metadata +166 -52
- data/doc/README_rdoc.html +0 -148
- data/doc/created.rid +0 -2
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -54
- data/doc/js/darkfish.js +0 -116
- data/doc/js/jquery.js +0 -32
- data/doc/js/quicksearch.js +0 -114
- data/doc/js/thickbox-compressed.js +0 -10
- data/doc/rdoc.css +0 -706
- data/lib/#open_ehr.rb# +0 -11
data/Gemfile
CHANGED
|
@@ -6,9 +6,17 @@ gem 'locale'
|
|
|
6
6
|
gem 'builder'
|
|
7
7
|
gem 'jeweler'
|
|
8
8
|
gem 'i18n'
|
|
9
|
+
gem 'treetop'
|
|
10
|
+
gem 'polyglot'
|
|
11
|
+
gem 'rdoc'
|
|
9
12
|
|
|
10
|
-
group :development do
|
|
13
|
+
group :development, :test do
|
|
11
14
|
gem 'rspec'
|
|
12
15
|
gem 'guard-rspec'
|
|
13
|
-
gem '
|
|
16
|
+
gem 'ruby-debug19'
|
|
17
|
+
gem 'spork', '>=0.9.0.rc2'
|
|
18
|
+
gem 'guard-spork'
|
|
19
|
+
gem 'simplecov'
|
|
20
|
+
gem 'rb-inotify'
|
|
21
|
+
gem 'libnotify'
|
|
14
22
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,32 +1,64 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
activesupport (3.0
|
|
4
|
+
activesupport (3.1.0)
|
|
5
|
+
multi_json (~> 1.0)
|
|
6
|
+
archive-tar-minitar (0.5.2)
|
|
5
7
|
builder (3.0.0)
|
|
6
|
-
|
|
8
|
+
columnize (0.3.4)
|
|
9
|
+
diff-lcs (1.1.3)
|
|
10
|
+
ffi (1.0.9)
|
|
7
11
|
git (1.2.5)
|
|
8
|
-
guard (0.
|
|
12
|
+
guard (0.7.0)
|
|
9
13
|
thor (~> 0.14.6)
|
|
10
|
-
guard-rspec (0.
|
|
14
|
+
guard-rspec (0.4.5)
|
|
15
|
+
guard (>= 0.4.0)
|
|
16
|
+
guard-spork (0.2.1)
|
|
11
17
|
guard (>= 0.2.2)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
spork (>= 0.8.4)
|
|
19
|
+
i18n (0.6.0)
|
|
20
|
+
jeweler (1.6.4)
|
|
21
|
+
bundler (~> 1.0)
|
|
15
22
|
git (>= 1.2.5)
|
|
16
23
|
rake
|
|
24
|
+
libnotify (0.5.7)
|
|
25
|
+
linecache19 (0.5.12)
|
|
26
|
+
ruby_core_source (>= 0.1.4)
|
|
17
27
|
locale (2.0.5)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
rspec
|
|
28
|
+
multi_json (1.0.3)
|
|
29
|
+
polyglot (0.3.2)
|
|
30
|
+
rake (0.9.2)
|
|
31
|
+
rb-inotify (0.8.6)
|
|
32
|
+
ffi (>= 0.5.0)
|
|
33
|
+
rdoc (3.9.4)
|
|
34
|
+
rspec (2.6.0)
|
|
35
|
+
rspec-core (~> 2.6.0)
|
|
36
|
+
rspec-expectations (~> 2.6.0)
|
|
37
|
+
rspec-mocks (~> 2.6.0)
|
|
38
|
+
rspec-core (2.6.4)
|
|
39
|
+
rspec-expectations (2.6.0)
|
|
25
40
|
diff-lcs (~> 1.1.2)
|
|
26
|
-
rspec-mocks (2.
|
|
27
|
-
|
|
41
|
+
rspec-mocks (2.6.0)
|
|
42
|
+
ruby-debug-base19 (0.11.25)
|
|
43
|
+
columnize (>= 0.3.1)
|
|
44
|
+
linecache19 (>= 0.5.11)
|
|
45
|
+
ruby_core_source (>= 0.1.4)
|
|
46
|
+
ruby-debug19 (0.11.6)
|
|
47
|
+
columnize (>= 0.3.1)
|
|
48
|
+
linecache19 (>= 0.5.11)
|
|
49
|
+
ruby-debug-base19 (>= 0.11.19)
|
|
50
|
+
ruby_core_source (0.1.5)
|
|
51
|
+
archive-tar-minitar (>= 0.5.2)
|
|
52
|
+
simplecov (0.5.3)
|
|
53
|
+
multi_json (~> 1.0.3)
|
|
54
|
+
simplecov-html (~> 0.5.3)
|
|
55
|
+
simplecov-html (0.5.3)
|
|
56
|
+
spork (0.9.0.rc9)
|
|
28
57
|
thor (0.14.6)
|
|
29
|
-
|
|
58
|
+
treetop (1.4.10)
|
|
59
|
+
polyglot
|
|
60
|
+
polyglot (>= 0.3.1)
|
|
61
|
+
xml-simple (1.1.0)
|
|
30
62
|
|
|
31
63
|
PLATFORMS
|
|
32
64
|
ruby
|
|
@@ -35,9 +67,17 @@ DEPENDENCIES
|
|
|
35
67
|
activesupport
|
|
36
68
|
builder
|
|
37
69
|
guard-rspec
|
|
70
|
+
guard-spork
|
|
38
71
|
i18n
|
|
39
72
|
jeweler
|
|
73
|
+
libnotify
|
|
40
74
|
locale
|
|
75
|
+
polyglot
|
|
76
|
+
rb-inotify
|
|
77
|
+
rdoc
|
|
41
78
|
rspec
|
|
42
|
-
|
|
79
|
+
ruby-debug19
|
|
80
|
+
simplecov
|
|
81
|
+
spork (>= 0.9.0.rc2)
|
|
82
|
+
treetop
|
|
43
83
|
xml-simple
|
data/Guardfile
CHANGED
|
@@ -2,8 +2,9 @@ guard 'rspec' do
|
|
|
2
2
|
watch(%r{^spec/.+_spec\.rb})
|
|
3
3
|
watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
|
4
4
|
watch('spec/spec_helper.rb') { "spec" }
|
|
5
|
+
watch(%r{^lib/open_ehr/parser/.+\.tt}) { "spec/lib/open_ehr/parser" }
|
|
5
6
|
end
|
|
6
7
|
|
|
7
|
-
guard 'spork' do
|
|
8
|
+
guard 'spork', :wait => 30, :cucumber => false do
|
|
8
9
|
watch('spec/spec_helper.rb')
|
|
9
10
|
end
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
+
Gemfile
|
|
2
|
+
Guardfile
|
|
1
3
|
History.txt
|
|
2
4
|
Manifest.txt
|
|
3
5
|
PostInstall.txt
|
|
4
6
|
README.rdoc
|
|
5
7
|
Rakefile
|
|
6
|
-
|
|
8
|
+
VERSION
|
|
7
9
|
lib/open_ehr.rb
|
|
8
10
|
lib/open_ehr/cli.rb
|
|
9
|
-
script/console
|
|
10
|
-
script/destroy
|
|
11
|
-
script/generate
|
|
12
11
|
spec/open_ehr_cli_spec.rb
|
|
13
12
|
spec/open_ehr_spec.rb
|
|
14
13
|
spec/spec.opts
|
|
15
14
|
spec/spec_helper.rb
|
|
16
|
-
tasks/rspec.rake
|
data/README.rdoc
CHANGED
|
@@ -5,62 +5,66 @@ Ruby openEHR implementation project.
|
|
|
5
5
|
|
|
6
6
|
= Version
|
|
7
7
|
|
|
8
|
-
Release-0.
|
|
8
|
+
Release-0.9.0b
|
|
9
9
|
|
|
10
10
|
= Requirements
|
|
11
11
|
|
|
12
|
-
* Ruby 1.
|
|
12
|
+
* Ruby 1.9.2 reccomended
|
|
13
13
|
* RubyGems
|
|
14
14
|
* Tested with Ruby 1.9.2 on Linux and FreeBSD.
|
|
15
|
-
* If you use Ruby 1.
|
|
16
|
-
runtime environment and some
|
|
15
|
+
* If you use early version of Ruby 1.8, you should
|
|
16
|
+
prepare racc runtime environment and some
|
|
17
|
+
adjustment. We do not support Ruby 1.6 anymore.
|
|
17
18
|
* It should work on other platforms with Ruby
|
|
18
19
|
support as well.
|
|
19
20
|
|
|
20
21
|
== DESCRIPTION:
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
This is the beta version 0.9.0 release of Ruby openEHR implementation
|
|
23
24
|
project. This release is still experimental preview of our work based
|
|
24
|
-
on openEHR specification release 1.0.2. We implemented almost
|
|
25
|
-
|
|
26
|
-
intention is to have
|
|
27
|
-
|
|
28
|
-
archetype based object creation and validation.
|
|
25
|
+
on openEHR specification release 1.0.2. We implemented almost of the
|
|
26
|
+
specifications of the openEHR. The work is still in progress. The
|
|
27
|
+
intention is to have a sample EHR to utilize all over the world
|
|
28
|
+
quickly with Ruby on Rails.
|
|
29
29
|
|
|
30
|
-
Parser
|
|
31
|
-
|
|
30
|
+
Parser is nearly performing completely. We now consider to descrive
|
|
31
|
+
archetype as another formalism such as YAML, instead of ADL.
|
|
32
32
|
|
|
33
|
-
Almost all classes passed the test constructed by
|
|
34
|
-
test/unit.
|
|
33
|
+
Almost all classes passed the test constructed by rspec2 (formaly used
|
|
34
|
+
test/unit). These test specification are under /spec.
|
|
35
35
|
|
|
36
|
-
Some specifications are not well determined yet, such as
|
|
37
|
-
|
|
38
|
-
classes.
|
|
36
|
+
Some specifications are not well determined yet, such as rm/security
|
|
37
|
+
and so on. We postponed to implement such classes.
|
|
39
38
|
|
|
40
|
-
Terminology and Demographic server will be implemented in
|
|
41
|
-
|
|
39
|
+
Terminology and Demographic server will be implemented in other
|
|
40
|
+
project.
|
|
42
41
|
|
|
43
42
|
= Authors
|
|
44
43
|
Akimichi Tatsukawa, Shinji Kobayashi
|
|
44
|
+
|
|
45
45
|
openEHR.jp, <http://openehr.jp>
|
|
46
46
|
|
|
47
47
|
= Copyright
|
|
48
|
-
The software, including all files in this directory
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
The software, including all files in this directory and
|
|
49
|
+
subdirectories is copyrighted to the original authors and
|
|
50
|
+
contributors, 2011.
|
|
51
|
+
|
|
51
52
|
All Rights Reserved.
|
|
52
53
|
|
|
53
54
|
= License
|
|
54
55
|
|
|
55
56
|
This product is under openEHR Open Source Software License
|
|
56
57
|
|
|
57
|
-
The openEHR Foundation
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
The openEHR Foundation has used the Mozilla Tri-license 1.1 on all
|
|
59
|
+
software copyrighted to the Foundation. Therefore, we release this
|
|
60
|
+
product under Mozilla Tri-license at now, but the openEHR foundation
|
|
61
|
+
is discussing about lincense for the resouces. We would change our
|
|
62
|
+
license for this package after the decision. The Mozilla tri-licence
|
|
63
|
+
essentially provides the user a choice of licence conditionsunder
|
|
64
|
+
which to operate with any given piece of software, being: the Mozilla
|
|
65
|
+
Public licence (MPL), and the Free Software Foundation GNU General
|
|
66
|
+
Public Licence (GPL) and Lesser GNU General Public Licence (LGPL). See
|
|
67
|
+
the Mozilla relicensing FAQ for details of this license. This in no
|
|
68
|
+
way constrains the way in which software created by other
|
|
69
|
+
organisations is licenced.
|
|
70
|
+
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.9.0
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require "adl_parser"
|
|
4
|
+
require 'readline'
|
|
5
|
+
require 'optparse'
|
|
6
|
+
require 'net/http'
|
|
7
|
+
|
|
8
|
+
module OpenEhr
|
|
9
|
+
module CommandLine
|
|
10
|
+
class Arguments < Hash
|
|
11
|
+
def initialize(args)
|
|
12
|
+
super() # default values
|
|
13
|
+
opts = ::OptionParser.new do |opts|
|
|
14
|
+
opts.banner = "Usage: #$0 [file|http://location.to.adl]* [options]"
|
|
15
|
+
opts.on('-v', '--verbose', 'display verbose message(Not Implemented Yet)') do
|
|
16
|
+
self[:verbose] = true
|
|
17
|
+
end
|
|
18
|
+
opts.on_tail('-h', '--help', 'display this help') do
|
|
19
|
+
puts opts
|
|
20
|
+
exit
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
opts.parse!(args)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class ADLValidator
|
|
28
|
+
def initialize(arguments)
|
|
29
|
+
@debug = false
|
|
30
|
+
@adl_validator = ::OpenEHR::Application::ADLValidator.new(::OpenEHR::ADL::Validator.new(::OpenEHR::ADL::Parser.new))
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def run
|
|
34
|
+
while argv = ARGV.shift
|
|
35
|
+
begin
|
|
36
|
+
input = nil
|
|
37
|
+
name = nil
|
|
38
|
+
case argv
|
|
39
|
+
when /\A(http:\/\/.*)/
|
|
40
|
+
name = $1
|
|
41
|
+
input = case response = Net::HTTP.get_response(Uri.parse($1))
|
|
42
|
+
when Net::HTTPSuccess
|
|
43
|
+
response.body
|
|
44
|
+
when Net::HTTPRedirection
|
|
45
|
+
name = response['location']
|
|
46
|
+
fetch(response['location'], limit - 1)
|
|
47
|
+
else
|
|
48
|
+
response.error!
|
|
49
|
+
end
|
|
50
|
+
when /\A("[^"]*)"/
|
|
51
|
+
name = argv
|
|
52
|
+
input = argv
|
|
53
|
+
else # assumes file name
|
|
54
|
+
name = argv
|
|
55
|
+
input = File.new(argv)
|
|
56
|
+
end
|
|
57
|
+
@adl_validator.run(input, name)
|
|
58
|
+
rescue SocketError => message
|
|
59
|
+
puts "SocketError: #{message}"
|
|
60
|
+
rescue Racc::ParseError => message
|
|
61
|
+
puts "ParseError: #{message}"
|
|
62
|
+
else
|
|
63
|
+
puts "Accepted '#{argv}'"
|
|
64
|
+
ensure
|
|
65
|
+
# input.close if input.kind_of? IO
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end # of CommandLine
|
|
71
|
+
end # of OpenEHR
|
|
72
|
+
|
|
73
|
+
if __FILE__ == $0
|
|
74
|
+
begin
|
|
75
|
+
arguments = OpenEhr::CommandLine::Arguments.new(ARGV)
|
|
76
|
+
validator = OpenEhr::CommandLine::ADLValidator.new(arguments)
|
|
77
|
+
validator.run
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
@@ -5,19 +5,21 @@ module OpenEHR
|
|
|
5
5
|
module ConstraintModel
|
|
6
6
|
module Primitive
|
|
7
7
|
class CPrimitive
|
|
8
|
-
attr_reader :
|
|
9
|
-
attr_accessor :assumed_value
|
|
8
|
+
attr_reader :type
|
|
9
|
+
attr_accessor :assumed_value, :default_value
|
|
10
10
|
|
|
11
11
|
def initialize(args = { })
|
|
12
12
|
self.default_value = args[:default_value]
|
|
13
13
|
self.assumed_value = args[:assumed_value]
|
|
14
|
+
self.type = args[:type]
|
|
15
|
+
@type ||= 'ANY'
|
|
14
16
|
end
|
|
15
17
|
|
|
16
|
-
def
|
|
17
|
-
if
|
|
18
|
-
raise ArgumentError, '
|
|
18
|
+
def type=(type)
|
|
19
|
+
if !type.nil? && type.empty?
|
|
20
|
+
raise ArgumentError, 'type should not be empty'
|
|
19
21
|
end
|
|
20
|
-
@
|
|
22
|
+
@type = type
|
|
21
23
|
end
|
|
22
24
|
|
|
23
25
|
def has_assumed_value?
|
|
@@ -129,7 +131,9 @@ module OpenEHR
|
|
|
129
131
|
end
|
|
130
132
|
|
|
131
133
|
class CReal < CInteger
|
|
132
|
-
|
|
134
|
+
def initialize(args = { })
|
|
135
|
+
super
|
|
136
|
+
end
|
|
133
137
|
end
|
|
134
138
|
|
|
135
139
|
module CDateModule
|
|
@@ -89,11 +89,10 @@ module OpenEHR
|
|
|
89
89
|
attr_reader :rm_type_name, :node_id, :occurrences
|
|
90
90
|
|
|
91
91
|
def initialize(args = { })
|
|
92
|
-
super
|
|
92
|
+
super
|
|
93
93
|
self.rm_type_name = args[:rm_type_name]
|
|
94
94
|
self.node_id = args[:node_id]
|
|
95
95
|
self.occurrences = args[:occurrences]
|
|
96
|
-
|
|
97
96
|
end
|
|
98
97
|
|
|
99
98
|
def rm_type_name=(rm_type_name)
|
|
@@ -104,7 +103,7 @@ module OpenEHR
|
|
|
104
103
|
end
|
|
105
104
|
|
|
106
105
|
def node_id=(node_id)
|
|
107
|
-
if node_id.nil?
|
|
106
|
+
if !node_id.nil? && node_id.empty?
|
|
108
107
|
raise ArgumentError, 'invalid node_id'
|
|
109
108
|
end
|
|
110
109
|
@node_id = node_id
|
|
@@ -145,7 +144,7 @@ module OpenEHR
|
|
|
145
144
|
end
|
|
146
145
|
|
|
147
146
|
def existence=(existence)
|
|
148
|
-
if existence.nil?
|
|
147
|
+
if !existence.nil? && (existence.lower < 0 || existence.upper > 1)
|
|
149
148
|
raise ArgumentError, 'invalid existence'
|
|
150
149
|
end
|
|
151
150
|
@existence = existence
|
|
@@ -309,29 +308,18 @@ module OpenEHR
|
|
|
309
308
|
end
|
|
310
309
|
|
|
311
310
|
def alternatives=(alternatives)
|
|
312
|
-
if alternatives.nil?
|
|
313
|
-
raise ArgumentError, 'alternatives are mandatory'
|
|
314
|
-
end
|
|
315
311
|
@alternatives = alternatives
|
|
316
312
|
end
|
|
317
313
|
end
|
|
318
314
|
|
|
319
315
|
class CMultipleAttribute < CAttribute
|
|
320
|
-
attr_accessor :members
|
|
321
|
-
attr_reader :cardinality
|
|
316
|
+
attr_accessor :members, :cardinality
|
|
322
317
|
|
|
323
318
|
def initialize(args = { })
|
|
324
319
|
super
|
|
325
320
|
self.members = args[:members]
|
|
326
321
|
self.cardinality = args[:cardinality]
|
|
327
322
|
end
|
|
328
|
-
|
|
329
|
-
def cardinality=(cardinality)
|
|
330
|
-
if cardinality.nil?
|
|
331
|
-
raise ArgumentError, 'cardinality is mandatory'
|
|
332
|
-
end
|
|
333
|
-
@cardinality = cardinality
|
|
334
|
-
end
|
|
335
323
|
end
|
|
336
324
|
end # of ConstraintModel
|
|
337
325
|
end # of Archetype
|
|
@@ -3,14 +3,16 @@ module OpenEHR
|
|
|
3
3
|
module Archetype
|
|
4
4
|
module Ontology
|
|
5
5
|
class ArchetypeOntology
|
|
6
|
-
attr_accessor :
|
|
6
|
+
attr_accessor :specialisation_depth
|
|
7
7
|
attr_accessor :term_attribute_names, :term_bindings
|
|
8
|
-
attr_reader :
|
|
8
|
+
attr_reader :term_definitions, :constraint_definitions
|
|
9
9
|
|
|
10
10
|
def initialize(args = { })
|
|
11
11
|
self.specialisation_depth = args[:specialisation_depth]
|
|
12
12
|
self.term_definitions = args[:term_definitions]
|
|
13
|
-
|
|
13
|
+
if args[:constraint_definitions]
|
|
14
|
+
self.constraint_definitions = args[:constraint_definitions]
|
|
15
|
+
end
|
|
14
16
|
self.term_bindings = args[:term_bindings]
|
|
15
17
|
end
|
|
16
18
|
|
|
@@ -18,6 +20,7 @@ module OpenEHR
|
|
|
18
20
|
if term_definitions.nil?
|
|
19
21
|
raise ArgumentError, 'term_definitions is mandatory'
|
|
20
22
|
end
|
|
23
|
+
@term_definition_map = definition_mapper(term_definitions)
|
|
21
24
|
@term_definitions = term_definitions
|
|
22
25
|
end
|
|
23
26
|
|
|
@@ -40,21 +43,45 @@ module OpenEHR
|
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
def constraint_binding(a_terminology, a_code)
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def constraint_definitions=(constraint_definitions)
|
|
50
|
+
@constraint_definition_map = definition_mapper(constraint_definitions)
|
|
51
|
+
@constraint_definitions = constraint_definitions
|
|
43
52
|
end
|
|
44
53
|
|
|
45
|
-
def constraint_definition(
|
|
54
|
+
def constraint_definition(args = {})
|
|
55
|
+
return @constraint_definition_map[args[:lang]][args[:code]]
|
|
46
56
|
end
|
|
47
57
|
|
|
48
58
|
def has_language?(a_lang)
|
|
59
|
+
return @term_definition_map.has_key? a_lang
|
|
49
60
|
end
|
|
50
61
|
|
|
51
62
|
def has_terminology?(a_terminology)
|
|
63
|
+
return @term_bindings.has_key? a_terminology
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def term_binding(args = { })
|
|
67
|
+
|
|
52
68
|
end
|
|
53
69
|
|
|
54
|
-
def
|
|
70
|
+
def term_definition(args = { })
|
|
71
|
+
return @term_definition_map[args[:lang]][args[:code]]
|
|
55
72
|
end
|
|
56
73
|
|
|
57
|
-
|
|
74
|
+
private
|
|
75
|
+
def definition_mapper(definitions)
|
|
76
|
+
map = { }
|
|
77
|
+
definitions.each do |lang, defs|
|
|
78
|
+
defs_map = { }
|
|
79
|
+
defs.each do |d|
|
|
80
|
+
defs_map[d.code] = d.items
|
|
81
|
+
end
|
|
82
|
+
map[lang] = defs_map
|
|
83
|
+
end
|
|
84
|
+
return map
|
|
58
85
|
end
|
|
59
86
|
end
|
|
60
87
|
|
|
@@ -85,6 +112,10 @@ module OpenEHR
|
|
|
85
112
|
return Set.new(@items.keys)
|
|
86
113
|
end
|
|
87
114
|
end
|
|
115
|
+
|
|
116
|
+
def method_missing(key)
|
|
117
|
+
return @items[key.to_sym]
|
|
118
|
+
end
|
|
88
119
|
end
|
|
89
120
|
|
|
90
121
|
class ARCHETYPE_TERM < ArchetypeTerm
|
|
@@ -4,6 +4,10 @@ include OpenEHR::RM::Common::Resource
|
|
|
4
4
|
module OpenEHR
|
|
5
5
|
module AM
|
|
6
6
|
module Archetype
|
|
7
|
+
autoload :Assertion, 'archetype/assertion'
|
|
8
|
+
autoload :ConstraintModel, 'archetype/constraint_model'
|
|
9
|
+
autoload :Ontology, 'archetype/ontology'
|
|
10
|
+
|
|
7
11
|
module ADLDefinition
|
|
8
12
|
include OpenEHR::RM::Support::Terminology
|
|
9
13
|
# include OpenEHR::RM::Support::Terminology::OpenEHR_Code_Set_Identifier
|
|
@@ -64,7 +68,7 @@ module OpenEHR
|
|
|
64
68
|
end
|
|
65
69
|
|
|
66
70
|
def concept_name(a_lang)
|
|
67
|
-
|
|
71
|
+
return @ontology.term_definition(:lang => a_lang, :code => @concept)[:text]
|
|
68
72
|
end
|
|
69
73
|
|
|
70
74
|
def constraint_references_valid?
|
|
@@ -79,7 +83,7 @@ module OpenEHR
|
|
|
79
83
|
def is_valid?
|
|
80
84
|
end
|
|
81
85
|
|
|
82
|
-
def logical_paths(a_lang)
|
|
86
|
+
def logical_paths(a_lang)
|
|
83
87
|
end
|
|
84
88
|
|
|
85
89
|
def node_ids_vaild?
|
|
@@ -124,11 +128,6 @@ module OpenEHR
|
|
|
124
128
|
@value = value
|
|
125
129
|
end
|
|
126
130
|
end
|
|
127
|
-
|
|
128
|
-
autoload :Assertion, 'archetype/assertion'
|
|
129
|
-
autoload :ConstraintModel, 'archetype/constraint_model'
|
|
130
|
-
autoload :Ontology, 'archetype/ontology'
|
|
131
|
-
|
|
132
131
|
end # of Archetype
|
|
133
132
|
end # of AM
|
|
134
133
|
end # of OpenEHR
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
|
3
|
+
|
|
4
|
+
module OpenEHR
|
|
2
5
|
module AM
|
|
3
|
-
module
|
|
6
|
+
module OpenEHRProfile
|
|
4
7
|
module DataTypes
|
|
5
8
|
module Text
|
|
6
9
|
class C_CODE_PHASE < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module OpenEHR
|
|
2
|
+
module Parser
|
|
3
|
+
module ADLGrammar
|
|
4
|
+
class Base < Treetop::Runtime::SyntaxNode
|
|
5
|
+
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class ArchLanguage < Base
|
|
9
|
+
def original_language
|
|
10
|
+
lang.value[:original_language]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def translations
|
|
14
|
+
lang.value[:translations]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|