ckm_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source :rubygems
2
+
3
+ gem 'soap4r-ruby1.9'
4
+ gem 'jeweler'
5
+
6
+ group :test, :development do
7
+ gem 'rspec'
8
+ gem 'cucumber'
9
+ gem 'guard'
10
+ gem 'guard-spork'
11
+ gem 'spork', '~> 1.0.0.rc'
12
+ gem 'guard-rspec', '~> 2.4.0'
13
+ gem 'guard-cucumber'
14
+ gem 'listen', '0.6'
15
+ gem 'rb-kqueue'
16
+ gem 'libnotify'
17
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,83 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ builder (3.1.4)
5
+ childprocess (0.3.7)
6
+ ffi (~> 1.0, >= 1.0.6)
7
+ coderay (1.0.8)
8
+ cucumber (1.2.1)
9
+ builder (>= 2.1.2)
10
+ diff-lcs (>= 1.1.3)
11
+ gherkin (~> 2.11.0)
12
+ json (>= 1.4.6)
13
+ diff-lcs (1.1.3)
14
+ ffi (1.3.1)
15
+ gherkin (2.11.6)
16
+ json (>= 1.7.6)
17
+ git (1.2.5)
18
+ guard (1.6.2)
19
+ listen (>= 0.6.0)
20
+ lumberjack (>= 1.0.2)
21
+ pry (>= 0.9.10)
22
+ terminal-table (>= 1.4.3)
23
+ thor (>= 0.14.6)
24
+ guard-cucumber (1.3.2)
25
+ cucumber (>= 1.2.0)
26
+ guard (>= 1.1.0)
27
+ guard-rspec (2.4.0)
28
+ guard (>= 1.1)
29
+ rspec (~> 2.11)
30
+ guard-spork (1.4.2)
31
+ childprocess (>= 0.2.3)
32
+ guard (>= 1.1)
33
+ spork (>= 0.8.4)
34
+ jeweler (1.8.4)
35
+ bundler (~> 1.0)
36
+ git (>= 1.2.5)
37
+ rake
38
+ rdoc
39
+ json (1.7.6)
40
+ libnotify (0.8.0)
41
+ ffi (>= 1.0.11)
42
+ listen (0.6.0)
43
+ lumberjack (1.0.2)
44
+ method_source (0.8.1)
45
+ pry (0.9.11.4)
46
+ coderay (~> 1.0.5)
47
+ method_source (~> 0.8)
48
+ slop (~> 3.4)
49
+ rake (10.0.3)
50
+ rb-kqueue (0.2.0)
51
+ ffi (>= 0.5.0)
52
+ rdoc (3.12)
53
+ json (~> 1.4)
54
+ rspec (2.12.0)
55
+ rspec-core (~> 2.12.0)
56
+ rspec-expectations (~> 2.12.0)
57
+ rspec-mocks (~> 2.12.0)
58
+ rspec-core (2.12.2)
59
+ rspec-expectations (2.12.1)
60
+ diff-lcs (~> 1.1.3)
61
+ rspec-mocks (2.12.2)
62
+ slop (3.4.3)
63
+ soap4r-ruby1.9 (2.0.5)
64
+ spork (1.0.0rc3)
65
+ terminal-table (1.4.5)
66
+ thor (0.17.0)
67
+
68
+ PLATFORMS
69
+ ruby
70
+
71
+ DEPENDENCIES
72
+ cucumber
73
+ guard
74
+ guard-cucumber
75
+ guard-rspec (~> 2.4.0)
76
+ guard-spork
77
+ jeweler
78
+ libnotify
79
+ listen (= 0.6)
80
+ rb-kqueue
81
+ rspec
82
+ soap4r-ruby1.9
83
+ spork (~> 1.0.0.rc)
data/Guardfile ADDED
@@ -0,0 +1,18 @@
1
+ guard 'spork' do
2
+ watch('Gemfile')
3
+ watch('Gemfile.lock')
4
+ watch('spec/spec_helper.rb') { :rspec }
5
+ watch(%r{features/support/}) { :cucumber }
6
+ end
7
+
8
+ guard 'cucumber', cli: '--format progress --no-profile --drb' do
9
+ watch(%r{^features/.+\.feature$})
10
+ watch(%r{^features/support/.+$}) { 'features' }
11
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
12
+ end
13
+
14
+ guard 'rspec', :version => 2, cli: '--drb' do
15
+ watch(%r{^spec/.+_spec\.rb$})
16
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
17
+ watch('spec/spec_helper.rb') { "spec" }
18
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,17 @@
1
+ This product is under Apache 2.0 license
2
+
3
+ Copyright [2013] Shinji Kobayashi, openEHR.jp
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+
17
+
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ ckm_client
2
+ ==========
3
+
4
+ A client module for the openEHR clincal knowledge manager
5
+
6
+ Usage
7
+ ----------
8
+ ckmc <command> <args>
9
+
10
+ Commands supported:
11
+ fetch Retrieve archetype by archetype_id
12
+ search query archetype by keyword
13
+ help show this help
14
+
15
+ License
16
+ ----------
17
+ This product is under Apache 2.0 License
data/Rakefile ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env rake
2
+ # encoding: utf-8
3
+
4
+ require 'rubygems'
5
+ require 'bundler'
6
+ require 'rake'
7
+
8
+ require 'jeweler'
9
+ Jeweler::Tasks.new do |gem|
10
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
11
+ gem.name = "ckm_client"
12
+ gem.homepage = "http://github.com/skoba/ckm_client"
13
+ gem.license = "Apache 2.0"
14
+ gem.summary = %Q{The openEHR CKM command line client}
15
+ gem.description = %Q{A client module for openEHR clinical knowlege manager}
16
+ gem.email = "skoba@moss.gr.jp"
17
+ gem.authors = ["Shinji KOBAYASHI"]
18
+ # dependencies defined in Gemfile
19
+ end
20
+ Jeweler::RubygemsDotOrgTasks.new
21
+
22
+ require 'rspec/core'
23
+ require 'rspec/core/rake_task'
24
+ RSpec::Core::RakeTask.new(:spec) do |spec|
25
+ spec.pattern = FileList['spec/**/*_spec.rb']
26
+ end
27
+
28
+
29
+ require 'cucumber'
30
+ require 'cucumber/rake/task'
31
+
32
+ Cucumber::Rake::Task.new(:features) do |t|
33
+ t.cucumber_opts = "features --format pretty"
34
+ end
35
+
36
+ task :default => [:spec, :features]
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/ckmc ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift(File.expand_path('../../lib', __FILE__))
3
+ require 'openehr/ckm_client'
4
+
5
+ case ARGV.shift
6
+ when 'help'
7
+ puts <<USAGE
8
+ Usage:
9
+ ckmc <command> [<args>]
10
+
11
+ Commands supported:
12
+ fetch Retrieve archetype by archetype_id
13
+ search query archetype by keyword
14
+ help show this help
15
+ USAGE
16
+ when 'fetch'
17
+ puts OpenEHR::CKMClient.new.fetch(ARGV[0])
18
+ when 'search'
19
+ puts 'Not yet implemented'
20
+ end
@@ -0,0 +1,22 @@
1
+ Feature: CKM Client access CKM repository
2
+
3
+ CKM(Clinical Knowledge Manager) is a repository of archetypes, which
4
+ contains established clincal inforomation models maintained by the
5
+ openEHR Project(http://www.openehr.org). This CKM client accesses
6
+ and queries archetype to CKM(http://www.openehr.org/knowledge/) or
7
+ others.
8
+
9
+ Scenario: repository is assigned by constructor
10
+ Given a CKM repository
11
+ When I cunstruct CKM client instance with repository option
12
+ Then CKM repository is assigned
13
+
14
+ Scenario: repository is not assigned
15
+ Given No repository assigned
16
+ When I construct CKM client instance
17
+ Then The openEHR official CKM is assigned as default
18
+
19
+ Scenario: fetch adl file by archetype ID
20
+ Given archetype ID
21
+ When I fetch adl file by archetype ID
22
+ Then ID matched archetype should be retrieved
@@ -0,0 +1,37 @@
1
+ OPENEHR_CKM = 'http://openehr.org/knowledge/services/ArchetypeFinderBean?wsdl'
2
+ Given /^a CKM repository$/ do
3
+ @repository = 'http://www.openehr.org/'
4
+ end
5
+
6
+ When /^I cunstruct CKM client instance with repository option$/ do
7
+ @ckmc = OpenEHR::CKMClient.new(@repository)
8
+ end
9
+
10
+ Then /^CKM repository is assigned$/ do
11
+ @ckmc.repository.should == @repository
12
+ end
13
+
14
+ Given /^No repository assigned$/ do
15
+ end
16
+
17
+ When /^I construct CKM client instance$/ do
18
+ @ckmc = OpenEHR::CKMClient.new
19
+ end
20
+
21
+ Then /^The openEHR official CKM is assigned as default$/ do
22
+ @ckmc.repository.should == OPENEHR_CKM
23
+ end
24
+
25
+ Given /^archetype ID$/ do
26
+ @archetype_id = 'openEHR-EHR-OBSERVATION.blood_pressure.v1'
27
+ end
28
+
29
+ When /^I fetch adl file by archetype ID$/ do
30
+ ckmc = OpenEHR::CKMClient.new
31
+ @adl_file = ckmc.fetch(@archetype_id)
32
+ end
33
+
34
+ Then /^ID matched archetype should be retrieved$/ do
35
+ @adl_file.should match /#{@ardchetype_id}/
36
+ end
37
+
@@ -0,0 +1,19 @@
1
+ require 'rubygems'
2
+ require 'spork'
3
+ #uncomment the following line to use spork with the debugger
4
+ #require 'spork/ext/ruby-debug'
5
+
6
+ Spork.prefork do
7
+ $LOAD_PATH << File.expand_path('../../../lib', __FILE__)
8
+ require 'openehr'
9
+ end
10
+
11
+ Spork.each_run do
12
+
13
+ end
14
+
15
+
16
+
17
+
18
+
19
+
@@ -0,0 +1,25 @@
1
+ require 'soap/wsdlDriver'
2
+ CKM_REPOSITORY = 'http://openehr.org/knowledge/services/ArchetypeFinderBean?wsdl'
3
+ module OpenEHR
4
+ class CKMClient
5
+ attr_reader :repository
6
+
7
+ def initialize(repository=CKM_REPOSITORY)
8
+ @repository = repository
9
+ end
10
+
11
+ def fetch(id)
12
+ SOAPDriver.new(@repository).get_adl_by_id(id)
13
+ end
14
+ end
15
+
16
+ class SOAPDriver
17
+ def initialize(repository)
18
+ @driver = SOAP::WSDLDriverFactory.new(repository).create_rpc_driver
19
+ end
20
+
21
+ def get_adl_by_id(id)
22
+ @driver.getArchetypeInADL(archetypeId: id).m_return
23
+ end
24
+ end
25
+ end
data/lib/openehr.rb ADDED
@@ -0,0 +1,3 @@
1
+ module OpenEHR
2
+ autoload :CKMClient, 'openehr/ckm_client'
3
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ REPOSITORY = 'http://www.openehr.org/'
4
+ OPENEHR_REPOSITORY = 'http://openehr.org/knowledge/services/ArchetypeFinderBean?wsdl'
5
+ ARCHETYPE_ID = 'openEHR-EHR-OBSERVATION.blood_pressure.v1'
6
+
7
+ module OpenEHR
8
+ describe CKMClient do
9
+ describe "#initialize" do
10
+ context 'repository is assigned as constructor parameter' do
11
+ let(:ckmc) { OpenEHR::CKMClient.new(REPOSITORY) }
12
+
13
+ it 'respoistory is REPOSITORY' do
14
+ ckmc.repository.should == REPOSITORY
15
+ end
16
+ end
17
+
18
+ context 'Default repository is openEHR CKM repository' do
19
+ let(:ckmc) { OpenEHR::CKMClient.new }
20
+
21
+ it 'default repository is openEHR ckm repository' do
22
+ ckmc.repository.should == OPENEHR_REPOSITORY
23
+ end
24
+ end
25
+ end
26
+
27
+ describe "#fetch" do
28
+ let(:ckmc) { OpenEHR::CKMClient.new }
29
+
30
+ it 'fetch archetype by id' do
31
+ ckmc.fetch(ARCHETYPE_ID).should match /#{ARCHETYPE_ID}/
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+ require 'spork'
3
+ require 'rspec'
4
+
5
+ Spork.prefork do
6
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
7
+ require 'openehr'
8
+ end
9
+
10
+ Spork.each_run do
11
+
12
+ end
13
+
14
+
15
+
16
+
17
+
metadata ADDED
@@ -0,0 +1,256 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ckm_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Shinji KOBAYASHI
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: soap4r-ruby1.9
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: jeweler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: cucumber
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: guard
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: guard-spork
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: spork
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.0.rc
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 1.0.0.rc
126
+ - !ruby/object:Gem::Dependency
127
+ name: guard-rspec
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 2.4.0
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 2.4.0
142
+ - !ruby/object:Gem::Dependency
143
+ name: guard-cucumber
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: listen
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - '='
164
+ - !ruby/object:Gem::Version
165
+ version: '0.6'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: '0.6'
174
+ - !ruby/object:Gem::Dependency
175
+ name: rb-kqueue
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: libnotify
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ description: A client module for openEHR clinical knowlege manager
207
+ email: skoba@moss.gr.jp
208
+ executables:
209
+ - ckmc
210
+ extensions: []
211
+ extra_rdoc_files:
212
+ - LICENSE.txt
213
+ - README.md
214
+ files:
215
+ - .travis.yml
216
+ - Gemfile
217
+ - Gemfile.lock
218
+ - Guardfile
219
+ - LICENSE.txt
220
+ - README.md
221
+ - Rakefile
222
+ - VERSION
223
+ - bin/ckmc
224
+ - features/ckm_client.feature
225
+ - features/step_definitions/ckm_client_steps.rb
226
+ - features/support/env.rb
227
+ - lib/openehr.rb
228
+ - lib/openehr/ckm_client.rb
229
+ - spec/openehr/ckm_client_spec.rb
230
+ - spec/spec_helper.rb
231
+ homepage: http://github.com/skoba/ckm_client
232
+ licenses:
233
+ - Apache 2.0
234
+ post_install_message:
235
+ rdoc_options: []
236
+ require_paths:
237
+ - lib
238
+ required_ruby_version: !ruby/object:Gem::Requirement
239
+ none: false
240
+ requirements:
241
+ - - ! '>='
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ required_rubygems_version: !ruby/object:Gem::Requirement
245
+ none: false
246
+ requirements:
247
+ - - ! '>='
248
+ - !ruby/object:Gem::Version
249
+ version: '0'
250
+ requirements: []
251
+ rubyforge_project:
252
+ rubygems_version: 1.8.25
253
+ signing_key:
254
+ specification_version: 3
255
+ summary: The openEHR CKM command line client
256
+ test_files: []