openehr 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,32 @@
1
+ *~
2
+ *#
3
+
4
+ \#*
5
+ .\#*
6
+
7
+ # rcov generated
8
+ coverage
9
+
10
+ # rdoc generated
11
+ rdoc
12
+
13
+ # yard generated
14
+ doc/
15
+ .yardoc
16
+
17
+ # bundler
18
+ .bundle
19
+ *.lock
20
+
21
+ # jeweler generated
22
+ pkg
23
+
24
+ # logger generated
25
+ log
26
+
27
+ # subversion ignore
28
+ .svn
29
+
30
+ tmp
31
+ *.gem
32
+ *.rbc
data/Gemfile CHANGED
@@ -1,23 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'xml-simple'
4
- gem 'activesupport'
5
- gem 'locale'
6
- gem 'builder'
7
- gem 'jeweler'
8
- gem 'i18n'
9
- gem 'treetop'
10
- gem 'polyglot'
11
- gem 'rdoc'
12
- gem 'sqlite3'
13
- gem 'activerecord'
14
-
15
- group :development, :test do
16
- gem 'rspec'
17
- gem 'guard-rspec'
18
- gem 'ruby-debug19'
19
- gem 'spork', '~> 1.0rc'
20
- gem 'guard-spork'
21
- gem 'simplecov'
22
- gem 'libnotify'
23
- end
3
+ gemspec
data/Guardfile CHANGED
@@ -1,12 +1,20 @@
1
1
  guard 'spork' do
2
2
  watch('spec/spec_helper.rb')
3
+ watch('feature/support/env.rb')
3
4
  end
4
5
 
5
- guard 'rspec', :version => 2, :cli => '--drb' do
6
+ guard 'rspec', :cli => '--drb --color' do
6
7
  watch(%r{^spec/.+_spec\.rb})
7
8
  watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" }
8
9
  watch('spec/spec_helper.rb') { "spec" }
9
10
  watch(%r{^lib/open_ehr/parser/.+\.tt}) { "spec/lib/open_ehr/parser" }
10
11
  end
11
12
 
13
+ guard 'cucumber', cli: '--drb --format progress' do
14
+ watch(%r{^features/.+\.feature$})
15
+ watch(%r{^features/support/.+$}) { 'features' }
16
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
17
+ end
18
+
12
19
  notification :libnotify, :timeout => 5, :transient => true, :append => false
20
+
data/README.rdoc CHANGED
@@ -5,7 +5,7 @@ Ruby openEHR implementation project.
5
5
 
6
6
  = Version
7
7
 
8
- Release-1.1.4
8
+ Release-1.1.5
9
9
 
10
10
  = Requirements
11
11
 
@@ -38,6 +38,8 @@ This package excludes:
38
38
  * ADL serializer(in progress)
39
39
  * ADL validator(in progress)
40
40
  * Data store/retrieve would be separate to the other project.
