diff --git a/.gitignore b/.gitignore
index e773938..acbe4f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,13 @@
.bundle
db/*.sqlite3
-log/*.log
+log/*
tmp/
.sass-cache/
.DS_Store
doc/patient-api
coverage.data
coverage/
+.idea
+util/files/
+Provider_Hash.txt
+nagios-nrpe-support/tmp/
diff --git a/.travis.yml b/.travis.yml
index b7f5d1f..25b5b81 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,11 @@
language: ruby
rvm:
- - 1.9.2
+ - 1.9.3
branches:
only:
- master
- - develop
+services:
+ - mongodb
notifications:
- email:
- recipients:
- - healthcare-ci@googlegroups.com
- on_failure: change
\ No newline at end of file
+ email: false
+script: bundle exec rake test:units test:functionals test:integration
diff --git a/Gemfile b/Gemfile
index b166b93..a014ff3 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
-source 'http://rubygems.org'
-#gem 'java-query-gateway', '0.1', :git =>"http://github.com/rdingwell/java-hquery-executor.git", :platforms => :jruby
-gem 'rails', '~> 3.2.1'
+source 'https://rubygems.org'
+
+gem 'rails'
gem 'jruby-openssl', :platforms => :jruby
group :assets do
gem 'sass-rails'
@@ -11,16 +11,19 @@ end
gem 'daemons'
gem 'jquery-rails'
-gem "mongoid", "~> 2.0"
-gem "bson_ext", "~> 1.3", :platforms => :mri
+gem 'mongoid'
-gem 'delayed_job_mongoid', '~> 1.0.8'
+gem 'delayed_job'
+gem 'delayed_job_mongoid'
-gem "hquery-patient-api", :git => 'http://github.com/hquery/patientapi.git', :tag => 'V0.3'
-gem "health-data-standards", :git => 'http://github.com/projectcypress/health-data-standards.git', :branch => 'develop'
-gem "hqmf2js", :git => 'http://github.com/hquery/hqmf2js.git', :tag => 'V0.3'
+gem 'hquery-patient-api', :git => 'http://github.com/scoophealth/patientapi.git', :branch => 'master'
+#gem 'hquery-patient-api', path: '../patientapi'
+gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'master'
+#gem 'health-data-standards', path: '../health-data-standards'
+#gem "health-data-standards", :git => 'http://github.com/scoophealth/health-data-standards.git', :branch => 'scoop-develop'
+gem "hqmf2js", :git => 'http://github.com/scoophealth/hqmf2js.git', :branch => 'scoop-develop'
#gem 'hqmf2js', path: '../hqmf2js'
-gem 'hqmf-parser', :git => 'https://github.com/hquery/hqmf-parser.git', :tag => 'V0.3'
+gem 'hqmf-parser', :git => 'http://github.com/scoophealth/hqmf-parser.git', :branch => 'scoop-develop'
gem 'coderay'
@@ -30,10 +33,10 @@ gem 'pry'
group :test do
# Pretty printed test output
- gem 'minitest'
+ gem 'minitest', '< 5.0.0'
gem 'turn', :require => false
gem 'cover_me', '>= 1.0.0.rc6', :platforms => :ruby
- gem 'factory_girl', '1.3.3'
+ gem 'factory_girl'
gem 'awesome_print', :require => 'ap'
gem 'mocha', :require => false
gem 'therubyracer', :platforms => :ruby
@@ -41,3 +44,7 @@ group :test do
end
+#group :production do
+# gem 'thin'
+#end
+
diff --git a/Gemfile.lock b/Gemfile.lock
index d551b59..d097852 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,183 +1,187 @@
GIT
- remote: http://github.com/hquery/hqmf2js.git
- revision: cc1936810085fa43542c351e92765677976cfd1f
- tag: V0.3
+ remote: http://github.com/scoophealth/health-data-standards.git
+ revision: 475fcb7cd48c9938e10ff3ffdcb40c59bae7ad6f
+ branch: master
specs:
- hqmf2js (0.1.0)
- coffee-script (~> 2.2.0)
- nokogiri (~> 1.5.2)
- sprockets (~> 2.1.2)
- tilt (~> 1.3.3)
+ health-data-standards (2.1.4)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ mongoid (~> 3.0.6)
+ nokogiri (~> 1.5.5)
+ rest-client (~> 1.6.7)
+ uuid (~> 2.3.5)
GIT
- remote: http://github.com/hquery/patientapi.git
- revision: b81d65013444263b0a6c8db1516b339e73bf1e9a
- tag: V0.3
+ remote: http://github.com/scoophealth/hqmf-parser.git
+ revision: 7255b22df28004a00721209b8a9f3ff708c2028d
+ branch: scoop-develop
specs:
- hquery-patient-api (0.1.0)
+ hqmf-parser (1.1.0)
+ google-spreadsheet-ruby (= 0.1.8)
+ roo (= 1.10.1)
+ rubyzip
+ spreadsheet (= 0.6.8)
GIT
- remote: http://github.com/projectcypress/health-data-standards.git
- revision: 41354a3fb14530ded02f5a35fdefac2aec3fa665
- branch: develop
+ remote: http://github.com/scoophealth/hqmf2js.git
+ revision: cfc4af98da3f516899c9614ecd673d7f23e9e461
+ branch: scoop-develop
specs:
- health-data-standards (1.0.1)
- builder (~> 3.0.0)
- erubis (~> 2.6)
- mongoid (~> 2.4.2)
- nokogiri (>= 1.4.4)
- uuid (~> 2.3.4)
+ hqmf2js (0.1.0)
+ coffee-script (~> 2.2.0)
+ nokogiri (~> 1.5.10)
+ sprockets (~> 2.2.2)
+ tilt (~> 1.4.1)
GIT
- remote: https://github.com/hquery/hqmf-parser.git
- revision: 8cbd14029c76c2c27409366528c59d0c34bddcc4
- tag: V0.3
+ remote: http://github.com/scoophealth/patientapi.git
+ revision: c38c5f72e0ea4801d2e5cb86c20bd04b544cc67a
+ branch: master
specs:
- hqmf-parser (0.0.1)
- google-spreadsheet-ruby (= 0.1.8)
- roo (= 1.10.1)
- rubyzip
- spreadsheet (= 0.6.8)
+ hquery-patient-api (1.0.5)
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
- actionmailer (3.2.2)
- actionpack (= 3.2.2)
- mail (~> 2.4.0)
- actionpack (3.2.2)
- activemodel (= 3.2.2)
- activesupport (= 3.2.2)
+ actionmailer (3.2.13)
+ actionpack (= 3.2.13)
+ mail (~> 2.5.3)
+ actionpack (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- journey (~> 1.0.1)
- rack (~> 1.4.0)
- rack-cache (~> 1.1)
+ journey (~> 1.0.4)
+ rack (~> 1.4.5)
+ rack-cache (~> 1.2)
rack-test (~> 0.6.1)
- sprockets (~> 2.1.2)
- activemodel (3.2.2)
- activesupport (= 3.2.2)
+ sprockets (~> 2.2.1)
+ activemodel (3.2.13)
+ activesupport (= 3.2.13)
builder (~> 3.0.0)
- activerecord (3.2.2)
- activemodel (= 3.2.2)
- activesupport (= 3.2.2)
+ activerecord (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.2)
- activemodel (= 3.2.2)
- activesupport (= 3.2.2)
- activesupport (3.2.2)
- i18n (~> 0.6)
+ activeresource (3.2.13)
+ activemodel (= 3.2.13)
+ activesupport (= 3.2.13)
+ activesupport (3.2.13)
+ i18n (= 0.6.1)
multi_json (~> 1.0)
- ansi (1.4.2)
+ ansi (1.4.3)
arel (3.0.2)
- awesome_print (1.0.2)
- bson (1.6.0)
- bson_ext (1.6.0)
- bson (= 1.6.0)
- builder (3.0.0)
+ awesome_print (1.1.0)
+ builder (3.0.4)
choice (0.1.6)
- coderay (1.0.5)
+ coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.3.3)
- configatron (2.9.0)
+ coffee-script-source (1.6.3)
+ configatron (2.13.0)
yamler (>= 0.1.0)
cover_me (1.2.0)
configatron
hashie
- daemons (1.1.4)
- delayed_job (3.0.1)
+ daemons (1.1.9)
+ delayed_job (3.0.5)
activesupport (~> 3.0)
- delayed_job_mongoid (1.0.8)
- delayed_job (~> 3.0.0)
- mongoid (>= 2.0)
+ delayed_job_mongoid (2.0.0)
+ delayed_job (~> 3.0)
+ mongoid (~> 3.0)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
- factory_girl (1.3.3)
- faraday (0.8.4)
+ factory_girl (4.2.0)
+ activesupport (>= 3.0.0)
+ faraday (0.8.7)
multipart-post (~> 1.1)
google-spreadsheet-ruby (0.1.8)
nokogiri (>= 1.4.3.1)
oauth (>= 0.3.6)
oauth2 (>= 0.5.0)
- hashie (1.2.0)
- hike (1.2.1)
- httpauth (0.1)
- i18n (0.6.0)
+ hashie (2.0.5)
+ hike (1.2.3)
+ httpauth (0.2.0)
+ i18n (0.6.1)
journey (1.0.4)
- jquery-rails (2.1.1)
- railties (>= 3.1.0, < 5.0)
- thor (~> 0.14)
- json (1.7.5)
- jwt (0.1.5)
- multi_json (>= 1.0)
- kramdown (0.13.5)
- libv8 (3.3.10.4)
+ jquery-rails (3.0.2)
+ railties (>= 3.0, < 5.0)
+ thor (>= 0.14, < 2.0)
+ json (1.8.0)
+ jwt (0.1.8)
+ multi_json (>= 1.5)
+ kramdown (1.1.0)
+ libv8 (3.11.8.17)
log4r (1.1.10)
- macaddr (1.6.1)
- systemu (~> 2.5.0)
- mail (2.4.4)
- i18n (>= 0.4.0)
+ macaddr (1.7.1)
+ systemu (~> 2.6.2)
+ mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
- method_source (0.7.0)
- mime-types (1.18)
- minitest (2.11.2)
- mocha (0.10.4)
+ method_source (0.8.1)
+ mime-types (1.23)
+ minitest (4.7.5)
+ mocha (0.14.0)
metaclass (~> 0.0.1)
- mongo (1.6.0)
- bson (= 1.6.0)
- mongoid (2.4.12)
+ mongoid (3.0.23)
activemodel (~> 3.1)
- mongo (<= 1.6.2)
+ moped (~> 1.2)
+ origin (~> 1.0)
tzinfo (~> 0.3.22)
- multi_json (1.3.6)
- multipart-post (1.1.5)
- nokogiri (1.5.5)
- oauth (0.4.6)
- oauth2 (0.8.0)
+ moped (1.5.0)
+ multi_json (1.7.7)
+ multi_xml (0.5.4)
+ multipart-post (1.2.0)
+ nokogiri (1.5.10)
+ oauth (0.4.7)
+ oauth2 (0.9.2)
faraday (~> 0.8)
- httpauth (~> 0.1)
+ httpauth (~> 0.2)
jwt (~> 0.1.4)
multi_json (~> 1.0)
+ multi_xml (~> 0.5)
rack (~> 1.2)
+ origin (1.1.0)
polyglot (0.3.3)
- pry (0.9.8.2)
+ pry (0.9.12.2)
coderay (~> 1.0.5)
- method_source (~> 0.7)
- slop (>= 2.4.4, < 3)
- rack (1.4.1)
+ method_source (~> 0.8)
+ slop (~> 3.4)
+ rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
- rack-ssl (1.3.2)
+ rack-ssl (1.3.3)
rack
- rack-test (0.6.1)
+ rack-test (0.6.2)
rack (>= 1.0)
- rails (3.2.2)
- actionmailer (= 3.2.2)
- actionpack (= 3.2.2)
- activerecord (= 3.2.2)
- activeresource (= 3.2.2)
- activesupport (= 3.2.2)
+ rails (3.2.13)
+ actionmailer (= 3.2.13)
+ actionpack (= 3.2.13)
+ activerecord (= 3.2.13)
+ activeresource (= 3.2.13)
+ activesupport (= 3.2.13)
bundler (~> 1.0)
- railties (= 3.2.2)
- railties (3.2.2)
- actionpack (= 3.2.2)
- activesupport (= 3.2.2)
+ railties (= 3.2.13)
+ railties (3.2.13)
+ actionpack (= 3.2.13)
+ activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
- thor (~> 0.14.6)
- rake (0.9.2.2)
- rdoc (3.12)
+ thor (>= 0.14.6, < 2.0)
+ rake (10.1.0)
+ rdoc (3.12.2)
json (~> 1.4)
+ ref (1.0.5)
+ rest-client (1.6.9)
+ mime-types (~> 1.16)
roo (1.10.1)
choice (>= 0.1.4)
google-spreadsheet-ruby (>= 0.1.5)
@@ -185,37 +189,39 @@ GEM
rubyzip (>= 0.9.4)
spreadsheet (> 0.6.4)
todonotes (>= 0.1.0)
- ruby-ole (1.2.11.4)
+ ruby-ole (1.2.11.7)
rubyzip (0.9.9)
- sass (3.1.15)
- sass-rails (3.2.4)
+ sass (3.2.9)
+ sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
- slop (2.4.4)
+ slop (3.4.5)
spreadsheet (0.6.8)
ruby-ole (>= 1.0)
- sprockets (2.1.3)
+ sprockets (2.2.2)
hike (~> 1.2)
+ multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- systemu (2.5.2)
- therubyracer (0.9.10)
- libv8 (~> 3.3.10)
- thor (0.14.6)
- tilt (1.3.3)
- todonotes (0.1.0)
+ systemu (2.6.5)
+ therubyracer (0.11.4)
+ libv8 (~> 3.11.8.12)
+ ref
+ thor (0.18.1)
+ tilt (1.4.1)
+ todonotes (0.1.1)
log4r
- treetop (1.4.10)
+ treetop (1.4.14)
polyglot
polyglot (>= 0.3.1)
- turn (0.9.3)
+ turn (0.9.6)
ansi
- tzinfo (0.3.33)
- uglifier (1.2.3)
+ tzinfo (0.3.37)
+ uglifier (2.1.1)
execjs (>= 0.3.0)
- multi_json (>= 1.0.2)
- uuid (2.3.5)
+ multi_json (~> 1.0, >= 1.0.2)
+ uuid (2.3.8)
macaddr (~> 1.0)
yamler (0.1.0)
@@ -224,13 +230,13 @@ PLATFORMS
DEPENDENCIES
awesome_print
- bson_ext (~> 1.3)
coderay
coffee-rails
cover_me (>= 1.0.0.rc6)
daemons
- delayed_job_mongoid (~> 1.0.8)
- factory_girl (= 1.3.3)
+ delayed_job
+ delayed_job_mongoid
+ factory_girl
health-data-standards!
hqmf-parser!
hqmf2js!
@@ -238,11 +244,11 @@ DEPENDENCIES
jquery-rails
jruby-openssl
kramdown
- minitest
+ minitest (< 5.0.0)
mocha
- mongoid (~> 2.0)
+ mongoid
pry
- rails (~> 3.2.1)
+ rails
sass-rails
therubyracer
therubyrhino
diff --git a/README b/README
deleted file mode 100644
index 7c36f23..0000000
--- a/README
+++ /dev/null
@@ -1,261 +0,0 @@
-== Welcome to Rails
-
-Rails is a web-application framework that includes everything needed to create
-database-backed web applications according to the Model-View-Control pattern.
-
-This pattern splits the view (also called the presentation) into "dumb"
-templates that are primarily responsible for inserting pre-built data in between
-HTML tags. The model contains the "smart" domain objects (such as Account,
-Product, Person, Post) that holds all the business logic and knows how to
-persist themselves to a database. The controller handles the incoming requests
-(such as Save New Account, Update Product, Show Post) by manipulating the model
-and directing data to the view.
-
-In Rails, the model is handled by what's called an object-relational mapping
-layer entitled Active Record. This layer allows you to present the data from
-database rows as objects and embellish these data objects with business logic
-methods. You can read more about Active Record in
-link:files/vendor/rails/activerecord/README.html.
-
-The controller and view are handled by the Action Pack, which handles both
-layers by its two parts: Action View and Action Controller. These two layers
-are bundled in a single package due to their heavy interdependence. This is
-unlike the relationship between the Active Record and Action Pack that is much
-more separate. Each of these packages can be used independently outside of
-Rails. You can read more about Action Pack in
-link:files/vendor/rails/actionpack/README.html.
-
-
-== Getting Started
-
-1. At the command prompt, create a new Rails application:
- rails new myapp (where myapp is the application name)
-
-2. Change directory to myapp and start the web server:
- cd myapp; rails server (run with --help for options)
-
-3. Go to http://localhost:3000/ and you'll see:
- "Welcome aboard: You're riding Ruby on Rails!"
-
-4. Follow the guidelines to start developing your application. You can find
-the following resources handy:
-
-* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
-* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
-
-
-== Debugging Rails
-
-Sometimes your application goes wrong. Fortunately there are a lot of tools that
-will help you debug it and get it back on the rails.
-
-First area to check is the application log files. Have "tail -f" commands
-running on the server.log and development.log. Rails will automatically display
-debugging and runtime information to these files. Debugging info will also be
-shown in the browser on requests from 127.0.0.1.
-
-You can also log your own messages directly into the log file from your code
-using the Ruby logger class from inside your controllers. Example:
-
- class WeblogController < ActionController::Base
- def destroy
- @weblog = Weblog.find(params[:id])
- @weblog.destroy
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
- end
- end
-
-The result will be a message in your log file along the lines of:
-
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
-
-More information on how to use the logger is at http://www.ruby-doc.org/core/
-
-Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
-several books available online as well:
-
-* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
-* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
-
-These two books will bring you up to speed on the Ruby language and also on
-programming in general.
-
-
-== Debugger
-
-Debugger support is available through the debugger command when you start your
-Mongrel or WEBrick server with --debugger. This means that you can break out of
-execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install ruby-debug to run the server in debugging
-mode. With gems, use sudo gem install ruby-debug. Example:
-
- class WeblogController < ActionController::Base
- def index
- @posts = Post.all
- debugger
- end
- end
-
-So the controller will accept the action, run the first line, then present you
-with a IRB prompt in the server window. Here you can do things like:
-
- >> @posts.inspect
- => "[#nil, "body"=>nil, "id"=>"1"}>,
- #"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
- >> @posts.first.title = "hello from a debugger"
- => "hello from a debugger"
-
-...and even better, you can examine how your runtime objects actually work:
-
- >> f = @posts.first
- => #nil, "body"=>nil, "id"=>"1"}>
- >> f.
- Display all 152 possibilities? (y or n)
-
-Finally, when you're ready to resume execution, you can enter "cont".
-
-
-== Console
-
-The console is a Ruby shell, which allows you to interact with your
-application's domain model. Here you'll have all parts of the application
-configured, just like it is when the application is running. You can inspect
-domain models, change values, and save to the database. Starting the script
-without arguments will launch it in the development environment.
-
-To start the console, run rails console from the application
-directory.
-
-Options:
-
-* Passing the -s, --sandbox argument will rollback any modifications
- made to the database.
-* Passing an environment name as an argument will load the corresponding
- environment. Example: rails console production.
-
-To reload your controllers and models after launching the console run
-reload!
-
-More information about irb can be found at:
-link:http://www.rubycentral.org/pickaxe/irb.html
-
-
-== dbconsole
-
-You can go to the command line of your database directly through rails
-dbconsole. You would be connected to the database with the credentials
-defined in database.yml. Starting the script without arguments will connect you
-to the development database. Passing an argument will connect you to a different
-database, like rails dbconsole production. Currently works for MySQL,
-PostgreSQL and SQLite 3.
-
-== Description of Contents
-
-The default directory structure of a generated Ruby on Rails application:
-
- |-- app
- | |-- assets
- | |-- images
- | |-- javascripts
- | `-- stylesheets
- | |-- controllers
- | |-- helpers
- | |-- mailers
- | |-- models
- | `-- views
- | `-- layouts
- |-- config
- | |-- environments
- | |-- initializers
- | `-- locales
- |-- db
- |-- doc
- |-- lib
- | `-- tasks
- |-- log
- |-- public
- |-- script
- |-- test
- | |-- fixtures
- | |-- functional
- | |-- integration
- | |-- performance
- | `-- unit
- |-- tmp
- | |-- cache
- | |-- pids
- | |-- sessions
- | `-- sockets
- `-- vendor
- |-- assets
- `-- stylesheets
- `-- plugins
-
-app
- Holds all the code that's specific to this particular application.
-
-app/assets
- Contains subdirectories for images, stylesheets, and JavaScript files.
-
-app/controllers
- Holds controllers that should be named like weblogs_controller.rb for
- automated URL mapping. All controllers should descend from
- ApplicationController which itself descends from ActionController::Base.
-
-app/models
- Holds models that should be named like post.rb. Models descend from
- ActiveRecord::Base by default.
-
-app/views
- Holds the template files for the view that should be named like
- weblogs/index.html.erb for the WeblogsController#index action. All views use
- eRuby syntax by default.
-
-app/views/layouts
- Holds the template files for layouts to be used with views. This models the
- common header/footer method of wrapping views. In your views, define a layout
- using the layout :default and create a file named default.html.erb.
- Inside default.html.erb, call <% yield %> to render the view using this
- layout.
-
-app/helpers
- Holds view helpers that should be named like weblogs_helper.rb. These are
- generated for you automatically when using generators for controllers.
- Helpers can be used to wrap functionality for your views into methods.
-
-config
- Configuration files for the Rails environment, the routing map, the database,
- and other dependencies.
-
-db
- Contains the database schema in schema.rb. db/migrate contains all the
- sequence of Migrations for your schema.
-
-doc
- This directory is where your application documentation will be stored when
- generated using rake doc:app
-
-lib
- Application specific libraries. Basically, any kind of custom code that
- doesn't belong under controllers, models, or helpers. This directory is in
- the load path.
-
-public
- The directory available for the web server. Also contains the dispatchers and the
- default HTML files. This should be set as the DOCUMENT_ROOT of your web
- server.
-
-script
- Helper scripts for automation and generation.
-
-test
- Unit and functional tests along with fixtures. When using the rails generate
- command, template test files will be generated for you and placed in this
- directory.
-
-vendor
- External libraries that the application depends on. Also includes the plugins
- subdirectory. If the app has frozen rails, those gems also go here, under
- vendor/rails/. This directory is in the load path.
diff --git a/README.md b/README.md
index 3f7f411..f505a05 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-hQuery
+hQuery [](http://travis-ci.org/scoophealth/query-gateway)
=========
The query gateway is a web based application that provides the back end for executing queries.
@@ -14,15 +14,20 @@ hQuery will also run on Windows, however, there are some minor limitations to fu
Dependencies
------------
-* Ruby = 1.9.2
-* Rails 3.1
+* Ruby = 1.9.3
+* Rails >= 3.1
* MongoDB >= 1.8.1
Install Instructions
--------------------
See the query composer for installation instructions for both the composer and gateway
- http://github.com/hquery
+ [https://github.com/scoophealth](https://github.com/scoophealth)
+
+Quick Start
+-----------
+
+Assuming the ruby environment has already been set up, you can use the runme.sh file to start a normal gateway server instance, and the secrunme.sh file to start a secure gateway server instance.
License
-------
@@ -44,4 +49,4 @@ limitations under the License.
Project Practices
-----------------
-Please try to follow our [Coding Style Guides](http://github.com/eedrummer/styleguide). Additionally, we will be using git in a pattern similar to [Vincent Driessen's workflow](http://nvie.com/posts/a-successful-git-branching-model/). While feature branches are encouraged, they are not required to work on the project.
\ No newline at end of file
+Please try to follow our [Coding Style Guides](http://github.com/eedrummer/styleguide). Additionally, we will be using git in a pattern similar to [Vincent Driessen's workflow](http://nvie.com/posts/a-successful-git-branching-model/). While feature branches are encouraged, they are not required to work on the project.
diff --git a/README.rdoc b/README.rdoc
index 05d537d..0a09c3c 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -13,10 +13,10 @@ hQuery will also run on Windows, however, there are some minor limitations to fu
= Dependencies
-* Ruby = 1.9.2
-* Rails 3.1
-* MongoDB >= 1.8.1
+* Ruby = 1.9.3
+* Rails >= 3.1
+* MongoDB >= 1.8.1+
= End-to-end Install Instructions
See the query composer for installation instructions for both the composer and gateway
- http://github
\ No newline at end of file
+ http://github
diff --git a/README.scoop b/README.scoop
new file mode 100644
index 0000000..63ffb01
--- /dev/null
+++ b/README.scoop
@@ -0,0 +1,20 @@
+Get the source code for the gateway. Do this with the following:
+
+cd ~
+
+git clone -b scoop-develop git://github.com/scoophealth/query-gateway.git
+
+Afterwards, go into the new directory, install, seed, and start the server.
+
+cd query-gateway
+
+bundle install
+
+bundle exec rake db:seed
+
+mkdir -p tmp/pids
+
+The following commands starts the server on port 3001.
+
+bundle exec script/delayed_job start
+bundle exec rails server -p 3001
diff --git a/README.scoop-test b/README.scoop-test
new file mode 100644
index 0000000..fe23164
--- /dev/null
+++ b/README.scoop-test
@@ -0,0 +1,17 @@
+To run the unit, functional and integration tests, from the root directory
+of the repository execute
+
+ rake test
+
+When changes are made to the E2E export documents requiring modifications
+of the health-data-standards E2E importer code, or the health-data-standards
+E2E importer code is changed for any other reason, the records stored in
+mongod are likely to change. When this happens, the file
+test/fixtures/scoop-records.json will need to be updated.
+
+Use util/relay-service.rb to load the updated test patient records into
+the mongod. Then export these mongod test patient records using:
+
+mongoexport -d query_gateway_development -c records > /tmp/scoop-records.json
+
+Use the export to update ./test/fixtures/scoop-records.json
diff --git a/app/assets/javascripts/sysinfo.js.coffee b/app/assets/javascripts/sysinfo.js.coffee
new file mode 100644
index 0000000..7615679
--- /dev/null
+++ b/app/assets/javascripts/sysinfo.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/app/assets/stylesheets/sysinfo.css.scss b/app/assets/stylesheets/sysinfo.css.scss
new file mode 100644
index 0000000..2fa38c3
--- /dev/null
+++ b/app/assets/stylesheets/sysinfo.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the sysinfo controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb
index cda91a5..372cfba 100644
--- a/app/controllers/queries_controller.rb
+++ b/app/controllers/queries_controller.rb
@@ -1,6 +1,7 @@
class QueriesController < ApplicationController
def index
if stale?(:last_modified => Query.last_query_update.utc)
+ Query.create_indexes # ensures the indexes are created, does nothing if they already exist
@queries = Query.desc(:updated_at)
respond_to do |format|
format.atom
@@ -48,7 +49,7 @@ def show
if stale?(:last_modified => @query.updated_at.utc)
@qh = @query.attributes
@qh.delete('delayed_job_id')
- if @query.status == :complete
+ if @query.status == :complete and @query.result != nil
@qh['result_url'] = result_url(@query.result)
end
respond_to do |format|
diff --git a/app/controllers/records_controller.rb b/app/controllers/records_controller.rb
index 85054c3..2496e44 100644
--- a/app/controllers/records_controller.rb
+++ b/app/controllers/records_controller.rb
@@ -2,13 +2,80 @@ class RecordsController < ApplicationController
def create
xml_file = params[:content].read
doc = Nokogiri::XML(xml_file)
- doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
- pi = HealthDataStandards::Import::C32::PatientImporter.instance
- patient = pi.parse_c32(doc)
-
- patient.save!
-
- render :text => 'Patient imported', :status => 201
+ root_element_name = doc.root.name
+ if root_element_name == 'ClinicalDocument'
+ doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
+ #document_type = doc.at_xpath('/cda:ClinicalDocument/cda:templateId')['root']
+ document_type = doc.at_xpath('/cda:ClinicalDocument/cda:realmCode')['code']
+ # check the specific flavour of cda
+ # E2E
+ if document_type == 'CA-BC' || document_type == 'CA'
+ pi = HealthDataStandards::Import::E2E::PatientImporter.instance
+ patient = pi.parse_e2e(doc)
+ # By specifying the _id field we create a new document when a record
+ # with that _id field doesn't already exist in the collection. If
+ # a record with the same _id field already exists, it is updated
+ # with the new document. For details see
+ # http://docs.mongodb.org/manual/reference/method/db.collection.save/
+ patient_id = OpenSSL::Digest::SHA224.new
+ hin_id = OpenSSL::Digest::SHA224.new
+ first_id = OpenSSL::Digest::SHA224.new
+ last_id = OpenSSL::Digest::SHA224.new
+ if !patient.medical_record_number.nil? && !patient.medical_record_number.empty?
+ patient_id << patient.medical_record_number.upcase
+ #patient.medical_record_number = "" # remove HIN
+ hin_id << patient.medical_record_number.upcase
+ patient.medical_record_number = Base64.strict_encode64(hin_id.digest)
+ end
+ if !patient.first.nil? && !patient.first.empty?
+ patient_id << patient.first.upcase
+ #patient.first = "" # remove first name
+ first_id << patient.first.upcase
+ patient.first = Base64.strict_encode64(first_id.digest)
+ end
+ if !patient.last.nil? && !patient.last.empty?
+ patient_id << patient.last.upcase
+ #patient.last = "" # remove last name
+ last_id << patient.last.upcase
+ patient.last = Base64.strict_encode64(last_id.digest)
+ end
+ if !patient.birthdate.nil? && !patient.birthdate.to_s.empty?
+ patient_id << patient.birthdate.to_s
+ end
+ if !patient.gender.nil? && !patient.gender.empty?
+ patient_id << patient.gender.upcase
+ end
+ patient[:hash_id] = Base64.strict_encode64(patient_id.digest)
+ # Use EMR instance demographic table primary key as unique _id in patient records collection
+ emr_demographics_key = patient.emr_demographics_primary_key
+ if emr_demographics_key
+ patient[:_id] = emr_demographics_key
+ else
+ patient[:_id] = patient[:hash_id]
+ end
+ ### Example of how to capture E2E document for debugging purposes
+ ### if patient[:_id] == '149'
+ ### File.open("#{Rails.root}/log/149.xml", 'wb') { |file| file.write(xml_file) }
+ ### end
+ # patient.save! isn't working as documented, don't know why
+ # appears that it should but upsert does what we need. See
+ # http://mongoid.org/en/mongoid/docs/persistence.html
+ patient.upsert
+ render :text => 'E2E Document imported', :status => 201
+ # C32
+ else
+ pi = HealthDataStandards::Import::C32::PatientImporter.instance
+ patient = pi.parse_c32(doc)
+ patient.save!
+ render :text => 'C32 Patient imported', :status => 201
+ end
+ else
+ render :text => 'Unknown XML Format', :status => 400
+ end
end
+ def destroy
+ Record.delete_all
+ render :text => 'All patients were deleted', :status => 200
+ end
end
diff --git a/app/controllers/sysinfo_controller.rb b/app/controllers/sysinfo_controller.rb
new file mode 100644
index 0000000..7c465da
--- /dev/null
+++ b/app/controllers/sysinfo_controller.rb
@@ -0,0 +1,56 @@
+class SysinfoController < ApplicationController
+
+ if defined?(Rails.root)
+ NAGIOS_PLUGINS = "#{Rails.root}/nagios-plugins"
+ else
+ NAGIOS_PLUGINS = File.dirname(__FILE__)+'/../../nagios-plugins'
+ end
+
+ def load
+ textstr = `#{NAGIOS_PLUGINS}/check_load --warning='5.0,4.0,3.0' --critical='10.0,6.0,4.0'`
+ textstr += 'Status Code: ' + $?.exitstatus.to_s + "\n"
+ render :text => textstr, :status =>201
+ end
+
+ def users
+ textstr = `#{NAGIOS_PLUGINS}/check_users -w '5' -c '10'`
+ textstr += 'Status Code: ' + $?.exitstatus.to_s + "\n"
+ render :text => textstr, :status =>201
+ end
+
+ def diskspace
+ textstr = `#{NAGIOS_PLUGINS}/check_disk -w '20%' -c '10%' -e`
+ textstr += 'Status Code: ' + $?.exitstatus.to_s + "\n"
+ render :text => textstr, :status =>201
+ end
+
+ def mongo
+ # do nothing
+ end
+
+ def processes
+ textstr = `#{NAGIOS_PLUGINS}/check_procs -w '250' -c '400'`
+ textstr += 'Status Code: ' + $?.exitstatus.to_s + "\n"
+ render :text => textstr, :status =>201
+ end
+
+ def swap
+ textstr = `#{NAGIOS_PLUGINS}/check_swap -w '95%' -c '90%'`
+ textstr += 'Status Code: ' + $?.exitstatus.to_s + "\n"
+ render :text => textstr, :status =>201
+ end
+
+
+ def import
+ textstr = `#{NAGIOS_PLUGINS}/check_import.sh`
+ textstr += 'Status Code: ' + $?.exitstatus.to_s + "\n"
+ render :text => textstr, :status =>201
+ end
+
+ def tomcat
+ textstr = `#{NAGIOS_PLUGINS}/check_procs -w 1:1 -c 1:1 -u tomcat6 -a tomcat6`
+ textstr += 'Status Code: ' + $?.exitstatus.to_s + "\n"
+ render :text => textstr, :status =>201
+ end
+
+end
diff --git a/app/helpers/sysinfo_helper.rb b/app/helpers/sysinfo_helper.rb
new file mode 100644
index 0000000..c054b55
--- /dev/null
+++ b/app/helpers/sysinfo_helper.rb
@@ -0,0 +1,2 @@
+module SysinfoHelper
+end
diff --git a/app/models/.gitkeep b/app/models/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/app/models/query.rb b/app/models/query.rb
index 63b5585..4d624bf 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -18,6 +18,8 @@ class Query
validates_presence_of :map
validates_presence_of :reduce
+
+ index({ updated_at: -1})
def status_change(new_status, message)
self.status = new_status
diff --git a/app/views/sysinfo/currentload.html.erb b/app/views/sysinfo/currentload.html.erb
new file mode 100644
index 0000000..61d0ae2
--- /dev/null
+++ b/app/views/sysinfo/currentload.html.erb
@@ -0,0 +1,2 @@
+
Sysinfo#currentload
+
Find me in app/views/sysinfo/currentload.html.erb
diff --git a/app/views/sysinfo/currentusers.html.erb b/app/views/sysinfo/currentusers.html.erb
new file mode 100644
index 0000000..8f864f5
--- /dev/null
+++ b/app/views/sysinfo/currentusers.html.erb
@@ -0,0 +1,2 @@
+
Sysinfo#currentusers
+
Find me in app/views/sysinfo/currentusers.html.erb
diff --git a/app/views/sysinfo/diskspace.html.erb b/app/views/sysinfo/diskspace.html.erb
new file mode 100644
index 0000000..4d3f59f
--- /dev/null
+++ b/app/views/sysinfo/diskspace.html.erb
@@ -0,0 +1,2 @@
+
Sysinfo#diskspace
+
Find me in app/views/sysinfo/diskspace.html.erb
diff --git a/app/views/sysinfo/mongo.html.erb b/app/views/sysinfo/mongo.html.erb
new file mode 100644
index 0000000..5a584dd
--- /dev/null
+++ b/app/views/sysinfo/mongo.html.erb
@@ -0,0 +1,2 @@
+
Sysinfo#mongo
+
Find me in app/views/sysinfo/mongo.html.erb
diff --git a/app/views/sysinfo/swap.html.erb b/app/views/sysinfo/swap.html.erb
new file mode 100644
index 0000000..2459daa
--- /dev/null
+++ b/app/views/sysinfo/swap.html.erb
@@ -0,0 +1,2 @@
+
Sysinfo#swap
+
Find me in app/views/sysinfo/swap.html.erb
diff --git a/app/views/sysinfo/totalprocesses.html.erb b/app/views/sysinfo/totalprocesses.html.erb
new file mode 100644
index 0000000..6ac7ba3
--- /dev/null
+++ b/app/views/sysinfo/totalprocesses.html.erb
@@ -0,0 +1,2 @@
+
Sysinfo#totalprocesses
+
Find me in app/views/sysinfo/totalprocesses.html.erb
diff --git a/cert/README b/cert/README
new file mode 100644
index 0000000..8e739d4
--- /dev/null
+++ b/cert/README
@@ -0,0 +1,53 @@
+# Change into the query-gateway root directory. Make a cert subdirectory.
+cd $HOME/query-gateway && mkdir cert && cd cert
+#
+# Generate a self-signed certificate. You need to answer some questions.
+# Most of them can be answered arbitrarily but it is important that the
+# Common Name be accurate. For development and test purposes you can
+# use something like *.localdomain to cover all hosts in localdomain.
+# I used:
+# Country Name (2 letter code) [GB]:CA
+# State or Province Name (full name): British Columbia
+# Locality Name (eg, city): Victoria
+# Organization Name (eg, company): University of Victoria
+# Organizational Unit Name (eg, section): Island Medical Program
+# Common Name (eg, your name or your server's hostname): *.localdomain
+# Email Address: scoophealth@googlegroups.com
+#
+# This will generate the certificate and key in a file named server.pem:
+openssl req -new -x509 -keyout server.pem -out server.pem -nodes -days 365
+#
+# Copy the self-signed certificate to query-gateway/cert/ca
+# [The location and name can be changed but must match
+# the entries in query-gateway/script/secure_rails.]
+mkdir ca && cp server.pem ca/LeadLab_root_cert_TEST.pem && rm server.pem
+#
+# Note: We used *.localdomain for the "Common Name" when prompted
+# for that information. For this to work, you will need an /etc/hosts
+# file that maps IP addresses to entries in the localdomain. For instance,
+# $ cat /etc/hosts
+# 127.0.0.1 localhost localhost.localdomain
+# 127.0.1.1 query-gateway query-gateway.localdomain
+# 192.168.52.100 mysql-host mysql-host.localdomain
+# 192.168.52.101 query-gateway0 query-gateway0.localdomain
+# 192.168.52.102 query-composer query-composer.localdomain
+# 192.168.52.103 query-gateway1 query-gateway1.localdomain
+#
+# Now find the hash of the self-signed certificate
+# $ openssl x509 -hash -noout -in ../cert/ca/LeadLab_root_cert_TEST.pem
+#
+# 962a3564
+#
+# Create a symbolic link from the self-signed certicate to a file in
+# /etc/ssl/certs with name matching the hash with suffix '.0'.
+#
+# /etc/ssl/certs/962a3564.0 ->/home/vagrant/query-gateway/cert/ca/LeadLab_root_cert_TEST.pem
+#
+# For this particular self-signed certificate's hash, I did this:
+# $ sudo ln -s /home/vagrant/query-gateway/cert/ca/LeadLab_root_cert_TEST.pem /etc/ssl/certs/962a3564.0
+#
+# To start up the SSL secured version of query-gateway on port 3222 use:
+# $ bundle exec script/delayed_job start
+# $ bundle exec ruby script/secure_rails server -p 3222
+# To start the non-SSL secured version on port 3001 use:
+# $ bundle exec rails server -p 3001
diff --git a/cert/ca/LeadLab_root_cert_TEST.pem b/cert/ca/LeadLab_root_cert_TEST.pem
new file mode 100644
index 0000000..5af6e59
--- /dev/null
+++ b/cert/ca/LeadLab_root_cert_TEST.pem
@@ -0,0 +1,36 @@
+-----BEGIN PRIVATE KEY-----
+MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBANEKAbCsoweaNzb1
+An3rPTlF/8lypAz6zReIML6dBrquO/R1fHYrs1qdQCOf8rY3mFU+FCloSFIITiF+
+NeqsVzGAFwRbT2HIwCiWMepLvjumLxCPSfUZiz+yhgXjNnNLu4m+YzDlFJCmMDV+
+m0Q0ViKFyPzPINGVI0xtPFTKX1fpAgMBAAECgYBsdQepdfjkUeRB9F9Fm87ZL3Nm
+Pr/VKC9O/U9lJq2+H/ZlgKuB2GynIB2OHkfcuP2lhJ8LWNrlDQAUqpoo1yApUydz
+u98QLFw7+7V5B8igC+mxjImc9XGdWtB+/sAQk3aQuEMLskmpvZHkCgzIWylvRvmb
+ATBFvethNnqRC5PrgQJBAPZvYoDub4nm9Lyb+7Pc8ZSKmmltngbYEFXhrld21WIn
+wL95ZeiJqyleZxsXth86fSWd+Fgv8KmYYrw7DMjIibkCQQDZJwyy1tibX6nTaou5
+TYBVAvlTuYA5iVOh1Q/a9T/Ko/4/dX8lm/Lm7MrMRxqIGok1IIexNhsfloN/TUew
+XJexAkArozupIw+jNr99qo1eozAwIn8HTj7ebWIvIwBxQny0nd92yHNwQviJIctW
+M9OvIfdJMvjn/M076t0JAdfYshIZAkA4wy9blDN8sc3nmKM7ZdnU3vkjfIra/12g
+INyLJK5vHtz345O/1frxiBYevbtetmkFPSKbHQSMBkELRr0liZ6RAkBzhur1fRhr
+RjJR38o684Z4Sx0iflyWFVe/08EVXBqCaj6Bb9/unQmYC+dWhmJqAOUS/FiaEmvC
+EaE6hG7QkARE
+-----END PRIVATE KEY-----
+-----BEGIN CERTIFICATE-----
+MIIDVDCCAr2gAwIBAgIJAOWAnoqQBfNbMA0GCSqGSIb3DQEBBQUAMIHCMQswCQYD
+VQQGEwJDQTEZMBcGA1UECAwQQnJpdGlzaCBDb2x1bWJpYTERMA8GA1UEBwwIVmlj
+dG9yaWExHzAdBgNVBAoMFlVuaXZlcnNpdHkgb2YgVmljdG9yaWExHzAdBgNVBAsM
+FklzbGFuZCBNZWRpY2FsIFByb2dyYW0xFjAUBgNVBAMMDSoubG9jYWxkb21haW4x
+KzApBgkqhkiG9w0BCQEWHHNjb29waGVhbHRoQGdvb2dsZWdyb3Vwcy5jb20wHhcN
+MTMwODI4MjAwMjEwWhcNMTQwODI4MjAwMjEwWjCBwjELMAkGA1UEBhMCQ0ExGTAX
+BgNVBAgMEEJyaXRpc2ggQ29sdW1iaWExETAPBgNVBAcMCFZpY3RvcmlhMR8wHQYD
+VQQKDBZVbml2ZXJzaXR5IG9mIFZpY3RvcmlhMR8wHQYDVQQLDBZJc2xhbmQgTWVk
+aWNhbCBQcm9ncmFtMRYwFAYDVQQDDA0qLmxvY2FsZG9tYWluMSswKQYJKoZIhvcN
+AQkBFhxzY29vcGhlYWx0aEBnb29nbGVncm91cHMuY29tMIGfMA0GCSqGSIb3DQEB
+AQUAA4GNADCBiQKBgQDRCgGwrKMHmjc29QJ96z05Rf/JcqQM+s0XiDC+nQa6rjv0
+dXx2K7NanUAjn/K2N5hVPhQpaEhSCE4hfjXqrFcxgBcEW09hyMAoljHqS747pi8Q
+j0n1GYs/soYF4zZzS7uJvmMw5RSQpjA1fptENFYihcj8zyDRlSNMbTxUyl9X6QID
+AQABo1AwTjAdBgNVHQ4EFgQUltQ6g39ZWulvvY/kTFqqQnJGXY0wHwYDVR0jBBgw
+FoAUltQ6g39ZWulvvY/kTFqqQnJGXY0wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B
+AQUFAAOBgQB6V+HzYlW9qgu/xliFIu1EjJmLGOtBf4aRkdg6gSaxDB84SggoKKG0
+YzrTuYN9vv70zqGTDc76FKQSjuSugnmn6eCKkTi9/9Xvc0ZMdT3Hr3KQfgseTEpA
+URHghVEJCn1s1OmW8Eb/I99FbhN6L8sibl9eWBSUZffTKiIJY3JX0g==
+-----END CERTIFICATE-----
diff --git a/cert/old_notes/README.cert b/cert/old_notes/README.cert
new file mode 100644
index 0000000..d746a73
--- /dev/null
+++ b/cert/old_notes/README.cert
@@ -0,0 +1,16 @@
+mkdir ca
+# Generate 4096-bit long RSA key for our root CA
+openssl genrsa -out ca/LeadLab_root_cert_TEST.pem 4096
+# Create a self-signed root CA certificate
+openssl req -new -x509 -days 1826 -key ca/LeadLab_root_cert_TEST.pem -out ca/LeadLab_root_cert_TEST.crt
+# Create a subordinate CA used for actual signing
+openssl genrsa -out endpoint.key 4096
+# Request a certificate for this subordinate CA
+openssl req -new -key endpoint.key -out endpoint.csr
+# Process request for the subordinate CA and get it signed by the root CA
+openssl x509 -req -days 730 -in endpoint.csr -CA ca/LeadLab_root_cert_TEST.crt -CAkey ca/LeadLab_root_cert_TEST.pem -set_serial 5342365815382548354816354178354175 -out endpoint.crt
+# Make client credentials
+#openssl genrsa -out client.key 4096
+#openssl req -new -key client.key -out client.csr
+#openssl x509 -req -days 730 -in client.csr -CA ca/LeadLab_root_cert_TEST.crt -CAkey ca/LeadLab_root_cert_TEST.pem -set_serial 5342365815382548354816354178354177 -out client.crt
+
diff --git a/cert/old_notes/endpoint-cert b/cert/old_notes/endpoint-cert
new file mode 100755
index 0000000..00f9f15
--- /dev/null
+++ b/cert/old_notes/endpoint-cert
@@ -0,0 +1,7 @@
+rm ./endpoint.crt
+rm ./endpoint.csr
+rm ./endpoint.key
+openssl genrsa -out endpoint.key 4096
+openssl req -new -key endpoint.key -out endpoint.csr
+openssl x509 -req -days 300 -in endpoint.csr -CA ca/LeadLab_root_cert_TEST.pem -CAkey ca/LeadLab_root_cert_TEST.key -set_serial 4167245126451912541925481541687546 -out endpoint.crt
+
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 2c7c6f2..15b00cd 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -9,6 +9,8 @@
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
+ config.log_level = :info #:debug
+
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
diff --git a/config/mongoid.yml b/config/mongoid.yml
index 23b4d0d..495e56c 100644
--- a/config/mongoid.yml
+++ b/config/mongoid.yml
@@ -1,20 +1,87 @@
+production:
+ sessions:
+ default:
+ database: query_gateway_production
+ hosts:
+ - localhost:27017
+
development:
- host: localhost
- database: query_gateway_development
+ # Configure available database sessions. (required)
+ sessions:
+ # Defines the default session. (required)
+ default:
+ # Defines the name of the default database that Mongoid can connect to.
+ # (required).
+ database: query_gateway_development
+ # Provides the hosts the default session can connect to. Must be an array
+ # of host:port pairs. (required)
+ hosts:
+ - localhost:27017
+ options:
+ # Change whether the session persists in safe mode by default.
+ # (default: false)
+ # safe: false
-test:
- host: <%= ENV['TEST_DB_HOST'] || 'localhost' %>
- database: query_gateway_test
+ # Change the default consistency model to :eventual or :strong.
+ # :eventual will send reads to secondaries, :strong sends everything
+ # to master. (default: :eventual)
+ # consistency: :eventual
-# set these environment variables on your prod server
-production:
- host: <%= ENV['MONGOID_HOST'] %>
- port: <%= ENV['MONGOID_PORT'] %>
- username: <%= ENV['MONGOID_USERNAME'] %>
- password: <%= ENV['MONGOID_PASSWORD'] %>
- database: <%= ENV['MONGOID_DATABASE'] %>
- # slaves:
- # - host: slave1.local
- # port: 27018
- # - host: slave2.local
- # port: 27019
+ # How many times Moped should attempt to retry an operation after
+ # failure. (default: 30)
+ # max_retries: 30
+
+ # The time in seconds that Moped should wait before retrying an
+ # operation on failure. (default: 1)
+ # retry_interval: 1
+ # Configure Mongoid specific options. (optional)
+ options:
+ # Configuration for whether or not to allow access to fields that do
+ # not have a field definition on the model. (default: true)
+ # allow_dynamic_fields: true
+
+ # Enable the identity map, needed for eager loading. (default: false)
+ # identity_map_enabled: false
+
+ # Includes the root model name in json serialization. (default: false)
+ # include_root_in_json: false
+
+ # Include the _type field in serializaion. (default: false)
+ # include_type_for_serialization: false
+
+ # Preload all models in development, needed when models use
+ # inheritance. (default: false)
+ # preload_models: false
+
+ # Protect id and type from mass assignment. (default: true)
+ # protect_sensitive_fields: true
+
+ # Raise an error when performing a #find and the document is not found.
+ # (default: true)
+ # raise_not_found_error: true
+
+ # Raise an error when defining a scope with the same name as an
+ # existing method. (default: false)
+ # scope_overwrite_exception: false
+
+ # Skip the database version check, used when connecting to a db without
+ # admin access. (default: false)
+ # skip_version_check: false
+
+ # User Active Support's time zone in conversions. (default: true)
+ # use_activesupport_time_zone: true
+
+ # Ensure all times are UTC in the app side. (default: false)
+ # use_utc: false
+test:
+ sessions:
+ default:
+ database: query_gateway_test
+ hosts:
+ - localhost:27017
+ options:
+ consistency: :strong
+ # In the test environment we lower the retries and retry interval to
+ # low amounts for fast failures.
+ max_retries: 1
+ retry_interval: 0
diff --git a/config/mongoid.yml.old b/config/mongoid.yml.old
new file mode 100644
index 0000000..be2631f
--- /dev/null
+++ b/config/mongoid.yml.old
@@ -0,0 +1,22 @@
+# Old config for Mongoid 2.x
+development:
+ host: localhost
+ database: query_gateway_development
+
+test:
+ host: <%= ENV['TEST_DB_HOST'] || 'localhost' %>
+ database: query_gateway_test
+
+# set these environment variables on your prod server
+production:
+ uri: <%= ENV['MONGOHQ_URL'] %>
+ #host: <%= ENV['MONGOID_HOST'] %>
+ #port: <%= ENV['MONGOID_PORT'] %>
+ #username: <%= ENV['MONGOID_USERNAME'] %>
+ #password: <%= ENV['MONGOID_PASSWORD'] %>
+ #database: <%= ENV['MONGOID_DATABASE'] %>
+ # slaves:
+ # - host: slave1.local
+ # port: 27018
+ # - host: slave2.local
+ # port: 27019
diff --git a/config/routes.rb b/config/routes.rb
index 887aac1..821c6d0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,25 +1,36 @@
QueryGateway::Application.routes.draw do
+ get 'sysinfo/load', :constraints => {:ip => /127.0.0.1/}
+ get 'sysinfo/users', :constraints => {:ip => /127.0.0.1/}
+ get 'sysinfo/diskspace', :constraints => {:ip => /127.0.0.1/}
+ get 'sysinfo/mongo', :constraints => {:ip => /127.0.0.1/}
+ get 'sysinfo/processes', :constraints => {:ip => /127.0.0.1/}
+ get 'sysinfo/swap', :constraints => {:ip => /127.0.0.1/}
+ get 'sysinfo/import', :constraints => {:ip => /127.0.0.1/}
+ get 'sysinfo/tomcat', :constraints => {:ip => /127.0.0.1/}
+
resources :results, :only => [:index, :show]
resources :queries
- post 'queries/upload_hqmf'
+ post 'queries/upload_hqmf', :constraints => {:ip => /127.0.0.1/}
- post 'pmn/create' # not sure why this required given the following line but tests break without it
- post 'pmn/PostRequest/:pmn_request_id', :to => 'pmn#create'
- post 'pmn/PostRequestDocument/:id/:doc_id/:offset', :to => 'pmn#add'
- put 'pmn/Start/:id', :to => 'pmn#start'
- post 'pmn/Stop/:id', :to => 'pmn#stop'
- get 'pmn/GetStatus/:id', :to => 'pmn#status'
- get 'pmn/GetResponse/:id', :to => 'pmn#get_response'
- get 'pmn/GetResponseDocument/:id/:doc_id/:offset', :to => 'pmn#doc'
- get 'pmn/Close/:id', :to => 'pmn#close'
+ post 'pmn/create', :constraints => {:ip => /127.0.0.1/} # not sure why this required given the following line but tests break without it
+ post 'pmn/PostRequest/:pmn_request_id', :to => 'pmn#create', :constraints => {:ip => /127.0.0.1/}
+ post 'pmn/PostRequestDocument/:id/:doc_id/:offset', :to => 'pmn#add', :constraints => {:ip => /127.0.0.1/}
+ put 'pmn/Start/:id', :to => 'pmn#start', :constraints => {:ip => /127.0.0.1/}
+ post 'pmn/Stop/:id', :to => 'pmn#stop', :constraints => {:ip => /127.0.0.1/}
+ get 'pmn/GetStatus/:id', :to => 'pmn#status', :constraints => {:ip => /127.0.0.1/}
+ get 'pmn/GetResponse/:id', :to => 'pmn#get_response', :constraints => {:ip => /127.0.0.1/}
+ get 'pmn/GetResponseDocument/:id/:doc_id/:offset', :to => 'pmn#doc', :constraints => {:ip => /127.0.0.1/}
+ get 'pmn/Close/:id', :to => 'pmn#close', :constraints => {:ip => /127.0.0.1/}
- get 'hdata/index'
- get 'hdata/root'
+ get 'hdata/index', :constraints => {:ip => /127.0.0.1/}
+ get 'hdata/root', :constraints => {:ip => /127.0.0.1/}
- post 'records/create'
- post 'library_functions', :to => "library_functions#create"
+ post 'records/create', :constraints => {:ip => /127.0.0.1/}
+ delete 'records/destroy', :constraints => {:ip => /127.0.0.1/}
+
+ post 'library_functions', :to => "library_functions#create", :constraints => {:ip => /127.0.0.1/}
root :to => 'queries#index'
diff --git a/db/seeds.rb b/db/seeds.rb
index 95e724c..1b592d2 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -5,4 +5,7 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
-`mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/records.json`
\ No newline at end of file
+#`mongoimport -d #{Mongoid.master.name} -h #{Mongoid.master.connection.host_to_try[0]} --drop -c records test/fixtures/records.json`
+
+#puts "#{Mongoid.default_session.inspect}"
+`mongoimport -d #{Mongoid.default_session.options[:database]} --drop --collection records --file test/fixtures/records.json`
\ No newline at end of file
diff --git a/doc_arch/endpoint_controllers.png b/doc_arch/endpoint_controllers.png
new file mode 100644
index 0000000..2d1886c
Binary files /dev/null and b/doc_arch/endpoint_controllers.png differ
diff --git a/doc_arch/endpoint_full_models.dot b/doc_arch/endpoint_full_models.dot
new file mode 100644
index 0000000..e4d55ee
--- /dev/null
+++ b/doc_arch/endpoint_full_models.dot
@@ -0,0 +1,9 @@
+digraph models_diagram {
+ graph[overlap=false, splines=true]
+ "Query" [shape=Mrecord, label="{Query|_id :Moped::BSON::ObjectId\l_type :String\lcreated_at :Time\ldelayed_job_id :Object\lerror_message :String\lfilter :Hash\lformat :String\lfunctions :String\lmap :String\lreduce :String\lrequest_id :Object\lstatus :Symbol\lupdated_at :Time\l}"]
+ "Result" [shape=Mrecord, label="{Result|_id :Moped::BSON::ObjectId\l_type :String\lcreated_at :Time\lquery_id :Object\l}"]
+ "JobLog" [shape=Mrecord, label="{JobLog|_id :Moped::BSON::ObjectId\l_type :String\lcreated_at :Time\lmessage :String\l}"]
+ "Query" -> "JobLog" [arrowtail=odot, arrowhead=crow, dir=both color="#44E053"]
+ "Query" -> "Result" [arrowtail=odot, arrowhead=dot, dir=both color="#4C7944"]
+ "JobLog" -> "Query" [arrowtail=crow, arrowhead=crow, dir=both color="#4657DB"]
+}
diff --git a/doc_arch/endpoint_full_models.png b/doc_arch/endpoint_full_models.png
new file mode 100644
index 0000000..390f876
Binary files /dev/null and b/doc_arch/endpoint_full_models.png differ
diff --git a/lib/job_stats.rb b/lib/job_stats.rb
index 52dcdea..bd8ad82 100644
--- a/lib/job_stats.rb
+++ b/lib/job_stats.rb
@@ -30,12 +30,14 @@ class JobStats
def self.stats
# check to see if we have a working connection to mongo
begin
- Mongoid.master.stats
+ #Mongoid.master.stats
+ Mongoid.default_session.stats
rescue
return {error: "Backend Down"}
end
s = {backend_status: :good}
+ #result = Query.collection().map_reduce(MAP, REDUCE, {out: {inline: 1}, raw: true})
result = Query.collection().map_reduce(MAP, REDUCE, {out: {inline: 1}, raw: true})
result["results"].each do |res|
type = res["_id"]
diff --git a/lib/mongo_query_executor.rb b/lib/mongo_query_executor.rb
index 1f83bba..069c3fc 100644
--- a/lib/mongo_query_executor.rb
+++ b/lib/mongo_query_executor.rb
@@ -18,10 +18,24 @@ def initialize(format, map_js, reduce_js, functions_js, query_id, filter={})
end
def execute
- db = Mongoid.master
+ #db = Mongoid.master
+ db = Mongoid.default_session #.options[:database]
exts = []
exts << @functions_js
- results = db[PATIENTS_COLLECTION].map_reduce(build_map_function(exts), build_reduce_function(), :query => @filter, raw: true, out: {inline: 1})
+ #results = db[PATIENTS_COLLECTION].map_reduce(build_map_function(exts), build_reduce_function(), :query => @filter, raw: true, out: {inline: 1})
+
+ # An example of using Moped to execute a map_reduce command on a session
+ # can be found at http://mongoid.org/en/moped/docs/driver.html under
+ # Session#command
+ results = db.command(
+ mapreduce: PATIENTS_COLLECTION,
+ map: build_map_function(exts),
+ reduce: @reduce_js,
+ query: @filter,
+ raw: true,
+ out: {inline: 1}
+ )
+
result = {}
results['results'].each do |rv|
key = QueryUtilities.stringify_key(rv['_id'])
@@ -49,25 +63,4 @@ def build_map_function(exts = "")
map(patient);
};"
end
-
- def build_reduce_function()
- "function(k,v){
-
- var iter = function(x){
- this.index = 0;
- this.arr = (x==null)? [] : x;
-
- this.hasNext = function(){
- return this.index < this.arr.length;
- };
-
- this.next = function(){
- return this.arr[this.index++];
- }
- };
-
- #{@reduce_js}
- return reduce(k,new iter(v));
- }"
- end
end
diff --git a/lib/patient_console.rb b/lib/patient_console.rb
index d1bf882..be9a841 100644
--- a/lib/patient_console.rb
+++ b/lib/patient_console.rb
@@ -48,7 +48,8 @@ def self.run
next
end
query = JSON.parse(parts[1..parts.length].join(' '))
- db = Mongoid.master
+ #db = Mongoid.master
+ db = Mongoid.default_session
@@patients = []
@@ -81,7 +82,8 @@ def self.load_patient(index)
def self.init
@@patient_index = 0
- db = Mongoid.master
+ #db = Mongoid.master
+ db = Mongoid.default_session
patient_api = QueryExecutor.patient_api_javascript.to_s
@@patients = []
db['records'].find().each {|p| @@patients << p}
diff --git a/lib/query_job.rb b/lib/query_job.rb
index 6437656..afddc80 100644
--- a/lib/query_job.rb
+++ b/lib/query_job.rb
@@ -1,4 +1,4 @@
-require 'mongo'
+#require 'mongo'
class QueryJob < Struct.new(:format, :map, :reduce,:functions, :filter, :query_id)
@@ -47,7 +47,9 @@ def self.submit(format, map, reduce, functions, filter = {}, query_id)
end
def self.find_job(job_id)
- Delayed::Job.find(BSON::ObjectId.from_string(job_id))
+ #TODO test this, method doesn't seem to be used anywhere
+ #Delayed::Job.find(Moped::BSON::ObjectId.from_string(job_id))
+ Delayed::Job.find(Moped::BSON::ObjectId(job_id))
end
def self.cancel_job(job_id)
diff --git a/lib/query_utilities.rb b/lib/query_utilities.rb
index 20b71a6..c579282 100644
--- a/lib/query_utilities.rb
+++ b/lib/query_utilities.rb
@@ -4,7 +4,7 @@ module QueryUtilities
require 'tilt'
def self.stringify_key(key)
- if (key.is_a? BSON::OrderedHash)
+ if (key.is_a? Moped::BSON::Document) #::OrderedHash)
key = (key.map {|val| stringify_key(val)}).join('_')
end
if (key.is_a? Array)
diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/lib/tasks/patient_console.rake b/lib/tasks/patient_console.rake
index 3659cb2..ae92db5 100644
--- a/lib/tasks/patient_console.rake
+++ b/lib/tasks/patient_console.rake
@@ -1,6 +1,6 @@
require 'patient_console'
require 'bundler/setup'
-require 'test/unit'
+require 'test/unit/testcase'
require 'tilt'
require 'coffee_script'
require 'sprockets'
@@ -14,4 +14,4 @@ namespace :patient do
PatientConsole.run
end
-end
\ No newline at end of file
+end
diff --git a/nagios-plugins/README.md b/nagios-plugins/README.md
new file mode 100644
index 0000000..86ccdbb
--- /dev/null
+++ b/nagios-plugins/README.md
@@ -0,0 +1 @@
+The Nagios plugins (check_disk, check_load, check_procs, check_swap, check_users) in this directory were extracted from the Ubuntu 14.04 LTS package nagios-plugins-basic, version 1.5-3ubuntu1.
diff --git a/nagios-plugins/check_disk b/nagios-plugins/check_disk
new file mode 100755
index 0000000..c9dcddb
Binary files /dev/null and b/nagios-plugins/check_disk differ
diff --git a/nagios-plugins/check_import.sh b/nagios-plugins/check_import.sh
new file mode 100755
index 0000000..769f09e
--- /dev/null
+++ b/nagios-plugins/check_import.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Check current and previous tomcat6 log for pattern 'records pending' and
+# 'records processed'. If we check logs for the previous day there should
+# be at least 2 pattern matches
+LOGFILE=/var/log/tomcat6/catalina.out
+LOGFILE1=/var/log/tomcat6/catalina.out.1.gz
+DATE=`/bin/date --date='yesterday' +"%Y-%m-%d"`
+TMPFILE=`/bin/tempfile`
+CMD=`grep "records p" $LOGFILE > $TMPFILE 2>&1`
+STATUS=$?
+if [ $STATUS -ge 2 ]; then
+ /bin/echo "UNKNOWN - Got $(/bin/cat $TMPFILE)"
+ /bin/rm $TMPFILE
+ exit 3
+fi
+CMD1=`zcat $LOGFILE1 | grep "records p" - >> $TMPFILE 2>&1`
+STATUS1=$?
+if [ $STATUS1 -ge 2 ]; then
+ /bin/echo "UNKNOWN - Got $(/bin/cat $TMPFILE)"
+ /bin/rm $TMPFILE
+ exit 3
+fi
+COUNT=`grep "$DATE" $TMPFILE | wc -l`
+if [ $COUNT -ge 2 ]; then
+ COUNTP=`grep "$DATE" $TMPFILE | grep "records processed" | wc -l`
+ if [ $COUNTP -ge 1 ]; then
+ echo "OK - 'records processed' has $COUNTP matches on $DATE"
+ /bin/rm $TMPFILE
+ exit 0
+ else
+ echo "WARNING - 'records processed' has 0 matches on $DATE"
+ /bin/rm $TMPFILE
+ exit 1
+ fi
+fi
+if [ $COUNT -eq 1 ]; then
+ echo "WARNING - 'records p' has only 1 match on $DATE"
+ /bin/rm $TMPFILE
+ exit 1
+else
+ echo "CRITICAL - 'records p' has 0 matches on $DATE"
+ /bin/rm $TMPFILE
+ exit 2
+fi
diff --git a/nagios-plugins/check_load b/nagios-plugins/check_load
new file mode 100755
index 0000000..8e6966c
Binary files /dev/null and b/nagios-plugins/check_load differ
diff --git a/nagios-plugins/check_procs b/nagios-plugins/check_procs
new file mode 100755
index 0000000..2807870
Binary files /dev/null and b/nagios-plugins/check_procs differ
diff --git a/nagios-plugins/check_swap b/nagios-plugins/check_swap
new file mode 100755
index 0000000..1c7dc19
Binary files /dev/null and b/nagios-plugins/check_swap differ
diff --git a/nagios-plugins/check_users b/nagios-plugins/check_users
new file mode 100755
index 0000000..02b3d8c
Binary files /dev/null and b/nagios-plugins/check_users differ
diff --git a/runme.bat b/runme.bat
new file mode 100644
index 0000000..199d3b2
--- /dev/null
+++ b/runme.bat
@@ -0,0 +1,9 @@
+::Windows Normal Gateway Startup Script
+
+@echo off
+echo "Installing Dependencies"
+call bundle install
+echo "Starting Delayed Job"
+call "cmd /c start /min bundle exec ruby script/delayed_job run"
+echo "Starting Normal Gateway"
+bundle exec rails server -p 3001
diff --git a/runme.sh b/runme.sh
new file mode 100755
index 0000000..b717da2
--- /dev/null
+++ b/runme.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Start Normal HTTP Gateway
+
+echo "Installing Dependencies"
+bundle install
+echo "Starting Delayed Job"
+bundle exec script/delayed_job start
+echo "Starting Normal Gateway"
+bundle exec rails server -p 3001
+echo "Stopping Delayed Job"
+bundle exec script/delayed_job stop
diff --git a/script/rails b/script/rails
index f8da2cf..7489a5a 100755
--- a/script/rails
+++ b/script/rails
@@ -1,6 +1,39 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
-APP_PATH = File.expand_path('../../config/application', __FILE__)
-require File.expand_path('../../config/boot', __FILE__)
+require 'rubygems'
+require 'rails/commands/server'
+require 'rack'
+require 'webrick'
+require 'webrick/https'
+
+#override server defaults options to use ssl
+CA_CERT_PATH = "cert/ca/LeadLab_root_cert_TEST.pem"
+#SERVER_CERT_PATH = "cert/endpoint.crt"
+#SERVER_KEY_PATH = "cert/endpoint.key"
+SERVER_CERT_PATH = "cert/ca/LeadLab_root_cert_TEST.pem"
+SERVER_KEY_PATH = "cert/ca/LeadLab_root_cert_TEST.pem"
+
+module Rails
+ class Server < ::Rack::Server
+ def default_options
+ super.merge({
+ :environment => (ENV['RAILS_ENV'] || "development").dup,
+ :daemonize => false,
+ :debugger => false,
+ :pid => File.expand_path("tmp/pids/server.pid"),
+ :config => File.expand_path("config.ru"),
+ :SSLEnable => false,
+ :SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT,
+ :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open(SERVER_KEY_PATH).read),
+ :SSLCertificate => OpenSSL::X509::Certificate.new(File.open(SERVER_CERT_PATH).read),
+ :SSLCACertificateFile => CA_CERT_PATH,
+ :SSLCertName => [["CN", WEBrick::Utils::getservername]],
+ })
+ end
+ end
+end
+
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
diff --git a/script/secure_rails b/script/secure_rails
new file mode 100755
index 0000000..fe9e04b
--- /dev/null
+++ b/script/secure_rails
@@ -0,0 +1,39 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+require 'rubygems'
+require 'rails/commands/server'
+require 'rack'
+require 'webrick'
+require 'webrick/https'
+
+#override server defaults options to use ssl
+CA_CERT_PATH = "cert/ca/LeadLab_root_cert_TEST.pem"
+#SERVER_CERT_PATH = "cert/endpoint.crt"
+#SERVER_KEY_PATH = "cert/endpoint.key"
+SERVER_CERT_PATH = "cert/ca/LeadLab_root_cert_TEST.pem"
+SERVER_KEY_PATH = "cert/ca/LeadLab_root_cert_TEST.pem"
+
+module Rails
+ class Server < ::Rack::Server
+ def default_options
+ super.merge({
+ :environment => (ENV['RAILS_ENV'] || "development").dup,
+ :daemonize => false,
+ :debugger => false,
+ :pid => File.expand_path("tmp/pids/secure_server.pid"),
+ :config => File.expand_path("config.ru"),
+ :SSLEnable => true,
+ :SSLVerifyClient => OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT,
+ :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.open(SERVER_KEY_PATH).read),
+ :SSLCertificate => OpenSSL::X509::Certificate.new(File.open(SERVER_CERT_PATH).read),
+ :SSLCACertificateFile => CA_CERT_PATH,
+ :SSLCertName => [["CN", WEBrick::Utils::getservername]],
+ })
+ end
+ end
+end
+
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
+require 'rails/commands'
diff --git a/secrunme.sh b/secrunme.sh
new file mode 100755
index 0000000..a73a20e
--- /dev/null
+++ b/secrunme.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Start Secure HTTPS Gateway
+
+echo "Installing Dependencies"
+bundle install
+echo "Starting Delayed Job"
+bundle exec script/delayed_job start
+echo "Starting Secure Gateway"
+bundle exec script/secure_rails server -p 3222
+echo "Stopping Delayed Job"
+bundle exec script/delayed_job stop
diff --git a/start-endpoint-example.sh b/start-endpoint-example.sh
new file mode 100755
index 0000000..b909c5f
--- /dev/null
+++ b/start-endpoint-example.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+#export HOME=/home/scoopadmin
+source $HOME/.bash_profile
+source $HOME/.bashrc
+export ENDPOINT=$HOME/git/scoophealth/hquery/query-gateway
+export GW_PIDFILE=$ENDPOINT/tmp/pids/server.pid
+export DL_PIDFILE=$ENDPOINT/tmp/pids/delayed_job.pid
+#
+# Make sure mongod is running
+if ! pgrep mongod > /dev/null
+then
+ sudo service mongod start
+fi
+#
+#echo "Starting relay service on port 3000"
+#$ENDPOINT/util/relay-service.rb >> $HOME/logs/rs.log 2>&1 &
+#
+echo "Starting Query Gateway on port 3001"
+cd $ENDPOINT
+# Stop delayed_job if running, remove pidfile
+if [ -f $DL_PIDFILE ];
+then
+ bundle exec $ENDPOINT/script/delayed_job stop
+ if [ -f $DL_PIDFILE ];
+ then
+ rm $DL_PIDFILE
+ fi
+fi
+#
+bundle exec $ENDPOINT/script/delayed_job start
+#
+# Start gateway
+# If gateway is already running (or has a stale server.pid), try to stop it.
+if [ -f $GW_PIDFILE ];
+then
+ kill `cat $GW_PIDFILE`
+ if [ -f $GW_PIDFILE ];
+ then
+ kill -9 `cat $GW_PIDFILE`
+ fi
+ rm $GW_PIDFILE
+fi
+bundle exec rails server -p 3001 >> $ENDPOINT/log/qgw.log 2>&1 &
+#/bin/ps -ef | grep "rails server -p 3001" | grep -v grep | awk '{print $2}' > tmp/pids/server.pid
diff --git a/stop-endpoint-example.sh b/stop-endpoint-example.sh
new file mode 100755
index 0000000..ca094b6
--- /dev/null
+++ b/stop-endpoint-example.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+source $HOME/.bash_profile
+source $HOME/.bashrc
+export ENDPOINT=$HOME/git/scoophealth/hquery/query-gateway
+export GW_PIDFILE=$ENDPOINT/tmp/pids/server.pid
+export DL_PIDFILE=$ENDPOINT/tmp/pids/delayed_job.pid
+cd $ENDPOINT
+if [ -f $DL_PIDFILE ];
+then
+ bundle exec $ENDPOINT/script/delayed_job stop
+ # pid file should be gone but recheck
+ if [ -f $DL_PIDFILE ];
+ then
+ rm $DL_PIDFILE
+ fi
+fi
+#
+# If gateway is running, stop it.
+if [ -f $GW_PIDFILE ];
+then
+ kill `cat $GW_PIDFILE`
+ if [ -f $GW_PIDFILE ];
+ then
+ kill -9 `cat $GW_PIDFILE`
+ fi
+ rm $GW_PIDFILE
+fi
diff --git a/support/oscar/interface_check.sh b/support/oscar/interface_check.sh
new file mode 100755
index 0000000..74ee8c4
--- /dev/null
+++ b/support/oscar/interface_check.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+# Bring up static interface if it is down; fails silently if that
+# IP address is already assigned to another interface, say via DHCP.
+# Example of usage via cron:
+#@midnight /root/bin/interface_check.sh > /dev/null 2>&1
+
+IPADDRESS=192.168.0.13 # change to actual private IP address
+t1=$(ifconfig | grep -o em1:1)
+t2='em1:1'
+
+if [ "$t1" != "$t2" ]; then
+ /sbin/ifconfig em1:1 $IPADDRESS netmask 255.255.255.0
+fi
+
+exit
diff --git a/support/oscar/mysql_reload.sh b/support/oscar/mysql_reload.sh
new file mode 100755
index 0000000..d5aba10
--- /dev/null
+++ b/support/oscar/mysql_reload.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+set -e # exit on errors
+# Example usage from cron:
+# 15 8 * * * /encrypted/root/mysql_reload.sh >> /encrypted/root/log/reload.log 2>&1
+#
+# Stop Tomcat. Nagios test of whether load succeeded
+# checks whether this script restarted Tomcat.
+# That will happen if script runs to completion.
+# In any case, Oscar cannot run while the database
+# is being restored from a dump.
+echo "Stopping Tomcat at `date`"
+/etc/init.d/tomcat6 stop
+#
+echo "Datebase dump inspection started at `date`"
+DUMPFILE="/encrypted/somedir/somedump.sql"
+CMD=`find $DUMPFILE -mtime 0 -print | wc -l`
+if [ $CMD -eq 0 ]
+then
+ HOST=`/bin/hostname`
+ echo "Check why the EMR SQL dump on $HOST failed to update for `date`."
+ exit
+fi
+echo "Database dump appears current"
+echo "Database reloading started at `date`"
+DBNAME="oscar_12_1"
+PASSWD="somepasswd"
+#
+mysql -uroot -p$PASSWD -e "drop database $DBNAME;"
+mysql -uroot -p$PASSWD -e "create database $DBNAME;"
+mysql -uroot -p$PASSWD $DBNAME < $DUMPFILE
+#
+echo "Completed database reload at `date`"
+# restart Oscar
+/etc/init.d/tomcat6 start
+echo "Tomcat restart completed at `date`"
diff --git a/test/factories/factory.rb b/test/factories/factory.rb
index a85b733..ad46bc4 100644
--- a/test/factories/factory.rb
+++ b/test/factories/factory.rb
@@ -4,57 +4,69 @@
# = jobs =
# ==========
-Factory.define :queued_job, :class => Query do |q|
- q.format 'js'
- q.map 'foo'
- q.reduce 'foo'
- q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued')]
- q.status :queued
+FactoryGirl.define do
+ factory :queued_job, :class => Query do |q|
+ q.format 'js'
+ q.map 'foo'
+ q.reduce 'foo'
+ q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued')]
+ q.status :queued
+ end
end
-Factory.define :running_job, :class => Query do |q|
- q.format 'js'
- q.map 'foo'
- q.reduce 'foo'
- q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'),
- JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running')]
- q.status :running
+FactoryGirl.define do
+ factory :running_job, :class => Query do |q|
+ q.format 'js'
+ q.map 'foo'
+ q.reduce 'foo'
+ q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'),
+ JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running')]
+ q.status :running
+ end
end
-Factory.define :successful_job, :class => Query do |q|
- q.format 'js'
- q.map 'foo'
- q.reduce 'foo'
- q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'),
- JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'),
- JobLog.new(:created_at => 30.seconds.ago.time, :message => 'Job successful')]
- q.status :complete
+FactoryGirl.define do
+ factory :successful_job, :class => Query do |q|
+ q.format 'js'
+ q.map 'foo'
+ q.reduce 'foo'
+ q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'),
+ JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'),
+ JobLog.new(:created_at => 30.seconds.ago.time, :message => 'Job successful')]
+ q.status :complete
+ end
end
-Factory.define :rescheduled_job,:class => Query do |q|
- q.format 'js'
- q.map 'foo'
- q.reduce 'foo'
- q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'),
- JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'),
- JobLog.new(:created_at => 15.seconds.ago.time, :message => 'Job rescheduled')]
- q.status :rescheduled
+FactoryGirl.define do
+ factory :rescheduled_job,:class => Query do |q|
+ q.format 'js'
+ q.map 'foo'
+ q.reduce 'foo'
+ q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'),
+ JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'),
+ JobLog.new(:created_at => 15.seconds.ago.time, :message => 'Job rescheduled')]
+ q.status :rescheduled
+ end
end
-Factory.define :failed_job, :class => Query do |q|
- q.format 'js'
- q.map 'foo'
- q.reduce 'foo'
- q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'),
- JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'),
- JobLog.new(:created_at => 10.seconds.ago.time, :message => 'Job failed')]
- q.status :failed
+FactoryGirl.define do
+ factory :failed_job, :class => Query do |q|
+ q.format 'js'
+ q.map 'foo'
+ q.reduce 'foo'
+ q.job_logs [JobLog.new(:created_at => 60.seconds.ago.time, :message => 'Job queued'),
+ JobLog.new(:created_at => 45.seconds.ago.time, :message => 'Job running'),
+ JobLog.new(:created_at => 10.seconds.ago.time, :message => 'Job failed')]
+ q.status :failed
+ end
end
# ===========
# = Results =
# ===========
-Factory.define :gender_result, :class => Result do |r|
- r.created_at Time.now
-end
\ No newline at end of file
+FactoryGirl.define do
+ factory :gender_result, :class => Result do |r|
+ r.created_at Time.now
+ end
+end
diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/fixtures/JOHN_CLEESE_1_25091940.xml b/test/fixtures/JOHN_CLEESE_1_25091940.xml
new file mode 100644
index 0000000..6ff7089
--- /dev/null
+++ b/test/fixtures/JOHN_CLEESE_1_25091940.xml
@@ -0,0 +1,4268 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PITO EMR-2-EMR Record of JOHN CLEESE
+
+
+
+
+
+
+
+
+
+ BC
+
+
+
+
+ JOHN
+ CLEESE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ OSCAR EMR {build.JOB_NAME}-{build.BUILD_NUMBER}
+
+
+
+
+
+
+
+
+ McMaster Hospital
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Advance Directives Section [without entries]
+ This section is not supported by the Originating Application
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Alerts [with entries]
+
+
+ Heart Attack
+
+
+
+
+
+
+
+
+ Heart Attack
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Allergies & Intolerances (Reaction List) [with entries]
+
+
+ PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PENICILLINS, COMBINATIONS WITH OTHER ANTIBACTERIAL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Confirmed present
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clinical Measured Observations [with entries]
+
+
+ Systolic Blood Pressure: 130 mm[Hg] (sitting position)
+ Diastolic Blood Pressure: 85 mm[Hg] (sitting position)
+ Height: 187 cm (in cm)
+ Heart Rate: 85 beats/min (in bpm (nnn) Range:40-180)
+ Temperature: 37 C (degrees celcius)
+ Waist: 92 cm (Waist Circum in cm)
+ Weight: 95 kg (in kg)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ Systolic Blood Pressure (sitting position)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ Diastolic Blood Pressure (sitting position)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ Height (in cm)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ Heart Rate (in bpm (nnn) Range:40-180)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ Temperature (degrees celcius)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ Waist (Waist Circum in cm)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ Weight (in kg)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Encounter History and Notes [with entries]
+
+
+ Sep 25, 2013 [25-Sep-2013 .: Tel-Progress Notes]
+BP 130/85 sitting position
+HT 187 in cm
+HR 85 in bpm (nnn) Range:40-180
+TEMP 37 degrees celcius
+WAIS 92 Waist Circum in cm
+WT 95 in kg
+ Sep 26, 2013 Situational Crisis
+ Sep 26, 2013 Vitamin D3
+ Sep 26, 2013 Vitamin C
+ Sep 26, 2013 Ginseng Tincture
+ Sep 26, 2013 Heart Attack
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+ Provider
+
+
+
+
+
+
+
+
+
+
+
+ [25-Sep-2013 .: Tel-Progress Notes]
+BP 130/85 sitting position
+HT 187 in cm
+HR 85 in bpm (nnn) Range:40-180
+TEMP 37 degrees celcius
+WAIS 92 Waist Circum in cm
+WT 95 in kg
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+ Provider
+
+
+
+
+
+
+
+
+
+
+
+ Situational Crisis
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+ Provider
+
+
+
+
+
+
+
+
+
+
+
+ Vitamin D3
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+ Provider
+
+
+
+
+
+
+
+
+
+
+
+ Vitamin C
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+ Provider
+
+
+
+
+
+
+
+
+
+
+
+ Ginseng Tincture
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+ Provider
+
+
+
+
+
+
+
+
+
+
+
+ Heart Attack
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Family History [without entries]
+ No information for this section for this patient
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Immunizations List [with entries]
+
+
+ Td Sep 01, 2012 Completed
+ Flu Feb 01, 2009 Completed
+ Pneumovax Oct 31, 2012 Completed
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IM
+
+
+
+
+
+
+ Td
+ 1234
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+ Left Delt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Flu
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IM
+
+
+
+
+
+
+ Pneumovax
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+ Right Delt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Laboratory Results and Reports [with entries]
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ WBC: 8.0 giga/L
+ RBC: 4.71 tera/L
+ Hemoglobin: 158 g/L
+ Hematocrit: 0.46
+ MCV: 99 fl
+ MCH: 33.5 pg
+ MCHC: 341 g/L
+ RDW: 12.6 %
+ Platelet Count: 295 giga/L
+ Neutrophils: 6.0 giga/L
+ Lymphocytes: 1.6 giga/L
+ Monocytes: 0.4 giga/L
+ Eosinophils: 0.1 giga/L
+ Basophils: 0.0 giga/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ INR: 1.0
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Glucose Random: 5.2 mmol/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Creatinine: 68 umol/L
+ Estimated GFR: 113 mL/min
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Uric Acid: 317 umol/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Albumin: 45 g/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Total Bilirubin: 16 umol/L
+ Direct Bilirubin: 5 umol/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Alkaline Phosphatase: 74 U/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Gamma GT: 10 U/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ ALT: 19 U/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ AST: 25 U/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Lactic Acid: 1.0 mmol/L
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1 Jun 27, 2013
+ Lipemia: Slight
+
+
+
+
+
+
+
+
+ HAEM1/HAEM3/CHEM4/CHEM29/REFER1
+
+
+
+
+
+
+
+
+ BOB MDCARE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WBC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 4.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RBC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 4.20
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hemoglobin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 133
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hematocrit
+
+
+
+
+ 0.46
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 0.38
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MCV
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 82
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MCH
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 27.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MCHC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 305
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RDW
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 11.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Platelet Count
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 150
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Neutrophils
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 2.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lymphocytes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 1.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Monocytes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 0.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Eosinophils
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 0.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Basophils
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 0.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ INR
+
+
+
+
+ 1.0
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 0.8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Glucose Random
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 3.3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Creatinine
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 70
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Estimated GFR
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >=60
+ >=60
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Uric Acid
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 234
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Albumin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 35
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Total Bilirubin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Direct Bilirubin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Alkaline Phosphatase
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 48
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Gamma GT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ALT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AST
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lactic Acid
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Normal Reference range is greater than 0.7
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lipemia
+
+
+
+
+ Slight
+
+
+
+
+
+
+
+
+
+ LIFELABS
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Medications and Prescriptions - Medication List [with entries]
+
+
+ TYLENOL EXTRA STRENGTH TAB 500MG QID 25 D
+ SPIRONOLACTONE 25MG TABLET QAM 28 D
+ IBUPROFEN TAB 400MG TID 28 D
+ ATIVAN 1MG BID 20 D
+ ASA 81 MG OD 28 D
+ FUROSEMIDE 20MG QAM 56 D
+ AVA-RAMIPRIL 5MG OD 28 D
+ CARVEDILOL 12.5MG OD 28 D
+ ATORVASTATIN 40MG OD 28 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ACETAMINOPHEN
+ TYLENOL EXTRA STRENGTH TAB 500MG
+
+
+
+
+
+ ACETAMINOPHEN
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ACETAMINOPHEN
+ TYLENOL EXTRA STRENGTH TAB 500MG
+
+
+
+
+
+ ACETAMINOPHEN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 25 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ACETAMINOPHEN
+ TYLENOL EXTRA STRENGTH TAB 500MG
+
+
+
+
+
+ ACETAMINOPHEN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SPIRONOLACTONE
+ SPIRONOLACTONE 25MG TABLET
+
+
+
+
+
+ SPIRONOLACTONE
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SPIRONOLACTONE
+ SPIRONOLACTONE 25MG TABLET
+
+
+
+
+
+ SPIRONOLACTONE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 28 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SPIRONOLACTONE
+ SPIRONOLACTONE 25MG TABLET
+
+
+
+
+
+ SPIRONOLACTONE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IBUPROFEN
+ IBUPROFEN TAB 400MG
+
+
+
+
+
+ IBUPROFEN
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IBUPROFEN
+ IBUPROFEN TAB 400MG
+
+
+
+
+
+ IBUPROFEN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 28 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IBUPROFEN
+ IBUPROFEN TAB 400MG
+
+
+
+
+
+ IBUPROFEN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LORAZEPAM
+ ATIVAN 1MG
+
+
+
+
+
+ LORAZEPAM
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LORAZEPAM
+ ATIVAN 1MG
+
+
+
+
+
+ LORAZEPAM
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 20 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LORAZEPAM
+ ATIVAN 1MG
+
+
+
+
+
+ LORAZEPAM
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ACETYLSALICYLIC ACID
+ ASA 81 MG
+
+
+
+
+
+ ACETYLSALICYLIC ACID
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ACETYLSALICYLIC ACID
+ ASA 81 MG
+
+
+
+
+
+ ACETYLSALICYLIC ACID
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 28 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ACETYLSALICYLIC ACID
+ ASA 81 MG
+
+
+
+
+
+ ACETYLSALICYLIC ACID
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FUROSEMIDE
+ FUROSEMIDE 20MG
+
+
+
+
+
+ FUROSEMIDE
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FUROSEMIDE
+ FUROSEMIDE 20MG
+
+
+
+
+
+ FUROSEMIDE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 56 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FUROSEMIDE
+ FUROSEMIDE 20MG
+
+
+
+
+
+ FUROSEMIDE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RAMIPRIL
+ AVA-RAMIPRIL 5MG
+
+
+
+
+
+ RAMIPRIL
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RAMIPRIL
+ AVA-RAMIPRIL 5MG
+
+
+
+
+
+ RAMIPRIL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 28 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RAMIPRIL
+ AVA-RAMIPRIL 5MG
+
+
+
+
+
+ RAMIPRIL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CARVEDILOL
+ CARVEDILOL 12.5MG
+
+
+
+
+
+ CARVEDILOL
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CARVEDILOL
+ CARVEDILOL 12.5MG
+
+
+
+
+
+ CARVEDILOL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 28 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CARVEDILOL
+ CARVEDILOL 12.5MG
+
+
+
+
+
+ CARVEDILOL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ATORVASTATIN (ATORVASTATIN CALCIUM)
+ ATORVASTATIN 40MG
+
+
+
+
+
+ ATORVASTATIN (ATORVASTATIN CALCIUM)
+
+
+
+
+
+
+
+
+
+
+
+ Long Term
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ATORVASTATIN (ATORVASTATIN CALCIUM)
+ ATORVASTATIN 40MG
+
+
+
+
+
+ ATORVASTATIN (ATORVASTATIN CALCIUM)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ 28 D
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ATORVASTATIN (ATORVASTATIN CALCIUM)
+ ATORVASTATIN 40MG
+
+
+
+
+
+ ATORVASTATIN (ATORVASTATIN CALCIUM)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Orders and Requests (without entries)
+ This section is not supported by the Originating Application
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Problems and Conditions - Problem List [with entries]
+
+
+ HEART FAILURE* (ICD9: 428)
+ ESSENTIAL HYPERTENSION* (ICD9: 401)
+ DIABETES MELLITUS* (ICD9: 250)
+ CHRONIC BRONCHITIS* (ICD9: 491)
+
+
+
+
+
+
+
+
+ HEART FAILURE*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ESSENTIAL HYPERTENSION*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DIABETES MELLITUS*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CHRONIC BRONCHITIS*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Risk Factors [with entries]
+
+
+ Situational Crisis
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ doctor
+ oscardoc
+
+
+
+
+
+
+
+
+
+ Situational Crisis
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/MZarilla.xml b/test/fixtures/MZarilla.xml
new file mode 100644
index 0000000..7eca174
--- /dev/null
+++ b/test/fixtures/MZarilla.xml
@@ -0,0 +1,3457 @@
+
+
+
+
+
+
+
+
+
+
+ A basic document
+
+
+
+
+
+
+
+ 1022 Main Street
+ Vancouver
+ BC
+ V3J3L2
+ Canada
+
+
+
+
+ Melvin
+ Zarilla
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Practice Manager 9.17.0001
+
+
+
+
+
+
+
+ ABCDEF
+
+
+
+
+
+
+
+
+
+
+ Advance Directives Section [with entries]
+ This section is not supported by the Originating Application
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Alerts [with entries]
+ Special Needs Support: Possible evidence of autism.
+Demonstrates early symptoms of autism., Effective Date: Jan 15, 2013
+Other: Feeding Issues.
+Discuss alternative feeding methods., Effective Date: Jun 08, 2011
+Other: Parents refusing immunization.
+Discussion with parents prior to any injections., Effective Date: Jan 08, 2011
+
+
+
+
+
+ Special Needs Support
+
+
+
+
+
+
+
+
+ Possible evidence of autism.
+Demonstrates early symptoms of autism.
+
+
+
+
+
+
+
+
+
+
+ Other
+
+
+
+
+
+
+
+
+ Parents refusing immunization.
+Discussion with parents prior to any injections.
+
+
+
+
+
+
+
+
+
+
+ Other
+
+
+
+
+
+
+
+
+ Feeding Issues.
+Discuss alternative feeding methods.
+
+
+
+
+
+
+
+
+
+
+
+ Allergies & Intolerances (Reaction List) [with entries]
+ Food Allergy: Lactose - dietary (substance), Severity: Severe, Details: Reported by Mother, Start: Jul 15, 2012
+Drug Allergy: Amoxicillin, Severity: Moderate, Details: Presented in clinic with hives, Start: May 08, 2012, End: May 08, 2012
+Food Allergy: Peanut - dietary (substance), Severity: Severe, Details: Reported by Mother, Start: Apr 01, 2012
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Peanut - dietary (substance)
+
+
+
+
+
+
+ Reported by Mother
+
+
+
+
+
+
+
+
+
+
+
+
+ Confirmed present
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Amoxicillin
+
+
+
+
+
+
+ Presented in clinic with hives
+
+
+
+
+
+
+
+
+
+
+
+
+ Confirmed present
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lactose - dietary (substance)
+
+
+
+
+
+
+ Reported by Mother
+
+
+
+
+
+
+
+
+
+
+
+
+ Confirmed present
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Clinical Measured Observations [with entries]
+ Weight: 11.3kg, Height: 82.5cm, BMI: 16.6, Pulse (bpm): 136, BP: 90/60, Temp: 38.4C - Oral, Date: Nov 01, 2013
+
+
+
+
+
+
+
+
+
+
+ Body height
+
+
+
+
+
+
+
+
+
+
+ Body weight
+
+
+
+
+
+
+
+
+
+
+ Heart rate
+
+
+
+
+
+
+
+
+
+
+ Systolic blood pressure
+
+
+
+
+
+
+
+
+
+
+ Diastolic blood pressure
+
+
+
+
+
+
+
+
+
+
+ Body temperature
+
+
+
+
+
+
+
+
+
+
+
+ Body mass index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Encounter History [with entries]
+ Dec 20, 2012 - Acute cystitis, 68226007 (SNOMED CT)
+
+Notes:
+ Meds reviewed - added Clopidogrel.
+Renewal of usual meds (left at hospital).
+Keen to stop smoking and lose weight.
+Pulse 60 /min
+Regular? Yes
+BP systolic 130 mm Hg
+BP diastolic 85 mm Hg
+Objective Note: Obese.
+Chest, CVS and Abdominal exams negative.
+Foot exam normal.
+Assessment Note: CAD stable.
+Suggested nicotine patch and stop Smoking Line. Consider dietician referral next visit.
+
+Dec 15, 2012 - Consult
+
+Notes:
+ History of Presenting Illness:
+Ms. Jones is a 38 year old single woman who developed pain and stiffness in several joints 2 months prior to referral. She has noted that it is very difficult to open jars due to the pain in the fingers and wrists. She also has difficulty dressing herself because of shoulder and elbow stiffness. Walking is painful, particularly on the balls of her feet, and she has noted some swelling of her knees, bilaterally. She experiences 1 hour of morning stiffness.
+She had some initial benefit from Naprosyn 375 mg PO BID, but found it upset her stomach, so stopped it about 3 weeks ago.
+She cannot recall any antecedent illnesses, and was enjoying several sporting activities prior to onset, including bike riding and hiking. On closer questioning she denies any skin rashes, and has not noticed any gastrointestinal, cardiac, or pulmonary symptoms.
+Medications/Allergies: She has not been on any medications for her condition however in the past she did take Penicillin for a “Strep Throat” and developed a widespread urticarial rash. She has not taken penicillin since.
+Past Medical History: No known medical problems. Two normal pregnancies, vaginal delivery.
+Past Surgical History: Appendectomy age 12; Cholecystectomy age 35
+Family History:
+A maternal aunt had Rheumatoid Arthritis. Her mother has diabetes mellitus. Her father suffered a heart attack in 2006, at the age of 68. She has two siblings, a brother 3 years older and a sister 2 years younger, both of whom are well.
+Social History:
+She smoked til age 30, at 1 ppd but no longer does. She drinks 4 glasses of wine per week. She was married but now divorced. She works in a flower shop. Her children are aged 15 and 18.
+Review of systems:
+There is no history of Raynaud’s phenomenon, photosensitivity skin rashes, mouth ulcers, or serositis of the heart, lungs, or mesentery. She has not had any diarrhea or bowel upset. Her weight is stable. She has not had psoriasis, nor other skin conditions except she did have resection of a melanoma at age 30. She has never had seizures and does not suffer from any mental illness.
+Physical Exam:
+Vitals: BP 135/75; P 70; Ht 1.61 m; Wt 63.4 kg BMI 24.5 RR 16
+H&N: No malar rash, telangiectasia, conjunctivitis, scleritis,parotitis, mouth ulcers, or lymphadenopathy. Sublingual salivary pool is normal and gingiva are normal. Thyroid gland is normal.
+Chest: Clear to IPPA
+CV: Physiological systolic murmurs over aortic valve. Normal S1 and S2.
+Abdomen: Normal bowel sounds. Normal palpation. No hepato or splenomegaly.
+Skin: Scar on back from melanoma removal. Fair complexion. No sclerodactyly, calcinosis, periungal erythema, or evidence of psoriasis.
+Neuro: Normal CNS and PNS. No movement disorder.
+MSK; 20 swollen and 22 tender joints out of 28 joint count. MCPs, PIPs and wrists bilaterally are swollen and tender. Both ankles are swollen and tender. Left knee has popliteal cyst. MTPs are tender. No deformities are evident.
+Lab Results: Date – March 15, 2012
+RF 85; Anti-CCP high positive; ESR 45; Hgb 115; WBC 4.5 – PMN 3.0; WBC 1.3; Monos 0.2; Creatinine 74
+Diagnostic Imaging: March 25, 2012 No erosions seen on hand films but some periarticular osteopenia is noted.
+Ultrasound Abdomen: March 28, 2012 – An obstetrical ultrasound of uterus was performed. Normal uterus, with no evidence of fetus or placenta.
+Bone Density: 2010, June 30; Tscores: L spine -1.3; Femoral neck -1.0
+Pathology reports: Normal PAP smears in past 5 assessments; skin biopsy – melanoma with margins clear
+
+
+Jun 12, 2012 - Cough and Fever
+
+Notes:
+3 days cough and fever. Not eating well. No vomiting or diarrhea. Formula fed but taking baby food as well.
+O/E Lethargic baby. Temp 39 degrees C. Not dehydrated. Resp rate 18. Some wheeze ut no indrawing. Crusty nose. Both Tm’s red and bulging. Pharynx red. No pus. Neck supple. Crusty eyes.
+Ongoing microcephaly.
+Weight: 5.2 kg
+Head circ: 42. cm
+Dx Influenza
+BOM
+Bronchiolitis
+Rx Biaxin
+Tylenol
+Ventolin with aerochamber.
+Advise mom to see public health for next vaccination.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A.
+ Black
+
+
+
+
+
+
+
+
+ Cough and Fever
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Notes: 3 days cough and fever. Not eating well. No vomiting or diarrhea. Formula fed but taking baby food as well.
+O/E Lethargic baby. Temp 39 degrees C. Not dehydrated. Resp rate 18. Some wheeze ut no indrawing. Crusty nose. Both Tm’s red and bulging. Pharynx red. No pus. Neck supple. Crusty eyes.
+Ongoing microcephaly.
+Weight: 5.2 kg
+Head circ: 42. cm
+Dx Influenza
+BOM
+Bronchiolitis
+Rx Biaxin
+Tylenol
+Ventolin with aerochamber.
+Advise mom to see public health for next vaccination.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A.
+ Black
+
+
+
+
+
+
+
+
+ Consult
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Notes: History of Presenting Illness:
+Ms. Jones is a 38 year old single woman who developed pain and stiffness in several joints 2 months prior to referral. She has noted that it is very difficult to open jars due to the pain in the fingers and wrists. She also has difficulty dressing herself because of shoulder and elbow stiffness. Walking is painful, particularly on the balls of her feet, and she has noted some swelling of her knees, bilaterally. She experiences 1 hour of morning stiffness.
+She had some initial benefit from Naprosyn 375 mg PO BID, but found it upset her stomach, so stopped it about 3 weeks ago.
+She cannot recall any antecedent illnesses, and was enjoying several sporting activities prior to onset, including bike riding and hiking. On closer questioning she denies any skin rashes, and has not noticed any gastrointestinal, cardiac, or pulmonary symptoms.
+Medications/Allergies: She has not been on any medications for her condition however in the past she did take Penicillin for a “Strep Throat” and developed a widespread urticarial rash. She has not taken penicillin since.
+Past Medical History: No known medical problems. Two normal pregnancies, vaginal delivery.
+Past Surgical History: Appendectomy age 12; Cholecystectomy age 35
+Family History:
+A maternal aunt had Rheumatoid Arthritis. Her mother has diabetes mellitus. Her father suffered a heart attack in 2006, at the age of 68. She has two siblings, a brother 3 years older and a sister 2 years younger, both of whom are well.
+Social History:
+She smoked til age 30, at 1 ppd but no longer does. She drinks 4 glasses of wine per week. She was married but now divorced. She works in a flower shop. Her children are aged 15 and 18.
+Review of systems:
+There is no history of Raynaud’s phenomenon, photosensitivity skin rashes, mouth ulcers, or serositis of the heart, lungs, or mesentery. She has not had any diarrhea or bowel upset. Her weight is stable. She has not had psoriasis, nor other skin conditions except she did have resection of a melanoma at age 30. She has never had seizures and does not suffer from any mental illness.
+Physical Exam:
+Vitals: BP 135/75; P 70; Ht 1.61 m; Wt 63.4 kg BMI 24.5 RR 16
+H&N: No malar rash, telangiectasia, conjunctivitis, scleritis,parotitis, mouth ulcers, or lymphadenopathy. Sublingual salivary pool is normal and gingiva are normal. Thyroid gland is normal.
+Chest: Clear to IPPA
+CV: Physiological systolic murmurs over aortic valve. Normal S1 and S2.
+Abdomen: Normal bowel sounds. Normal palpation. No hepato or splenomegaly.
+Skin: Scar on back from melanoma removal. Fair complexion. No sclerodactyly, calcinosis, periungal erythema, or evidence of psoriasis.
+Neuro: Normal CNS and PNS. No movement disorder.
+MSK; 20 swollen and 22 tender joints out of 28 joint count. MCPs, PIPs and wrists bilaterally are swollen and tender. Both ankles are swollen and tender. Left knee has popliteal cyst. MTPs are tender. No deformities are evident.
+Lab Results: Date – March 15, 2012
+RF 85; Anti-CCP high positive; ESR 45; Hgb 115; WBC 4.5 – PMN 3.0; WBC 1.3; Monos 0.2; Creatinine 74
+Diagnostic Imaging: March 25, 2012 No erosions seen on hand films but some periarticular osteopenia is noted.
+Ultrasound Abdomen: March 28, 2012 – An obstetrical ultrasound of uterus was performed. Normal uterus, with no evidence of fetus or placenta.
+Bone Density: 2010, June 30; Tscores: L spine -1.3; Femoral neck -1.0
+Pathology reports: Normal PAP smears in past 5 assessments; skin biopsy – melanoma with margins clear
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Susan
+ Gold
+
+
+
+
+
+
+
+
+ Acute cystitis, 68226007 (SNOMED CT)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Notes: Meds reviewed - added Clopidogrel.
+Renewal of usual meds (left at hospital).
+Keen to stop smoking and lose weight.
+Pulse 60 /min
+Regular? Yes
+BP systolic 130 mm Hg
+BP diastolic 85 mm Hg
+Objective Note: Obese.
+Chest, CVS and Abdominal exams negative.
+Foot exam normal.
+Assessment Note: CAD stable.
+Suggested nicotine patch and stop Smoking Line. Consider dietician referral next visit.
+
+
+
+
+
+
+
+
+
+
+
+ Family History [with entries]
+ Mother: Fetal alcohol syndrome, Age at Onset: 0, Comment: Family history of alcoholism, refusal for treatment, Cause of Death: Cirrhosis(liver)
+Natural Mother: Family history of cancer of colon, Age at Onset: 54, Comment: Mom was diagnosed with metastatic cancer of colon and died at age 55., Age at Death: 55, Cause of Death: Cancer of colon,
+Natural Mother: Diabetes mellitus, Comment: Family history of obesity with extremely poor diet during childhood, due to lack of education and financial hardship, Cause of Death: Kidney Disease
+
+
+
+
+
+ Fetal alcohol syndrome
+
+
+
+
+
+
+
+
+
+
+ Family history of alcoholism, refusal for treatment
+
+
+
+
+
+
+
+
+
+
+
+
+ Cirrhosis(liver)
+
+
+
+
+
+
+
+
+
+ Family history of cancer of colon
+
+
+
+
+
+
+
+
+
+
+ Mom was diagnosed with metastatic cancer of colon and died at age 55.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Cancer of colon,
+
+
+
+
+
+
+
+
+
+ Diabetes mellitus
+
+
+
+
+
+
+
+
+
+
+ Family history of obesity with extremely poor diet during childhood, due to lack of education and financial hardship
+
+
+
+
+
+
+ Kidney Disease
+
+
+
+
+
+
+
+
+
+
+ Immunizations List [with entries]
+ Pentacel: Patient’s Mother is extremely nervous. - Date: Mar 10, 2014, Series #: 2 of 3, Lot #: A41CA687A., Facility: Conform Family Clinic
+Rotavirus (oral) - Date: Apr 17, 2012, Series #: 1 of 2, Lot #: 5551212, Facility: Primary Office
+VZ (Varicella Zoster): Patient refused vaccine due to fear of needles. - Date: Jun 21, 2011, Refused Immunization, Series #: 1 of 1, Lot #: U1768AA, Facility: Family Practice Clinic
+
+
+
+
+
+
+
+
+
+
+ Rotavirus (oral)
+ 5551212
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Primary Office
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Rotavirus (oral)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Left Arm
+
+
+
+
+
+ Pentacel
+ A41CA687A.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Conform Family Clinic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Pentacel
+
+
+
+
+
+
+
+
+ Patient’s Mother is extremely nervous.
+
+
+
+
+
+
+
+
+
+
+
+
+ Right Arm
+
+
+
+
+
+ Varicella Zoster
+ U1768AA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Family Practice Clinic
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Varicella Zoster
+
+
+
+
+
+
+
+
+
+ Patient Refused
+
+
+
+
+
+
+
+ Patient refused vaccine due to fear of needles.
+
+
+
+
+
+
+
+
+
+
+
+ Laboratory Results and Reports [with entries]
+ Mar 12 2012 1:01PM
+ Hematology Panel
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Status: Completed
+ WBC 6690-2: 9.3 giga/L, Range: 4.0-10.0
+ Interpretation Code: Normal
+ RBC 789-8: 4.88 tera/L, Range: 3.80-4.80
+ Interpretation Code: Abnormal
+ Hemoglobin 718-7: 116 g/L, Range: 120-150
+ Interpretation Code: Abnormal
+ Hematocrit 4544-3: 0.37, Range: 0.35-0.43
+ Interpretation Code: Normal
+ MCV 787-2: 76 fl, Range: 82-98
+ Interpretation Code: Abnormal
+ MCH 785-6: 23.8 pg, Range: 27.5-33.5
+ Interpretation Code: Abnormal
+ MCHC 786-4: 311 g/L, Range: 305-365
+ Interpretation Code: Normal
+ RDW 788-0: 15.7 %, Range: 11.5-14.5
+ Interpretation Code: Abnormal
+ Platelet Count 777-3: 253 giga/L, Range: 150-400
+ Interpretation Code: Normal
+ Neutrophils 751-8: 5.3 giga/L, Range: 2.0-7.5
+ Interpretation Code: Normal
+ Lymphocytes 731-0: 3.2 giga/L, Range: 1.0-4.0
+ Interpretation Code: Normal
+ Monocytes 742-7: 0.6 giga/L, Range: 0.1-0.8
+ Interpretation Code: Normal
+ Eosinophils 711-2: 0.1 giga/L, Range: 0.0-0.7
+ Interpretation Code: Normal
+ Basophils 704-7: 0.0 giga/L, Range: 0.0-0.2
+ Interpretation Code: Normal
+
+Mar 12 2012 1:01PM
+ Ferritin
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Status: Completed
+ Ferritin 2276-4: <5 ug/L, Range: 15-180
+ Interpretation Code: Abnormal
+ Notes:
+ Serum ferritin is the recommended single\.br\test to diagnose iron deficiency.\.br\
+
+Mar 12 2012 1:01PM
+ Glucose Fasting
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Status: Completed
+ Glucose Fasting 14771-0: 4.8 mmol/L, Range: 3.3-5.5
+ Interpretation Code: Normal
+
+Mar 12 2012 1:01PM
+ Lipids
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Note: Fasting?: YES
+ Lab OBR Status: Completed
+ Cholesterol 14647-2: 3.98 mmol/L, Range: 2.00-4.59
+ Interpretation Code: Normal
+ LDL Cholesterol 39469-2: 1.98 mmol/L, Range: 1.50-2.99
+ Interpretation Code: Normal
+ Notes:
+ The LDL-C target for moderate and high\.br\risk individuals is less than 2.0 mmol/L\.br\or a reduction of 50% or more. For low \.br\risk individuals, the LDL-C target is a \.br\reduction of 50% or more. See Can. J. \.br\Cardiol. 2009\.br\25(10):567-569.\.br\
+ HDL Cholesterol 14646-4: 1.71 mmol/L, Range: >1.10
+ Interpretation Code: Normal
+ Chol/HDL (Risk Ratio) 32309-7: 2.33, Range: <4.4
+ Interpretation Code: Normal
+ Triglycerides 14927-8: 0.64 mmol/L, Range: 0.45-2.29
+ Interpretation Code: Normal
+
+Mar 12 2012 1:01PM
+ TSH
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Status: Completed
+ TSH 3016-3: 3.0 mU/L, Range: 0.38-5.5
+ Interpretation Code: Normal
+
+Mar 12 2012 1:01PM
+ Free T4
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Status: Completed
+ Free T4 14920-3: 13.3 pmol/L, Range: 10.5-20.0
+ Interpretation Code: Normal
+
+Jan 11 2012 11:19AM
+ Urine Drug/Ethanol Screen
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Note: This method does not detect Oxycodone. Please order Oxycodone, if needed.\.br\URINE DRUG SCREENS\.br\Specimens for Urine Drug Screens will be stored for 2 weeks.\.br\Please call if confirmatory or additional testing is required.\.br\MSP requires clinical indications/justification for confirmatory testing.\.br\This Urine Drug Screen is not valid for legal purposes.
+ Lab OBR Status: Completed
+ Amphetamines 19261-7: neg.
+ Interpretation Code: Normal
+ Benzodiazepines 14316-4: neg.
+ Interpretation Code: Normal
+ Cocaine 19359-9: neg.
+ Interpretation Code: Normal
+ Opiates 19295-5: POS.
+ Interpretation Code: Normal
+ Oxycodone 19642-8: neg.
+ Interpretation Code: Normal
+ Methadone+Metabolite 42251-9: POS.
+ Interpretation Code: Normal
+ Test Comment X10083: *
+ Interpretation Code: Normal
+
+Apr 11 2012 8:43AM
+ General Information
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Note: Ciprofloxacin, Levofloxacin, Moxifloxacin and Norfloxacin are not recommended for children <18 years of age. \.br\\.br\Partial resistance to quinolones may not be detected by standard susceptibility testing methods. Quinolones should be avoided or used with caution if history of recent quinolone use. \.br\\.br\2 + Oropharyngeal flora also present. \.br\\.br\Ph''d by: LL Rec''d by: Dr\.br\Date: 11Apr12 Time: 0845 \.br\\.br\Clinical Information: Excelleris Testing
+ Lab OBR Status: Completed
+
+Apr 11 2012 8:43AM
+ Sputum Culture
+ Ordering Provider: MDCARE, BOB
+ Lab OBR Status: Completed
+ Site 19803-6: Source: Sputum
+ Gram Stain 664-3: Gram Stain:
+ Gram Stain 664-3: 2+ White Blood Cells
+ Gram Stain 664-3: 1+ Epithelial Cells
+ Gram Stain 664-3: 3+ Gram Positive Cocci
+ Gram Stain 664-3: 3+ Gram Negative Bacilli
+ Gram Stain 664-3: Specimen suitable for culture.
+ Culture 6463-4: No MRSA isolated.
+ Notes:
+ Culture results may be unrepresentative due to delay in transport.
+ Organism XBC19-0: Streptococcus pneumoniae 3+ Growth
+ Notes:
+ Penicillin Sensitive (meningitis)\.br\Penicillin Sensitive (non-meningitis)\.br\Penicillin Sensitive (oral)\.br\
+ Amoxicillin 16-6: S
+ Erythromycin 233-7: S
+ Trimethoprim-Sulfa 516-5: S
+ Levofloxacin 20396-8: S
+ Organism XBC19-0: Klebsiella pneumoniae (AMPC) 4+ Growth
+ Notes:
+ POSITIVE FOR AMP C CEPHALOSPORINASE.\.br\Infection Control notified.\.br\This organism is resistant to all penicillins, cephalosporins, aztreonam and beta-lactamase inhibitor combination drugs.\.br\This isolate is also SENSITIVE to Imipenem.
+ Ampicillin 28-1: R
+ Amoxicillin-Clavulanate 20-8: R
+ Cefazolin 76-0: R
+ Cephalothin-Cephalexin X10042: R
+ Cefixime 80-2: R
+ Ceftriaxone 141-2: R
+ Piperacillin-Tazobactam 412-7: R
+ Meropenem 6652-2: S
+ Ertapenem 35801-0: S
+ Trimethoprim-Sulfa 516-5: S
+ Ciprofloxacin 185-9: R
+ Gentamicin 267-5: R
+ Tobramycin 508-2: R
+ Amikacin 12-5: S
+
+
+
+
+
+ Hematology Panel
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ WBC
+
+
+
+
+ 9.3 giga/L
+
+
+
+ 4.0-10.0
+
+
+
+
+
+
+
+
+
+ RBC
+
+
+
+
+ 4.88 tera/L
+
+
+
+ 3.80-4.80
+
+
+
+
+
+
+
+
+
+ Hemoglobin
+
+
+
+
+ 116 g/L
+
+
+
+ 120-150
+
+
+
+
+
+
+
+
+
+ Hematocrit
+
+
+
+
+ 0.37
+
+
+
+ 0.35-0.43
+
+
+
+
+
+
+
+
+
+ MCV
+
+
+
+
+ 76 fl
+
+
+
+ 82-98
+
+
+
+
+
+
+
+
+
+ MCH
+
+
+
+
+ 23.8 pg
+
+
+
+ 27.5-33.5
+
+
+
+
+
+
+
+
+
+ MCHC
+
+
+
+
+ 311 g/L
+
+
+
+ 305-365
+
+
+
+
+
+
+
+
+
+ RDW
+
+
+
+
+ 15.7 %
+
+
+
+ 11.5-14.5
+
+
+
+
+
+
+
+
+
+ Platelet Count
+
+
+
+
+ 253 giga/L
+
+
+
+ 150-400
+
+
+
+
+
+
+
+
+
+ Neutrophils
+
+
+
+
+ 5.3 giga/L
+
+
+
+ 2.0-7.5
+
+
+
+
+
+
+
+
+
+ Lymphocytes
+
+
+
+
+ 3.2 giga/L
+
+
+
+ 1.0-4.0
+
+
+
+
+
+
+
+
+
+ Monocytes
+
+
+
+
+ 0.6 giga/L
+
+
+
+ 0.1-0.8
+
+
+
+
+
+
+
+
+
+ Eosinophils
+
+
+
+
+ 0.1 giga/L
+
+
+
+ 0.0-0.7
+
+
+
+
+
+
+
+
+
+ Basophils
+
+
+
+
+ 0.0 giga/L
+
+
+
+ 0.0-0.2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Ferritin
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Ferritin
+
+
+
+
+ <5 ug/L
+
+
+
+
+ Serum ferritin is the recommended single\.br\test to diagnose iron deficiency.\.br\
+
+
+
+
+
+ 15-180
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Glucose Fasting
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Glucose Fasting
+
+
+
+
+ 4.8 mmol/L
+
+
+
+ 3.3-5.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lipids
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+ Fasting?: YES
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Cholesterol
+
+
+
+
+ 3.98 mmol/L
+
+
+
+ 2.00-4.59
+
+
+
+
+
+
+
+
+
+ LDL Cholesterol
+
+
+
+
+ 1.98 mmol/L
+
+
+
+
+ The LDL-C target for moderate and high\.br\risk individuals is less than 2.0 mmol/L\.br\or a reduction of 50% or more. For low \.br\risk individuals, the LDL-C target is a \.br\reduction of 50% or more. See Can. J. \.br\Cardiol. 2009\.br\25(10):567-569.\.br\
+
+
+
+
+
+ 1.50-2.99
+
+
+
+
+
+
+
+
+
+ HDL Cholesterol
+
+
+
+
+ 1.71 mmol/L
+
+
+
+ >1.10
+
+
+
+
+
+
+
+
+
+ Chol/HDL (Risk Ratio)
+
+
+
+
+ 2.33
+
+
+
+ <4.4
+
+
+
+
+
+
+
+
+
+ Triglycerides
+
+
+
+
+ 0.64 mmol/L
+
+
+
+ 0.45-2.29
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TSH
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TSH
+
+
+
+
+ 3.0 mU/L
+
+
+
+ 0.38-5.5
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Free T4
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Free T4
+
+
+
+
+ 13.3 pmol/L
+
+
+
+ 10.5-20.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Urine Drug/Ethanol Screen
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+ This method does not detect Oxycodone. Please order Oxycodone, if needed.\.br\URINE DRUG SCREENS\.br\Specimens for Urine Drug Screens will be stored for 2 weeks.\.br\Please call if confirmatory or additional testing is required.\.br\MSP requires clinical indications/justification for confirmatory testing.\.br\This Urine Drug Screen is not valid for legal purposes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Amphetamines
+
+
+
+
+ neg.
+
+
+
+
+
+
+
+
+ Benzodiazepines
+
+
+
+
+ neg.
+
+
+
+
+
+
+
+
+ Cocaine
+
+
+
+
+ neg.
+
+
+
+
+
+
+
+
+ Opiates
+
+
+
+
+ POS.
+
+
+
+
+
+
+
+
+ Oxycodone
+
+
+
+
+ neg.
+
+
+
+
+
+
+
+
+ Methadone+Metabolite
+
+
+
+
+ POS.
+
+
+
+
+
+
+
+
+ Test Comment
+
+
+
+
+ *
+
+
+
+
+
+
+
+
+
+
+
+
+ General Information
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+ Ciprofloxacin, Levofloxacin, Moxifloxacin and Norfloxacin are not recommended for children <18 years of age. \.br\\.br\Partial resistance to quinolones may not be detected by standard susceptibility testing methods. Quinolones should be avoided or used with caution if history of recent quinolone use. \.br\\.br\2 + Oropharyngeal flora also present. \.br\\.br\Ph''d by: LL Rec''d by: Dr\.br\Date: 11Apr12 Time: 0845 \.br\\.br\Clinical Information: Excelleris Testing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sputum Culture
+
+
+
+
+
+
+ BOB
+ MDCARE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Site
+
+
+
+
+ Source: Sputum
+
+
+
+
+
+
+
+ Gram Stain
+
+
+
+
+ Gram Stain:
+
+
+
+
+
+
+
+ Gram Stain
+
+
+
+
+ 2+ White Blood Cells
+
+
+
+
+
+
+
+ Gram Stain
+
+
+
+
+ 1+ Epithelial Cells
+
+
+
+
+
+
+
+ Gram Stain
+
+
+
+
+ 3+ Gram Positive Cocci
+
+
+
+
+
+
+
+ Gram Stain
+
+
+
+
+ 3+ Gram Negative Bacilli
+
+
+
+
+
+
+
+ Gram Stain
+
+
+
+
+ Specimen suitable for culture.
+
+
+
+
+
+
+
+ Culture
+
+
+
+
+ No MRSA isolated.
+
+
+
+ Culture results may be unrepresentative due to delay in transport.
+
+
+
+
+
+
+
+
+
+
+ Organism
+
+
+
+
+ Streptococcus pneumoniae 3+ Growth
+
+
+
+ Penicillin Sensitive (meningitis)\.br\Penicillin Sensitive (non-meningitis)\.br\Penicillin Sensitive (oral)\.br\
+
+
+
+
+
+
+
+
+
+
+ Amoxicillin
+
+
+
+
+ S
+
+
+
+
+
+
+
+ Erythromycin
+
+
+
+
+ S
+
+
+
+
+
+
+
+ Trimethoprim-Sulfa
+
+
+
+
+ S
+
+
+
+
+
+
+
+ Levofloxacin
+
+
+
+
+ S
+
+
+
+
+
+
+
+ Organism
+
+
+
+
+ Klebsiella pneumoniae (AMPC) 4+ Growth
+
+
+
+ POSITIVE FOR AMP C CEPHALOSPORINASE.\.br\Infection Control notified.\.br\This organism is resistant to all penicillins, cephalosporins, aztreonam and beta-lactamase inhibitor combination drugs.\.br\This isolate is also SENSITIVE to Imipenem.
+
+
+
+
+
+
+
+
+
+
+ Ampicillin
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Amoxicillin-Clavulanate
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Cefazolin
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Cephalothin-Cephalexin
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Cefixime
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Ceftriaxone
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Piperacillin-Tazobactam
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Meropenem
+
+
+
+
+ S
+
+
+
+
+
+
+
+ Ertapenem
+
+
+
+
+ S
+
+
+
+
+
+
+
+ Trimethoprim-Sulfa
+
+
+
+
+ S
+
+
+
+
+
+
+
+ Ciprofloxacin
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Gentamicin
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Tobramycin
+
+
+
+
+ R
+
+
+
+
+
+
+
+ Amikacin
+
+
+
+
+ S
+
+
+
+
+
+
+
+
+
+
+
+
+ Medications & Prescriptions - Medication List [with entries]
+ ERYTHRO-BASE, Directions: 1x 1 Tablet(s) Four times daily, Repeats: 0, Details: Take with Food
+Melatonin 5mg capsule, Directions: 1x 5 Mg Once daily PRN, Repeats: 0, Details: One capsule daily at bedtime as needed
+. Take at bedtime
+KENALOG-10 INJECTION 10MG/ML, Directions: 1x 5 Mg Once a month intra-articularly, Repeats: 0, Details: 5mg administered intra-articularly to right foot monthly. Bring medication to Doctor's office for administration.
+DOM-SALBUTAMOL 5MG/ML SOLN, Directions: 1x 1 Millilitres Twice daily, Repeats: 0, Details: 1ml with 5ml Normal saline by Nebulizer twice daily.
+VENTOLIN HFA, Directions: 1x 100 Mcg Four times daily, Repeats: 0, Details: 1-2 Puffs four times daily for 30 days. Use with Aerochamber
+
+
+
+
+
+
+
+
+
+
+
+ VENTOLIN HFA
+
+
+
+
+
+
+ Patient uses an Aerochamber with Inhaler
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VENTOLIN HFA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [Frequency: Four times daily]
+
+