ncs_mdes 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+
6
+ spec/doc-base
7
+
8
+ .yardoc
9
+ docs
10
+ *.dot
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm ruby-1.8.7-p334@ncs_mdes
data/.yardopts ADDED
@@ -0,0 +1,5 @@
1
+ --no-private
2
+ --markup markdown
3
+ --hide-void-return
4
+ --files CHANGELOG.md
5
+ --readme README.md
data/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ 0.2.0
2
+ =====
3
+
4
+ - Rename gem to ncs_mdes (from ncs-mdes).
5
+ - Embed the VDR transmission XSD since we now have permission to
6
+ distribute the MDES structure.
7
+ - Update version 2.0 to be based on 2.0.01.02.
8
+
9
+ 0.1.0
10
+ =====
11
+
12
+ - Add mdes-console executable.
13
+
14
+ 0.0.1
15
+ =====
16
+
17
+ - First version. Reads data from VDR transmission schema for MDES 1.2
18
+ and 2.0.
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ # For yard's markdown support
7
+ platforms :jruby do gem 'maruku' end
8
+ platforms :ruby_18, :ruby_19 do gem 'rdiscount' end
9
+ end
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ NCS Navigator MDES Module
2
+ =========================
3
+
4
+ This gem provides a consistent computable interface to the National
5
+ Children's Study Master Data Element Specification. All of the data it
6
+ exposes is derived at runtime from the documents provided by the
7
+ National Children's Study Program Office, which must be available on
8
+ the system where it is running.
9
+
10
+ Use
11
+ ---
12
+
13
+ require 'ncs_navigator/mdes'
14
+ require 'pp'
15
+
16
+ mdes = NcsNavigator::Mdes('1.2')
17
+ pp mdes.transmission_tables.collect(&:name)
18
+
19
+ For more details see the API documentation, starting with {NcsNavigator::Mdes::Specification}.
20
+
21
+ ### Examine
22
+
23
+ This gem includes a console for interactively analyzing and randomly
24
+ poking at the MDES. It is called `mdes-console`:
25
+
26
+ $ mdes-console
27
+ Documents are expected to be in the default location.
28
+ $mdes12 is a Specification for 1.2
29
+ $mdes20 is a Specification for 2.0
30
+ ruby-1.8.7-p334 :001 >
31
+
32
+ It is based on ruby's IRB. Use it to examine the loaded MDES data
33
+ without a lot of edit-save-run cycles:
34
+
35
+ ruby-1.8.7-p334 :001 > $mdes20.transmission_tables.first.name
36
+ => "study_center"
37
+
38
+ E.g., find all the variables of a particular XML schema type:
39
+
40
+ ruby-1.8.7-p334 :002 > $mdes20.transmission_tables.collect { |t| t.variables }.flatten.select { |v| v.type.base_type == :decimal }.collect(&:name)
41
+ => ["correction_factor_temp", "current_temp", "maximum_temp", "minimum_temp", "precision_term_temp", "trh_temp", "salts_moist", "s_33rh_reading", "s_75rh_reading", "s_33rh_reading_calib", "s_75rh_reading_calib", "precision_term_temp", "rf_temp", "correction_factor_temp", "sample_receipt_temp"]
42
+
43
+ Or the labels for a particular code list:
44
+
45
+ ruby-1.8.7-p334 :003 > $mdes20.types.find { |t| t.name == 'confirm_type_cl7' }.code_list.collect(&:label)
46
+ => ["Yes", "No", "Refused", "Don't Know", "Legitimate Skip", "Missing in Error"]
47
+
48
+ Or the number of code lists that include "Yes" as an option:
49
+
50
+ ruby-1.8.7-p334 :004 > $mdes20.types.select { |t| t.code_list && t.code_list.collect(&:label).include?('Yes') }.size
51
+ => 23
52
+
53
+ Develop
54
+ -------
55
+
56
+ ### Writing API docs
57
+
58
+ Run `bundle exec yard server --reload` to get a dynamically-refreshing
59
+ view of the API docs on localhost:8808.
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new do |t|
6
+ t.pattern = "spec/**/*_spec.rb"
7
+ end
data/bin/mdes-console ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ##
4
+ # Provides a IRB session with a NcsNavigator::Mdes::Specification instance
5
+ # for free-form prodding.
6
+
7
+ require 'irb'
8
+ require 'ncs_navigator/mdes'
9
+
10
+ $mdes12 = NcsNavigator::Mdes::Specification.new('1.2')
11
+ $mdes20 = NcsNavigator::Mdes::Specification.new('2.0')
12
+
13
+ expected_loc = ENV[NcsNavigator::Mdes::SourceDocuments::BASE_ENV_VAR] ?
14
+ ENV[NcsNavigator::Mdes::SourceDocuments::BASE_ENV_VAR].inspect :
15
+ 'the default location'
16
+
17
+ puts "Documents are expected to be in #{expected_loc}."
18
+ puts "$mdes12 is a Specification for 1.2"
19
+ puts "$mdes20 is a Specification for 2.0"
20
+
21
+ IRB.start(__FILE__)