41
+ * Terminology service(moved to open_terminology package)
42
+ * Rails plugin(moved to openehr-rails package
41
43
 
42
44
  Almost all classes passed the test constructed by RSpec2. These spec
43
45
  files are under /spec.
@@ -59,7 +61,7 @@ reference implementation project of the openEHR.
59
61
  = Copyright
60
62
  The software, including all files in this directory and
61
63
  subdirectories is copyrighted to the original authors and
62
- contributors, 2011.
64
+ contributors, 2011-2013.
63
65
 
64
66
  All Rights Reserved.
65
67
 
@@ -67,7 +69,7 @@ All Rights Reserved.
67
69
 
68
70
  This product is under Apache 2.0 license
69
71
 
70
- Copyright [2012] Shinji Kobayashi, Akimichi Tatsukawa, openEHR.jp
72
+ Copyright [2012,2013] Shinji Kobayashi, Akimichi Tatsukawa, openEHR.jp
71
73
 
72
74
  Licensed under the Apache License, Version 2.0 (the "License");
73
75
  you may not use this file except in compliance with the License.
data/Rakefile CHANGED
@@ -1,44 +1,14 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
- require './lib/openehr'
3
+ require "bundler/gem_tasks"
4
+ Bundler::GemHelper::install_tasks
4
5
 
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
6
  require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "openehr"
18
- gem.homepage = "http://github.com/skoba/ruby-impl-openehr"
19
- gem.license = "Apache 2.0 license"
20
- gem.summary = %Q{Ruby implementation of the openEHR specification}
21
- gem.description = %Q{This project is an implementation of the openEHR specification on Ruby.}
22
- gem.email = "skoba@moss.gr.jp"
23
- gem.authors = ["Shinji KOBAYASHI", "Akimichi Tatsukawa"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
7
  require 'rspec/core'
29
8
  require 'rspec/core/rake_task'
9
+
30
10
  RSpec::Core::RakeTask.new(:spec) do |spec|
31
11
  spec.pattern = FileList['spec/**/*_spec.rb']
32
12
  end
33
13
 
34
14
  task :default => :spec
35
-
36
- require 'rdoc/task'
37
- Rake::RDocTask.new do |rdoc|
38
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
39
-
40
- rdoc.rdoc_dir = 'rdoc'
41
- rdoc.title = "gempack #{version}"
42
- rdoc.rdoc_files.include('README*')
43
- rdoc.rdoc_files.include('lib/**/*.rb')
44
- end
@@ -0,0 +1,9 @@
1
+ Feature: RMFactory generates RM insntances
2
+ In order to generate RM instance by archetype definition
3
+ As RM factory
4
+ RM Type and attributes should be specified
5
+
6
+ Scenario: RMFactory generates DvText instance
7
+ Given "DV_TEXT" in archetype definition with attribute
8
+ When RM Factory generates instance
9
+ Then DvText instance should be available
@@ -0,0 +1,12 @@
1
+ Given /^\"DV_TEXT\" in archetype definition with attribute$/ do
2
+ @type= "DV_TEXT"
3
+ @params = [value: 'text']
4
+ end
5
+
6
+ When /^RM Factory generates instance$/ do
7
+ @dv_text = OpenEHR::RM::Factory.create(@type, @params)
8
+ end
9
+
10
+ Then /^DvText instance should be available$/ do
11
+ @dv_text.should be_an_instance_of OpenEHR::RM::DataTypes::Text::DvText
12
+ end
@@ -0,0 +1,10 @@
1
+ require 'spork'
2
+
3
+ Spork.prefork do
4
+ $LOAD_PATH << File.expand_path('../../../lib', __FILE__)
5
+ require 'openehr'
6
+ end
7
+
8
+ Spork.each_run do
9
+
10
+ end
data/lib/openehr.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  $:.unshift(File.dirname(__FILE__))
2
+ require 'openehr/version'
2
3
 
3
4
  module OpenEHR
4
5
  autoload :AssumedLibraryTypes, 'openehr/assumed_library_types'
5
6
  autoload :RM, 'openehr/rm'
6
7
  autoload :AM, 'openehr/am'
7
- autoload :Terminology, 'openehr/terminology'
8
- autoload :Serializer, 'openehr/serializer'
9
8
  autoload :Parser, 'openehr/parser'
9
+ autoload :Serializer, 'openehr/serializer'
10
+ autoload :Terminology, 'openehr/terminology'
10
11
  end
data/lib/openehr/rm.rb CHANGED
@@ -11,5 +11,6 @@ module OpenEHR
11
11
  autoload :Integration, 'rm/integration'
12
12
  autoload :Security, 'rm/security'
13
13
  autoload :Support, 'rm/support'
14
+ autoload :Factory, 'rm/factory'
14
15
  end
15
16
  end
@@ -46,7 +46,7 @@ module OpenEHR
46
46
 
47
47
  def initialize(args)
48
48
  super(args)
49
- self.is_terminal = args[:is_terminal]
49
+ self.terminal = args[:is_terminal].nil? ? args[:terminal] : args[:is_terminal]
50
50
  end
51
51
 
52
52
  def value=(v)
@@ -58,10 +58,14 @@ module OpenEHR
58
58
  @is_terminal
59
59
  end
60
60
 
61
+ alias terminal? is_terminal?
62
+
61
63
  def is_terminal=(s)
62
64
  raise ArgumentError, "terminal should not be nil" if s.nil?
63
65
  @is_terminal = s
64
66
  end
67
+
68
+ alias terminal= is_terminal=
65
69
  end # end of DvState
66
70
 
67
71
  class DvIdentifier < DataValue
@@ -13,7 +13,7 @@ module OpenEHR
13
13
 
14
14
  class DvOrdered < OpenEHR::RM::DataTypes::Basic::DataValue
15
15
  include Comparable
16
- attr_accessor :normal_range, :other_refference_ranges, :normal_status
16
+ attr_accessor :normal_range, :other_reference_ranges, :normal_status
17
17
 
18
18
  def initialize(args = {})
19
19
  super(args)
@@ -93,7 +93,7 @@ module OpenEHR
93
93
  end
94
94
  end
95
95
 
96
- class VersionedEHRAccesss < VersionedObject
96
+ class VersionedEHRAccess < VersionedObject
97
97
 
98
98
  end
99
99
 
@@ -0,0 +1,180 @@
1
+ require 'active_support/inflector'
2
+
3
+ module OpenEHR
4
+ module RM
5
+ class Factory
6
+ def self.create(type, *param)
7
+ type = type.downcase.camelize if type.include? '_'
8
+ class_eval("#{type}Factory").create(*param)
9
+ end
10
+ end
11
+
12
+ class DvBooleanFactory
13
+ def self.create(*param)
14
+ OpenEHR::RM::DataTypes::Basic::DvBoolean.new(*param)
15
+ end
16
+ end
17
+
18
+ class DvStateFactory
19
+ def self.create(*param)
20
+ OpenEHR::RM::DataTypes::Basic::DvState.new(*param)
21
+ end
22
+ end
23
+
24
+ class DvIdentifierFactory
25
+ def self.create(*param)
26
+ OpenEHR::RM::DataTypes::Basic::DvIdentifier.new(*param)
27
+ end
28
+ end
29
+
30
+ class DvTextFactory
31
+ def self.create(*param)
32
+ OpenEHR::RM::DataTypes::Text::DvText.new(*param)
33
+ end
34
+ end
35
+
36
+ class TermMappingFactory
37
+ def self.create(*param)
38
+ OpenEHR::RM::DataTypes::Text::TermMapping.new(*param)
39
+ end
40
+ end
41
+
42
+ class CodePhraseFactory
43
+ def self.create(*param)
44
+ OpenEHR::RM::DataTypes::Text::CodePhrase.new(*param)
45
+ end
46
+ end
47
+
48
+ class DvCodedTextFactory
49
+ def self.create(*param)
50
+ OpenEHR::RM::DataTypes::Text::DvCodedText.new(*param)
51
+ end
52
+ end
53
+
54
+ class DvParagraphFactory
55
+ def self.create(*param)
56
+ OpenEHR::RM::DataTypes::Text::DvParagraph.new(*param)
57
+ end
58
+ end
59
+
60
+ class DvOrderedFactory
61
+ def self.create(*param)
62
+ OpenEHR::RM::DataTypes::Quantity::DvOrdered.new(*param)
63
+ end
64
+ end
65
+
66
+ class DvIntervalFactory
67
+ def self.create(*param)
68
+ OpenEHR::RM::DataTypes::Quantity::DvInterval.new(*param)
69
+ end
70
+ end
71
+
72
+ class ReferenceRangeFactory
73
+ def self.create(*param)
74
+ OpenEHR::RM::DataTypes::Quantity::ReferenceRange.new(*param)
75
+ end
76
+ end
77
+
78
+ class DvOrdinalFactory
79
+ def self.create(*param)
80
+ OpenEHR::RM::DataTypes::Quantity::DvOrdinal.new(*param)
81
+ end
82
+ end
83
+
84
+ class DvQuantifiedFactory
85
+ def self.create(*param)
86
+ DataTypes::Quantity::DvQuantified.new(*param)
87
+ end
88
+ end
89
+
90
+ class DvAmountFactory
91
+ def self.create(*param)
92
+ DataTypes::Quantity::DvAmount.new(*param)
93
+ end
94
+ end
95
+
96
+ class DvQuantityFactory
97
+ def self.create(*param)
98
+ OpenEHR::RM::DataTypes::Quantity::DvQuantity.new(*param)
99
+ end
100
+ end
101
+
102
+ class DvCountFactory
103
+ def self.create(*param)
104
+ DataTypes::Quantity::DvCount.new(*param)
105
+ end
106
+ end
107
+
108
+ class DvProportionFactory
109
+ def self.create(*param)
110
+ DataTypes::Quantity::DvProportion.new(*param)
111
+ end
112
+ end
113
+
114
+ class DvAbsoluteQuantityFactory
115
+ def self.create(*param)
116
+ DataTypes::Quantity::DvAbsoluteQuantity.new(*param)
117
+ end
118
+ end
119
+
120
+ class DvTemporalFactory
121
+ def self.create(*param)
122
+ DataTypes::Quantity::DateTime::DvTemporal.new(*param)
123
+ end
124
+ end
125
+
126
+ class DvDateFactory
127
+ def self.create(*param)
128
+ OpenEHR::RM::DataTypes::Quantity::DateTime::DvDate.new(*param)
129
+ end
130
+ end
131
+
132
+ class DvTimeFactory
133
+ def self.create(*param)
134
+ DataTypes::Quantity::DateTime::DvTime.new(*param)
135
+ end
136
+ end
137
+
138
+ class DvDateTimeFactory
139
+ def self.create(*param)
140
+ DataTypes::Quantity::DateTime::DvDateTime.new(*param)
141
+ end
142
+ end
143
+
144
+ class DvDurationFactory
145
+ def self.create(*param)
146
+ DataTypes::Quantity::DateTime::DvDuration.new(*param)
147
+ end
148
+ end
149
+
150
+ class DvEncapsulatedFactory
151
+ def self.create(*param)
152
+ DataTypes::Encapsulated::DvEncapsulated.new(*param)
153
+ end
154
+ end
155
+
156
+ class DvMultimediaFactory
157
+ def self.create(*param)
158
+ DataTypes::Encapsulated::DvMultimedia.new(*param)
159
+ end
160
+ end
161
+
162
+ class DvParsableFactory
163
+ def self.create(*param)
164
+ DataTypes::Encapsulated::DvParsable.new(*param)
165
+ end
166
+ end
167
+
168
+ class DvUriFactory
169
+ def self.create(*param)
170
+ DataTypes::URI::DvUri.new(*param)
171
+ end
172
+ end
173
+
174
+ class DvEhrUriFactory
175
+ def self.create(*param)
176
+ DataTypes::URI::DvEhrUri.new(*param)
177
+ end
178
+ end
179
+ end
180
+ end